From 111e8076c3e6653938451edd2a4321991fdbf9c2 Mon Sep 17 00:00:00 2001 From: brego Date: Mon, 3 Oct 2005 20:43:55 +0000 Subject: [PATCH] This change fixes the problem me and gwoo experienced. I didn't remove all the debug-comments, as they may still prove usefull soon. Please test if this works at your place. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1058 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/dispatcher.php | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/cake/dispatcher.php b/cake/dispatcher.php index ec4b4bb96..8a8367639 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -245,6 +245,8 @@ class Dispatcher extends Object $docRoot = $_SERVER['DOCUMENT_ROOT']; $scriptName = $_SERVER['PHP_SELF']; + //print "base: $base
"; + // if document root ends with 'webroot', it's probably correctly set $r = null; @@ -270,25 +272,59 @@ class Dispatcher extends Object } else { - if(empty($base)){ + if(empty($base)) + { + // print "setUri: ".setUri()."
"; $isDir = explode('/', setUri()); + foreach ($isDir as $xyz) + { + if (!empty($xyz)) + { + $isDir2[] = $xyz; + } + } + $isDir = $isDir2; + if (isset($isDir[1])) + { $first = $isDir[1]; + } + else + { + + $first = $isDir[0]; + } $webPath[] = DS.$first.DS; + $dir = $docRoot.$first.DS; + //$x = 1; foreach ($isDir as $dirName) { - if(!empty($dirName) && is_dir($docRoot.$first.DS.$dirName)) + if (empty($dirName)) + { + // continue; + } + //print "
$x: $dir
"; + $dir .= $dirName.DS; + //$x += 1; + if(!empty($dirName) && is_dir($dir)) { $webPath[] = $dirName.DS; } + //print "
"; + // print_r($webPath); + // print "
"; } $webroot = implode('', $webPath); $base = substr($webroot, 0, -1); + + //print "base: $base
"; } else { $webroot =setUri(); } $this->webroot = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.DS.WEBROOT_DIR.DS; + // print "webrot:".$this->webroot."
"; + // document root is probably not set to Cake 'webroot' dir if (preg_match('/\\/index.php(\/)?$/i', $scriptName, $r)) { @@ -298,6 +334,8 @@ class Dispatcher extends Object } else { + // print "base: $base
"; + return $base; } }