diff --git a/VERSION.txt b/VERSION.txt index 874021b1f..e5fc04540 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.8.2032 \ No newline at end of file +0.10.8.2036 \ No newline at end of file diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 145b83a3b..63ca2548d 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -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) diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index ba1a5404b..729aa2b65 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -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}'"); } }