Fixed bad URL interpretation on CGI and Apache wrongly supplying PATH_INFO when directory index requested
--- a/includes/paths.php Sun Mar 30 07:24:48 2008 -0700
+++ b/includes/paths.php Tue Apr 01 01:24:10 2008 -0400
@@ -107,13 +107,21 @@
function parse_url($sanitize = true)
{
$title = '';
- if( isset($_GET['title']) )
+ if ( isset($_GET['title']) )
{
$title = $_GET['title'];
}
- elseif( isset($_SERVER['PATH_INFO']) )
+ else if ( isset($_SERVER['PATH_INFO']) )
{
- $title = substr($_SERVER['PATH_INFO'], ( strpos($_SERVER['PATH_INFO'], '/') ) + 1 );
+ // fix for apache + CGI (occurred on a GoDaddy server, thanks mm3)
+ if ( @substr(@$_SERVER['GATEWAY_INTERFACE'], 0, 3) === 'CGI' && $_SERVER['PATH_INFO'] == scriptPath . '/index.php' )
+ {
+ // do nothing; ignore PATH_INFO
+ }
+ else
+ {
+ $title = substr($_SERVER['PATH_INFO'], ( strpos($_SERVER['PATH_INFO'], '/') ) + 1 );
+ }
}
else
{