mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merging fixes and enhancements into trunk
Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
40f3a01d1e
commit
818806195f
18 changed files with 347 additions and 221 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.8.1954
|
||||
0.10.8.1986
|
|
@ -28,28 +28,50 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Get Cake's root directory
|
||||
* These defines should only be edited if you have cake installed in
|
||||
* a directory layout other than the way it is distributed.
|
||||
* Each define has a commented line of code that explains what you would change.
|
||||
*
|
||||
*/
|
||||
if (!defined('DS'))
|
||||
{
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('ROOT'))
|
||||
{
|
||||
define('ROOT', dirname(dirname(dirname(__FILE__))).DS);
|
||||
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||
define('ROOT', dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
|
||||
if (!defined('APP_DIR'))
|
||||
{
|
||||
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
|
||||
define ('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||
}
|
||||
|
||||
/**
|
||||
* This only needs to be changed if the cake installed libs are located
|
||||
* outside of the distributed directory structure.
|
||||
*/
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH'))
|
||||
{
|
||||
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
//DO NOT EDIT BELOW THIS LINE//
|
||||
///////////////////////////////
|
||||
if (!defined('DS'))
|
||||
{
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (!defined('WEBROOT_DIR'))
|
||||
{
|
||||
define ('WEBROOT_DIR', basename(dirname(__FILE__)));
|
||||
}
|
||||
require_once ROOT.'cake'.DS.'bootstrap.php';
|
||||
|
||||
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
|
||||
|
||||
|
||||
require_once 'cake'.DS.'bootstrap.php';
|
||||
?>
|
|
@ -247,15 +247,16 @@ function loadController ($name)
|
|||
{
|
||||
$controller_fn = CONTROLLERS.$name.'_controller.php';
|
||||
}
|
||||
elseif(file_exists(LIBS.'controller'.DS.$name.'_controller.php'))
|
||||
elseif($controller_fn = fileExistsInPath(LIBS.'controller'.DS.$name.'_controller.php'))
|
||||
{
|
||||
$controller_fn = LIBS.'controller'.DS.$name.'_controller.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$controller_fn = false;
|
||||
return false;
|
||||
}
|
||||
return file_exists($controller_fn)? require_once($controller_fn): false;
|
||||
require_once($controller_fn);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -302,6 +303,10 @@ function loadPluginController ($plugin, $controller)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -915,4 +920,18 @@ function LogError ($message)
|
|||
CakeLog::write('error', str_replace($bad, $good, $message));
|
||||
}
|
||||
|
||||
function fileExistsInPath ($file)
|
||||
{
|
||||
$paths = explode(PATH_SEPARATOR, get_include_path());
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$fullPath = $path . DIRECTORY_SEPARATOR . $file;
|
||||
if (file_exists($fullPath))
|
||||
{
|
||||
return $fullPath;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
|
@ -33,9 +33,9 @@
|
|||
/**
|
||||
* Configuration, directory layout and standard libraries
|
||||
*/
|
||||
require_once ROOT.'cake'.DS.'basics.php';
|
||||
require_once ROOT.APP_DIR.DS.'config'.DS.'core.php';
|
||||
require_once ROOT.'cake'.DS.'config'.DS.'paths.php';
|
||||
require_once 'cake'.DS.'basics.php';
|
||||
require_once ROOT.DS.APP_DIR.DS.'config'.DS.'core.php';
|
||||
require_once 'cake'.DS.'config'.DS.'paths.php';
|
||||
require_once LIBS.'object.php';
|
||||
require_once LIBS.'session.php';
|
||||
require_once LIBS.'security.php';
|
||||
|
|
|
@ -36,65 +36,65 @@
|
|||
*/
|
||||
if(!defined('ROOT'))
|
||||
{
|
||||
define ('ROOT', '../');
|
||||
define ('ROOT', '../');
|
||||
}
|
||||
|
||||
if(!defined('WEBROOT_DIR'))
|
||||
{
|
||||
define ('WEBROOT_DIR', 'webroot');
|
||||
define ('WEBROOT_DIR', 'webroot');
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the application's directory.
|
||||
*/
|
||||
define ('CAKE', ROOT.'cake'.DS);
|
||||
define ('CAKE', 'cake'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's directory.
|
||||
*/
|
||||
define ('APP', ROOT.APP_DIR.DS);
|
||||
define ('APP', ROOT.DS.APP_DIR.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's models directory.
|
||||
*/
|
||||
define ('MODELS', APP.'models'.DS);
|
||||
define ('MODELS', APP.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's controllers directory.
|
||||
*/
|
||||
define ('CONTROLLERS', APP.'controllers'.DS);
|
||||
define ('CONTROLLERS', APP.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's controllers directory.
|
||||
*/
|
||||
define ('COMPONENTS', CONTROLLERS.'components'.DS);
|
||||
define ('COMPONENTS', CONTROLLERS.'components'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's views directory.
|
||||
*/
|
||||
define ('VIEWS', APP.'views'.DS);
|
||||
define ('VIEWS', APP.'views'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's helpers directory.
|
||||
*/
|
||||
define ('HELPERS', VIEWS.'helpers'.DS);
|
||||
define ('HELPERS', VIEWS.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's layouts directory.
|
||||
*/
|
||||
define ('LAYOUTS', VIEWS.'layouts'.DS);
|
||||
define ('LAYOUTS', VIEWS.'layouts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's elements directory.
|
||||
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
|
||||
* and are not linked to a particular layout (like polls, footers and so on).
|
||||
*/
|
||||
define ('ELEMENTS', VIEWS.'elements'.DS);
|
||||
define ('ELEMENTS', VIEWS.'elements'.DS);
|
||||
|
||||
/**
|
||||
* Path to the configuration files directory.
|
||||
*/
|
||||
define ('CONFIGS', APP.'config'.DS);
|
||||
define ('CONFIGS', APP.'config'.DS);
|
||||
|
||||
/**
|
||||
* Path to the libs directory.
|
||||
|
@ -104,67 +104,67 @@ define ('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);
|
|||
/**
|
||||
* Path to the libs directory.
|
||||
*/
|
||||
define ('LIBS', CAKE.'libs'.DS);
|
||||
define ('LIBS', CAKE.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the logs directory.
|
||||
*/
|
||||
define ('LOGS', ROOT.'logs'.DS);
|
||||
define ('LOGS', ROOT.DS.'logs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the modules directory.
|
||||
*/
|
||||
define ('MODULES', ROOT.'modules'.DS);
|
||||
define ('MODULES', ROOT.DS.'modules'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('WWW_ROOT', APP.WEBROOT_DIR.DS);
|
||||
define ('WWW_ROOT', APP.WEBROOT_DIR.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('CSS', WWW_ROOT.'css'.DS);
|
||||
define ('CSS', WWW_ROOT.'css'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('JS', WWW_ROOT.'js'.DS);
|
||||
define ('JS', WWW_ROOT.'js'.DS);
|
||||
|
||||
/**
|
||||
* Path to the scripts direcotry.
|
||||
*/
|
||||
define('SCRIPTS', CAKE.'scripts'.DS);
|
||||
define('SCRIPTS', CAKE.'scripts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the tests directory.
|
||||
*/
|
||||
define ('TESTS', ROOT.'tests'.DS);
|
||||
define ('TESTS', ROOT.DS.'tests'.DS);
|
||||
|
||||
/**
|
||||
* Path to the controller test directory.
|
||||
*/
|
||||
define ('CONTROLLER_TESTS',TESTS.APP_DIR.DS.'controllers'.DS);
|
||||
define ('CONTROLLER_TESTS', TESTS.APP_DIR.DS.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the helpers test directory.
|
||||
*/
|
||||
define ('HELPER_TESTS', TESTS.APP_DIR.DS.'helpers'.DS);
|
||||
define ('HELPER_TESTS', TESTS.APP_DIR.DS.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the models' test directory.
|
||||
*/
|
||||
define ('MODEL_TESTS', TESTS.APP_DIR.DS.'models'.DS);
|
||||
define ('MODEL_TESTS', TESTS.APP_DIR.DS.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the lib test directory.
|
||||
*/
|
||||
define ('LIB_TESTS', TESTS.'libs'.DS);
|
||||
define ('LIB_TESTS', TESTS.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the temporary files directory.
|
||||
*/
|
||||
define ('TMP', ROOT.'tmp'.DS);
|
||||
define ('TMP', APP.'tmp'.DS);
|
||||
|
||||
/**
|
||||
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||
|
@ -174,14 +174,14 @@ define('CACHE', TMP.'cache'.DS);
|
|||
/**
|
||||
* Path to the vendors directory.
|
||||
*/
|
||||
define ('VENDORS', ROOT.'vendors'.DS);
|
||||
define ('VENDORS', ROOT.DS.'vendors'.DS);
|
||||
|
||||
/**
|
||||
* Path to the Pear directory
|
||||
* The purporse is to make it easy porting Pear libs into Cake
|
||||
* without setting the include_path PHP variable.
|
||||
*/
|
||||
define ('PEAR', VENDORS.'Pear'.DS);
|
||||
define ('PEAR', VENDORS.'Pear'.DS);
|
||||
|
||||
/**
|
||||
* Full url prefix
|
||||
|
@ -203,17 +203,17 @@ unset($httpHost);
|
|||
/**
|
||||
* Web path to the public images directory.
|
||||
*/
|
||||
define ('IMAGES_URL', 'img/');
|
||||
define ('IMAGES_URL', 'img/');
|
||||
|
||||
/**
|
||||
* Web path to the CSS files directory.
|
||||
*/
|
||||
define ('CSS_URL', 'css/');
|
||||
define ('CSS_URL', 'css/');
|
||||
|
||||
/**
|
||||
* Web path to the js files directory.
|
||||
*/
|
||||
define ('JS_URL', 'js/');
|
||||
define ('JS_URL', 'js/');
|
||||
|
||||
|
||||
?>
|
|
@ -99,9 +99,9 @@ class Component extends Object
|
|||
{
|
||||
$componentFn = COMPONENTS.$componentFn;
|
||||
}
|
||||
else if(file_exists(LIBS.'controller'.DS.'components'.DS.$componentFn))
|
||||
else if($componentFn = fileExistsInPath(LIBS.'controller'.DS.'components'.DS.$componentFn))
|
||||
{
|
||||
$componentFn = LIBS.'controller'.DS.'components'.DS.$componentFn;
|
||||
|
||||
}
|
||||
|
||||
$componentCn = $component.'Component';
|
||||
|
|
|
@ -454,9 +454,9 @@ class Controller extends Object
|
|||
$ref = env('HTTP_REFERER');
|
||||
$base = FULL_BASE_URL . $this->webroot;
|
||||
|
||||
if ($ref != null && defined(FULL_BASE_URL))
|
||||
if ($ref != null && (defined(FULL_BASE_URL) || FULL_BASE_URL))
|
||||
{
|
||||
if (strpos(env('HTTP_REFERER'), $base) == 0)
|
||||
if (strpos($ref, $base) === 0)
|
||||
{
|
||||
return substr($ref, strlen($base) - 1);
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ class Controller extends Object
|
|||
$fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($alias.$niceName);
|
||||
$fieldNames[ $tabl['name'] ]['model'] = $fkNames[1];
|
||||
$fieldNames[ $tabl['name'] ]['modelKey'] = $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']];
|
||||
$fieldNames[ $tabl['name'] ]['controller'] = Inflector::pluralize($this->{$model}->tableToModel[Inflector::pluralize($fkNames[0])]);
|
||||
$fieldNames[ $tabl['name'] ]['controller'] = Inflector::pluralize($this->{$model}->tableToModel[$fkNames[0]]);
|
||||
$fieldNames[ $tabl['name'] ]['foreignKey'] = true;
|
||||
}
|
||||
else if( 'created' != $tabl['name'] && 'updated' != $tabl['name'] )
|
||||
|
|
|
@ -117,7 +117,7 @@ class ConnectionManager extends Object
|
|||
}
|
||||
|
||||
$tail = 'dbo'.DS.$filename.'.php';
|
||||
if (file_exists(LIBS.'model'.DS.$tail))
|
||||
if (fileExistsInPath(LIBS.'model'.DS.$tail))
|
||||
{
|
||||
require_once(LIBS.'model'.DS.$tail);
|
||||
}
|
||||
|
|
|
@ -395,14 +395,14 @@ class DboSource extends DataSource
|
|||
{
|
||||
if (true === $this->generateSelfAssociationQuery($model, $linkModel, $type, $assoc, $assocData, $queryData, false, $null))
|
||||
{
|
||||
$linkedModels[] = $type.$assoc;
|
||||
$linkedModels[] = $type.'/'.$assoc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (true === $this->generateAssociationQuery($model, $linkModel, $type, $assoc, $assocData, $queryData, false, $null))
|
||||
{
|
||||
$linkedModels[] = $type.$assoc;
|
||||
$linkedModels[] = $type.'/'.$assoc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -419,62 +419,15 @@ class DboSource extends DataSource
|
|||
{
|
||||
foreach($model->{$type} as $assoc => $assocData)
|
||||
{
|
||||
if (!in_array($type.$assoc, $linkedModels))
|
||||
if (!in_array($type.'/'.$assoc, $linkedModels))
|
||||
{
|
||||
$linkModel =& $model->{$assocData['className']};
|
||||
$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet);
|
||||
|
||||
if ($model->recursive > 1 && $linkModel->recursive > 0)
|
||||
$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive);
|
||||
} else {
|
||||
// Fetch recursively on belongsTo and hasOne
|
||||
if ($model->recursive > 1)
|
||||
{
|
||||
foreach($linkModel->__associations as $type1)
|
||||
{
|
||||
foreach($linkModel->{$type1} as $assoc1 => $assocData1)
|
||||
{
|
||||
$deepModel =& $linkModel->{$assocData1['className']};
|
||||
|
||||
if ($assoc1 != $model->name)
|
||||
{
|
||||
foreach ($resultSet as $i => $data)
|
||||
{
|
||||
if (isset($data[$linkModel->name]))
|
||||
{
|
||||
foreach ($resultSet[$i][$linkModel->name] as $value)
|
||||
{
|
||||
$datas[][$linkModel->name] = $value[$linkModel->primaryKey];
|
||||
$fetch = $this->queryDeepAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $array, true, $datas);
|
||||
unset($datas);
|
||||
|
||||
if (!empty($fetch[0]))
|
||||
{
|
||||
foreach ($fetch as $j => $row1)
|
||||
{
|
||||
if(!empty($row1))
|
||||
{
|
||||
foreach ($resultSet as $valueResult => $endResult)
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($endResult[$linkModel->name] as $keyCheck)
|
||||
{
|
||||
foreach ($row1 as $mas)
|
||||
{
|
||||
if($keyCheck[$linkModel->primaryKey] == $mas[$deepModel->name][$assocData1['foreignKey']])
|
||||
{
|
||||
$resultSet[$i][$linkModel->name][$count][$deepModel->name][] = $mas[$deepModel->name];
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($fetch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,20 +441,6 @@ class DboSource extends DataSource
|
|||
return $resultSet;
|
||||
}
|
||||
|
||||
function queryDeepAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet)
|
||||
{
|
||||
$query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet);
|
||||
if ($query)
|
||||
{
|
||||
foreach ($resultSet as $i => $row)
|
||||
{
|
||||
$q = $this->insertQueryData($query, $resultSet, $association, $assocData, $model, $linkModel, $i);
|
||||
$fetch[] = $this->fetchAll($q);
|
||||
}
|
||||
return $fetch;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
@ -515,7 +454,7 @@ class DboSource extends DataSource
|
|||
* @param unknown_type $resultSet
|
||||
* @param integer $recursive Number of levels of association
|
||||
*/
|
||||
function queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet)
|
||||
function queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive)
|
||||
{
|
||||
$query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet);
|
||||
if ($query)
|
||||
|
@ -527,21 +466,58 @@ class DboSource extends DataSource
|
|||
|
||||
if (!empty($fetch) && is_array($fetch))
|
||||
{
|
||||
if (isset($fetch[0][$association]))
|
||||
if ($recursive > 0)
|
||||
{
|
||||
foreach ($fetch as $j => $row)
|
||||
foreach($linkModel->__associations as $type1)
|
||||
{
|
||||
$resultSet[$i][$association][$j] = $row[$association];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$plural = Inflector::pluralize($association);
|
||||
foreach ($fetch as $j => $row)
|
||||
{
|
||||
$resultSet[$i][$plural][$j] = $row[$plural];
|
||||
if ($recursive > 1)
|
||||
{
|
||||
foreach($linkModel->{$type1} as $assoc1 => $assocData1)
|
||||
{
|
||||
$deepModel =& $linkModel->{$assocData1['className']};
|
||||
if ($deepModel->name != $model->name)
|
||||
{
|
||||
$this->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->__mergeAssociation($resultSet[$i], $fetch, $association, $type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function __mergeAssociation(&$data, $merge, $association, $type)
|
||||
{
|
||||
if (isset($merge[0]) && !isset($merge[0][$association]))
|
||||
{
|
||||
$association = Inflector::pluralize($association);
|
||||
}
|
||||
|
||||
if ($type == 'belongsTo' || $type == 'hasOne')
|
||||
{
|
||||
if (isset($merge[$association]))
|
||||
{
|
||||
$data[$association] = $merge[$association][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[$association] = $merge[0][$association];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($merge as $i => $row)
|
||||
{
|
||||
if (count($row) == 1)
|
||||
{
|
||||
$data[$association][] = $row[$association];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[$association][] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -726,11 +702,12 @@ class DboSource extends DataSource
|
|||
case 'belongsTo':
|
||||
if ($external)
|
||||
{
|
||||
$conditions = $assocData['conditions'];
|
||||
$sql = 'SELECT * FROM '.$this->name($linkModel->table).' AS '.$this->name($alias);
|
||||
$conditions = $assocData['conditions'];
|
||||
|
||||
$condition = $linkModel->escapeField($assocData['foreignKey']);
|
||||
$condition = $linkModel->escapeField($linkModel->primaryKey);
|
||||
$condition .= '={$__cake_id__$}';
|
||||
|
||||
if (is_array($conditions))
|
||||
{
|
||||
$conditions[] = $condition;
|
||||
|
@ -743,8 +720,11 @@ class DboSource extends DataSource
|
|||
}
|
||||
$conditions .= $condition;
|
||||
}
|
||||
$sql .= $this->conditions($queryData['conditions']) . $this->order($queryData['order']);
|
||||
$sql .= $this->limit($queryData['limit']);
|
||||
$sql .= $this->conditions($conditions) . $this->order($assocData['order']);
|
||||
if (isset($assocData['limit']))
|
||||
{
|
||||
$sql .= $this->limit($assocData['limit']);
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
else if($joinedOnSelf != true)
|
||||
|
@ -995,7 +975,7 @@ class DboSource extends DataSource
|
|||
}
|
||||
|
||||
$count = count($fields);
|
||||
if ($count > 1 && $fields[0] != '*')
|
||||
if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false)
|
||||
{
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
|
@ -1041,27 +1021,27 @@ class DboSource extends DataSource
|
|||
$out = array();
|
||||
foreach ($conditions as $key => $value)
|
||||
{
|
||||
// Treat multiple values as an IN condition.
|
||||
if (is_array($value))
|
||||
{
|
||||
$data = $key . ' IN (';
|
||||
foreach ($value as $valElement)
|
||||
{
|
||||
$data .= $this->value($valElement) . ', ';
|
||||
}
|
||||
// Remove trailing ',' and complete clause.
|
||||
$data[strlen($data)-2] = ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($value != '{$__cake_id__$}') && ($value != '{$__cake_foreignKey__$}'))
|
||||
if (is_array($value))
|
||||
{
|
||||
$data = $key . ' IN (';
|
||||
foreach ($value as $valElement)
|
||||
{
|
||||
$data .= $this->value($valElement) . ', ';
|
||||
}
|
||||
$data[strlen($data)-2] = ')';
|
||||
}
|
||||
elseif (preg_match('/(?P<expression>LIKE\\x20|=\\x20|>\\x20|<\\x20|<=\\x20|>=\\x20|<>\\x20)(?P<value>.*)/i', $value, $match))
|
||||
{
|
||||
$data = $this->name($key) . ' '.$match['expression'].' '. $this->value($match['value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($value != '{$__cake_id__$}') && ($value != '{$__cake_foreignKey__$}'))
|
||||
{
|
||||
$value = $this->value($value);
|
||||
}
|
||||
$data = $this->name($key) . '=';
|
||||
|
||||
//$slashedValue = $this->value($value);
|
||||
//TODO: Remove the = below so LIKE and other compares can be used
|
||||
$data = $key . '=';
|
||||
if ($value === null)
|
||||
{
|
||||
$data .= 'null';
|
||||
|
@ -1070,7 +1050,7 @@ class DboSource extends DataSource
|
|||
{
|
||||
$data .= $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$out[] = $data;
|
||||
}
|
||||
return ' WHERE ' . join(' AND ', $out);
|
||||
|
@ -1096,13 +1076,39 @@ class DboSource extends DataSource
|
|||
* @param string $dir Direction (ASC or DESC)
|
||||
* @return string ORDER BY clause
|
||||
*/
|
||||
function order ($key, $dir = '')
|
||||
function order ($keys, $dir = '')
|
||||
{
|
||||
if (trim($key) == '')
|
||||
if (empty($keys))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
return ' ORDER BY '.$key.' '.$dir;
|
||||
|
||||
if(is_array($keys))
|
||||
{
|
||||
foreach($keys as $key => $value)
|
||||
{
|
||||
if(is_numeric($key))
|
||||
{
|
||||
$key = $value;
|
||||
$value = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$value= ' '.$value;
|
||||
}
|
||||
$order[] = $this->name($key).$value;
|
||||
}
|
||||
return ' ORDER BY '.join(',', $order);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/(?P<direction>\\x20ASC|\\x20DESC)/', $keys, $match))
|
||||
{
|
||||
$dir = $match['direction'];
|
||||
$keys = preg_replace('/'.$match['direction'].'/', '', $keys);
|
||||
}
|
||||
return ' ORDER BY '.$this->name($keys).$dir;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1116,7 +1122,6 @@ class DboSource extends DataSource
|
|||
{
|
||||
$this->showLog();
|
||||
}
|
||||
//$this->disconnect();
|
||||
$this->_conn = NULL;
|
||||
$this->connected = false;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ class DboMysql extends DboSource
|
|||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function &describe (&$model)
|
||||
function describe (&$model)
|
||||
{
|
||||
$cache = parent::describe($model);
|
||||
if ($cache != null)
|
||||
|
@ -238,7 +238,7 @@ class DboMysql extends DboSource
|
|||
}
|
||||
if (isset($column[0]))
|
||||
{
|
||||
$fields[] = array('name' => $column[0]['Field'], 'type' => $column[0]['Type']);
|
||||
$fields[] = array('name' => $column[0]['Field'], 'type' => $column[0]['Type'], 'null' => $column[0]['Null']);
|
||||
}
|
||||
}
|
||||
$this->__cacheDescription($model->table, $fields);
|
||||
|
@ -291,7 +291,14 @@ class DboMysql extends DboSource
|
|||
{
|
||||
$data = mysql_real_escape_string($data, $this->connection);
|
||||
}
|
||||
$return = "'" . $data . "'";
|
||||
if(!is_numeric($data))
|
||||
{
|
||||
$return = "'" . $data . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = $data;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ uses('model'.DS.'datasources'.DS.'dbo_source');
|
|||
class DboPostgres extends DboSource
|
||||
{
|
||||
|
||||
|
||||
var $description = "PostgreSQL DBO Driver";
|
||||
|
||||
var $_baseConfig = array('persistent' => true,
|
||||
|
@ -53,8 +52,7 @@ class DboPostgres extends DboSource
|
|||
'login' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'cake',
|
||||
'port' => 3306
|
||||
);
|
||||
'port' => 3306);
|
||||
|
||||
var $columns = array(
|
||||
'primary_key' => array('name' => 'serial primary key'),
|
||||
|
@ -67,10 +65,8 @@ class DboPostgres extends DboSource
|
|||
'time' => array('name' => 'time'),
|
||||
'date' => array('name' => 'date'),
|
||||
'binary' => array('name' => 'bytea'),
|
||||
'boolean' => array('name' => 'boolean')
|
||||
);
|
||||
|
||||
|
||||
'boolean' => array('name' => 'boolean'),
|
||||
'number' => array('name' => 'numeric'));
|
||||
|
||||
/**
|
||||
* Connects to the database using options in the given configuration array.
|
||||
|
@ -119,10 +115,6 @@ class DboPostgres extends DboSource
|
|||
function query ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
echo "<pre>";
|
||||
print_r($args);
|
||||
echo "</pre>";
|
||||
die();
|
||||
if (count($args) == 1)
|
||||
{
|
||||
return $this->fetchAll($args[0]);
|
||||
|
@ -130,13 +122,13 @@ class DboPostgres extends DboSource
|
|||
elseif (count($args) > 1 && strpos($args[0], 'findBy') === 0)
|
||||
{
|
||||
$field = Inflector::underscore(str_replace('findBy', '', $args[0]));
|
||||
$query = '`' . $args[2]->name . '`.`' . $field . '` = ' . $this->value($args[1][0]);
|
||||
$query = '"' . $args[2]->name . '"."' . $field . '" = ' . $this->value($args[1][0]);
|
||||
return $args[2]->find($query);
|
||||
}
|
||||
elseif (count($args) > 1 && strpos($args[0], 'findAllBy') === 0)
|
||||
{
|
||||
$field = Inflector::underscore(str_replace('findAllBy', '', $args[0]));
|
||||
$query = '`' . $args[2]->name . '`.`' . $field . '` = ' . $this->value($args[1][0]);
|
||||
$query = '"' . $args[2]->name . '"."' . $field . '" = ' . $this->value($args[1][0]);
|
||||
return $args[2]->findAll($query);
|
||||
}
|
||||
}
|
||||
|
@ -146,9 +138,10 @@ class DboPostgres extends DboSource
|
|||
*
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow ()
|
||||
function fetchRow ($assoc = false)
|
||||
{
|
||||
return pg_fetch_array($this->_result);
|
||||
$assoc = ($assoc === false) ? PGSQL_BOTH : PGSQL_ASSOC;
|
||||
return pg_fetch_array($this->_result, null, $assoc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,29 +151,23 @@ class DboPostgres extends DboSource
|
|||
*/
|
||||
function listSources ()
|
||||
{
|
||||
$sql = "SELECT a.relname AS name
|
||||
FROM pg_class a, pg_user b
|
||||
WHERE ( relkind = 'r') and relname !~ '^pg_' AND relname !~ '^sql_'
|
||||
AND relname !~ '^xin[vx][0-9]+' AND b.usesysid = a.relowner
|
||||
AND NOT (EXISTS (SELECT viewname FROM pg_views WHERE viewname=a.relname));";
|
||||
$sql = "SELECT table_name as name FROM information_schema.tables WHERE table_schema = 'public';";
|
||||
|
||||
$this->execute($sql);
|
||||
$result = $this->fetchRow();
|
||||
$result = $this->query($sql);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tables = array();
|
||||
$tables[] = $result['name'];
|
||||
while ($row = $this->fetchRow())
|
||||
{
|
||||
$tables[] = $row['name'];
|
||||
}
|
||||
return $tables;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tables = array();
|
||||
foreach ($result as $item)
|
||||
{
|
||||
$tables[] = $item['name'];
|
||||
}
|
||||
return $tables;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,6 +190,28 @@ class DboPostgres extends DboSource
|
|||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function &describe (&$model)
|
||||
{
|
||||
$cache = parent::describe($model);
|
||||
if ($cache != null)
|
||||
{
|
||||
return $cache;
|
||||
}
|
||||
|
||||
$fields = false;
|
||||
|
||||
$fields = $this->query("SELECT column_name as name, data_type as type FROM information_schema.columns WHERE table_name =".$this->name($model->table));
|
||||
|
||||
$this->__cacheDescription($model->table, $fields);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a quoted and escaped string of $data for use in an SQL statement.
|
||||
*
|
||||
|
|
|
@ -586,6 +586,23 @@ class Model extends Object
|
|||
return $this->_tableInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associative array of field names and column types.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getColumnTypes ()
|
||||
{
|
||||
$columns = $this->loadInfo();
|
||||
$columns = $columns->value;
|
||||
|
||||
$cols = array();
|
||||
foreach($columns as $col) {
|
||||
$cols[$col['name']] = $col['type'];
|
||||
}
|
||||
return $cols;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if given field name exists in this Model's database table.
|
||||
* Starts by loading the metadata into the private property table_info if that is not already set.
|
||||
|
@ -836,6 +853,7 @@ class Model extends Object
|
|||
|
||||
if(!$this->id > 0 && isset($newID))
|
||||
{
|
||||
$this->__insertID = $newID;
|
||||
$this->id = $newID;
|
||||
}
|
||||
|
||||
|
|
|
@ -583,6 +583,23 @@ class Model extends Object
|
|||
return $this->_tableInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associative array of field names and column types.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getColumnTypes ()
|
||||
{
|
||||
$columns = $this->loadInfo();
|
||||
$columns = $columns->value;
|
||||
|
||||
$cols = array();
|
||||
foreach($columns as $col) {
|
||||
$cols[$col['name']] = $col['type'];
|
||||
}
|
||||
return $cols;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this Model has given field in its database table.
|
||||
*
|
||||
|
@ -832,6 +849,7 @@ class Model extends Object
|
|||
|
||||
if(!$this->id > 0 && isset($newID))
|
||||
{
|
||||
$this->__insertID = $newID;
|
||||
$this->id = $newID;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class Helper extends Object
|
|||
|
||||
function loadConfig()
|
||||
{
|
||||
return $this->readConfigFile(CAKE.'config'.DS.'tags.ini.php');
|
||||
return $this->readConfigFile($config = fileExistsInPath(CAKE.'config'.DS.'tags.ini.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,8 +85,8 @@ class FormHelper extends Helper
|
|||
if( $error == $this->Html->tagIsInvalid( $this->Html->model, $this->Html->field) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class FormHelper extends Helper
|
|||
* @param string $errorMsg Text that will appear if an error has occurred.
|
||||
* @param int $size Size attribute for INPUT element
|
||||
* @param array $htmlOptions HTML options array.
|
||||
* @return string The formatted INPUT element, with a label and wrapped in a div.
|
||||
* @return string The formatted INPUT element, with a label and wrapped in a div.
|
||||
*/
|
||||
function generateInputDiv($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ class FormHelper extends Helper
|
|||
* @param array $htmlOptions HTML options array
|
||||
* @return string Date option wrapped in a div.
|
||||
*/
|
||||
function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected )
|
||||
function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null )
|
||||
{
|
||||
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));;
|
||||
$str = $this->Html->dateTimeOptionTag( $tagName, 'MDY' , 'NONE', $selected, $htmlOptions);
|
||||
|
|
|
@ -290,7 +290,14 @@ class HtmlHelper extends Helper
|
|||
|
||||
if ($this->tagIsInvalid($this->model, $this->field))
|
||||
{
|
||||
$htmlAttributes['class'] = 'form_error';
|
||||
if (isset($htmlAttributes['class']) && trim($htmlAttributes['class']) != "")
|
||||
{
|
||||
$htmlAttributes['class'] .= ' form_error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlAttributes['class'] = 'form_error';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->output(sprintf($this->tags['textarea'], $this->model,$this->field,
|
||||
|
@ -450,9 +457,21 @@ class HtmlHelper extends Helper
|
|||
$htmlAttributes['type'] = 'text';
|
||||
}
|
||||
|
||||
if (!isset($htmlAttributes['id']))
|
||||
{
|
||||
$htmlAttributes['id'] = $this->model.Inflector::camelize($this->field);
|
||||
}
|
||||
|
||||
if ($this->tagIsInvalid($this->model, $this->field))
|
||||
{
|
||||
$htmlAttributes['class'] = 'form_error';
|
||||
if (isset($htmlAttributes['class']) && trim($htmlAttributes['class']) != "")
|
||||
{
|
||||
$htmlAttributes['class'] .= ' form_error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlAttributes['class'] = 'form_error';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->output(sprintf($this->tags['input'], $this->model, $this->field,
|
||||
|
|
|
@ -281,7 +281,7 @@ class View extends Object
|
|||
return $this->pluginView($action, $layout);
|
||||
}
|
||||
|
||||
if (!is_file($viewFileName))
|
||||
if (!is_file($viewFileName) && !$viewFileName = fileExistsInPath($viewFileName))
|
||||
{
|
||||
if (strtolower(get_class($this)) == 'template')
|
||||
{
|
||||
|
@ -306,9 +306,8 @@ class View extends Object
|
|||
{
|
||||
$missingViewFileName = VIEWS.$viewDir.DS.$errorAction.$this->ext;
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml'))
|
||||
elseif($missingViewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml'))
|
||||
{
|
||||
$missingViewFileName = LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -535,20 +534,19 @@ class View extends Object
|
|||
{
|
||||
$viewFileName = VIEWS.'errors'.DS.$this->subDir.$type.$action.$this->ext;
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
|
||||
elseif($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
|
||||
{
|
||||
$viewFileName = LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml';
|
||||
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$this->viewPath.DS.$type.$action.'.thtml'))
|
||||
elseif($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.$this->viewPath.DS.$type.$action.'.thtml'))
|
||||
{
|
||||
$viewFileName = LIBS.'view'.DS.'templates'.DS.$this->viewPath.DS.$type.$action.'.thtml';
|
||||
|
||||
}
|
||||
|
||||
$viewPath = explode(DS, $viewFileName);
|
||||
$i = array_search('..', $viewPath);
|
||||
unset($viewPath[$i-1]);
|
||||
unset($viewPath[$i]);
|
||||
|
||||
$return = '/'.implode('/', $viewPath);
|
||||
return $return;
|
||||
}
|
||||
|
@ -585,9 +583,8 @@ class View extends Object
|
|||
{
|
||||
$layoutFileName = LAYOUTS.$this->subDir.$type."{$this->layout}$this->ext";
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS."layouts".DS.$type."{$this->layout}.thtml"))
|
||||
elseif($layoutFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS."layouts".DS.$type."{$this->layout}.thtml"))
|
||||
{
|
||||
$layoutFileName = LIBS.'view'.DS.'templates'.DS."layouts".DS.$type."{$this->layout}.thtml";
|
||||
}
|
||||
return $layoutFileName;
|
||||
}
|
||||
|
@ -684,9 +681,9 @@ class View extends Object
|
|||
{
|
||||
$helperFn = HELPERS.$helperFn;
|
||||
}
|
||||
else if(file_exists(LIBS.'view'.DS.'helpers'.DS.$helperFn))
|
||||
else if($helperFn = fileExistsInPath(LIBS.'view'.DS.'helpers'.DS.$helperFn))
|
||||
{
|
||||
$helperFn = LIBS.'view'.DS.'helpers'.DS.$helperFn;
|
||||
|
||||
}
|
||||
if (is_file($helperFn))
|
||||
{
|
||||
|
|
26
index.php
26
index.php
|
@ -3,7 +3,7 @@
|
|||
|
||||
/**
|
||||
* Requests collector.
|
||||
*
|
||||
*
|
||||
* This file collects requests if:
|
||||
* - no mod_rewrite is avilable or .htaccess files are not supported
|
||||
* - /public is not set as a web root.
|
||||
|
@ -11,14 +11,14 @@
|
|||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
|
@ -36,16 +36,28 @@ define ('APP_DIR', 'app');
|
|||
define ('DS', DIRECTORY_SEPARATOR);
|
||||
define ('ROOT', dirname(__FILE__).DS);
|
||||
|
||||
require_once ROOT.'cake'.DS.'basics.php';
|
||||
require_once ROOT.APP_DIR.DS.'config'.DS.'core.php';
|
||||
require_once ROOT.'cake'.DS.'config'.DS.'paths.php';
|
||||
/**
|
||||
* This only needs to be changed if the cake installed libs are located
|
||||
* outside of the distributed directory structure.
|
||||
*/
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH'))
|
||||
{
|
||||
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||
}
|
||||
|
||||
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
|
||||
|
||||
require_once 'cake'.DS.'basics.php';
|
||||
require_once 'config'.DS.'core.php';
|
||||
require_once 'cake'.DS.'config'.DS.'paths.php';
|
||||
|
||||
|
||||
$uri = setUri();
|
||||
|
||||
/**
|
||||
* As mod_rewrite (or .htaccess files) is not working, we need to take care
|
||||
* of what would normally be rewritten, i.e. the static files in /public
|
||||
* of what would normally be rewritten, i.e. the static files in app/webroot/
|
||||
*/
|
||||
if ($uri === '/' || $uri === '/index.php')
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue