diff --git a/VERSION.txt b/VERSION.txt index 25c48449a..d8302f804 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.5.1797 RC 1 \ No newline at end of file +0.10.5.1806 RC 1 \ No newline at end of file diff --git a/cake/libs/controller/components/session.php b/cake/libs/controller/components/session.php index c96b1af63..52a41a94b 100644 --- a/cake/libs/controller/components/session.php +++ b/cake/libs/controller/components/session.php @@ -150,6 +150,20 @@ class SessionComponent extends Object } +/** + * Enter description here... + * + * Use like this. $this->Session->valid(); + * This will return true if session is valid + * false if session is invalid + * + * @return boolean + */ + function renew() + { + $this->CakeSession->renew(); + } + /** * Enter description here... * diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index ed6cc1009..98d450024 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -112,7 +112,7 @@ class DboSource extends DataSource function execute($sql) { $t = getMicrotime(); - $this->_result = $this->__execute($sql); + $this->_result = $this->_execute($sql); $this->affected = $this->lastAffected(); $this->took = round((getMicrotime() - $t) * 1000, 0); @@ -407,7 +407,7 @@ class DboSource extends DataSource if ($linkModel == null) { // Generates primary query - $sql = 'SELECT ' . join(', ', $this->fields($queryData['fields'])) . ' FROM '; + $sql = 'SELECT ' . join(', ', $this->fields($model, $model->name, $queryData['fields'])) . ' FROM '; $sql .= $this->name($model->table).' AS '; $sql .= $this->name($model->name).' ' . join(' ', $queryData['joins']).' '; $sql .= $this->conditions($queryData['conditions']).' '.$this->order($queryData['order']); @@ -418,7 +418,7 @@ class DboSource extends DataSource $alias = $association; if($model->name == $linkModel->name) { - $alias = Inflector::pluralize($association); + // $alias = Inflector::pluralize($association); } switch ($type) @@ -430,7 +430,8 @@ class DboSource extends DataSource { return $assocData['finderQuery']; } - $sql = 'SELECT * FROM '.$this->name($linkModel->table).' AS '.$alias; + $sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields'])); + $sql .= ' FROM '.$this->name($linkModel->table).' AS '.$alias; $conditions = $queryData['conditions']; $condition = $model->escapeField($assocData['foreignKey']); $condition .= '={$__cake_foreignKey__$}'; @@ -510,8 +511,8 @@ class DboSource extends DataSource else { $conditions = $assocData['conditions']; - $sql = 'SELECT * FROM '.$this->name($linkModel->table).' AS '; - $sql .= $this->name($alias); + $sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields'])); + $sql .= ' FROM '.$this->name($linkModel->table).' AS '. $this->name($alias); $cond = $this->name($alias).'.'.$this->name($assocData['foreignKey']); $cond .= '={$__cake_id__$}'; @@ -541,14 +542,13 @@ class DboSource extends DataSource else { $joinTbl = $this->name($assocData['joinTable']); - $alias = $this->name($alias); - $sql = 'SELECT '.join(', ', $this->fields($assocData['fields'])); - $sql .= ' FROM '.$this->name($linkModel->table).' AS '.$alias; + $sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields'])); + $sql .= ' FROM '.$this->name($linkModel->table).' AS '.$this->name($alias); $sql .= ' JOIN '.$joinTbl.' ON '.$joinTbl; $sql .= '.'.$this->name($assocData['foreignKey']).'={$__cake_id__$}'; $sql .= ' AND '.$joinTbl.'.'.$this->name($assocData['associationForeignKey']); - $sql .= ' = '.$alias.'.'.$this->name($linkModel->primaryKey); + $sql .= ' = '.$this->name($alias).'.'.$this->name($linkModel->primaryKey); $sql .= $this->conditions($assocData['conditions']); $sql .= $this->order($assocData['order']); @@ -621,10 +621,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(); @@ -639,11 +639,11 @@ class DboSource extends DataSource } } - function fields ($fields) + function fields (&$model, $alias, $fields) { if (is_array($fields)) { - $f = $fields; + $fields = $fields; } else { @@ -661,7 +661,12 @@ class DboSource extends DataSource } else { - $fields = array('*'); + //$fields = array('*'); + foreach ($model->_tableInfo->value as $field) + { + $fields[]= $field['name']; + } + } } @@ -669,7 +674,7 @@ class DboSource extends DataSource { for ($i = 0; $i < count($fields); $i++) { - $fields[$i] = $this->name($fields[$i]); + $fields[$i] = $this->name($alias).'.'.$this->name($fields[$i]); } } return $fields; diff --git a/cake/libs/model/dbo/dbo_mysql.php b/cake/libs/model/dbo/dbo_mysql.php index 2c38a315e..e94a38638 100644 --- a/cake/libs/model/dbo/dbo_mysql.php +++ b/cake/libs/model/dbo/dbo_mysql.php @@ -125,8 +125,9 @@ class DboMysql extends DboSource * * @param string $sql SQL statement * @return resource Result resource identifier + * @access protected */ - function __execute ($sql) + function _execute ($sql) { return mysql_query($sql, $this->connection); } @@ -168,10 +169,16 @@ class DboMysql extends DboSource */ function fetchRow ($assoc = false) { - //return mysql_fetch_array($this->_result, $assoc? MYSQL_ASSOC: MYSQL_BOTH); - $this->resultSet($this->_result); - $resultRow = $this->fetchResult(); - return $resultRow; + if(is_resource($this->_result)) + { + $this->resultSet($this->_result); + $resultRow = $this->fetchResult(); + return $resultRow; + } + else + { + return null; + } } /** @@ -244,7 +251,7 @@ class DboMysql extends DboSource { return '*'; } - return '`'.$data.'`'; + return '`'. ereg_replace('\.', '`.`', $data) .'`'; } /** diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index eb38f0254..3caae32b8 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -453,7 +453,7 @@ class Model extends Object switch($key) { case 'fields': - $data = '*'; + $data = ''; break; case 'foreignKey': $data = Inflector::singularize($this->table).'_id'; @@ -1346,7 +1346,8 @@ class Model extends Object */ function getNumRows () { - return $this->__numRows; + //return $this->__numRows; + return $this->db->lastNumRows(); } /** @@ -1356,7 +1357,8 @@ class Model extends Object */ function getAffectedRows () { - return $this->__affectedRows; + //return $this->__affectedRows; + return $this->db->lastAffected(); } /** diff --git a/cake/libs/model/model_php5.php b/cake/libs/model/model_php5.php index ccfcda48d..98f80cc27 100644 --- a/cake/libs/model/model_php5.php +++ b/cake/libs/model/model_php5.php @@ -450,7 +450,7 @@ class Model extends Object switch($key) { case 'fields': - $data = '*'; + $data = ''; break; case 'foreignKey': $data = Inflector::singularize($this->table).'_id'; @@ -1343,7 +1343,8 @@ class Model extends Object */ function getNumRows () { - return $this->__numRows; + //return $this->__numRows; + return $this->db->lastNumRows(); } /** @@ -1353,7 +1354,8 @@ class Model extends Object */ function getAffectedRows () { - return $this->__affectedRows; + //return $this->__affectedRows; + return $this->db->lastAffected(); } /** diff --git a/cake/libs/session.php b/cake/libs/session.php index fb1f770a9..e128016bf 100644 --- a/cake/libs/session.php +++ b/cake/libs/session.php @@ -314,6 +314,7 @@ class CakeSession extends Object setcookie(CAKE_SESSION_COOKIE, '', time()-42000, $this->path); } $file = $sessionpath.DS."sess_".session_id(); + session_destroy(); @unlink($file); $this->__construct($this->path); } @@ -427,8 +428,8 @@ class CakeSession extends Object { if($this->readSessionVar("Config")) { - if($this->userAgent == $this->readSessionVar("Config.userAgent") && - $this->time <= $this->readSessionVar("Config.time")) + if($this->userAgent == $this->readSessionVar("Config.userAgent") + && $this->time <= $this->readSessionVar("Config.time")) { $this->writeSessionVar("Config.time", $this->sessionTime); $this->valid = true; @@ -449,11 +450,6 @@ class CakeSession extends Object $this->valid = true; $this->_setError(1, "Session is valid"); } - - if($this->security == 'high') - { - $this->_regenerateId(); - } header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); } @@ -519,7 +515,7 @@ class CakeSession extends Object * @access private * */ - function _renew() + function renew() { $this->_regenerateId(); } diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index fe5c121d4..283213d37 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -61,7 +61,7 @@ class AjaxHelper extends Helper * * @var array */ - var $ajaxOptions = array('method','position','form','parameters','evalScripts', 'asynchronous', 'onComplete', 'onUninitialized', 'onLoading', 'onLoaded', 'onInteractive'); + var $ajaxOptions = array('type', 'confirm', 'condition', 'before', 'after', 'fallback', 'update', 'loading', 'loaded', 'interactive', 'complete', 'with', 'url', 'method', 'position', 'form', 'parameters', 'evalScripts', 'asynchronous', 'onComplete', 'onUninitialized', 'onLoading', 'onLoaded', 'onInteractive'); /** * Options for draggable. @@ -84,8 +84,6 @@ class AjaxHelper extends Helper */ var $sortOptions = array('tag', 'only', 'overlap', 'constraint', 'containment', 'handle', 'hoverClass', 'ghosting', 'dropOnEmpty', 'onUpdate', 'onChange'); - var $__ajaxKeys = array('url', 'with', 'update', 'loading', 'loaded', 'interactive', 'complete', 'type', 'confirm', 'condition', 'before', 'after', 'fallback'); - /** * Returns link to remote action * @@ -377,22 +375,10 @@ class AjaxHelper extends Helper $options['id'] = r("/", "_", $field); } - $htmlOptions = $options; - $ajaxOptions = array('with', 'asynchronous', 'synchronous', 'method', 'position', 'form'); + $htmlOptions = $this->__getHtmlOptions($options); $htmlOptions['autocomplete'] = "off"; - foreach($ajaxOptions as $key) - { - if(isset($options[$key])) - { - $ajaxOptions[$key] = $options[$key]; - } - else - { - unset($ajaxOptions[$key]); - } - } if(!isset($options['class'])) { $options['class'] = "auto_complete"; @@ -537,9 +523,13 @@ class AjaxHelper extends Helper } - function __getHtmlOptions($options) + function __getHtmlOptions($options, $extra = array()) { - foreach($this->__ajaxKeys as $key) + foreach($this->ajaxOptions as $key) + { + unset($options[$key]); + } + foreach($extra as $key) { unset($options[$key]); } diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 9be111e57..7814740a8 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -1377,7 +1377,7 @@ class HtmlHelper extends Helper { $value = isset($value)? $value : $this->tagValue($tagName."_min"); $minValue = empty($selected) ? date('i') : $selected ; - for( $minCount=0; $minCount<61; $minCount++) + for( $minCount=0; $minCount<60; $minCount++) { $mins[$minCount] = sprintf('%02d', $minCount); } diff --git a/cake/scripts/acl.php b/cake/scripts/acl.php index 3d5829224..77b23c327 100644 --- a/cake/scripts/acl.php +++ b/cake/scripts/acl.php @@ -51,19 +51,17 @@ define ('APP_DIR', 'app'); * */ define ('DEBUG', 1); - +require_once (ROOT.'cake'.DS.'basics.php'); require_once (ROOT.'cake'.DS.'config'.DS.'paths.php'); -require_once (CAKE.'basics.php'); require_once (CONFIGS.'core.php'); require_once (CONFIGS.'database.php'); - uses ('neat_array'); uses ('object'); uses ('session'); uses ('security'); +uses ('model'.DS.'connection_manager'); +uses ('model'.DS.'datasources'.DS.'dbo_source'); uses ('model'.DS.'model'); -uses ('model'.DS.'dbo'.DS.'dbo_factory'); -uses ('controller'.DS.'controller'); uses ('controller'.DS.'components'.DS.'acl'); uses ('controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aclnode'); uses ('controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aco'); @@ -105,12 +103,6 @@ class AclCLI { * @var unknown_type */ var $acl; -/** - * Enter description here... - * - * @var unknown_type - */ - var $controller; /** * Enter description here... @@ -119,6 +111,13 @@ class AclCLI { */ var $args; +/** + * Enter description here... + * + * @var unknown_type + */ + var $dataSource = 'default'; + /** * Enter description here... * @@ -143,9 +142,7 @@ class AclCLI { $this->acl = $acl->getACL(); $this->args = $args; - - $this->controller =& new Controller(); - $this->controller->constructClasses(); + $this->db =& ConnectionManager::getDataSource($this->dataSource); $this->stdin = fopen('php://stdin', 'r'); $this->stdout = fopen('php://stdout', 'w'); @@ -382,7 +379,7 @@ class AclCLI { `rght` int(11) default NULL, PRIMARY KEY (`id`) );"; - $this->controller->db->query($sql); + $this->db->query($sql); fwrite($this->stdout, "Creating access request objects table (acos)...\n"); $sql2 = "CREATE TABLE `aros` ( @@ -393,7 +390,7 @@ class AclCLI { `rght` int(11) default NULL, PRIMARY KEY (`id`) );"; - $this->controller->db->query($sql2); + $this->db->query($sql2); fwrite($this->stdout, "Creating relationships table (aros_acos)...\n"); $sql3 = "CREATE TABLE `aros_acos` ( @@ -406,7 +403,7 @@ class AclCLI { `_delete` int(11) NOT NULL default '0', PRIMARY KEY (`id`) );"; - $this->controller->db->query($sql3); + $this->db->query($sql3); fwrite($this->stdout, "\nDone.\n"); } @@ -574,7 +571,7 @@ class AclCLI { $class = ucwords($type); $vars['secondary_id'] = ($class == 'aro' ? 'user_id' : 'object_id'); $vars['data_name'] = $type; - $vars['table_name'] = $class . 's'; + $vars['table_name'] = $type . 's'; $vars['class'] = $class; return $vars; }