diff --git a/VERSION.txt b/VERSION.txt index ef6d7a8d8..1aad52d6e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.5.1810 RC 1 \ No newline at end of file +0.10.6.1816 RC 1 \ No newline at end of file diff --git a/app/config/core.php b/app/config/core.php index 1fe17a4a9..ba73672ac 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -65,6 +65,17 @@ define('CAKE_SESSION_COOKIE', 'CAKEPHP'); */ define('CAKE_SECURITY', 'high'); +/** + * Set Cake Session time out. + * If CAKE_SECURITY define is set + * high: multiplied by 10 + * medium: is multiplied by 100 + * low is: multiplied by 300 + * + * Number below is seconds. + */ +define('CAKE_SESSION_TIMEOUT', '120'); + /** * Set a random string of used in session. * diff --git a/app/webroot/index.php b/app/webroot/index.php index b3560ef24..7bf38ed70 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -2,7 +2,7 @@ /* SVN FILE: $Id$ */ /** - * The main "loop" + * Short description for file. * * Long description for file * @@ -34,18 +34,11 @@ */ if (!defined('DS')) { -/** - * Enter description here... - */ define('DS', DIRECTORY_SEPARATOR); } if (!defined('ROOT')) { -/** - * Enter description here... - * - */ define('ROOT', dirname(dirname(dirname(__FILE__))).DS); } @@ -58,88 +51,5 @@ if (!defined('WEBROOT_DIR')) { define ('WEBROOT_DIR', basename(dirname(__FILE__))); } - - -/** - * 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 LIBS.'object.php'; -require_once LIBS.'session.php'; -require_once LIBS.'security.php'; -require_once LIBS.'neat_array.php'; -require_once LIBS.'inflector.php'; - -/** - * Enter description here... - */ - - if (empty($uri) && defined('BASE_URL')) - { - $uri = setUri(); - if ($uri === '/' || $uri === '/index.php' || $uri === '/app/') - { - $_GET['url'] = '/'; - $url = '/'; - } - else - { - $elements = explode('/index.php', $uri); - if(!empty($elements[1])) - { - $_GET['url'] = $elements[1]; - $url = $elements[1]; - } - else - { - $_GET['url'] = '/'; - $url = '/'; - } - } - } - else - { - $url = empty($_GET['url'])? null: $_GET['url']; - } - - -if (strpos($url, 'ccss/') === 0) -{ - include WWW_ROOT.DS.'css.php'; - die(); -} - - -DEBUG? error_reporting(E_ALL): error_reporting(0); -if (DEBUG) -{ - ini_set('display_errors', 1); -} - -$TIME_START = getMicrotime(); - -require_once CAKE.'dispatcher.php'; -require_once LIBS.'model'.DS.'connection_manager.php'; - -config('database'); - -if (class_exists('DATABASE_CONFIG') && !class_exists('AppModel')) -{ - require_once LIBS.'model'.DS.'model.php'; - loadModels(); -} - -//RUN THE SCRIPT - if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico') - { - }else{ - $Dispatcher= new Dispatcher (); - $Dispatcher->dispatch($url); - } - -if (DEBUG) { - echo ""; -} +require_once ROOT.'cake'.DS.'bootstrap.php'; ?> \ No newline at end of file diff --git a/cake/bootstrap.php b/cake/bootstrap.php new file mode 100644 index 000000000..8ae0da88d --- /dev/null +++ b/cake/bootstrap.php @@ -0,0 +1,128 @@ + + * Copyright (c) 2005, 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 + * @copyright Copyright (c) 2005, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project + * @package cake + * @subpackage cake.cake + * @since CakePHP v 0.2.9 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ + + + +/** + * 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 LIBS.'object.php'; +require_once LIBS.'session.php'; +require_once LIBS.'security.php'; +require_once LIBS.'neat_array.php'; +require_once LIBS.'inflector.php'; + +/** + * Enter description here... + */ +if (empty($uri) && defined('BASE_URL')) +{ + $uri = setUri(); + if ($uri === '/' || $uri === '/index.php' || $uri === '/app/') + { + $_GET['url'] = '/'; + $url = '/'; + } + else + { + $elements = explode('/index.php', $uri); + if(!empty($elements[1])) + { + $_GET['url'] = $elements[1]; + $url = $elements[1]; + } + else + { + $_GET['url'] = '/'; + $url = '/'; + } + } +} +else +{ + if(empty($_GET['url'])) + { + $url = null; + } + else + { + $url = $_GET['url']; + } + +} + + +if (strpos($url, 'ccss/') === 0) +{ + include WWW_ROOT.DS.'css.php'; + die(); +} + + +if (DEBUG) +{ + error_reporting(E_ALL); + ini_set('display_errors', 1); +} +else +{ + error_reporting(0); +} + +$TIME_START = getMicrotime(); + +require_once CAKE.'dispatcher.php'; +require_once LIBS.'model'.DS.'connection_manager.php'; + +config('database'); + +if (class_exists('DATABASE_CONFIG') && !class_exists('AppModel')) +{ + require_once LIBS.'model'.DS.'model.php'; + loadModels(); +} + +if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico') +{ +} +else +{ + $Dispatcher= new Dispatcher (); + $Dispatcher->dispatch($url); +} + +if (DEBUG) +{ + echo ""; +} +?> \ No newline at end of file diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index 2b10f23ad..bdef9d598 100644 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -340,8 +340,16 @@ class DataSource extends Object { case '{$__cake_id__$}': $val = null; - if (isset($data[$index][$model->name])) { - $val = $data[$index][$model->name][$model->primaryKey]; + if (isset($data[$index][$model->name])) + { + if(isset($data[$index][$model->name][$model->primaryKey])) + { + $val = $data[$index][$model->name][$model->primaryKey]; + } + else + { + $val = ''; + } } break; case '{$__cake_foreignKey__$}': diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 769a18abe..11796c354 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -462,7 +462,7 @@ class DboSource extends DataSource } else { - if(isset($this->joinFieldJoin)) + if(isset($this->joinFieldJoin) && !isset($queryData['fields'])) { $joinFields = ', '; $joinFields .= join(', ', $this->joinFieldJoin['fields']); @@ -714,10 +714,10 @@ class DboSource extends DataSource { $data['conditions'] = ' 1 '; } - // if (!isset($data['fields'])) - // { - // $data['fields'] = '*'; - // } + if (!isset($data['fields'])) + { + $data['fields'] = ''; + } if (!isset($data['joins'])) { $data['joins'] = array(); @@ -754,7 +754,6 @@ class DboSource extends DataSource } else { - //$fields = array('*'); foreach ($model->_tableInfo->value as $field) { $fields[]= $field['name']; diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index 3caae32b8..023365dbb 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -621,7 +621,7 @@ class Model extends Object * @param mixed $fields String of single fieldname, or an array of fieldnames. * @return array Array of database fields */ - function read ($id = null, $fields = null) + function read ($fields = null, $id = null) { $this->validationErrors = null; if ($id != null) @@ -950,7 +950,7 @@ class Model extends Object */ function find ($conditions = null, $fields = null, $order = null, $recursive = 1) { - $data = $this->findAll($conditions, $fields, $order, 1, $recursive); + $data = $this->findAll($conditions, $fields, $order, 1, null, $recursive); if (empty($data[0])) { return false; @@ -1068,9 +1068,9 @@ class Model extends Object * @param string $conditions SQL conditions (WHERE clause conditions) * @return int Number of matching rows */ - function findCount ($conditions = null) + function findCount ($conditions = null, $recursive = 0) { - list($data) = $this->findAll($conditions, 'COUNT(*) AS count', null, null, 1, 0); + list($data) = $this->findAll($conditions, 'COUNT(*) AS count', null, null, 1, $recursive); if (isset($data[0]['count'])) { return $data[0]['count']; diff --git a/cake/libs/model/model_php5.php b/cake/libs/model/model_php5.php index 98f80cc27..60fad5c8d 100644 --- a/cake/libs/model/model_php5.php +++ b/cake/libs/model/model_php5.php @@ -618,7 +618,7 @@ class Model extends Object * @param mixed $fields String of single fieldname, or an array of fieldnames. * @return array Array of database fields */ - function read ($id = null, $fields = null) + function read ($fields = null, $id = null) { $this->validationErrors = null; if ($id != null) @@ -947,7 +947,7 @@ class Model extends Object */ function find ($conditions = null, $fields = null, $order = null, $recursive = 1) { - $data = $this->findAll($conditions, $fields, $order, 1, $recursive); + $data = $this->findAll($conditions, $fields, $order, 1, null, $recursive); if (empty($data[0])) { return false; @@ -1065,9 +1065,9 @@ class Model extends Object * @param string $conditions SQL conditions (WHERE clause conditions) * @return int Number of matching rows */ - function findCount ($conditions = null) + function findCount ($conditions = null, $recursive = 0) { - list($data) = $this->findAll($conditions, 'COUNT(*) AS count', null, null, 1, 0); + list($data) = $this->findAll($conditions, 'COUNT(*) AS count', null, null, 1, $recursive); if (isset($data[0]['count'])) { return $data[0]['count']; diff --git a/cake/libs/security.php b/cake/libs/security.php index 522a37910..f2bc3a063 100644 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -3,20 +3,20 @@ /** * Short description for file. - * + * * Long description for file * * PHP versions 4 and 5 * * CakePHP : Rapid Development Framework - * Copyright (c) 2005, Cake Software Foundation, Inc. + * Copyright (c) 2005, 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) 2005, Cake Software Foundation, Inc. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project * @package cake @@ -30,7 +30,7 @@ /** * Short description for file. - * + * * Long description for file * * @package cake @@ -39,18 +39,18 @@ */ class Security extends Object { - + function &getInstance() { static $instance = array(); - + if (!$instance) { $instance[0] =& new Security; } return $instance[0]; } - + function inactiveMins() { $security =& Security::getInstance(); @@ -60,27 +60,27 @@ class Security extends Object return 10; break; case 'medium': - return 20; + return 100; break; case 'low': default : - return 30; + return 300; break; } } - + function generateAuthKey() { - + return $authKey; } - + function validateAuthKey($authKey) { return true; } - - + + function hash($string, $type='sha1') { $type = strtolower($type); @@ -111,7 +111,7 @@ class Security extends Object return md5($string); } } - + function cipher($text, $key) { if (!defined('CIPHER_SEED')) @@ -120,7 +120,7 @@ class Security extends Object define('CIPHER_SEED', 'mKEZGy8AB8FErX4t'); } srand(CIPHER_SEED); - + $out = ''; for($i = 0; $i < strlen($text); $i++) { @@ -128,7 +128,7 @@ class Security extends Object { $toss = rand(0, 255); } - + $mask = rand(0, 255); $out .= chr(ord(substr($text, $i, 1)) ^ $mask); } diff --git a/cake/libs/session.php b/cake/libs/session.php index e128016bf..6af2e8033 100644 --- a/cake/libs/session.php +++ b/cake/libs/session.php @@ -126,7 +126,7 @@ class CakeSession extends Object } $this->time = time(); - $this->sessionTime = $this->time + (Security::inactiveMins() * 60); + $this->sessionTime = $this->time + (Security::inactiveMins() * CAKE_SESSION_TIMEOUT); $this->security = CAKE_SECURITY; $this->_initSession(); $this->_begin(); @@ -370,7 +370,6 @@ class CakeSession extends Object ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_path', $this->path); ini_set('session.gc_probability', 1); - ini_set('session.gc_maxlifetime', Security::inactiveMins() * 60); ini_set('session.auto_start', 0); ini_set('session.save_path', TMP.'sessions'); break; @@ -384,7 +383,6 @@ class CakeSession extends Object ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_path', $this->path); ini_set('session.gc_probability', 1); - ini_set('session.gc_maxlifetime', Security::inactiveMins() * 60); ini_set('session.auto_start', 0); session_set_save_handler(array('CakeSession', '_open'), array('CakeSession', '_close'), @@ -398,7 +396,6 @@ class CakeSession extends Object ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_path', $this->path); ini_set('session.gc_probability', 1); - ini_set('session.gc_maxlifetime', Security::inactiveMins() * 60); break; default : $config = CONFIGS.CAKE_SESSION_SAVE.'.php'; @@ -412,7 +409,6 @@ class CakeSession extends Object ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_path', $this->path); ini_set('session.gc_probability', 1); - ini_set('session.gc_maxlifetime', Security::inactiveMins() * 60); } break; }