From: Geoffrey T. D. <da...@us...> - 2001-02-15 05:56:38
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv21734/lib Modified Files: config.php Log Message: Fixed (I think) SF bug #132469. The problem was that the value for VIRTUAL_PATH being auto-deduced by lib/config.php was wrong. Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** config.php 2001/02/14 22:02:05 1.32 --- config.php 2001/02/15 05:57:18 1.33 *************** *** 121,127 **** define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME)); } if (!defined('VIRTUAL_PATH')) { ! if (USE_PATH_INFO and isset($REDIRECT_URL)) { // FIXME: This is a hack, and won't work if the requested --- 121,167 ---- define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME)); } + + + function IsProbablyRedirectToIndex () + { + // This might be a redirect to the DirectoryIndex, + // e.g. REQUEST_URI = /dir/ got redirected + // to SCRIPT_NAME = /dir/index.php + + // In this case, the proper virtual path is still + // $SCRIPT_NAME, since pages appear at + // e.g. /dir/index.php/FrontPage. + + global $REQUEST_URI, $SCRIPT_NAME; + + $requri = preg_quote($REQUEST_URI, '%'); + return preg_match("%^${requri}[^/]*$%", $SCRIPT_NAME); + } + + if (!defined('VIRTUAL_PATH')) { ! // We'd like to auto-detect when the cases where apaches ! // 'Action' directive (or similar means) is used to ! // redirect page requests to a cgi-handler. ! // ! // In cases like this, requests for e.g. /wiki/FrontPage ! // get redirected to a cgi-script called, say, ! // /path/to/wiki/index.php. The script gets all ! // of /wiki/FrontPage as it's PATH_INFO. ! // ! // The problem is: ! // How to detect when this has happened reliably? ! // How to pick out the "virtual path" (in this case '/wiki')? ! // ! // (Another time an redirect might occur is to a DirectoryIndex ! // -- the requested URI is '/wikidir/', the request gets ! // passed to '/wikidir/index.php'. In this case, the ! // proper VIRTUAL_PATH is '/wikidir/index.php', since the ! // pages will appear at e.g. '/wikidir/index.php/FrontPage'. ! // ! ! if (USE_PATH_INFO and isset($REDIRECT_URL) ! and ! IsProbablyRedirectToIndex()) { // FIXME: This is a hack, and won't work if the requested |