mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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
This commit is contained in:
parent
d44a364285
commit
111e8076c3
1 changed files with 40 additions and 2 deletions
|
@ -245,6 +245,8 @@ class Dispatcher extends Object
|
||||||
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||||
$scriptName = $_SERVER['PHP_SELF'];
|
$scriptName = $_SERVER['PHP_SELF'];
|
||||||
|
|
||||||
|
//print "base: $base<br>";
|
||||||
|
|
||||||
|
|
||||||
// if document root ends with 'webroot', it's probably correctly set
|
// if document root ends with 'webroot', it's probably correctly set
|
||||||
$r = null;
|
$r = null;
|
||||||
|
@ -270,25 +272,59 @@ class Dispatcher extends Object
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(empty($base)){
|
if(empty($base))
|
||||||
|
{
|
||||||
|
// print "setUri: ".setUri()."<br>";
|
||||||
$isDir = explode('/', setUri());
|
$isDir = explode('/', setUri());
|
||||||
|
foreach ($isDir as $xyz)
|
||||||
|
{
|
||||||
|
if (!empty($xyz))
|
||||||
|
{
|
||||||
|
$isDir2[] = $xyz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$isDir = $isDir2;
|
||||||
|
if (isset($isDir[1]))
|
||||||
|
{
|
||||||
$first = $isDir[1];
|
$first = $isDir[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$first = $isDir[0];
|
||||||
|
}
|
||||||
$webPath[] = DS.$first.DS;
|
$webPath[] = DS.$first.DS;
|
||||||
|
$dir = $docRoot.$first.DS;
|
||||||
|
//$x = 1;
|
||||||
foreach ($isDir as $dirName)
|
foreach ($isDir as $dirName)
|
||||||
{
|
{
|
||||||
if(!empty($dirName) && is_dir($docRoot.$first.DS.$dirName))
|
if (empty($dirName))
|
||||||
|
{
|
||||||
|
// continue;
|
||||||
|
}
|
||||||
|
//print "<br>$x: $dir<br>";
|
||||||
|
$dir .= $dirName.DS;
|
||||||
|
//$x += 1;
|
||||||
|
if(!empty($dirName) && is_dir($dir))
|
||||||
{
|
{
|
||||||
$webPath[] = $dirName.DS;
|
$webPath[] = $dirName.DS;
|
||||||
}
|
}
|
||||||
|
//print "<br>";
|
||||||
|
// print_r($webPath);
|
||||||
|
// print "<br>";
|
||||||
}
|
}
|
||||||
$webroot = implode('', $webPath);
|
$webroot = implode('', $webPath);
|
||||||
$base = substr($webroot, 0, -1);
|
$base = substr($webroot, 0, -1);
|
||||||
|
|
||||||
|
//print "base: $base<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$webroot =setUri();
|
$webroot =setUri();
|
||||||
}
|
}
|
||||||
$this->webroot = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.DS.WEBROOT_DIR.DS;
|
$this->webroot = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.DS.WEBROOT_DIR.DS;
|
||||||
|
// print "webrot:".$this->webroot."<br>";
|
||||||
|
|
||||||
// document root is probably not set to Cake 'webroot' dir
|
// document root is probably not set to Cake 'webroot' dir
|
||||||
if (preg_match('/\\/index.php(\/)?$/i', $scriptName, $r))
|
if (preg_match('/\\/index.php(\/)?$/i', $scriptName, $r))
|
||||||
{
|
{
|
||||||
|
@ -298,6 +334,8 @@ class Dispatcher extends Object
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// print "base: $base<br>";
|
||||||
|
|
||||||
return $base;
|
return $base;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue