Skip to content

Commit

Permalink
Fixing request errors in certain PHP/Fastcgi configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Apr 9, 2012
1 parent 0374821 commit ae24f62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/concrete/controllers/dashboard/system/seo/urls.php
Expand Up @@ -15,7 +15,7 @@ public function getRewriteRules(){
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule ^(.*)$ ' . DISPATCHER_FILENAME .'
RewriteRule . ' . DISPATCHER_FILENAME .' [L]
</IfModule>';

return preg_replace('/\t/', '', $strRules);
Expand Down
36 changes: 20 additions & 16 deletions web/concrete/libraries/request.php
Expand Up @@ -48,18 +48,22 @@ private static function parsePathFromRequest($var) {
switch ( $var ) {

case 'PATH_INFO':
// DIR_REL not in path; do nothing.
break;

// DIR_REL not in path; do nothing.
break;

case 'REQUEST_URI':
$path = str_replace($_SERVER['QUERY_STRING'], '', $path);
$path = trim($path, '?');
default:
// if the path starts off with dir_rel, we remove it:
if (DIR_REL != '') {
$dr = trim(DIR_REL, '/');
$path = trim($path, '/');
if (strpos($path, $dr) === 0) {
$path = substr($path, strlen($dr));
// if the path starts off with dir_rel, we remove it:
if (DIR_REL != '') {
$dr = trim(DIR_REL, '/');
$path = trim($path, '/');
if (strpos($path, $dr) === 0) {
$path = substr($path, strlen($dr));
}
}
}
break;
}

$path = trim($path, '/');
Expand Down Expand Up @@ -92,19 +96,19 @@ public static function get() {
$path = Request::parsePathFromRequest(SERVER_PATH_VARIABLE);
}
if (!$path) {
$path = Request::parsePathFromRequest('ORIG_PATH_INFO');
$path = Request::parsePathFromRequest('PATH_INFO');
}
if (!$path) {
$path = Request::parsePathFromRequest('PATH_INFO');
}/*
$path = Request::parsePathFromRequest('REDIRECT_URL');
}
if (!$path) {
$path = Request::parsePathFromRequest('REQUEST_URI');
}*/
}
if (!$path) {
$path = Request::parsePathFromRequest('SCRIPT_NAME');
$path = Request::parsePathFromRequest('ORIG_PATH_INFO');
}
if (!$path) {
$path = Request::parsePathFromRequest('REDIRECT_URL');
$path = Request::parsePathFromRequest('SCRIPT_NAME');
}
$req = new Request($path);
}
Expand Down

0 comments on commit ae24f62

Please sign in to comment.