Merging fixes and enhancements into trunk.

Revision: [2044]
Refactored and removed uneeded regex checks

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2045 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-02-19 06:10:12 +00:00
parent 49ca527459
commit 528d0e837f
2 changed files with 12 additions and 29 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ // // +---------------------------------------------------------------------------------------------------+ //
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.8.2036 0.10.8.2045

View file

@ -345,7 +345,7 @@ class Dispatcher extends Object
* *
* @return string Base URL * @return string Base URL
*/ */
function baseUrl() function baseUrl()
{ {
$htaccess = null; $htaccess = null;
$base = $this->admin; $base = $this->admin;
@ -376,39 +376,22 @@ class Dispatcher extends Object
$webroot =setUri(); $webroot =setUri();
$htaccess = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.'/'.WEBROOT_DIR.'/'; $htaccess = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.'/'.WEBROOT_DIR.'/';
} }
if(APP_DIR === 'app') if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
{ {
if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs)) !empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/'.APP_DIR.'/';
{ return $base.$regs[1].'/'.APP_DIR;
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/'; }
return $regs[1]; elseif (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs))
} {
elseif (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs)) !empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[0].'/';
{ return $base.$regs[0];
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[0].'/';
return $regs[0];
}
else
{
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
return $base;
}
} }
else else
{ {
if (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs)) !empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
{ return $base;
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[0].'/';
return $regs[0];
}
else
{
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
return $base;
}
} }
} }
return $base;
} }
function _restructureParams($params) function _restructureParams($params)