mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-12 20:49:50 +00:00
Merging fixes and enhancements into trunk.
Revision: [2035] Cleaning up code formating Revision: [2034] Added fix for parse error when using PHP 4 Revision: [2033] Fixed dispatcher to set the proper paths when app/webroot is moved outside of a normal cake install path and placed deeper in the web path of the DOCUMNET ROOT git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2036 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a6051579d7
commit
49ca527459
3 changed files with 54 additions and 51 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.8.2032
|
||||
0.10.8.2036
|
|
@ -354,58 +354,61 @@ class Dispatcher extends Object
|
|||
{
|
||||
$base = BASE_URL.$this->admin;
|
||||
}
|
||||
|
||||
$docRoot = env('DOCUMENT_ROOT');
|
||||
$scriptName = env('PHP_SELF');
|
||||
$r = null;
|
||||
|
||||
// If document root ends with 'webroot', it's probably correctly set
|
||||
$r = null;
|
||||
if (preg_match('/'.APP_DIR.'\\'.DS.WEBROOT_DIR.'/', $docRoot))
|
||||
{
|
||||
$this->webroot = '/';
|
||||
if (preg_match('/^(.*)\/index\.php$/', $scriptName, $r))
|
||||
{
|
||||
if(!empty($r[1]))
|
||||
{
|
||||
return $base.$r[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defined('BASE_URL'))
|
||||
{
|
||||
$webroot =setUri();
|
||||
$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))
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/';
|
||||
return $regs[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/^(.*)\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/';
|
||||
return $regs[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $base;
|
||||
if (preg_match('/'.APP_DIR.'\\'.DS.WEBROOT_DIR.'/', $docRoot))
|
||||
{
|
||||
$this->webroot = '/';
|
||||
if (preg_match('/^(.*)\/index\.php$/', $scriptName, $r))
|
||||
{
|
||||
if(!empty($r[1]))
|
||||
{
|
||||
return $base.$r[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defined('BASE_URL'))
|
||||
{
|
||||
$webroot =setUri();
|
||||
$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))
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/';
|
||||
return $regs[1];
|
||||
}
|
||||
elseif (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs))
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[0].'/';
|
||||
return $regs[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs))
|
||||
{
|
||||
!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)
|
||||
|
|
|
@ -1039,7 +1039,7 @@ class Model extends Object
|
|||
{
|
||||
foreach ($this->hasAndBelongsToMany as $assoc => $data)
|
||||
{
|
||||
$this->db->execute("DELETE FROM {$this->db->name($data['joinTable'])} WHERE {$this->db->name($data['foreignKey'])} = '{$id}'");
|
||||
$this->db->execute("DELETE FROM ".$this->db->name($data['joinTable'])." WHERE ".$this->db->name($data['foreignKey'])." = '{$id}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue