diff --git a/VERSION.txt b/VERSION.txt index 7dbc5cdd1..ce450f2d1 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.4.1701_beta \ No newline at end of file +0.10.5.1787 RC 1 \ No newline at end of file diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 1000628aa..3b474d045 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -476,12 +476,10 @@ class Controller extends Object function generateFieldNames( $data = null, $doCreateOptions = true ) { $fieldNames = array(); - $model = $this->modelClass; $modelKey = $this->modelKey; $table = $this->{$model}->table; $association = array_search($table,$this->{$model}->alias); - $objRegistryModel = ClassRegistry::getObject($modelKey); foreach ($objRegistryModel->_tableInfo as $tables) @@ -489,12 +487,10 @@ class Controller extends Object foreach ($tables as $tabl) { $alias = null; - // set up the prompt if ($objRegistryModel->isForeignKey($tabl['name'])) { $niceName = substr( $tabl['name'], 0, strpos( $tabl['name'], "_id" ) ); $fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($niceName); - // this is a foreign key, also set up the other controller $fieldNames[ $tabl['name'] ]['table'] = Inflector::pluralize($niceName); $association = array_search($fieldNames[ $tabl['name'] ]['table'],$this->{$model}->alias); if($this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']] == $model) @@ -519,27 +515,16 @@ class Controller extends Object { $fieldNames[$tabl['name']]['prompt'] = 'Modified'; } - - // Now, set up some other attributes that will be useful for auto generating a form. - //tagName is in the format table/field "post/title" - $fieldNames[ $tabl['name']]['tagName'] = $model.'/'.$tabl['name']; - - // Now, find out if this is a required field. - //$validationFields = ClassRegistry::getObject($table)->validate; + $fieldNames[ $tabl['name']]['tagName'] = $model.'/'.$tabl['name']; $validationFields = $objRegistryModel->validate; if( isset( $validationFields[ $tabl['name'] ] ) ) { - // Now, we know that this field has some validation set. - // find out if it is a required field. if( VALID_NOT_EMPTY == $validationFields[ $tabl['name'] ] ) { - // this is a required field. $fieldNames[$tabl['name']]['required'] = true; $fieldNames[$tabl['name']]['errorMsg'] = "Required Field"; } } - - // now, determine what the input type should be for this database field. $lParenPos = strpos( $tabl['type'], '('); $rParenPos = strpos( $tabl['type'], ')'); if( false != $lParenPos ) @@ -553,26 +538,17 @@ class Controller extends Object } switch( $type ) { - case "text": case "mediumtext": - { $fieldNames[ $tabl['name']]['type'] = 'area'; - //$fieldNames[ $tabl['name']]['size'] = $fieldLength; - } break; case "varchar": case "char": - { if (isset($fieldNames[ $tabl['name']]['foreignKey'])) { $fieldNames[ $tabl['name']]['type'] = 'select'; - // This is a foreign key select dropdown box. now, we have to add the options. $fieldNames[ $tabl['name']]['options'] = array(); - - // get the list of options from the other model. $otherModel = ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); - if (is_object($otherModel)) { if ($doCreateOptions) @@ -582,7 +558,6 @@ class Controller extends Object { foreach ($pass as $key => $value) { - if($alias.$key == $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']] && isset( $value['id'] ) && isset( $value[$otherDisplayField])) { $fieldNames[ $tabl['name']]['options'][$value['id']] = $value[$otherDisplayField]; @@ -597,19 +572,17 @@ class Controller extends Object { $fieldNames[ $tabl['name']]['type'] = 'input'; } - } + break; case "tinyint": - { - if( $fieldLength > 1 ) - { - $fieldNames[ $tabl['name']]['type'] = 'input'; - } - else - { - $fieldNames[ $tabl['name']]['type'] = 'checkbox'; - } - } + if( $fieldLength > 1 ) + { + $fieldNames[ $tabl['name']]['type'] = 'input'; + } + else + { + $fieldNames[ $tabl['name']]['type'] = 'checkbox'; + } break; case "int": case "smallint": @@ -618,11 +591,6 @@ class Controller extends Object case "decimal": case "float": case "double": - { - //BUGBUG: Need a better way to determine if this field is an auto increment foreign key. - // If it is a number, and it is a foreign key, we'll make a HUGE assumption that it is an auto increment field. - // for foreign key autonumber fields, we'll set the type to 'key' so that it does not display in the input form. - $charCount = strlen($this->$model->primaryKey); if(0 == strncmp($tabl['name'], $this->$model->primaryKey, $charCount)) { @@ -631,12 +599,8 @@ class Controller extends Object else if( isset( $fieldNames[ $tabl['name']]['foreignKey'] ) ) { $fieldNames[ $tabl['name']]['type'] = 'select'; - // This is a foreign key select dropdown box. now, we have to add the options. $fieldNames[ $tabl['name']]['options'] = array(); - - // get the list of options from the other model. $otherModel = ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); - if( is_object($otherModel) ) { if( $doCreateOptions ) @@ -660,15 +624,10 @@ class Controller extends Object { $fieldNames[ $tabl['name']]['type'] = 'input'; } - } break; case "enum": - { - // for enums, the $fieldLength variable is actually the list of enums. $fieldNames[ $tabl['name']]['type'] = 'select'; - // This is a foreign key select dropdown box. now, we have to add the options. $fieldNames[ $tabl['name']]['options'] = array(); - $enumValues = split(',', $fieldLength ); foreach ($enumValues as $enum ) { @@ -676,73 +635,60 @@ class Controller extends Object $fieldNames[$tabl['name']]['options'][$enum] = $enum; } $fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']]; - - } - break; - case "date": - case "datetime": - { - if(0 != strncmp( "created", $tabl['name'], 6 ) && 0 != strncmp("modified",$tabl['name'], 8)) - { - $fieldNames[ $tabl['name']]['type'] = $type; - } - if(isset($data[$model][$tabl['name']])) - { - $fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']]; - } - else - { - $ieldNames[ $tabl['name']]['selected'] = null; - } - } - break; - default: - //sorry, this database field type is not yet set up. - break; - - - } // end switch - } - // now, add any necessary hasAndBelongsToMany list boxes - // loop through the many to many relations to make a list box. - foreach($objRegistryModel->hasAndBelongsToMany as $relation => $relData) - { - $modelName = $relData['className']; - $manyAssociation = $relation; - $modelKeyM = Inflector::underscore($modelName); - $modelObject = new $modelName(); - - if($doCreateOptions) - { - $otherDisplayField = $modelObject->getDisplayField(); - $fieldNames[$modelKeyM]['model'] = $modelName; - $fieldNames[$modelKeyM]['prompt'] = "Related ".Inflector::humanize(Inflector::pluralize($modelName)); - $fieldNames[$modelKeyM]['type'] = "selectMultiple"; - $fieldNames[$modelKeyM]['tagName'] = $manyAssociation.'/'.$manyAssociation; - - foreach($modelObject->findAll() as $pass) - { - foreach($pass as $key=>$value) - { - if($key == $modelName && isset($value[$modelObject->primaryKey]) && isset( $value[$otherDisplayField])) - { - $fieldNames[$modelKeyM]['options'][$value[$modelObject->primaryKey]] = $value[$otherDisplayField]; - } - } - } - if( isset( $data[$manyAssociation] ) ) - { - foreach( $data[$manyAssociation] as $key => $row ) + break; + case "date": + case "datetime": + if(0 != strncmp( "created", $tabl['name'], 6 ) && 0 != strncmp("modified",$tabl['name'], 8)) + { + $fieldNames[ $tabl['name']]['type'] = $type; + } + if(isset($data[$model][$tabl['name']])) + { + $fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']]; + } + else + { + $fieldNames[ $tabl['name']]['selected'] = null; + } + break; + default: + break; + } + } + foreach($objRegistryModel->hasAndBelongsToMany as $relation => $relData) + { + $modelName = $relData['className']; + $manyAssociation = $relation; + $modelKeyM = Inflector::underscore($modelName); + $modelObject = new $modelName(); + if($doCreateOptions) + { + $otherDisplayField = $modelObject->getDisplayField(); + $fieldNames[$modelKeyM]['model'] = $modelName; + $fieldNames[$modelKeyM]['prompt'] = "Related ".Inflector::humanize(Inflector::pluralize($modelName)); + $fieldNames[$modelKeyM]['type'] = "selectMultiple"; + $fieldNames[$modelKeyM]['tagName'] = $manyAssociation.'/'.$manyAssociation; + foreach($modelObject->findAll() as $pass) { - $fieldNames[$modelKeyM]['selected'][$row[$modelObject->primaryKey]] = $row[$modelObject->primaryKey]; + foreach($pass as $key=>$value) + { + if($key == $modelName && isset($value[$modelObject->primaryKey]) && isset( $value[$otherDisplayField])) + { + $fieldNames[$modelKeyM]['options'][$value[$modelObject->primaryKey]] = $value[$otherDisplayField]; + } + } } - } - } - } // end loop through manytomany relations. + if( isset( $data[$manyAssociation] ) ) + { + foreach( $data[$manyAssociation] as $key => $row ) + { + $fieldNames[$modelKeyM]['selected'][$row[$modelObject->primaryKey]] = $row[$modelObject->primaryKey]; + } + } + } + } } - - return $fieldNames; + return $fieldNames; } - } ?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index eb40392e6..ed6cc1009 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -120,11 +120,6 @@ class DboSource extends DataSource $this->numRows = $this->lastNumRows($this->_result); $this->logQuery($sql); - if (($this->debug && $this->error) || ($this->fullDebug)) - { - $this->showQuery($sql); - } - if ($this->error) { return false; @@ -233,7 +228,15 @@ class DboSource extends DataSource sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC): $this->_queriesLog; - print("\n\n"); + if($this->_queriesCnt >1) + { + $text = 'queries'; + } + else + { + $text = 'query'; + } + print("
{$this->_queriesCnt} queries took {$this->_queriesTime} ms
\n\n"); print("\n"); foreach($log AS $k=>$i) @@ -680,7 +683,7 @@ class DboSource extends DataSource function conditions ($conditions) { $rt = ''; - if (!strpos(low($conditions), 'where') || strpos(low($conditions), 'where') === 0) + if (!is_array($conditions) && (!strpos(low($conditions), 'where') || strpos(low($conditions), 'where') === 0)) { $rt = ' WHERE '; } @@ -698,17 +701,31 @@ class DboSource extends DataSource $out = array(); foreach ($conditions as $key => $value) { - $slashedValue = $this->value($value); - //TODO: Remove the = below so LIKE and other compares can be used - $data = $key . '='; - if ($value === null) - { - $data .= 'null'; - } - else - { - $data = $slashedValue; - } + // 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 + { + $slashedValue = $this->value($value); + //TODO: Remove the = below so LIKE and other compares can be used + $data = $key . '='; + if ($value === null) + { + $data .= 'null'; + } + else + { + $data .= $slashedValue; + } + } $out[] = $data; } return ' WHERE ' . join(' AND ', $out); @@ -776,4 +793,4 @@ class DboSource extends DataSource } -?> \ No newline at end of file +?> diff --git a/cake/libs/model/dbo/dbo.php b/cake/libs/model/dbo/dbo.php deleted file mode 100644 index d23b55026..000000000 --- a/cake/libs/model/dbo/dbo.php +++ /dev/null @@ -1,474 +0,0 @@ - - * 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.libs.model.dbo - * @since CakePHP v 0.2.9 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -/** - * Enter description here... - * - */ -if(!class_exists('Object')) -{ - uses('object'); -} - -/** - * Purpose: DBO/ADO - * - * Description: - * A SQL functions wrapper. Provides ability to get results as arrays - * and query logging (with execution time). - * - * Example usage: - * - * - * require_once('dbo_mysql.php'); // or 'dbo_postgres.php' - * - * // create and connect the object - * $db = new DBO_MySQL(array( // or 'DBO_Postgres' - * 'host'=>'localhost', - * 'login'=>'username', - * 'password'=>'password', - * 'database'=>'database')); - * - * // read the whole query result array (of rows) - * $all_rows = $db->all("SELECT a,b,c FROM table"); - * - * // read the first row with debugging on - * $first_row_only = $db->one("SELECT a,b,c FROM table WHERE a=1", TRUE); - * - * // emulate the usual way of reading query results - * if ($db->query("SELECT a,b,c FROM table")) - * { - * while ( $row = $db->farr() ) - * { - * print $row['a'].$row['b'].$row['c']; - * } - * } - * - * // show a log of all queries, sorted by execution time - * $db->showLog(TRUE); - * - * - * @package cake - * @subpackage cake.cake.libs.model.dbo - * @since CakePHP v 0.2.9 - */ -class DBO extends Object -{ - -/** - * Are we connected to the database? - * - * @var boolean - * @access public - */ - var $connected=FALSE; - -/** - * Connection configuration. - * - * @var array - * @access public - */ - var $config=FALSE; - -/** - * Enter description here... - * - * @var boolean - * @access public - */ - var $debug=FALSE; - -/** - * Enter description here... - * - * @var boolean - * @access public - */ - var $fullDebug=FALSE; - -/** - * Enter description here... - * - * @var unknown_type - * @access public - */ - var $error=NULL; - -/** - * String to hold how many rows were affected by the last SQL operation. - * - * @var unknown_type - * @access public - */ - var $affected=NULL; - -/** - * Number of rows in current resultset - * - * @var int - * @access public - */ - var $numRows=NULL; - -/** - * Time the last query took - * - * @var unknown_type - * @access public - */ - var $took=NULL; - -/** - * Enter description here... - * - * @var unknown_type - * @access private - */ - var $_conn=NULL; - -/** - * Enter description here... - * - * @var unknown_type - * @access private - */ - var $_result=NULL; - -/** - * Queries count. - * - * @var unknown_type - * @access private - */ - var $_queriesCnt=0; - -/** - * Total duration of all queries. - * - * @var unknown_type - * @access private - */ - var $_queriesTime=NULL; - -/** - * Enter description here... - * - * @var unknown_type - * @access private - */ - var $_queriesLog=array(); - -/** - * Maximum number of items in query log, to prevent query log taking over - * too much memory on large amounts of queries -- I we've had problems at - * >6000 queries on one system. - * - * @var int Maximum number of queries in the queries log. - * @access private - */ - var $_queriesLogMax=200; - - -/** - * Constructor. Sets the level of debug for dbo (fullDebug or debug). - * - * @param array $config - * @return unknown - */ - function __construct($config=NULL) - { - $this->debug = DEBUG > 0; - $this->fullDebug = DEBUG > 1; - parent::__construct(); - return $this->connect($config); - } - -/** - * Destructor. Closes connection to the database. - * - */ - function __destruct() - { - $this->close(); - } - -/** - * Returns a string with a USE [databasename] SQL statement. - * - * @param string $db_name Name of database to use - * @return unknown Result of the query - */ - function useDb($db_name) - { - return $this->query("USE {$db_name}"); - } - -/** - * Disconnects database, kills the connection and says the connection is closed, and if DEBUG is turned on, the log for this object is shown. - * - */ - function close () - { - if ($this->fullDebug) $this->showLog(); - $this->disconnect(); - $this->_conn = NULL; - $this->connected = false; - } - -/** - * Prepares a value, or an array of values for database queries by quoting and escaping them. - * - * @param mixed $data A value or an array of values to prepare. - * @return mixed Prepared value or array of values. - */ - function prepare ($data) - { - if (is_array($data)) - { - $out = null; - foreach ($data as $key=>$item) - { - $out[$key] = $this->value($item); - } - return $out; - } - else - { - return $this->value($data); - } - } - - function tables() - { - return array_map('strtolower', $this->tablesList()); - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return unknown - */ - function rawQuery ($sql) - { - $this->took = $this->error = $this->numRows = false; - return $this->execute($sql); - } - -/** - * Queries the database with given SQL statement, and obtains some metadata about the result - * (rows affected, timing, any errors, number of rows in resultset). The query is also logged. - * If DEBUG is set, the log is shown all the time, else it is only shown on errors. - * - * @param string $sql - * @return unknown - */ - function query($sql) - { - $t = getMicrotime(); - $this->_result = $this->execute($sql); - $this->affected = $this->lastAffected(); - $this->took = round((getMicrotime()-$t)*1000, 0); - $this->error = $this->lastError(); - $this->numRows = $this->lastNumRows($this->_result); - $this->logQuery($sql); - if (($this->debug && $this->error) || ($this->fullDebug)) - $this->showQuery($sql); - - return $this->error? false: $this->_result; - } - -/** - * Returns a single row of results from the _last_ SQL query. - * - * @param resource $res - * @return array A single row of results - */ - function farr ($assoc=false) - { - if ($assoc === false) - { - return $this->fetchRow(); - } - else - { - return $this->fetchRow($assoc); - } - } - -/** - * Returns a single row of results for a _given_ SQL query. - * - * @param string $sql SQL statement - * @return array A single row of results - */ - function one ($sql) - { - return $this->query($sql)? $this->farr(): false; - } - -/** - * Returns an array of all result rows for a given SQL query. - * Returns false if no rows matched. - * - * @param string $sql SQL statement - * @return array Array of resultset rows, or false if no rows matched - */ - function all ($sql) - { - if($this->query($sql)) - { - $out=array(); - while ($item = $this->farr(null, true)) - { - $out[] = $item; - } - return $out; - } - else - { - return false; - } - } - -/** - * Returns a single field of the first of query results for a given SQL query, or false if empty. - * - * @param string $name Name of the field - * @param string $sql SQL query - * @return unknown - */ - function field ($name, $sql) - { - $data = $this->one($sql); - return empty($data[$name])? false: $data[$name]; - } - -/** - * Checks if the specified table contains any record matching specified SQL - * - * @param string $table Name of table to look in - * @param string $sql SQL WHERE clause (condition only, not the "WHERE" part) - * @return boolean True if the table has a matching record, else false - */ - function hasAny($table, $sql) - { - $out = $this->one("SELECT COUNT(*) AS count FROM {$table}".($sql? " WHERE {$sql}":"")); - return is_array($out)? $out[0]['count']: false; - } - -/** - * Checks if it's connected to the database - * - * @return boolean True if the database is connected, else false - */ - function isConnected() - { - return $this->connected; - } - -/** - * Outputs the contents of the log. - * - * @param boolean $sorted - */ - function showLog($sorted=false) - { - $log = $sorted? - sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC): - $this->_queriesLog; - - print("
{$this->_queriesCnt} {$text} took {$this->_queriesTime} ms
NrQueryErrorAffectedNum. rowsTook (ms)
\n\n"); - print("\n"); - - foreach($log AS $k=>$i) - { - print("\n"); - } - - print("
{$this->_queriesCnt} queries took {$this->_queriesTime} ms
NrQueryErrorAffectedNum. rowsTook (ms)
".($k+1)."{$i['query']}{$i['error']}{$i['affected']}{$i['numRows']}{$i['took']}
\n"); - } - -/** - * Log given SQL query. - * - * @param string $sql SQL statement - */ - function logQuery($sql) - { - $this->_queriesCnt++; - $this->_queriesTime += $this->took; - - $this->_queriesLog[] = array( - 'query'=>$sql, - 'error'=>$this->error, - 'affected'=>$this->affected, - 'numRows'=>$this->numRows, - 'took'=>$this->took - ); - - if (count($this->_queriesLog) > $this->_queriesLogMax) - { - array_pop($this->_queriesLog); - } - - if ($this->error) - return false; // shouldn't we be logging errors somehow? - } - -/** - * Output information about an SQL query. The SQL statement, number of rows in resultset, - * and execution time in microseconds. If the query fails, and error is output instead. - * - * @param string $sql - */ - function showQuery($sql) - { - $error = $this->error; - - if (strlen($sql)>200 && !$this->fullDebug) - { - $sql = substr($sql, 0, 200) .'[...]'; - } - - if ($this->debug || $error) - { - print("

Query: {$sql} [Aff:{$this->affected} Num:{$this->numRows} Took:{$this->took}ms]"); - if($error) - { - print("
ERROR: {$this->error}"); - } - print('

'); - } - } -} - -?> \ No newline at end of file diff --git a/cake/libs/model/dbo/dbo_factory.php b/cake/libs/model/dbo/dbo_factory.php deleted file mode 100644 index 0ffe04e31..000000000 --- a/cake/libs/model/dbo/dbo_factory.php +++ /dev/null @@ -1,134 +0,0 @@ - - * 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.libs.model.dbo - * @since CakePHP v 0.10.0.1076 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -/** - * Enter description here... - * - */ -if(!class_exists('Object')) -{ - uses('object'); -} -/** - * Enter description here... - * - */ -if (!class_exists('DATABASE_CONFIG')) -{ - config('database'); -} - -/** - * DbFactory - * - * Creates DBO-descendant objects from a given db connection configuration - * - * @package cake - * @subpackage cake.cake.libs.model.dbo - * @since CakePHP v 0.10.0.1076 - * - */ -class DboFactory extends Object -{ -/** - * A semi-singelton. Returns actual instance, or creates a new one with given config. - * - * @param string $config Name of key of $dbConfig array to be used. - * @return mixed - */ - function getInstance($config = null) - { - $configName = $config; - static $instance = array(); - if ($configName == null && !empty($instance)) - { - return $instance["default"]; - } - else if ($configName == null && empty($instance)) - { - return false; - } - - if (!key_exists($configName, $instance)) - { - $configs = get_class_vars('DATABASE_CONFIG'); - $config = $configs[$configName]; - - // special case for AdoDB -- driver name in the form of 'adodb-drivername' - if (preg_match('#^adodb[\-_](.*)$#i', $config['driver'], $res)) - { - uses('model'.DS.'dbo'.DS.'dbo_adodb'); - $config['driver'] = $res[1]; - $instance[$configName] =& new DBO_AdoDB($config); - } - // special case for PEAR:DB -- driver name in the form of 'pear-drivername' - elseif (preg_match('#^pear[\-_](.*)$#i', $config['driver'], $res)) - { - uses('model'.DS.'dbo'.DS.'dbo_pear'); - $config['driver'] = $res[1]; - $instance[$configName] =& new DBO_Pear($config); - } - // regular, Cake-native db drivers - else - { - $db_driver_class = 'DBO_'.$config['driver']; - $db_driver_fn = LIBS.strtolower('model'.DS.'dbo'.DS.$db_driver_class.'.php'); - if (file_exists($db_driver_fn)) - { - uses(strtolower('model'.DS.'dbo'.DS.$db_driver_class)); - $instance[$configName] =& new $db_driver_class($config); - } - else - { - return false; - } - } - } - return $instance[$configName]; - } - -/** - * Sets config to use. If there is already a connection, close it first. - * - * @param string $configName Name of the config array key to use. - * @return mixed - */ - function setConfig($config) - { - $db = DboFactory::getInstance(); - if ($db->isConnected() === true) - { - $db->close(); - } - return $this->getInstance($config); - } -} - -?> \ No newline at end of file diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index 3c1ba9f86..fe5c121d4 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -464,6 +464,8 @@ class AjaxHelper extends Helper function dropRemote($id, $options = array(), $ajaxOptions = array()) { $options['onDrop'] = "function(element){" . $this->remoteFunction($ajaxOptions) . "}"; + $options = $this->_optionsForDroppable($options); + return $this->Javascript->codeBlock("Droppables.add('$id'$options);"); } /** diff --git a/cake/libs/view/templates/elements/dump.thtml b/cake/libs/view/templates/elements/dump.thtml new file mode 100644 index 000000000..4371389e2 --- /dev/null +++ b/cake/libs/view/templates/elements/dump.thtml @@ -0,0 +1,36 @@ + + * 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.libs.view.templates.pages + * @since CakePHP v 0.10.5.1782 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +?> +
+

Controller dump:

+
+            controller); ?>
+        
+
\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_action.thtml b/cake/libs/view/templates/errors/missing_action.thtml index 8e5af57ea..17548a2f3 100644 --- a/cake/libs/view/templates/errors/missing_action.thtml +++ b/cake/libs/view/templates/errors/missing_action.thtml @@ -60,14 +60,4 @@ in file : Error: Unable to execute action in -

- -1):?> -

Controller dump:

-
-db);
-print_r($this);
-?>
-
- \ No newline at end of file +

\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_connection.thtml b/cake/libs/view/templates/errors/missing_connection.thtml index 9cd60fe66..22a84ec47 100644 --- a/cake/libs/view/templates/errors/missing_connection.thtml +++ b/cake/libs/view/templates/errors/missing_connection.thtml @@ -36,12 +36,4 @@

Notice: this error is being rendered by the app/views/errors/missing_database.thtml view file, a user-customizable error page for handling errors within CakePHP. -

- - 1) { ?> -

Controller dump:

-db); - pr($this); -?> - \ No newline at end of file +

\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_helper_class.thtml b/cake/libs/view/templates/errors/missing_helper_class.thtml index fa6af4dd2..06548cba7 100644 --- a/cake/libs/view/templates/errors/missing_helper_class.thtml +++ b/cake/libs/view/templates/errors/missing_helper_class.thtml @@ -62,14 +62,4 @@ in file :

Error: Unable to load helper class in View::_loadHelpers -

- -1):?> -

Controller dump:

-
-db);
-print_r($this);
-?>
-
- +

\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_helper_file.thtml b/cake/libs/view/templates/errors/missing_helper_file.thtml index 9b12b7aa3..3c121829b 100644 --- a/cake/libs/view/templates/errors/missing_helper_file.thtml +++ b/cake/libs/view/templates/errors/missing_helper_file.thtml @@ -62,14 +62,4 @@ in file :

Error: Unable to load helper file in View::_loadHelpers -

- -1):?> -

Controller dump:

-
-db);
-print_r($this);
-?>
-
- +

\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_scaffolddb.thtml b/cake/libs/view/templates/errors/missing_scaffolddb.thtml index 2ca8cbf40..f534eed3f 100644 --- a/cake/libs/view/templates/errors/missing_scaffolddb.thtml +++ b/cake/libs/view/templates/errors/missing_scaffolddb.thtml @@ -36,14 +36,4 @@

Notice: this error is being rendered by the app/views/errors/missing_database.thtml view file, a user-customizable error page for handling errors within CakePHP. -

- -1):?> -

Controller dump:

-
-db);
-print_r($this);
-?>
-
- \ No newline at end of file +

\ No newline at end of file diff --git a/cake/libs/view/templates/errors/missing_view.thtml b/cake/libs/view/templates/errors/missing_view.thtml index 054e8dab0..e57e843e7 100644 --- a/cake/libs/view/templates/errors/missing_view.thtml +++ b/cake/libs/view/templates/errors/missing_view.thtml @@ -43,14 +43,4 @@ view file, a user-customizable error page for handling missing/invalid views dur

Fatal: Unable to load view file missingView;?> for action missingView;?>:: -

- -1):?> -

Controller dump:

-
-db);
-print_r($this);
-?>
-
- \ No newline at end of file +

\ No newline at end of file diff --git a/cake/libs/view/templates/layouts/default.thtml b/cake/libs/view/templates/layouts/default.thtml index 2127c06c1..0c46e53b4 100644 --- a/cake/libs/view/templates/layouts/default.thtml +++ b/cake/libs/view/templates/layouts/default.thtml @@ -45,6 +45,7 @@ controller->Session)) $this->controller->Session->flash(); ?> +