mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '1.3-misc' of dev@code.cakephp.org:cakephp into 1.3-logging
This commit is contained in:
commit
98f0e370a1
77 changed files with 853 additions and 585 deletions
|
@ -241,11 +241,6 @@
|
|||
*/
|
||||
//date_default_timezone_set('UTC');
|
||||
|
||||
/**
|
||||
* If you are on PHP 5.3 uncomment this line and correct your server timezone
|
||||
* to fix the date & time related errors.
|
||||
*/
|
||||
//date_default_timezone_set('UTC');
|
||||
/**
|
||||
*
|
||||
* Cache Engine Configuration
|
||||
|
|
0
app/views/layouts/email/html/empty
Normal file
0
app/views/layouts/email/html/empty
Normal file
0
app/views/layouts/email/text/empty
Normal file
0
app/views/layouts/email/text/empty
Normal file
|
@ -17,4 +17,4 @@
|
|||
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
// +--------------------------------------------------------------------------------------------+ //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
1.3.0.0
|
||||
1.3.0-alpha
|
|
@ -19,5 +19,5 @@
|
|||
* @since CakePHP(tm) v 1.1.11.4062
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
return $config['Cake.version'] = '1.3.0';
|
||||
return $config['Cake.version'] = '1.3.0-alpha';
|
||||
?>
|
||||
|
|
|
@ -72,7 +72,7 @@ if (!defined('APP')) {
|
|||
define('COMPONENTS', CONTROLLERS.'components'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's views directory.
|
||||
* Path to the application's libs directory.
|
||||
*/
|
||||
define('APPLIBS', APP.'libs'.DS);
|
||||
|
||||
|
|
|
@ -353,9 +353,10 @@ class DbConfigTask extends Shell {
|
|||
* @return void
|
||||
**/
|
||||
function getConfig() {
|
||||
App::import('Model', 'ConnectionManager', false);
|
||||
|
||||
$useDbConfig = 'default';
|
||||
$configs = get_class_vars($this->databaseClassName);
|
||||
|
||||
if (!is_array($configs)) {
|
||||
return $this->execute();
|
||||
}
|
||||
|
|
|
@ -82,10 +82,6 @@ class FixtureTask extends Shell {
|
|||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (!class_exists('CakeSchema')) {
|
||||
App::import('Model', 'CakeSchema', false);
|
||||
}
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
@ -176,6 +172,9 @@ class FixtureTask extends Shell {
|
|||
* @access private
|
||||
*/
|
||||
function bake($model, $useTable = false, $importOptions = array()) {
|
||||
if (!class_exists('CakeSchema')) {
|
||||
App::import('Model', 'CakeSchema', false);
|
||||
}
|
||||
$table = $schema = $records = $import = $modelImport = $recordImport = null;
|
||||
if (!$useTable) {
|
||||
$useTable = Inflector::tableize($model);
|
||||
|
|
|
@ -75,16 +75,6 @@ class ModelTask extends Shell {
|
|||
**/
|
||||
var $__validations = array();
|
||||
|
||||
/**
|
||||
* startup method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function startup() {
|
||||
App::import('Model', 'Model', false);
|
||||
parent::startup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
|
@ -176,6 +166,8 @@ class ModelTask extends Shell {
|
|||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
App::import('Model', 'Model', false);
|
||||
|
||||
$this->hr();
|
||||
$this->out(sprintf("Bake Model\nPath: %s", $this->path));
|
||||
$this->hr();
|
||||
|
@ -796,6 +788,8 @@ class ModelTask extends Shell {
|
|||
if (!isset($useDbConfig)) {
|
||||
$useDbConfig = $this->connection;
|
||||
}
|
||||
App::import('Model', 'ConnectionManager', false);
|
||||
|
||||
$db =& ConnectionManager::getDataSource($useDbConfig);
|
||||
$useTable = Inflector::tableize($modelName);
|
||||
$fullTableName = $db->fullTableName($useTable, false);
|
||||
|
@ -823,6 +817,8 @@ class ModelTask extends Shell {
|
|||
if (!isset($useDbConfig)) {
|
||||
$useDbConfig = $this->connection;
|
||||
}
|
||||
App::import('Model', 'ConnectionManager', false);
|
||||
|
||||
$tables = array();
|
||||
$db =& ConnectionManager::getDataSource($useDbConfig);
|
||||
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<?php echo $xml->header(); ?>
|
||||
<?php echo $content_for_layout; ?>
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
?>
|
||||
<div class="<?php echo $pluralVar;?> form">
|
||||
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
|
||||
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
|
||||
<fieldset>
|
||||
<legend><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></legend>
|
||||
<?php
|
||||
|
@ -33,34 +33,34 @@
|
|||
if ($action == 'add' && $field == $primaryKey) {
|
||||
continue;
|
||||
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
|
||||
echo "\t\techo \$form->input('{$field}');\n";
|
||||
echo "\t\techo \$this->Form->input('{$field}');\n";
|
||||
}
|
||||
}
|
||||
if (!empty($associations['hasAndBelongsToMany'])) {
|
||||
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
|
||||
echo "\t\techo \$form->input('{$assocName}');\n";
|
||||
echo "\t\techo \$this->Form->input('{$assocName}');\n";
|
||||
}
|
||||
}
|
||||
echo "\t?>\n";
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
echo "<?php echo \$form->end(__('Submit', true));?>\n";
|
||||
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n";
|
||||
?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<?php if ($action != 'add'):?>
|
||||
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
|
||||
<?php endif;?>
|
||||
<li><?php echo "<?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
|
||||
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
|
||||
<?php
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
|
||||
<p>
|
||||
<?php echo "<?php
|
||||
echo \$paginator->counter(array(
|
||||
echo \$this->Paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?>";?>
|
||||
|
@ -35,7 +35,7 @@ echo \$paginator->counter(array(
|
|||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<?php foreach ($fields as $field):?>
|
||||
<th><?php echo "<?php echo \$paginator->sort('{$field}');?>";?></th>
|
||||
<th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th>
|
||||
<?php endforeach;?>
|
||||
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
|
||||
</tr>
|
||||
|
@ -55,7 +55,7 @@ foreach (\${$pluralVar} as \${$singularVar}):
|
|||
foreach ($associations['belongsTo'] as $alias => $details) {
|
||||
if ($field === $details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "\t\t<td>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
|
||||
echo "\t\t<td>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ foreach (\${$pluralVar} as \${$singularVar}):
|
|||
}
|
||||
|
||||
echo "\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t<?php echo \$html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t</td>\n";
|
||||
echo "\t</tr>\n";
|
||||
|
||||
|
@ -77,20 +77,20 @@ echo "<?php endforeach; ?>\n";
|
|||
</table>
|
||||
</div>
|
||||
<div class="paging">
|
||||
<?php echo "\t<?php echo \$paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
|
||||
| <?php echo "\t<?php echo \$paginator->numbers();?>\n"?>
|
||||
<?php echo "\t<?php echo \$paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
|
||||
<?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
|
||||
| <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?>
|
||||
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
|
||||
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
|
||||
<?php
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ foreach ($fields as $field) {
|
|||
if ($field === $details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
|
||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t \n\t\t</dd>\n";
|
||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t \n\t\t</dd>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -50,17 +50,17 @@ foreach ($fields as $field) {
|
|||
<div class="actions">
|
||||
<ul>
|
||||
<?php
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
|
||||
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ if (!empty($associations['hasOne'])) :
|
|||
<?php echo "<?php endif; ?>\n";?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
|
||||
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -132,9 +132,9 @@ echo "\t<?php
|
|||
}
|
||||
|
||||
echo "\t\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t</td>\n";
|
||||
echo "\t\t</tr>\n";
|
||||
|
||||
|
@ -144,7 +144,7 @@ echo "\t<?php endforeach; ?>\n";
|
|||
<?php echo "<?php endif; ?>\n\n";?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
|
||||
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -641,15 +641,15 @@ class CakeSession extends Object {
|
|||
function __regenerateId() {
|
||||
$oldSessionId = session_id();
|
||||
if ($oldSessionId) {
|
||||
$sessionpath = session_save_path();
|
||||
if (empty($sessionpath)) {
|
||||
$sessionpath = "/tmp";
|
||||
}
|
||||
if (session_id() != "" || isset($_COOKIE[session_name()])) {
|
||||
if (session_id() != ''|| isset($_COOKIE[session_name()])) {
|
||||
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
|
||||
}
|
||||
session_regenerate_id(true);
|
||||
if (PHP_VERSION < 5.1) {
|
||||
$sessionPath = session_save_path();
|
||||
if (empty($sessionPath)) {
|
||||
$sessionPath = '/tmp';
|
||||
}
|
||||
$newSessid = session_id();
|
||||
|
||||
if (function_exists('session_write_close')) {
|
||||
|
@ -659,7 +659,7 @@ class CakeSession extends Object {
|
|||
session_id($oldSessionId);
|
||||
session_start();
|
||||
session_destroy();
|
||||
$file = $sessionpath . DS . "sess_$oldSessionId";
|
||||
$file = $sessionPath . DS . 'sess_' . $oldSessionId;
|
||||
@unlink($file);
|
||||
$this->__initSession();
|
||||
session_id($newSessid);
|
||||
|
|
|
@ -488,6 +488,14 @@ class App extends Object {
|
|||
*/
|
||||
var $components = array();
|
||||
|
||||
/**
|
||||
* List of additional path(s) where datasource files reside.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $datasources = array();
|
||||
|
||||
/**
|
||||
* List of additional path(s) where libs files reside.
|
||||
*
|
||||
|
|
|
@ -450,10 +450,10 @@ class AuthComponent extends Object {
|
|||
return false;
|
||||
}
|
||||
$defaults = array(
|
||||
'loginAction' => Router::normalize(array(
|
||||
'controller'=> Inflector::underscore(Inflector::pluralize($this->userModel)),
|
||||
'loginAction' => array(
|
||||
'controller' => Inflector::underscore(Inflector::pluralize($this->userModel)),
|
||||
'action' => 'login'
|
||||
)),
|
||||
),
|
||||
'sessionKey' => 'Auth.' . $this->userModel,
|
||||
'logoutRedirect' => $this->loginAction,
|
||||
'loginError' => __('Login failed. Invalid username or password.', true),
|
||||
|
|
|
@ -215,7 +215,7 @@ class CookieComponent extends Object {
|
|||
foreach ($key as $name => $value) {
|
||||
if (strpos($name, '.') === false) {
|
||||
$this->__values[$name] = $value;
|
||||
$this->__write(".$name", $value);
|
||||
$this->__write("[$name]", $value);
|
||||
|
||||
} else {
|
||||
$names = explode('.', $name, 2);
|
||||
|
@ -223,7 +223,7 @@ class CookieComponent extends Object {
|
|||
$this->__values[$names[0]] = array();
|
||||
}
|
||||
$this->__values[$names[0]] = Set::insert($this->__values[$names[0]], $names[1], $value);
|
||||
$this->__write("." . implode('.', $names), $value);
|
||||
$this->__write('[' . implode('][', $names) . ']', $value);
|
||||
}
|
||||
}
|
||||
$this->__encrypted = true;
|
||||
|
@ -289,12 +289,12 @@ class CookieComponent extends Object {
|
|||
}
|
||||
if (strpos($key, '.') === false) {
|
||||
unset($this->__values[$key]);
|
||||
$this->__delete(".$key");
|
||||
$this->__delete("[$key]");
|
||||
return;
|
||||
}
|
||||
$names = explode('.', $key, 2);
|
||||
$this->__values[$names[0]] = Set::remove($this->__values[$names[0]], $names[1]);
|
||||
$this->__delete("." . implode('.', $names));
|
||||
$this->__delete('[' . implode('][', $names) . ']');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,11 +315,11 @@ class CookieComponent extends Object {
|
|||
if (is_array($value)) {
|
||||
foreach ($value as $key => $val) {
|
||||
unset($this->__values[$name][$key]);
|
||||
$this->__delete(".$name.$key");
|
||||
$this->__delete("[$name][$key]");
|
||||
}
|
||||
}
|
||||
unset($this->__values[$name]);
|
||||
$this->__delete(".$name");
|
||||
$this->__delete("[$name]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,6 +354,11 @@ class CookieComponent extends Object {
|
|||
return $this->__expires;
|
||||
}
|
||||
$this->__reset = $this->__expires;
|
||||
|
||||
if ($expires == 0) {
|
||||
return $this->__expires = 0;
|
||||
}
|
||||
|
||||
if (is_integer($expires) || is_numeric($expires)) {
|
||||
return $this->__expires = $now + intval($expires);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,9 @@ class Controller extends Object {
|
|||
*
|
||||
* Example: var $uses = array('Product', 'Post', 'Comment');
|
||||
*
|
||||
* Can be set to array() to use no models. Can be set to false to
|
||||
* use no models and prevent the merging of $uses with AppController
|
||||
*
|
||||
* @var mixed A single name as a string or a list of names as an array.
|
||||
* @access protected
|
||||
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
|
||||
|
|
|
@ -229,16 +229,8 @@ class Debugger extends Object {
|
|||
*/
|
||||
function log($var, $level = LOG_DEBUG) {
|
||||
$_this = Debugger::getInstance();
|
||||
$trace = $_this->trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
|
||||
$source = null;
|
||||
|
||||
if (is_object($trace[0]['object']) && isset($trace[0]['object']->_reporter->_test_stack)) {
|
||||
$stack = $trace[0]['object']->_reporter->_test_stack;
|
||||
$source = sprintf('[%1$s, %3$s::%2$s()]' . "\n",
|
||||
array_shift($stack), array_pop($stack), array_pop($stack));
|
||||
}
|
||||
|
||||
CakeLog::write($level, $source . $_this->exportVar($var));
|
||||
$source = $_this->trace(array('start' => 1)) . "\n";
|
||||
CakeLog::write($level, "\n" . $source . $_this->exportVar($var));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -326,7 +326,7 @@ class Folder extends Object {
|
|||
* @static
|
||||
*/
|
||||
function addPathElement($path, $element) {
|
||||
return Folder::slashTerm($path) . $element;
|
||||
return rtrim($path, DS) . DS . $element;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -693,7 +693,7 @@ class HttpSocket extends CakeSocket {
|
|||
|
||||
foreach ($items as $item) {
|
||||
if (strpos($item, '=') !== false) {
|
||||
list($key, $value) = explode('=', $item);
|
||||
list($key, $value) = explode('=', $item, 2);
|
||||
} else {
|
||||
$key = $item;
|
||||
$value = null;
|
||||
|
|
|
@ -474,7 +474,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
'fields' => array($Model->primaryKey, $left, $right), 'recursive' => $recursive)
|
||||
);
|
||||
if ($nextNode) {
|
||||
list($nextNode)= array_values($nextNode);
|
||||
list($nextNode) = array_values($nextNode);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -657,6 +657,8 @@ class TreeBehavior extends ModelBehavior {
|
|||
$sort = $field . ' ' . $order;
|
||||
$nodes = $this->children($Model, $id, true, $fields, $sort, null, null, $recursive);
|
||||
|
||||
$cacheQueries = $Model->cacheQueries;
|
||||
$Model->cacheQueries = false;
|
||||
if ($nodes) {
|
||||
foreach ($nodes as $node) {
|
||||
$id = $node[$Model->alias][$Model->primaryKey];
|
||||
|
@ -666,6 +668,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
}
|
||||
}
|
||||
}
|
||||
$Model->cacheQueries = $cacheQueries;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -320,45 +320,53 @@ class DataSource extends Object {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used to create new records. The "C" CRUD.
|
||||
*
|
||||
* To-be-overridden in subclasses.
|
||||
*
|
||||
* @param unknown_type $model
|
||||
* @param unknown_type $fields
|
||||
* @param unknown_type $values
|
||||
* @return unknown
|
||||
* @param Model $model The Model to be created.
|
||||
* @param array $fields An Array of fields to be saved.
|
||||
* @param array $values An Array of values to save.
|
||||
* @return boolean success
|
||||
*/
|
||||
function create(&$model, $fields = null, $values = null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to read records from the Datasource. The "R" in CRUD
|
||||
*
|
||||
* To-be-overridden in subclasses.
|
||||
*
|
||||
* @param unknown_type $model
|
||||
* @param unknown_type $queryData
|
||||
* @return unknown
|
||||
* @param Model $model The model being read.
|
||||
* @param array $queryData An array of query data used to find the data you want
|
||||
* @return mixed
|
||||
*/
|
||||
function read(&$model, $queryData = array()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a record(s) in the datasource.
|
||||
*
|
||||
* To-be-overridden in subclasses.
|
||||
*
|
||||
* @param unknown_type $model
|
||||
* @param unknown_type $fields
|
||||
* @param unknown_type $values
|
||||
* @return unknown
|
||||
* @param Model $model Instance of the model class being updated
|
||||
* @param array $fields Array of fields to be updated
|
||||
* @param array $values Array of values to be update $fields to.
|
||||
* @return boolean Success
|
||||
*/
|
||||
function update(&$model, $fields = null, $values = null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a record(s) in the datasource.
|
||||
*
|
||||
* To-be-overridden in subclasses.
|
||||
*
|
||||
* @param unknown_type $model
|
||||
* @param unknown_type $id
|
||||
* @param Model $model The model class having record(s) deleted
|
||||
* @param mixed $id Primary key of the model
|
||||
*/
|
||||
function delete(&$model, $id = null) {
|
||||
if ($id == null) {
|
||||
|
@ -396,6 +404,16 @@ class DataSource extends Object {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the conditions for the Datasource being available
|
||||
* are satisfied. Often used from connect() to check for support
|
||||
* before establishing a connection.
|
||||
*
|
||||
* @return boolean Whether or not the Datasources conditions for use are met.
|
||||
**/
|
||||
function enabled() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Returns true if the DataSource supports the given interface (method)
|
||||
*
|
||||
|
|
|
@ -110,7 +110,9 @@ class DboAdodb extends DboSource {
|
|||
$adodb_driver = substr($config['connect'], 0, $persistent);
|
||||
$connect = 'PConnect';
|
||||
}
|
||||
|
||||
if (!$this->enabled()) {
|
||||
return false;
|
||||
}
|
||||
$this->_adodb = NewADOConnection($adodb_driver);
|
||||
|
||||
$this->_adodbDataDict = NewDataDictionary($this->_adodb, $adodb_driver);
|
||||
|
@ -123,6 +125,14 @@ class DboAdodb extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that AdoDB is available.
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return function_exists('NewADOConnection');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -146,6 +146,14 @@ class DboDb2 extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the DB2 extension is installed/loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('ibm_db2');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -140,10 +140,19 @@ class DboFirebird extends DboSource {
|
|||
$connect = $config['connect'];
|
||||
|
||||
$this->connected = false;
|
||||
|
||||
$this->connection = $connect($config['host'] . ':' . $config['database'], $config['login'], $config['password']);
|
||||
$this->connected = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the interbase extension is loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('interbase');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -164,6 +164,14 @@ class DboMssql extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that MsSQL is installed/loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('mssql');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -118,6 +118,40 @@ class DboMysqlBase extends DboSource {
|
|||
'boolean' => array('name' => 'tinyint', 'limit' => '1')
|
||||
);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
$cols = $this->query('DESCRIBE ' . $this->fullTableName($model));
|
||||
|
||||
foreach ($cols as $column) {
|
||||
$colKey = array_keys($column);
|
||||
if (isset($column[$colKey[0]]) && !isset($column[0])) {
|
||||
$column[0] = $column[$colKey[0]];
|
||||
}
|
||||
if (isset($column[0])) {
|
||||
$fields[$column[0]['Field']] = array(
|
||||
'type' => $this->column($column[0]['Type']),
|
||||
'null' => ($column[0]['Null'] == 'YES' ? true : false),
|
||||
'default' => $column[0]['Default'],
|
||||
'length' => $this->length($column[0]['Type']),
|
||||
);
|
||||
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
||||
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->__cacheDescription($this->fullTableName($model, false), $fields);
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
* Generates and executes an SQL UPDATE statement for given model, fields, and values.
|
||||
*
|
||||
|
@ -498,6 +532,14 @@ class DboMysql extends DboMysqlBase {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the MySQL extension is installed/loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('mysql');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
@ -547,52 +589,6 @@ class DboMysql extends DboMysqlBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
$cols = $this->query('SHOW FULL COLUMNS FROM ' . $this->fullTableName($model));
|
||||
|
||||
foreach ($cols as $column) {
|
||||
$colKey = array_keys($column);
|
||||
if (isset($column[$colKey[0]]) && !isset($column[0])) {
|
||||
$column[0] = $column[$colKey[0]];
|
||||
}
|
||||
if (isset($column[0])) {
|
||||
$fields[$column[0]['Field']] = array(
|
||||
'type' => $this->column($column[0]['Type']),
|
||||
'null' => ($column[0]['Null'] == 'YES' ? true : false),
|
||||
'default' => $column[0]['Default'],
|
||||
'length' => $this->length($column[0]['Type']),
|
||||
);
|
||||
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
||||
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
||||
}
|
||||
foreach ($this->fieldParameters as $name => $value) {
|
||||
if (!empty($column[0][$value['column']])) {
|
||||
$fields[$column[0]['Field']][$name] = $column[0][$value['column']];
|
||||
}
|
||||
}
|
||||
if (isset($fields[$column[0]['Field']]['collate'])) {
|
||||
$charset = $this->getCharsetName($fields[$column[0]['Field']]['collate']);
|
||||
if ($charset) {
|
||||
$fields[$column[0]['Field']]['charset'] = $charset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->__cacheDescription($this->fullTableName($model, false), $fields);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a quoted and escaped string of $data for use in an SQL statement.
|
||||
*
|
||||
|
|
|
@ -89,6 +89,14 @@ class DboMysqli extends DboMysqlBase {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that MySQLi is installed/enabled
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('mysqli');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
@ -159,44 +167,6 @@ class DboMysqli extends DboMysqlBase {
|
|||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
$cols = $this->query('DESCRIBE ' . $this->fullTableName($model));
|
||||
|
||||
foreach ($cols as $column) {
|
||||
$colKey = array_keys($column);
|
||||
if (isset($column[$colKey[0]]) && !isset($column[0])) {
|
||||
$column[0] = $column[$colKey[0]];
|
||||
}
|
||||
if (isset($column[0])) {
|
||||
$fields[$column[0]['Field']] = array(
|
||||
'type' => $this->column($column[0]['Type']),
|
||||
'null' => ($column[0]['Null'] == 'YES' ? true : false),
|
||||
'default' => $column[0]['Default'],
|
||||
'length' => $this->length($column[0]['Type'])
|
||||
);
|
||||
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
||||
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->__cacheDescription($this->fullTableName($model, false), $fields);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a quoted and escaped string of $data for use in an SQL statement.
|
||||
*
|
||||
|
@ -344,26 +314,6 @@ class DboMysqli extends DboMysqlBase {
|
|||
return 'text';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the length of a database-native column description, or null if no length
|
||||
*
|
||||
* @param string $real Real database-layer column type (i.e. "varchar(255)")
|
||||
* @return integer An integer representing the length of the column
|
||||
*/
|
||||
function length($real) {
|
||||
$col = str_replace(array(')', 'unsigned'), '', $real);
|
||||
$limit = null;
|
||||
|
||||
if (strpos($col, '(') !== false) {
|
||||
list($col, $limit) = explode('(', $col);
|
||||
}
|
||||
|
||||
if ($limit != null) {
|
||||
return intval($limit);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
|
|
@ -112,6 +112,14 @@ class DboOdbc extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the ODBC extension is installed/loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('odbc');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -129,6 +129,14 @@ class DboPostgres extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if PostgreSQL is enabled/loaded
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('pgsql');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
@ -289,6 +297,7 @@ class DboPostgres extends DboSource {
|
|||
case 'date':
|
||||
case 'datetime':
|
||||
case 'timestamp':
|
||||
case 'time':
|
||||
if ($data === '') {
|
||||
return $read ? 'NULL' : 'DEFAULT';
|
||||
}
|
||||
|
|
|
@ -143,6 +143,14 @@ class DboSqlite extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that SQLite is enabled/installed
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('sqlite');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -111,6 +111,14 @@ class DboSybase extends DboSource {
|
|||
return $this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that one of the sybase extensions is installed
|
||||
*
|
||||
* @return boolean
|
||||
**/
|
||||
function enabled() {
|
||||
return extension_loaded('sybase') || extension_loaded('sybase_ct');
|
||||
}
|
||||
/**
|
||||
* Disconnects from database.
|
||||
*
|
||||
|
|
|
@ -116,7 +116,9 @@ class DboSource extends DataSource {
|
|||
}
|
||||
parent::__construct($config);
|
||||
$this->fullDebug = Configure::read() > 1;
|
||||
|
||||
if (!$this->enabled()) {
|
||||
return false;
|
||||
}
|
||||
if ($autoConnect) {
|
||||
return $this->connect();
|
||||
} else {
|
||||
|
|
|
@ -2079,12 +2079,13 @@ class Model extends Overloadable {
|
|||
}
|
||||
$results = $db->read($this, $query);
|
||||
$this->resetAssociations();
|
||||
$this->findQueryType = null;
|
||||
|
||||
if ($query['callbacks'] === true || $query['callbacks'] === 'after') {
|
||||
$results = $this->__filterResults($results);
|
||||
}
|
||||
|
||||
$this->findQueryType = null;
|
||||
|
||||
if ($type === 'all') {
|
||||
return $results;
|
||||
} else {
|
||||
|
|
|
@ -229,6 +229,9 @@ class String {
|
|||
$options += $defaults;
|
||||
$format = $options['format'];
|
||||
$data = (array)$data;
|
||||
if (empty($data)) {
|
||||
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
|
||||
}
|
||||
|
||||
if (!isset($format)) {
|
||||
$format = sprintf(
|
||||
|
|
|
@ -544,7 +544,7 @@ class Helper extends Overloadable {
|
|||
$errors = $this->validationErrors;
|
||||
$entity = $view->entity();
|
||||
if (!empty($entity)) {
|
||||
return Set::extract($errors,join('.',$entity));
|
||||
return Set::extract($errors, join('.', $entity));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,10 +645,18 @@ class Helper extends Overloadable {
|
|||
|
||||
$view =& ClassRegistry::getObject('view');
|
||||
$result = null;
|
||||
|
||||
|
||||
$entity = $view->entity();
|
||||
if (!empty($this->data) && !empty($entity)) {
|
||||
$result = Set::extract($this->data,join('.',$entity));
|
||||
$result = Set::extract($this->data, join('.', $entity));
|
||||
}
|
||||
|
||||
$habtmKey = $this->field();
|
||||
if (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) {
|
||||
if (ClassRegistry::isKeySet($habtmKey)) {
|
||||
$model =& ClassRegistry::getObject($habtmKey);
|
||||
$result = $this->__selectedArray($this->data[$habtmKey], $model->primaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($result)) {
|
||||
|
|
|
@ -81,15 +81,15 @@ class CacheHelper extends AppHelper {
|
|||
$cacheTime = 0;
|
||||
$useCallbacks = false;
|
||||
if (is_array($this->cacheAction)) {
|
||||
$contoller = Inflector::underscore($this->controllerName);
|
||||
$controller = Inflector::underscore($this->controllerName);
|
||||
$check = str_replace('/', '_', $this->here);
|
||||
$replace = str_replace('/', '_', $this->base);
|
||||
$match = str_replace($this->base, '', $this->here);
|
||||
$match = str_replace('//', '/', $match);
|
||||
$match = str_replace('/' . $contoller . '/', '', $match);
|
||||
$match = str_replace('/' . $controller . '/', '', $match);
|
||||
$match = str_replace('/' . $this->controllerName . '/', '', $match);
|
||||
$check = str_replace($replace, '', $check);
|
||||
$check = str_replace('_' . $contoller . '_', '', $check);
|
||||
$check = str_replace('_' . $controller . '_', '', $check);
|
||||
$check = str_replace('_' . $this->controllerName . '_', '', $check);
|
||||
$check = Inflector::slug($check);
|
||||
$check = preg_replace('/^_+/', '', $check);
|
||||
|
@ -179,7 +179,6 @@ class CacheHelper extends AppHelper {
|
|||
$outputResult = array_values($outputResult);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($fileResult)) {
|
||||
$i = 0;
|
||||
foreach ($fileResult as $cacheBlock) {
|
||||
|
@ -202,24 +201,23 @@ class CacheHelper extends AppHelper {
|
|||
function __parseOutput($cache) {
|
||||
$count = 0;
|
||||
if (!empty($this->__match)) {
|
||||
|
||||
foreach ($this->__match as $found) {
|
||||
$original = $cache;
|
||||
$length = strlen($found);
|
||||
$position = 0;
|
||||
|
||||
for ($i = 1; $i <= 1; $i++) {
|
||||
$position = strpos($cache, $found, $position);
|
||||
for ($i = 1; $i <= 1; $i++) {
|
||||
$position = strpos($cache, $found, $position);
|
||||
|
||||
if ($position !== false) {
|
||||
$cache = substr($original, 0, $position);
|
||||
$cache .= $this->__replace[$count];
|
||||
$cache .= substr($original, $position + $length);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if ($position !== false) {
|
||||
$cache = substr($original, 0, $position);
|
||||
$cache .= $this->__replace[$count];
|
||||
$cache .= substr($original, $position + $length);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
return $cache;
|
||||
}
|
||||
|
@ -301,5 +299,4 @@ class CacheHelper extends AppHelper {
|
|||
return cache('views' . DS . $cache, $file, $timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -772,9 +772,13 @@ class FormHelper extends AppHelper {
|
|||
|
||||
if ($label !== false) {
|
||||
$labelAttributes = $this->domId(array(), 'for');
|
||||
if (in_array($options['type'], array('date', 'datetime'))) {
|
||||
$labelAttributes['for'] .= 'Month';
|
||||
} else if ($options['type'] === 'time') {
|
||||
if ($options['type'] === 'date' || $options['type'] === 'datetime') {
|
||||
if (isset($options['dateFormat']) && $options['dateFormat'] === 'NONE') {
|
||||
$labelAttributes['for'] .= 'Hour';
|
||||
} else {
|
||||
$labelAttributes['for'] .= 'Month';
|
||||
}
|
||||
} elseif ($options['type'] === 'time') {
|
||||
$labelAttributes['for'] .= 'Hour';
|
||||
}
|
||||
|
||||
|
@ -1818,7 +1822,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if ($name !== null) {
|
||||
if ((!$selectedIsEmpty && $selected == $name) || ($selectedIsArray && in_array($name, $selected))) {
|
||||
if ((!$selectedIsEmpty && (string)$selected == (string)$name) || ($selectedIsArray && in_array($name, $selected))) {
|
||||
if ($attributes['style'] === 'checkbox') {
|
||||
$htmlOptions['checked'] = true;
|
||||
} else {
|
||||
|
|
|
@ -250,11 +250,13 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates a sorting link
|
||||
* Generates a sorting link. Sets named parameters for the sort and direction. Handles
|
||||
* direction switching automatically.
|
||||
*
|
||||
* @param string $title Title for the link.
|
||||
* @param string $key The name of the key that the recordset should be sorted.
|
||||
* @param array $options Options for sorting link. See #options for list of keys.
|
||||
* @param string $title Title for the link.
|
||||
* @param string $key The name of the key that the recordset should be sorted. If $key is null
|
||||
* $title will be used for the key, and a title will be generated by inflection.
|
||||
* @param array $options Options for sorting link. See #options for list of keys.
|
||||
* @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
|
||||
* key the returned link will sort by 'desc'.
|
||||
*/
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php echo $html->charset(); ?>
|
||||
<?php echo $this->Html->charset(); ?>
|
||||
<title>
|
||||
<?php __('CakePHP: the rapid development php framework:'); ?>
|
||||
<?php echo $title_for_layout; ?>
|
||||
</title>
|
||||
<?php
|
||||
echo $html->meta('icon');
|
||||
echo $this->Html->meta('icon');
|
||||
|
||||
echo $html->css('cake.generic');
|
||||
echo $this->Html->css('cake.generic');
|
||||
|
||||
echo $scripts_for_layout;
|
||||
?>
|
||||
|
@ -42,18 +42,18 @@
|
|||
<body>
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<h1><?php echo $html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1>
|
||||
<h1><?php echo $this->Html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
||||
<?php $session->flash(); ?>
|
||||
<?php $this->Session->flash(); ?>
|
||||
|
||||
<?php echo $content_for_layout; ?>
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<?php echo $html->link(
|
||||
$html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
|
||||
<?php echo $this->Html->link(
|
||||
$this->Html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
|
||||
'http://www.cakephp.org/',
|
||||
array('target' => '_blank', 'escape' => false)
|
||||
);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php echo $html->charset(); ?>
|
||||
<?php echo $this->Html->charset(); ?>
|
||||
<title><?php echo $page_title; ?></title>
|
||||
|
||||
<?php if (Configure::read() == 0) { ?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
echo $rss->header();
|
||||
echo $this->Rss->header();
|
||||
|
||||
if (!isset($channel)) {
|
||||
$channel = array();
|
||||
|
@ -8,8 +8,8 @@ if (!isset($channel['title'])) {
|
|||
$channel['title'] = $title_for_layout;
|
||||
}
|
||||
|
||||
echo $rss->document(
|
||||
$rss->channel(
|
||||
echo $this->Rss->document(
|
||||
$this->Rss->channel(
|
||||
array(), $channel, $content_for_layout
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?php echo $xml->header(); ?>
|
||||
<?php echo $this->Xml->header(); ?>
|
||||
<?php echo $content_for_layout; ?>
|
|
@ -27,8 +27,9 @@ if (Configure::read() == 0):
|
|||
endif;
|
||||
?>
|
||||
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
|
||||
<a href="http://code.cakephp.org/wiki/changelog/1_2_x_x"><?php __('Read the changelog'); ?> </a>
|
||||
<?php
|
||||
echo $this->Html->link(__('Read the changelog', true), 'http://code.cakephp.org/wiki/changelog/1_3_0-alpha');
|
||||
|
||||
if (Configure::read() > 0):
|
||||
Debugger::checkSessionKey();
|
||||
endif;
|
||||
|
@ -107,13 +108,27 @@ To change its layout, create: APP/views/layouts/default.ctp.<br />
|
|||
You can also add some CSS styles for your pages at: APP/webroot/css.');
|
||||
?>
|
||||
</p>
|
||||
|
||||
<h3><?php __('Getting Started'); ?></h3>
|
||||
<p>
|
||||
<a href="http://book.cakephp.org"><strong>new</strong> CakePHP 1.2 Docs</a>
|
||||
<?php
|
||||
echo $this->Html->link(
|
||||
sprintf('<strong>%s</strong>%s', __('new', true ), __('CakePHP 1.2 Docs', true )),
|
||||
'http://book.cakephp.org',
|
||||
array('target' => '_blank', 'escape' => false)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://book.cakephp.org/view/219/the-cakephp-blog-tutorial"><?php __('The 15 min Blog Tutorial'); ?></a><br />
|
||||
<?php
|
||||
echo $this->Html->link(
|
||||
__('The 15 min Blog Tutorial', true),
|
||||
'http://book.cakephp.org/view/219/the-cakephp-blog-tutorial',
|
||||
array('target' => '_blank', 'escape' => false)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<h3><?php __('More about Cake'); ?></h3>
|
||||
<p>
|
||||
<?php __('CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.'); ?>
|
||||
|
@ -121,7 +136,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
|
|||
<p>
|
||||
<?php __('Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.'); ?>
|
||||
</p>
|
||||
<br />
|
||||
|
||||
<ul>
|
||||
<li><a href="http://www.cakefoundation.org/"><?php __('Cake Software Foundation'); ?> </a>
|
||||
<ul><li><?php __('Promoting development related to CakePHP'); ?></li></ul></li>
|
||||
|
@ -139,7 +154,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
|
|||
<ul><li><?php __('Community mailing list'); ?></li></ul></li>
|
||||
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
|
||||
<ul><li><?php __('Live chat about CakePHP'); ?></li></ul></li>
|
||||
<li><a href="https://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a>
|
||||
<li><a href="http://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a>
|
||||
<ul><li><?php __('For the Development of CakePHP (Tickets, Git browser, Roadmap, Changelogs)'); ?></li></ul></li>
|
||||
<li><a href="http://www.cakeforge.org"><?php __('CakeForge'); ?> </a>
|
||||
<ul><li><?php __('Open Development for CakePHP'); ?></li></ul></li>
|
||||
|
|
|
@ -95,7 +95,7 @@ class ApiShellTest extends CakeTestCase {
|
|||
'3. beforeRender()',
|
||||
'4. constructClasses()',
|
||||
'5. disableCache()',
|
||||
'6. flash($message, $url, $pause = 1)',
|
||||
'6. flash($message, $url, $pause = 1, $layout = \'flash\')',
|
||||
'7. header($status)',
|
||||
'8. isAuthorized()',
|
||||
'9. loadModel($modelClass = null, $id = null)',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
* TestTaskTest file
|
||||
* ModelTaskTest file
|
||||
*
|
||||
* Test Case for test generation shell task
|
||||
*
|
||||
|
@ -17,7 +18,7 @@
|
|||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
* @since CakePHP v 1.3
|
||||
* @since CakePHP v 1.2.6
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
App::import('Shell', 'Shell', false);
|
||||
|
@ -37,12 +38,10 @@ require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php';
|
|||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php';
|
||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
|
||||
|
||||
|
||||
Mock::generatePartial(
|
||||
'ShellDispatcher', 'TestModelTaskMockShellDispatcher',
|
||||
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
||||
);
|
||||
|
||||
Mock::generatePartial(
|
||||
'ModelTask', 'MockModelTask',
|
||||
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest')
|
||||
|
@ -217,9 +216,9 @@ class ModelTaskTest extends CakeTestCase {
|
|||
function testInteractiveFieldValidation() {
|
||||
$this->Task->initValidations();
|
||||
$this->Task->interactive = true;
|
||||
$this->Task->setReturnValueAt(0, 'in', '20');
|
||||
$this->Task->setReturnValueAt(0, 'in', '19');
|
||||
$this->Task->setReturnValueAt(1, 'in', 'y');
|
||||
$this->Task->setReturnValueAt(2, 'in', '16');
|
||||
$this->Task->setReturnValueAt(2, 'in', '15');
|
||||
$this->Task->setReturnValueAt(3, 'in', 'n');
|
||||
|
||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||
|
|
|
@ -84,6 +84,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->_debug = Configure::read('debug');
|
||||
$this->Case =& new SubjectCakeTestCase();
|
||||
$reporter =& new MockCakeHtmlReporter();
|
||||
$this->Case->setReporter($reporter);
|
||||
|
@ -97,6 +98,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Configure::write('debug', $this->_debug);
|
||||
unset($this->Case);
|
||||
unset($this->Reporter);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class CodeCoverageManagerTest extends CakeTestCase {
|
|||
App::import('Core', 'Folder');
|
||||
$folder = new Folder();
|
||||
$folder->cd($path);
|
||||
$contents = $folder->ls();
|
||||
$contents = $folder->read();
|
||||
|
||||
/**
|
||||
* remove method
|
||||
|
|
|
@ -389,6 +389,7 @@ class ComponentTest extends CakeTestCase {
|
|||
function testNestedComponentLoading() {
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('Apple');
|
||||
$Controller->uses = false;
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
|
||||
|
@ -409,6 +410,7 @@ class ComponentTest extends CakeTestCase {
|
|||
function testComponentStartup() {
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('Apple');
|
||||
$Controller->uses = false;
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
$Controller->beforeFilter();
|
||||
|
@ -429,6 +431,7 @@ class ComponentTest extends CakeTestCase {
|
|||
*/
|
||||
function testMultipleComponentInitialize() {
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->uses = false;
|
||||
$Controller->components = array('Orange', 'Banana');
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
|
@ -450,7 +453,7 @@ class ComponentTest extends CakeTestCase {
|
|||
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
|
||||
|
||||
$Controller->uses = false;
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
|
||||
|
@ -482,8 +485,12 @@ class ComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
**/
|
||||
function testComponentParamsNoDuplication() {
|
||||
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
|
||||
return;
|
||||
}
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('Orange' => array('setting' => array('itemx')));
|
||||
$Controller->uses = false;
|
||||
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
|
@ -499,6 +506,7 @@ class ComponentTest extends CakeTestCase {
|
|||
function testMutuallyReferencingComponents() {
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('MutuallyReferencingOne');
|
||||
$Controller->uses = false;
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
|
||||
|
@ -524,6 +532,7 @@ class ComponentTest extends CakeTestCase {
|
|||
function testSomethingReferencingEmailComponent() {
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('SomethingWithEmail');
|
||||
$Controller->uses = false;
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
$Controller->beforeFilter();
|
||||
|
@ -550,14 +559,17 @@ class ComponentTest extends CakeTestCase {
|
|||
* @access public
|
||||
*/
|
||||
function testDoubleLoadingOfSessionComponent() {
|
||||
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController');
|
||||
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->uses = array();
|
||||
$Controller->uses = false;
|
||||
$Controller->components = array('Session');
|
||||
$Controller->constructClasses();
|
||||
|
||||
$this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange')));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -408,8 +408,6 @@ HEADBLOC;
|
|||
This is the body of the message
|
||||
|
||||
This email was sent using the CakePHP Framework, http://cakephp.org.
|
||||
|
||||
|
||||
TEXTBLOC;
|
||||
|
||||
$html = <<<HTMLBLOC
|
||||
|
@ -417,7 +415,7 @@ TEXTBLOC;
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>EmailTest</title>
|
||||
<title>Email Test</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -425,7 +423,6 @@ TEXTBLOC;
|
|||
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
HTMLBLOC;
|
||||
|
||||
$this->Controller->EmailTest->sendAs = 'text';
|
||||
|
@ -452,7 +449,7 @@ HTMLBLOC;
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>EmailTest</title>
|
||||
<title>Email Test</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -477,8 +474,6 @@ standards.
|
|||
This is the body of the message
|
||||
|
||||
This email was sent using the CakePHP Framework, http://cakephp.org.
|
||||
|
||||
|
||||
TEXTBLOC;
|
||||
|
||||
$this->Controller->EmailTest->sendAs = 'text';
|
||||
|
|
|
@ -561,7 +561,9 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
function testAjaxRedirectAsRequestAction() {
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$this->_init();
|
||||
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)));
|
||||
App::build(array(
|
||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||
), true);
|
||||
|
||||
$this->Controller->RequestHandler = new NoStopRequestHandler($this);
|
||||
$this->Controller->RequestHandler->expectOnce('_stop');
|
||||
|
@ -574,6 +576,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$this->assertPattern('/posts index/', $result, 'RequestAction redirect failed.');
|
||||
|
||||
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
||||
App::build();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -222,6 +222,7 @@ class SecurityComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testRequireSecureFail() {
|
||||
$_SERVER['HTTPS'] = 'off';
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$this->Controller->action = 'posted';
|
||||
$this->Controller->Security->requireSecure('posted');
|
||||
|
|
|
@ -772,7 +772,9 @@ class ControllerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testRender() {
|
||||
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)));
|
||||
App::build(array(
|
||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||
), true);
|
||||
|
||||
$Controller =& new Controller();
|
||||
$Controller->viewPath = 'posts';
|
||||
|
@ -797,6 +799,7 @@ class ControllerTest extends CakeTestCase {
|
|||
|
||||
$Controller->ControllerComment->validationErrors = array();
|
||||
ClassRegistry::flush();
|
||||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,7 +131,14 @@ class MergePostsController extends MergeVarPluginAppController {
|
|||
* @package cake.tests.cases.libs.controller
|
||||
**/
|
||||
class ControllerMergeVarsTestCase extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* Skips the case if APP_CONTROLLER_EXISTS is defined
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function skip() {
|
||||
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), 'APP_CONTROLLER_EXISTS cannot run. %s');
|
||||
}
|
||||
/**
|
||||
* end test
|
||||
*
|
||||
|
|
|
@ -286,6 +286,7 @@ class DebuggerTest extends CakeTestCase {
|
|||
Debugger::log(array('whatever', 'here'));
|
||||
$result = file_get_contents(TMP . 'logs' . DS . 'debug.log');
|
||||
$this->assertPattern('/DebuggerTest\:\:testLog/', $result);
|
||||
$this->assertPattern('/\[main\]/', $result);
|
||||
$this->assertPattern('/array/', $result);
|
||||
$this->assertPattern('/"whatever",/', $result);
|
||||
$this->assertPattern('/"here"/', $result);
|
||||
|
|
|
@ -219,6 +219,18 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test Adding path elements to a path
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testAddPathElement() {
|
||||
$result = Folder::addPathElement(DS . 'some' . DS . 'dir', 'another_path');
|
||||
$this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
|
||||
|
||||
$result = Folder::addPathElement(DS . 'some' . DS . 'dir' . DS, 'another_path');
|
||||
$this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
|
||||
}
|
||||
/**
|
||||
* testFolderRead method
|
||||
*
|
||||
|
|
|
@ -1026,6 +1026,28 @@ class HttpSocketTest extends CakeTestCase {
|
|||
'host' => 'www.google.com',
|
||||
'port' => 8080,
|
||||
));
|
||||
|
||||
$uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2%3Dvalue3');
|
||||
$this->assertIdentical($uri, array(
|
||||
'scheme' => 'http',
|
||||
'host' => 'www.cakephp.org',
|
||||
'path' => '/',
|
||||
'query' => array(
|
||||
'param1' => 'value1',
|
||||
'param2' => 'value2=value3'
|
||||
)
|
||||
));
|
||||
|
||||
$uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2=value3');
|
||||
$this->assertIdentical($uri, array(
|
||||
'scheme' => 'http',
|
||||
'host' => 'www.cakephp.org',
|
||||
'path' => '/',
|
||||
'query' => array(
|
||||
'param1' => 'value1',
|
||||
'param2' => 'value2=value3'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2603,7 +2603,7 @@ class I18nTest extends CakeTestCase {
|
|||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __domainCategorySingular($domain = 'test_plugin', $category = LC_MONETARY) {
|
||||
function __domainCategorySingular($domain = 'test_plugin', $category = 3) {
|
||||
$singular = __dc($domain, 'Plural Rule 1', $category, true);
|
||||
return $singular;
|
||||
}
|
||||
|
@ -2614,7 +2614,7 @@ class I18nTest extends CakeTestCase {
|
|||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __domainCategoryPlural($domain = 'test_plugin', $category = LC_MONETARY) {
|
||||
function __domainCategoryPlural($domain = 'test_plugin', $category = 3) {
|
||||
$plurals = array();
|
||||
for ($number = 0; $number <= 25; $number++) {
|
||||
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category, true), (float)$number);
|
||||
|
@ -2653,7 +2653,7 @@ class I18nTest extends CakeTestCase {
|
|||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __category($category = LC_MONETARY) {
|
||||
function __category($category = 3) {
|
||||
$singular = __c('Plural Rule 1', $category, true);
|
||||
return $singular;
|
||||
}
|
||||
|
|
|
@ -1220,6 +1220,25 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->assertIdentical($nodes, $sortedNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* test reordering large-ish trees with cacheQueries = true.
|
||||
* This caused infinite loops when moving down elements as stale data is returned
|
||||
* from the memory cache
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReorderBigTreeWithQueryCaching() {
|
||||
extract($this->settings);
|
||||
$this->Tree =& new $modelClass();
|
||||
$this->Tree->initialize(2, 10);
|
||||
|
||||
$original = $this->Tree->cacheQueries;
|
||||
$this->Tree->cacheQueries = true;
|
||||
$this->Tree->reorder(array('field' => 'name', 'direction' => 'DESC'));
|
||||
$this->assertTrue($this->Tree->cacheQueries, 'cacheQueries was not restored after reorder(). %s');
|
||||
$this->Tree->cacheQueries = $original;
|
||||
}
|
||||
/**
|
||||
* testGenerateTreeListWithSelfJoin method
|
||||
*
|
||||
|
|
|
@ -161,7 +161,7 @@ class MysqlTestModel extends Model {
|
|||
* @subpackage cake.tests.cases.libs.model.datasources.dbo
|
||||
*/
|
||||
class DboMysqlTest extends CakeTestCase {
|
||||
|
||||
var $fixtures = array('core.binary_test');
|
||||
/**
|
||||
* The Dbo instance to be tested
|
||||
*
|
||||
|
@ -187,7 +187,6 @@ class DboMysqlTest extends CakeTestCase {
|
|||
*/
|
||||
function startTest() {
|
||||
$db = ConnectionManager::getDataSource('test_suite');
|
||||
$this->db = new DboMysqlTestDb($db->config);
|
||||
$this->model = new MysqlTestModel();
|
||||
}
|
||||
|
||||
|
@ -196,8 +195,9 @@ class DboMysqlTest extends CakeTestCase {
|
|||
*
|
||||
* @access public
|
||||
*/
|
||||
function endTest() {
|
||||
unset($this->db);
|
||||
function tearDown() {
|
||||
unset($this->model);
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,11 +285,11 @@ class DboMysqlTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testTinyintCasting() {
|
||||
$this->db->cacheSources = $this->db->testing = false;
|
||||
$this->db->cacheSources = false;
|
||||
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
|
||||
|
||||
$this->model = new CakeTestModel(array(
|
||||
'name' => 'Tinyint', 'table' => $this->db->fullTableName('tinyint', false)
|
||||
'name' => 'Tinyint', 'table' => 'tinyint', 'ds' => 'test_suite'
|
||||
));
|
||||
|
||||
$result = $this->model->schema();
|
||||
|
@ -324,12 +324,12 @@ class DboMysqlTest extends CakeTestCase {
|
|||
* @access public
|
||||
*/
|
||||
function testIndexDetection() {
|
||||
$this->db->cacheSources = $this->db->testing = false;
|
||||
$this->db->cacheSources = false;
|
||||
|
||||
$name = $this->db->fullTableName('simple');
|
||||
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
|
||||
$expected = array('PRIMARY' => array('column' => 'id', 'unique' => 1));
|
||||
$result = $this->db->index($name, false);
|
||||
$result = $this->db->index('simple', false);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->db->query('DROP TABLE ' . $name);
|
||||
|
||||
|
@ -339,7 +339,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
||||
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
|
||||
);
|
||||
$result = $this->db->index($name, false);
|
||||
$result = $this->db->index('with_a_key', false);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->db->query('DROP TABLE ' . $name);
|
||||
|
||||
|
@ -350,7 +350,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
|
||||
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
|
||||
);
|
||||
$result = $this->db->index($name, false);
|
||||
$result = $this->db->index('with_two_keys', false);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->db->query('DROP TABLE ' . $name);
|
||||
|
||||
|
@ -362,7 +362,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
|
||||
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
|
||||
);
|
||||
$result = $this->db->index($name, false);
|
||||
$result = $this->db->index('with_compound_keys', false);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->db->query('DROP TABLE ' . $name);
|
||||
|
||||
|
@ -375,7 +375,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
|
||||
'other_way' => array('column' => array('small_int', 'bool'), 'unique' => 0),
|
||||
);
|
||||
$result = $this->db->index($name, false);
|
||||
$result = $this->db->index('with_multiple_compound_keys', false);
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->db->query('DROP TABLE ' . $name);
|
||||
}
|
||||
|
@ -628,6 +628,24 @@ class DboMysqlTest extends CakeTestCase {
|
|||
|
||||
$this->db->query($this->db->dropSchema($schema1));
|
||||
}
|
||||
/**
|
||||
* test saving and retrieval of blobs
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testBlobSaving() {
|
||||
$this->db->cacheSources = false;
|
||||
$data = "GIF87ab |