Skip to content

Instantly share code, notes, and snippets.

@rvsjoen
Created November 10, 2011 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvsjoen/1355080 to your computer and use it in GitHub Desktop.
Save rvsjoen/1355080 to your computer and use it in GitHub Desktop.
RFC violation
diff --git administrator/includes/framework.php administrator/includes/framework.php
index 0e2ec0e..a6d7274 100644
--- administrator/includes/framework.php
+++ administrator/includes/framework.php
@@ -21,7 +21,23 @@ defined('_JEXEC') or die;
* Installation check, and check on removal of the install directory.
*/
if (!file_exists(JPATH_CONFIGURATION.'/configuration.php') || (filesize(JPATH_CONFIGURATION.'/configuration.php') < 10) /*|| file_exists(JPATH_INSTALLATION.'/index.php')*/) {
- header('Location: ../installation/index.php');
+
+ if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
+ $https = 's://';
+ }
+ else {
+ $https = '://';
+ }
+
+ if (!empty($_SERVER['PHP_SELF']) && !empty ($_SERVER['REQUEST_URI'])) {
+ $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '../installation/index.php';
+ }
+ else {
+ // IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
+ $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '../installation/index.php';
+ }
+
+ header('Location: ' . $theURI);
exit();
}
diff --git includes/framework.php includes/framework.php
index a507f9d..df8c140 100644
--- includes/framework.php
+++ includes/framework.php
@@ -24,7 +24,23 @@ defined('_JEXEC') or die;
if (!file_exists(JPATH_CONFIGURATION.'/configuration.php') || (filesize(JPATH_CONFIGURATION.'/configuration.php') < 10) /*|| file_exists(JPATH_INSTALLATION.'/index.php')*/) {
if (file_exists(JPATH_INSTALLATION.'/index.php')) {
- header('Location: '.substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'index.php')).'installation/index.php');
+
+ if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
+ $https = 's://';
+ }
+ else {
+ $https = '://';
+ }
+
+ if (!empty($_SERVER['PHP_SELF']) && !empty ($_SERVER['REQUEST_URI'])) {
+ $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . 'installation/index.php';
+ }
+ else {
+ // IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
+ $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . 'installation/index.php';
+ }
+
+ header('Location: '.$theURI);
exit();
} else {
echo 'No configuration file found and no installation code available. Exiting...';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment