mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Applying patch from 'davidpersson' fixing code spacing. Closes #5643
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7772 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6da2040b45
commit
1b456f2cf1
70 changed files with 233 additions and 233 deletions
|
@ -387,7 +387,7 @@ if (!function_exists('array_combine')) {
|
||||||
|
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'SCRIPT_FILENAME':
|
case 'SCRIPT_FILENAME':
|
||||||
if (defined('SERVER_IIS') && SERVER_IIS === true){
|
if (defined('SERVER_IIS') && SERVER_IIS === true) {
|
||||||
return str_replace('\\\\', '\\', env('PATH_TRANSLATED'));
|
return str_replace('\\\\', '\\', env('PATH_TRANSLATED'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -464,7 +464,7 @@ if (!function_exists('file_put_contents')) {
|
||||||
$expires = strtotime($expires, $now);
|
$expires = strtotime($expires, $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(low($target)) {
|
switch (low($target)) {
|
||||||
case 'cache':
|
case 'cache':
|
||||||
$filename = CACHE . $path;
|
$filename = CACHE . $path;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -383,19 +383,19 @@ class ShellDispatcher {
|
||||||
*/
|
*/
|
||||||
function getInput($prompt, $options = null, $default = null) {
|
function getInput($prompt, $options = null, $default = null) {
|
||||||
if (!is_array($options)) {
|
if (!is_array($options)) {
|
||||||
$print_options = '';
|
$printOptions = '';
|
||||||
} else {
|
} else {
|
||||||
$print_options = '(' . implode('/', $options) . ')';
|
$printOptions = '(' . implode('/', $options) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($default == null) {
|
if ($default == null) {
|
||||||
$this->stdout($prompt . " $print_options \n" . '> ', false);
|
$this->stdout($prompt . " $printOptions \n" . '> ', false);
|
||||||
} else {
|
} else {
|
||||||
$this->stdout($prompt . " $print_options \n" . "[$default] > ", false);
|
$this->stdout($prompt . " $printOptions \n" . "[$default] > ", false);
|
||||||
}
|
}
|
||||||
$result = fgets($this->stdin);
|
$result = fgets($this->stdin);
|
||||||
|
|
||||||
if ($result === false){
|
if ($result === false) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$result = trim($result);
|
$result = trim($result);
|
||||||
|
@ -454,7 +454,7 @@ class ShellDispatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($params['app'][0] == '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) {
|
if ($params['app'][0] == '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) {
|
||||||
$params['root'] = dirname($params['app']);
|
$params['root'] = dirname($params['app']);
|
||||||
} elseif (strpos($params['app'], '/')) {
|
} elseif (strpos($params['app'], '/')) {
|
||||||
$params['root'] .= '/' . dirname($params['app']);
|
$params['root'] .= '/' . dirname($params['app']);
|
||||||
|
|
|
@ -199,7 +199,7 @@ class ApiShell extends Shell {
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
|
|
||||||
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
|
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
|
||||||
foreach($result[2] as $key => $method) {
|
foreach ($result[2] as $key => $method) {
|
||||||
$method = str_replace('function ', '', trim($method));
|
$method = str_replace('function ', '', trim($method));
|
||||||
|
|
||||||
if (strpos($method, '__') === false && $method[0] != '_') {
|
if (strpos($method, '__') === false && $method[0] != '_') {
|
||||||
|
|
|
@ -86,7 +86,7 @@ class BakeShell extends Shell {
|
||||||
$this->out('[Q]uit');
|
$this->out('[Q]uit');
|
||||||
|
|
||||||
$classToBake = strtoupper($this->in(__('What would you like to Bake?', true), array('D', 'M', 'V', 'C', 'P', 'Q')));
|
$classToBake = strtoupper($this->in(__('What would you like to Bake?', true), array('D', 'M', 'V', 'C', 'P', 'Q')));
|
||||||
switch($classToBake) {
|
switch ($classToBake) {
|
||||||
case 'D':
|
case 'D':
|
||||||
$this->DbConfig->execute();
|
$this->DbConfig->execute();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -95,7 +95,7 @@ class ConsoleShell extends Shell {
|
||||||
$command = trim($this->in(''));
|
$command = trim($this->in(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($command) {
|
switch ($command) {
|
||||||
case 'help':
|
case 'help':
|
||||||
$this->out('Console help:');
|
$this->out('Console help:');
|
||||||
$this->out('-------------');
|
$this->out('-------------');
|
||||||
|
|
|
@ -80,7 +80,7 @@ class I18nShell extends Shell {
|
||||||
$this->out(__('[Q]uit', true));
|
$this->out(__('[Q]uit', true));
|
||||||
|
|
||||||
$choice = strtoupper($this->in(__('What would you like to do?', true), array('E', 'I', 'H', 'Q')));
|
$choice = strtoupper($this->in(__('What would you like to do?', true), array('E', 'I', 'H', 'Q')));
|
||||||
switch($choice) {
|
switch ($choice) {
|
||||||
case 'E':
|
case 'E':
|
||||||
$this->Extract->execute();
|
$this->Extract->execute();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -264,7 +264,7 @@ class SchemaShell extends Shell {
|
||||||
$table = $this->args[1];
|
$table = $this->args[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($command) {
|
switch ($command) {
|
||||||
case 'create':
|
case 'create':
|
||||||
$this->__create($Schema, $table);
|
$this->__create($Schema, $table);
|
||||||
break;
|
break;
|
||||||
|
@ -372,7 +372,7 @@ class SchemaShell extends Shell {
|
||||||
$db->fullDebug = true;
|
$db->fullDebug = true;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach($contents as $table => $sql) {
|
foreach ($contents as $table => $sql) {
|
||||||
if (empty($sql)) {
|
if (empty($sql)) {
|
||||||
$this->out(sprintf(__('%s is up to date.', true), $table));
|
$this->out(sprintf(__('%s is up to date.', true), $table));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -143,7 +143,7 @@ class Shell extends Object {
|
||||||
ClassRegistry::map($shellKey, $shellKey);
|
ClassRegistry::map($shellKey, $shellKey);
|
||||||
|
|
||||||
if (!PHP5 && isset($this->args[0])) {
|
if (!PHP5 && isset($this->args[0])) {
|
||||||
if(strpos($this->className, low(Inflector::camelize($this->args[0]))) !== false) {
|
if (strpos($this->className, low(Inflector::camelize($this->args[0]))) !== false) {
|
||||||
$dispatch->shiftArgs();
|
$dispatch->shiftArgs();
|
||||||
}
|
}
|
||||||
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
|
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
|
||||||
|
@ -348,7 +348,7 @@ class Shell extends Object {
|
||||||
function out($string, $newline = true) {
|
function out($string, $newline = true) {
|
||||||
if (is_array($string)) {
|
if (is_array($string)) {
|
||||||
$str = '';
|
$str = '';
|
||||||
foreach($string as $message) {
|
foreach ($string as $message) {
|
||||||
$str .= $message ."\n";
|
$str .= $message ."\n";
|
||||||
}
|
}
|
||||||
$string = $str;
|
$string = $str;
|
||||||
|
@ -364,7 +364,7 @@ class Shell extends Object {
|
||||||
function err($string) {
|
function err($string) {
|
||||||
if (is_array($string)) {
|
if (is_array($string)) {
|
||||||
$str = '';
|
$str = '';
|
||||||
foreach($string as $message) {
|
foreach ($string as $message) {
|
||||||
$str .= $message ."\n";
|
$str .= $message ."\n";
|
||||||
}
|
}
|
||||||
$string = $str;
|
$string = $str;
|
||||||
|
|
|
@ -280,7 +280,7 @@ class DbConfigTask extends Shell {
|
||||||
$info['port'] = null;
|
$info['port'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($info['persistent'] === false) {
|
if ($info['persistent'] === false) {
|
||||||
$info['persistent'] = 'false';
|
$info['persistent'] = 'false';
|
||||||
} else {
|
} else {
|
||||||
$info['persistent'] = 'false';
|
$info['persistent'] = 'false';
|
||||||
|
|
|
@ -411,7 +411,7 @@ class ModelTask extends Shell {
|
||||||
if ($type === 'belongsTo') {
|
if ($type === 'belongsTo') {
|
||||||
$alias = 'Parent' . $associations[$type][$i]['alias'];
|
$alias = 'Parent' . $associations[$type][$i]['alias'];
|
||||||
}
|
}
|
||||||
if($type === 'hasOne' || $type === 'hasMany') {
|
if ($type === 'hasOne' || $type === 'hasMany') {
|
||||||
$alias = 'Child' . $associations[$type][$i]['alias'];
|
$alias = 'Child' . $associations[$type][$i]['alias'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class PluginTask extends Shell {
|
||||||
|
|
||||||
$plugin = null;
|
$plugin = null;
|
||||||
|
|
||||||
if(isset($this->args[0])) {
|
if (isset($this->args[0])) {
|
||||||
$plugin = Inflector::camelize($this->args[0]);
|
$plugin = Inflector::camelize($this->args[0]);
|
||||||
$pluginPath = Inflector::underscore($plugin) . DS;
|
$pluginPath = Inflector::underscore($plugin) . DS;
|
||||||
$this->Dispatch->shiftArgs();
|
$this->Dispatch->shiftArgs();
|
||||||
|
@ -87,7 +87,7 @@ class PluginTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->args[0])) {
|
if (isset($this->args[0])) {
|
||||||
$task = Inflector::classify($this->args[0]);
|
$task = Inflector::classify($this->args[0]);
|
||||||
$this->Dispatch->shiftArgs();
|
$this->Dispatch->shiftArgs();
|
||||||
if (in_array($task, $this->tasks)) {
|
if (in_array($task, $this->tasks)) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class ProjectTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->bake($project)) {
|
if ($this->bake($project)) {
|
||||||
$path = Folder::slashTerm($project);
|
$path = Folder::slashTerm($project);
|
||||||
if ($this->createHome($path)) {
|
if ($this->createHome($path)) {
|
||||||
$this->out(__('Welcome page created', true));
|
$this->out(__('Welcome page created', true));
|
||||||
|
@ -122,7 +122,7 @@ class ProjectTask extends Shell {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function bake($path, $skel = null, $skip = array('empty')) {
|
function bake($path, $skel = null, $skip = array('empty')) {
|
||||||
if(!$skel) {
|
if (!$skel) {
|
||||||
$skel = $this->params['skel'];
|
$skel = $this->params['skel'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ class ViewTask extends Shell {
|
||||||
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||||
$associations = array();
|
$associations = array();
|
||||||
|
|
||||||
foreach ($keys as $key => $type){
|
foreach ($keys as $key => $type) {
|
||||||
foreach ($model->{$type} as $assocKey => $assocData) {
|
foreach ($model->{$type} as $assocKey => $assocData) {
|
||||||
$associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey;
|
$associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey;
|
||||||
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
|
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<?php
|
<?php
|
||||||
$content = explode("\n", $content);
|
$content = explode("\n", $content);
|
||||||
|
|
||||||
foreach($content as $line):
|
foreach ($content as $line):
|
||||||
echo '<p> ' . $line . '</p>';
|
echo '<p> ' . $line . '</p>';
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
|
@ -37,7 +37,7 @@
|
||||||
echo "\t\techo \$form->input('{$field}');\n";
|
echo "\t\techo \$form->input('{$field}');\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($associations['hasAndBelongsToMany'])) {
|
if (!empty($associations['hasAndBelongsToMany'])) {
|
||||||
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
|
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
|
||||||
echo "\t\techo \$form->input('{$assocName}');\n";
|
echo "\t\techo \$form->input('{$assocName}');\n";
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
<?php
|
<?php
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $type => $data) {
|
foreach ($associations as $type => $data) {
|
||||||
foreach($data as $alias => $details) {
|
foreach ($data as $alias => $details) {
|
||||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||||
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
||||||
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
$output = "<h2>Sweet, \"".Inflector::humanize($app)."\" got Baked by CakePHP!</h2>\n";
|
$output = "<h2>Sweet, \"".Inflector::humanize($app)."\" got Baked by CakePHP!</h2>\n";
|
||||||
$output .="
|
$output .="
|
||||||
<?php
|
<?php
|
||||||
if(Configure::read() > 0):
|
if (Configure::read() > 0):
|
||||||
Debugger::checkSessionKey();
|
Debugger::checkSessionKey();
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -52,16 +52,16 @@ foreach (\${$pluralVar} as \${$singularVar}):
|
||||||
echo "\t<tr<?php echo \$class;?>>\n";
|
echo "\t<tr<?php echo \$class;?>>\n";
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$isKey = false;
|
$isKey = false;
|
||||||
if(!empty($associations['belongsTo'])) {
|
if (!empty($associations['belongsTo'])) {
|
||||||
foreach ($associations['belongsTo'] as $alias => $details) {
|
foreach ($associations['belongsTo'] as $alias => $details) {
|
||||||
if($field === $details['foreignKey']) {
|
if ($field === $details['foreignKey']) {
|
||||||
$isKey = true;
|
$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 \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller'=> '{$details['controller']}', 'action'=>'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($isKey !== true) {
|
if ($isKey !== true) {
|
||||||
echo "\t\t<td>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t</td>\n";
|
echo "\t\t<td>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t</td>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ echo "<?php endforeach; ?>\n";
|
||||||
<?php
|
<?php
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $type => $data) {
|
foreach ($associations as $type => $data) {
|
||||||
foreach($data as $alias => $details) {
|
foreach ($data as $alias => $details) {
|
||||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||||
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
||||||
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
<?php
|
<?php
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$isKey = false;
|
$isKey = false;
|
||||||
if(!empty($associations['belongsTo'])) {
|
if (!empty($associations['belongsTo'])) {
|
||||||
foreach ($associations['belongsTo'] as $alias => $details) {
|
foreach ($associations['belongsTo'] as $alias => $details) {
|
||||||
if($field === $details['foreignKey']) {
|
if ($field === $details['foreignKey']) {
|
||||||
$isKey = true;
|
$isKey = true;
|
||||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize(Inflector::underscore($alias))."'); ?></dt>\n";
|
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 \$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";
|
||||||
|
@ -40,7 +40,7 @@ foreach ($fields as $field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($isKey !== true) {
|
if ($isKey !== true) {
|
||||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize($field)."'); ?></dt>\n";
|
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize($field)."'); ?></dt>\n";
|
||||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\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 \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t \n\t\t</dd>\n";
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ foreach ($fields as $field) {
|
||||||
|
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $type => $data) {
|
foreach ($associations as $type => $data) {
|
||||||
foreach($data as $alias => $details) {
|
foreach ($data as $alias => $details) {
|
||||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||||
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
|
||||||
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
|
||||||
|
@ -70,7 +70,7 @@ foreach ($fields as $field) {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($associations['hasOne'])) :
|
if (!empty($associations['hasOne'])) :
|
||||||
foreach ($associations['hasOne'] as $alias => $details): ?>
|
foreach ($associations['hasOne'] as $alias => $details): ?>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
<h3><?php echo "<?php __('Related ".Inflector::humanize($details['controller'])."');?>";?></h3>
|
<h3><?php echo "<?php __('Related ".Inflector::humanize($details['controller'])."');?>";?></h3>
|
||||||
|
@ -93,10 +93,10 @@ if(!empty($associations['hasOne'])) :
|
||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
if(empty($associations['hasMany'])) {
|
if (empty($associations['hasMany'])) {
|
||||||
$associations['hasMany'] = array();
|
$associations['hasMany'] = array();
|
||||||
}
|
}
|
||||||
if(empty($associations['hasAndBelongsToMany'])) {
|
if (empty($associations['hasAndBelongsToMany'])) {
|
||||||
$associations['hasAndBelongsToMany'] = array();
|
$associations['hasAndBelongsToMany'] = array();
|
||||||
}
|
}
|
||||||
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
||||||
|
|
|
@ -430,7 +430,7 @@ class Dispatcher extends Object {
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function _restructureParams($params, $reverse = false) {
|
function _restructureParams($params, $reverse = false) {
|
||||||
if($reverse === true) {
|
if ($reverse === true) {
|
||||||
extract(Router::getArgs($params['action']));
|
extract(Router::getArgs($params['action']));
|
||||||
$params = array_merge($params, array('controller'=> $params['plugin'],
|
$params = array_merge($params, array('controller'=> $params['plugin'],
|
||||||
'action'=> $params['controller'],
|
'action'=> $params['controller'],
|
||||||
|
@ -688,7 +688,7 @@ class Dispatcher extends Object {
|
||||||
readfile($assetFile);
|
readfile($assetFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Configure::read('Asset.compress')) {
|
if (Configure::read('Asset.compress')) {
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
12
cake/libs/cache/file.php
vendored
12
cake/libs/cache/file.php
vendored
|
@ -84,7 +84,7 @@ class FileEngine extends CacheEngine {
|
||||||
),
|
),
|
||||||
$settings
|
$settings
|
||||||
));
|
));
|
||||||
if(!isset($this->__File)) {
|
if (!isset($this->__File)) {
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
require LIBS . 'file.php';
|
require LIBS . 'file.php';
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class FileEngine extends CacheEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->settings['path'] = $this->__File->Folder->cd($this->settings['path']);
|
$this->settings['path'] = $this->__File->Folder->cd($this->settings['path']);
|
||||||
if(empty($this->settings['path'])) {
|
if (empty($this->settings['path'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->__active();
|
return $this->__active();
|
||||||
|
@ -124,7 +124,7 @@ class FileEngine extends CacheEngine {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->__setKey($key) === false) {
|
if ($this->__setKey($key) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class FileEngine extends CacheEngine {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function read($key) {
|
function read($key) {
|
||||||
if($this->__setKey($key) === false || !$this->__init || !$this->__File->exists()) {
|
if ($this->__setKey($key) === false || !$this->__init || !$this->__File->exists()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->settings['lock']) {
|
if ($this->settings['lock']) {
|
||||||
|
@ -192,7 +192,7 @@ class FileEngine extends CacheEngine {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function delete($key) {
|
function delete($key) {
|
||||||
if($this->__setKey($key) === false || !$this->__init) {
|
if ($this->__setKey($key) === false || !$this->__init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->__File->delete();
|
return $this->__File->delete();
|
||||||
|
@ -214,7 +214,7 @@ class FileEngine extends CacheEngine {
|
||||||
$threshold = $now - $this->settings['duration'];
|
$threshold = $now - $this->settings['duration'];
|
||||||
}
|
}
|
||||||
while (($entry = $dir->read()) !== false) {
|
while (($entry = $dir->read()) !== false) {
|
||||||
if($this->__setKey($entry) === false) {
|
if ($this->__setKey($entry) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($check) {
|
if ($check) {
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Configure extends Object {
|
||||||
if (!$suffix) {
|
if (!$suffix) {
|
||||||
return $contents[0];
|
return $contents[0];
|
||||||
} else {
|
} else {
|
||||||
foreach($contents[1] as $item) {
|
foreach ($contents[1] as $item) {
|
||||||
if (substr($item, - strlen($suffix)) === $suffix) {
|
if (substr($item, - strlen($suffix)) === $suffix) {
|
||||||
if ($extension) {
|
if ($extension) {
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
|
|
|
@ -292,7 +292,7 @@ class DbAcl extends AclBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch($perm['_' . $action]) {
|
switch ($perm['_' . $action]) {
|
||||||
case -1:
|
case -1:
|
||||||
return false;
|
return false;
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -283,7 +283,7 @@ class AuthComponent extends Object {
|
||||||
$keys = array('pass', 'named', 'controller', 'action', 'plugin');
|
$keys = array('pass', 'named', 'controller', 'action', 'plugin');
|
||||||
$url = array();
|
$url = array();
|
||||||
|
|
||||||
foreach($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
if (!empty($params[$key])) {
|
if (!empty($params[$key])) {
|
||||||
if (is_array($params[$key])) {
|
if (is_array($params[$key])) {
|
||||||
foreach ($params[$key] as $name => $value) {
|
foreach ($params[$key] as $name => $value) {
|
||||||
|
@ -491,7 +491,7 @@ class AuthComponent extends Object {
|
||||||
case 'model':
|
case 'model':
|
||||||
$this->mapActions();
|
$this->mapActions();
|
||||||
$action = $this->params['action'];
|
$action = $this->params['action'];
|
||||||
if(isset($this->actionMap[$action])) {
|
if (isset($this->actionMap[$action])) {
|
||||||
$action = $this->actionMap[$action];
|
$action = $this->actionMap[$action];
|
||||||
}
|
}
|
||||||
if (is_string($object)) {
|
if (is_string($object)) {
|
||||||
|
@ -507,7 +507,7 @@ class AuthComponent extends Object {
|
||||||
}
|
}
|
||||||
if (method_exists($object, 'isAuthorized')) {
|
if (method_exists($object, 'isAuthorized')) {
|
||||||
$valid = $object->isAuthorized($user, $this->action(':controller'), $action);
|
$valid = $object->isAuthorized($user, $this->action(':controller'), $action);
|
||||||
} elseif ($object){
|
} elseif ($object) {
|
||||||
trigger_error(sprintf(__('%s::isAuthorized() is not defined.', true), get_class($object)), E_USER_WARNING);
|
trigger_error(sprintf(__('%s::isAuthorized() is not defined.', true), get_class($object)), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -247,7 +247,7 @@ class CookieComponent extends Object {
|
||||||
|
|
||||||
if (count($name) > 1) {
|
if (count($name) > 1) {
|
||||||
if (isset($this->__values[$name[0]])) {
|
if (isset($this->__values[$name[0]])) {
|
||||||
if(isset($this->__values[$name[0]][$name[1]])) {
|
if (isset($this->__values[$name[0]][$name[1]])) {
|
||||||
return $this->__values[$name[0]][$name[1]];
|
return $this->__values[$name[0]][$name[1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,7 +574,7 @@ class EmailComponent extends Object{
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
if(substr($line, 0, 1) == '.') {
|
if (substr($line, 0, 1) == '.') {
|
||||||
$line = '.' . $line;
|
$line = '.' . $line;
|
||||||
}
|
}
|
||||||
$formatted = array_merge($formatted, explode("\n", wordwrap($line, $this->lineLength, "\n", true)));
|
$formatted = array_merge($formatted, explode("\n", wordwrap($line, $this->lineLength, "\n", true)));
|
||||||
|
|
|
@ -389,13 +389,13 @@ class RequestHandlerComponent extends Object {
|
||||||
*/
|
*/
|
||||||
function getReferrer() {
|
function getReferrer() {
|
||||||
if (env('HTTP_HOST') != null) {
|
if (env('HTTP_HOST') != null) {
|
||||||
$sess_host = env('HTTP_HOST');
|
$sessHost = env('HTTP_HOST');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env('HTTP_X_FORWARDED_HOST') != null) {
|
if (env('HTTP_X_FORWARDED_HOST') != null) {
|
||||||
$sess_host = env('HTTP_X_FORWARDED_HOST');
|
$sessHost = env('HTTP_X_FORWARDED_HOST');
|
||||||
}
|
}
|
||||||
return trim(preg_replace('/(?:\:.*)/', '', $sess_host));
|
return trim(preg_replace('/(?:\:.*)/', '', $sessHost));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets remote client IP
|
* Gets remote client IP
|
||||||
|
|
|
@ -260,11 +260,11 @@ class Scaffold extends Object {
|
||||||
|
|
||||||
if ($this->controller->_beforeScaffold($action)) {
|
if ($this->controller->_beforeScaffold($action)) {
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
if(isset($params['pass'][0])) {
|
if (isset($params['pass'][0])) {
|
||||||
$this->ScaffoldModel->id = $params['pass'][0];
|
$this->ScaffoldModel->id = $params['pass'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->ScaffoldModel->exists()) {
|
if (!$this->ScaffoldModel->exists()) {
|
||||||
if (isset($this->controller->Session) && $this->controller->Session->valid() != false) {
|
if (isset($this->controller->Session) && $this->controller->Session->valid() != false) {
|
||||||
$this->controller->Session->setFlash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)));
|
$this->controller->Session->setFlash(sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)));
|
||||||
$this->controller->redirect($this->redirect);
|
$this->controller->redirect($this->redirect);
|
||||||
|
@ -394,7 +394,7 @@ class Scaffold extends Object {
|
||||||
if (!empty($admin)) {
|
if (!empty($admin)) {
|
||||||
$params['action'] = str_replace($admin . '_', '', $params['action']);
|
$params['action'] = str_replace($admin . '_', '', $params['action']);
|
||||||
}
|
}
|
||||||
switch($params['action']) {
|
switch ($params['action']) {
|
||||||
case 'index':
|
case 'index':
|
||||||
$this->__scaffoldIndex($params);
|
$this->__scaffoldIndex($params);
|
||||||
break;
|
break;
|
||||||
|
@ -440,7 +440,7 @@ class Scaffold extends Object {
|
||||||
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||||
$associations = array();
|
$associations = array();
|
||||||
|
|
||||||
foreach ($keys as $key => $type){
|
foreach ($keys as $key => $type) {
|
||||||
foreach ($this->ScaffoldModel->{$type} as $assocKey => $assocData) {
|
foreach ($this->ScaffoldModel->{$type} as $assocKey => $assocData) {
|
||||||
$associations[$type][$assocKey]['primaryKey'] = $this->ScaffoldModel->{$assocKey}->primaryKey;
|
$associations[$type][$assocKey]['primaryKey'] = $this->ScaffoldModel->{$assocKey}->primaryKey;
|
||||||
$associations[$type][$assocKey]['displayField'] = $this->ScaffoldModel->{$assocKey}->displayField;
|
$associations[$type][$assocKey]['displayField'] = $this->ScaffoldModel->{$assocKey}->displayField;
|
||||||
|
|
|
@ -367,7 +367,7 @@ class Debugger extends Object {
|
||||||
*/
|
*/
|
||||||
function exportVar($var, $recursion = 0) {
|
function exportVar($var, $recursion = 0) {
|
||||||
$_this = Debugger::getInstance();
|
$_this = Debugger::getInstance();
|
||||||
switch(strtolower(gettype($var))) {
|
switch (strtolower(gettype($var))) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return ($var) ? 'true' : 'false';
|
return ($var) ? 'true' : 'false';
|
||||||
break;
|
break;
|
||||||
|
@ -420,12 +420,12 @@ class Debugger extends Object {
|
||||||
function __object($var) {
|
function __object($var) {
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
if(is_object($var)) {
|
if (is_object($var)) {
|
||||||
$className = get_class($var);
|
$className = get_class($var);
|
||||||
$objectVars = get_object_vars($var);
|
$objectVars = get_object_vars($var);
|
||||||
|
|
||||||
foreach($objectVars as $key => $value) {
|
foreach ($objectVars as $key => $value) {
|
||||||
if(is_object($value)) {
|
if (is_object($value)) {
|
||||||
$value = get_class($value) . ' object';
|
$value = get_class($value) . ' object';
|
||||||
} elseif (is_array($value)) {
|
} elseif (is_array($value)) {
|
||||||
$value = 'array';
|
$value = 'array';
|
||||||
|
|
|
@ -110,9 +110,9 @@ class ErrorHandler extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method !== 'error') {
|
if ($method !== 'error') {
|
||||||
if (Configure::read() == 0){
|
if (Configure::read() == 0) {
|
||||||
$method = 'error404';
|
$method = 'error404';
|
||||||
if(isset($code) && $code == 500) {
|
if (isset($code) && $code == 500) {
|
||||||
$method = 'error500';
|
$method = 'error500';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,8 +234,8 @@ class File extends Object {
|
||||||
function write($data, $mode = 'w', $force = false) {
|
function write($data, $mode = 'w', $force = false) {
|
||||||
$success = false;
|
$success = false;
|
||||||
if ($this->open($mode, $force) === true) {
|
if ($this->open($mode, $force) === true) {
|
||||||
if($this->lock !== null) {
|
if ($this->lock !== null) {
|
||||||
if(flock($this->handle, LOCK_EX) === false) {
|
if (flock($this->handle, LOCK_EX) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,9 +125,9 @@ class Folder extends Object {
|
||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Change directory to $desired_path.
|
* Change directory to $path.
|
||||||
*
|
*
|
||||||
* @param string $desired_path Path to the directory to change to
|
* @param string $path Path to the directory to change to
|
||||||
* @return string The new path. Returns false on failure
|
* @return string The new path. Returns false on failure
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -189,12 +189,12 @@ class Folder extends Object {
|
||||||
* @return array Files that match given pattern
|
* @return array Files that match given pattern
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function find($regexp_pattern = '.*', $sort = false) {
|
function find($regexpPattern = '.*', $sort = false) {
|
||||||
list($dirs, $files) = $this->read($sort);
|
list($dirs, $files) = $this->read($sort);
|
||||||
|
|
||||||
$found = array();
|
$found = array();
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (preg_match("/^{$regexp_pattern}$/i", $file)) {
|
if (preg_match("/^{$regexpPattern}$/i", $file)) {
|
||||||
$found[] = $file;
|
$found[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,9 +536,9 @@ class Folder extends Object {
|
||||||
$path = $this->slashTerm($path);
|
$path = $this->slashTerm($path);
|
||||||
if (is_dir($path) === true) {
|
if (is_dir($path) === true) {
|
||||||
$files = glob($path . "*", GLOB_NOSORT);
|
$files = glob($path . "*", GLOB_NOSORT);
|
||||||
$normal_files = glob($path . "*");
|
$normalFiles = glob($path . "*");
|
||||||
$hidden_files = glob($path . "\.?*");
|
$hiddenFiles = glob($path . "\.?*");
|
||||||
$files = array_merge($normal_files, $hidden_files);
|
$files = array_merge($normalFiles, $hiddenFiles);
|
||||||
if (is_array($files)) {
|
if (is_array($files)) {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (preg_match("/(\.|\.\.)$/", $file)) {
|
if (preg_match("/(\.|\.\.)$/", $file)) {
|
||||||
|
|
|
@ -417,10 +417,10 @@ class Inflector extends Object {
|
||||||
return $replace;
|
return $replace;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word.
|
* Returns an underscore-syntaxed (like_this_dear_reader) version of the $camel_cased_word.
|
||||||
*
|
*
|
||||||
* @param string $camel_cased_word Camel-cased word to be "underscorized"
|
* @param string $camelCasedWord Camel-cased word to be "underscorized"
|
||||||
* @return string Underscore-syntaxed version of the $camel_cased_word
|
* @return string Underscore-syntaxed version of the $camelCasedWord
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
|
@ -442,9 +442,9 @@ class Inflector extends Object {
|
||||||
return $replace;
|
return $replace;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns corresponding table name for given $class_name. ("posts" for the model class "Post").
|
* Returns corresponding table name for given $className. ("posts" for the model class "Post").
|
||||||
*
|
*
|
||||||
* @param string $class_name Name of class to get database table name for
|
* @param string $className Name of class to get database table name for
|
||||||
* @return string Name of the database table for given class
|
* @return string Name of the database table for given class
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
|
|
|
@ -245,7 +245,7 @@ class MagicFileResource extends Object{
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function read($length = null) {
|
function read($length = null) {
|
||||||
if (!is_object($this->resource)){
|
if (!is_object($this->resource)) {
|
||||||
return substr($this->resource, $this->offset, $length);
|
return substr($this->resource, $this->offset, $length);
|
||||||
}
|
}
|
||||||
return $this->resource->read($length);
|
return $this->resource->read($length);
|
||||||
|
|
|
@ -129,7 +129,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
if ($contain) {
|
if ($contain) {
|
||||||
$backupBindings = array();
|
$backupBindings = array();
|
||||||
foreach($this->types as $relation) {
|
foreach ($this->types as $relation) {
|
||||||
$backupBindings[$relation] = $instance->{$relation};
|
$backupBindings[$relation] = $instance->{$relation};
|
||||||
}
|
}
|
||||||
foreach ($this->types as $type) {
|
foreach ($this->types as $type) {
|
||||||
|
@ -180,16 +180,16 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
|
|
||||||
$query['fields'] = (array)$query['fields'];
|
$query['fields'] = (array)$query['fields'];
|
||||||
if (!empty($Model->belongsTo)) {
|
if (!empty($Model->belongsTo)) {
|
||||||
foreach($Model->belongsTo as $assoc => $data) {
|
foreach ($Model->belongsTo as $assoc => $data) {
|
||||||
if (!empty($data['fields'])) {
|
if (!empty($data['fields'])) {
|
||||||
foreach((array) $data['fields'] as $field) {
|
foreach ((array) $data['fields'] as $field) {
|
||||||
$query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field;
|
$query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($mandatory[$Model->alias])) {
|
if (!empty($mandatory[$Model->alias])) {
|
||||||
foreach($mandatory[$Model->alias] as $field) {
|
foreach ($mandatory[$Model->alias] as $field) {
|
||||||
if ($field == '--primaryKey--') {
|
if ($field == '--primaryKey--') {
|
||||||
$field = $Model->primaryKey;
|
$field = $Model->primaryKey;
|
||||||
} else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
|
} else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
|
||||||
|
@ -213,7 +213,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
*/
|
*/
|
||||||
function afterFind(&$Model, $results, $primary) {
|
function afterFind(&$Model, $results, $primary) {
|
||||||
if (!empty($Model->__backContainableAssociation)) {
|
if (!empty($Model->__backContainableAssociation)) {
|
||||||
foreach($Model->__backContainableAssociation as $relation => $bindings) {
|
foreach ($Model->__backContainableAssociation as $relation => $bindings) {
|
||||||
$Model->{$relation} = $bindings;
|
$Model->{$relation} = $bindings;
|
||||||
unset($Model->__backContainableAssociation);
|
unset($Model->__backContainableAssociation);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
if (!empty($Model->__backInnerAssociation)) {
|
if (!empty($Model->__backInnerAssociation)) {
|
||||||
$assocs = $Model->__backInnerAssociation;
|
$assocs = $Model->__backInnerAssociation;
|
||||||
unset($Model->__backInnerAssociation);
|
unset($Model->__backInnerAssociation);
|
||||||
foreach($assocs as $currentModel) {
|
foreach ($assocs as $currentModel) {
|
||||||
$this->resetBindings($Model->$currentModel);
|
$this->resetBindings($Model->$currentModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,9 +370,9 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
*/
|
*/
|
||||||
function fieldDependencies(&$Model, $map, $fields = array()) {
|
function fieldDependencies(&$Model, $map, $fields = array()) {
|
||||||
if ($fields === false) {
|
if ($fields === false) {
|
||||||
foreach($map as $parent => $children) {
|
foreach ($map as $parent => $children) {
|
||||||
foreach($children as $type => $bindings) {
|
foreach ($children as $type => $bindings) {
|
||||||
foreach($bindings as $dependency) {
|
foreach ($bindings as $dependency) {
|
||||||
if ($type == 'hasAndBelongsToMany') {
|
if ($type == 'hasAndBelongsToMany') {
|
||||||
$fields[$parent][] = '--primaryKey--';
|
$fields[$parent][] = '--primaryKey--';
|
||||||
} else if ($type == 'belongsTo') {
|
} else if ($type == 'belongsTo') {
|
||||||
|
@ -386,10 +386,10 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
if (empty($map[$Model->alias])) {
|
if (empty($map[$Model->alias])) {
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
foreach($map[$Model->alias] as $type => $bindings) {
|
foreach ($map[$Model->alias] as $type => $bindings) {
|
||||||
foreach($bindings as $dependency) {
|
foreach ($bindings as $dependency) {
|
||||||
$innerFields = array();
|
$innerFields = array();
|
||||||
switch($type) {
|
switch ($type) {
|
||||||
case 'belongsTo':
|
case 'belongsTo':
|
||||||
$fields[] = $Model->{$type}[$dependency]['foreignKey'];
|
$fields[] = $Model->{$type}[$dependency]['foreignKey'];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -754,7 +754,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
if (is_null($instance[$model->alias][$left]) || is_null($instance[$model->alias][$right])) {
|
if (is_null($instance[$model->alias][$left]) || is_null($instance[$model->alias][$right])) {
|
||||||
$errors[] = array('node', $instance[$model->alias][$model->primaryKey],
|
$errors[] = array('node', $instance[$model->alias][$model->primaryKey],
|
||||||
'has invalid left or right values');
|
'has invalid left or right values');
|
||||||
} elseif ($instance[$model->alias][$left] == $instance[$model->alias][$right]){
|
} elseif ($instance[$model->alias][$left] == $instance[$model->alias][$right]) {
|
||||||
$errors[] = array('node', $instance[$model->alias][$model->primaryKey],
|
$errors[] = array('node', $instance[$model->alias][$model->primaryKey],
|
||||||
'left and right values identical');
|
'left and right values identical');
|
||||||
} elseif ($instance[$model->alias][$parent]) {
|
} elseif ($instance[$model->alias][$parent]) {
|
||||||
|
|
|
@ -411,7 +411,7 @@ class DataSource extends Object {
|
||||||
$val = null;
|
$val = null;
|
||||||
|
|
||||||
if (strpos($query, $key) !== false) {
|
if (strpos($query, $key) !== false) {
|
||||||
switch($key) {
|
switch ($key) {
|
||||||
case '{$__cakeID__$}':
|
case '{$__cakeID__$}':
|
||||||
if (isset($data[$model->alias]) || isset($data[$association])) {
|
if (isset($data[$model->alias]) || isset($data[$association])) {
|
||||||
if (isset($data[$model->alias][$model->primaryKey])) {
|
if (isset($data[$model->alias][$model->primaryKey])) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ class DboDb2 extends DboSource {
|
||||||
if ($config['cataloged']) {
|
if ($config['cataloged']) {
|
||||||
$this->connection = $connect($config['database'], $config['login'], $config['password']);
|
$this->connection = $connect($config['database'], $config['login'], $config['password']);
|
||||||
} else {
|
} else {
|
||||||
$conn_string = sprintf(
|
$connString = sprintf(
|
||||||
"DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;",
|
"DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;",
|
||||||
$config['database'],
|
$config['database'],
|
||||||
$config['hostname'],
|
$config['hostname'],
|
||||||
|
@ -126,7 +126,7 @@ class DboDb2 extends DboSource {
|
||||||
$config['login'],
|
$config['login'],
|
||||||
$config['password']
|
$config['password']
|
||||||
);
|
);
|
||||||
$this->connection = db2_connect($conn_string, '', '');
|
$this->connection = db2_connect($connString, '', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->connection) {
|
if ($this->connection) {
|
||||||
|
@ -161,15 +161,15 @@ class DboDb2 extends DboSource {
|
||||||
// get result from db
|
// get result from db
|
||||||
$result = db2_exec($this->connection, $sql);
|
$result = db2_exec($this->connection, $sql);
|
||||||
|
|
||||||
if(!is_bool($result)){
|
if (!is_bool($result)) {
|
||||||
// build table/column map for this result
|
// build table/column map for this result
|
||||||
$map = array();
|
$map = array();
|
||||||
$num_fields = db2_num_fields($result);
|
$numFields = db2_num_fields($result);
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
|
||||||
while ($j < $num_fields) {
|
while ($j < $numFields) {
|
||||||
$columnName = strtolower(db2_field_name($result, $j));
|
$columnName = strtolower(db2_field_name($result, $j));
|
||||||
$tmp = strpos($sql, '.' . $columnName, $offset);
|
$tmp = strpos($sql, '.' . $columnName, $offset);
|
||||||
$tableName = substr($sql, $offset, ($tmp-$offset));
|
$tableName = substr($sql, $offset, ($tmp-$offset));
|
||||||
|
|
|
@ -265,7 +265,7 @@ class DboMssql extends DboSource {
|
||||||
return "''";
|
return "''";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($column) {
|
switch ($column) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$data = $this->boolean((bool)$data);
|
$data = $this->boolean((bool)$data);
|
||||||
break;
|
break;
|
||||||
|
@ -500,11 +500,11 @@ class DboMssql extends DboSource {
|
||||||
function resultSet(&$results) {
|
function resultSet(&$results) {
|
||||||
$this->results =& $results;
|
$this->results =& $results;
|
||||||
$this->map = array();
|
$this->map = array();
|
||||||
$num_fields = mssql_num_fields($results);
|
$numFields = mssql_num_fields($results);
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
|
|
||||||
while ($j < $num_fields) {
|
while ($j < $numFields) {
|
||||||
$column = mssql_field_name($results, $j);
|
$column = mssql_field_name($results, $j);
|
||||||
|
|
||||||
if (strpos($column, '__')) {
|
if (strpos($column, '__')) {
|
||||||
|
|
|
@ -203,7 +203,7 @@ class DboMysql extends DboSource {
|
||||||
'default' => $column[0]['Default'],
|
'default' => $column[0]['Default'],
|
||||||
'length' => $this->length($column[0]['Type']),
|
'length' => $this->length($column[0]['Type']),
|
||||||
);
|
);
|
||||||
if(!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
||||||
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,11 +436,11 @@ class DboMysql extends DboSource {
|
||||||
}
|
}
|
||||||
$this->results =& $results;
|
$this->results =& $results;
|
||||||
$this->map = array();
|
$this->map = array();
|
||||||
$num_fields = mysql_num_fields($results);
|
$numFields = mysql_num_fields($results);
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
|
|
||||||
while ($j < $num_fields) {
|
while ($j < $numFields) {
|
||||||
|
|
||||||
$column = mysql_fetch_field($results,$j);
|
$column = mysql_fetch_field($results,$j);
|
||||||
if (!empty($column->table)) {
|
if (!empty($column->table)) {
|
||||||
|
@ -510,15 +510,15 @@ class DboMysql extends DboSource {
|
||||||
function index($model) {
|
function index($model) {
|
||||||
$index = array();
|
$index = array();
|
||||||
$table = $this->fullTableName($model);
|
$table = $this->fullTableName($model);
|
||||||
if($table) {
|
if ($table) {
|
||||||
$indexes = $this->query('SHOW INDEX FROM ' . $table);
|
$indexes = $this->query('SHOW INDEX FROM ' . $table);
|
||||||
$keys = Set::extract($indexes, '{n}.STATISTICS');
|
$keys = Set::extract($indexes, '{n}.STATISTICS');
|
||||||
foreach ($keys as $i => $key) {
|
foreach ($keys as $i => $key) {
|
||||||
if(!isset($index[$key['Key_name']])) {
|
if (!isset($index[$key['Key_name']])) {
|
||||||
$index[$key['Key_name']]['column'] = $key['Column_name'];
|
$index[$key['Key_name']]['column'] = $key['Column_name'];
|
||||||
$index[$key['Key_name']]['unique'] = intval($key['Non_unique'] == 0);
|
$index[$key['Key_name']]['unique'] = intval($key['Non_unique'] == 0);
|
||||||
} else {
|
} else {
|
||||||
if(!is_array($index[$key['Key_name']]['column'])) {
|
if (!is_array($index[$key['Key_name']]['column'])) {
|
||||||
$col[] = $index[$key['Key_name']]['column'];
|
$col[] = $index[$key['Key_name']]['column'];
|
||||||
}
|
}
|
||||||
$col[] = $key['Column_name'];
|
$col[] = $key['Column_name'];
|
||||||
|
@ -535,35 +535,35 @@ class DboMysql extends DboSource {
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
function alterSchema($compare, $table = null) {
|
function alterSchema($compare, $table = null) {
|
||||||
if(!is_array($compare)) {
|
if (!is_array($compare)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$out = '';
|
$out = '';
|
||||||
$colList = array();
|
$colList = array();
|
||||||
foreach($compare as $curTable => $types) {
|
foreach ($compare as $curTable => $types) {
|
||||||
if (!$table || $table == $curTable) {
|
if (!$table || $table == $curTable) {
|
||||||
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
||||||
foreach($types as $type => $column) {
|
foreach ($types as $type => $column) {
|
||||||
switch($type) {
|
switch ($type) {
|
||||||
case 'add':
|
case 'add':
|
||||||
foreach($column as $field => $col) {
|
foreach ($column as $field => $col) {
|
||||||
$col['name'] = $field;
|
$col['name'] = $field;
|
||||||
$alter = 'ADD '.$this->buildColumn($col);
|
$alter = 'ADD '.$this->buildColumn($col);
|
||||||
if(isset($col['after'])) {
|
if (isset($col['after'])) {
|
||||||
$alter .= ' AFTER '. $this->name($col['after']);
|
$alter .= ' AFTER '. $this->name($col['after']);
|
||||||
}
|
}
|
||||||
$colList[] = $alter;
|
$colList[] = $alter;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'drop':
|
case 'drop':
|
||||||
foreach($column as $field => $col) {
|
foreach ($column as $field => $col) {
|
||||||
$col['name'] = $field;
|
$col['name'] = $field;
|
||||||
$colList[] = 'DROP '.$this->name($field);
|
$colList[] = 'DROP '.$this->name($field);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'change':
|
case 'change':
|
||||||
foreach($column as $field => $col) {
|
foreach ($column as $field => $col) {
|
||||||
if(!isset($col['name'])) {
|
if (!isset($col['name'])) {
|
||||||
$col['name'] = $field;
|
$col['name'] = $field;
|
||||||
}
|
}
|
||||||
$colList[] = 'CHANGE '. $this->name($field).' '.$this->buildColumn($col);
|
$colList[] = 'CHANGE '. $this->name($field).' '.$this->buildColumn($col);
|
||||||
|
|
|
@ -159,7 +159,7 @@ class DboMysqli extends DboSource {
|
||||||
$firstResult = mysqli_store_result($this->connection);
|
$firstResult = mysqli_store_result($this->connection);
|
||||||
|
|
||||||
if (mysqli_more_results($this->connection)) {
|
if (mysqli_more_results($this->connection)) {
|
||||||
while($lastResult = mysqli_next_result($this->connection));
|
while ($lastResult = mysqli_next_result($this->connection));
|
||||||
}
|
}
|
||||||
return $firstResult;
|
return $firstResult;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ class DboMysqli extends DboSource {
|
||||||
'default' => $column[0]['Default'],
|
'default' => $column[0]['Default'],
|
||||||
'length' => $this->length($column[0]['Type'])
|
'length' => $this->length($column[0]['Type'])
|
||||||
);
|
);
|
||||||
if(!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
|
||||||
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,10 +412,10 @@ class DboMysqli extends DboSource {
|
||||||
}
|
}
|
||||||
$this->results =& $results;
|
$this->results =& $results;
|
||||||
$this->map = array();
|
$this->map = array();
|
||||||
$num_fields = mysqli_num_fields($results);
|
$numFields = mysqli_num_fields($results);
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
while ($j < $num_fields) {
|
while ($j < $numFields) {
|
||||||
$column = mysqli_fetch_field_direct($results, $j);
|
$column = mysqli_fetch_field_direct($results, $j);
|
||||||
if (!empty($column->table)) {
|
if (!empty($column->table)) {
|
||||||
$this->map[$index++] = array($column->table, $column->name);
|
$this->map[$index++] = array($column->table, $column->name);
|
||||||
|
|
|
@ -199,7 +199,7 @@ class DboSqlite extends DboSource {
|
||||||
'default' => $column[0]['dflt_value'],
|
'default' => $column[0]['dflt_value'],
|
||||||
'length' => $this->length($column[0]['type'])
|
'length' => $this->length($column[0]['type'])
|
||||||
);
|
);
|
||||||
if($column[0]['pk'] == 1) {
|
if ($column[0]['pk'] == 1) {
|
||||||
$fields[$column[0]['name']] = array(
|
$fields[$column[0]['name']] = array(
|
||||||
'type' => $fields[$column[0]['name']]['type'],
|
'type' => $fields[$column[0]['name']]['type'],
|
||||||
'null' => false,
|
'null' => false,
|
||||||
|
|
|
@ -345,7 +345,7 @@ class DboSource extends DataSource {
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
$first = $this->fetchRow();
|
$first = $this->fetchRow();
|
||||||
if ($first != null){
|
if ($first != null) {
|
||||||
$out[] = $first;
|
$out[] = $first;
|
||||||
}
|
}
|
||||||
while ($this->hasResult() && $item = $this->fetchResult()) {
|
while ($this->hasResult() && $item = $this->fetchResult()) {
|
||||||
|
@ -397,7 +397,7 @@ class DboSource extends DataSource {
|
||||||
$data = (array)$data;
|
$data = (array)$data;
|
||||||
$count = count($data);
|
$count = count($data);
|
||||||
|
|
||||||
for($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
if ($data[$i] == '*') {
|
if ($data[$i] == '*') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ class DboSource extends DataSource {
|
||||||
if ($type == 'hasAndBelongsToMany') {
|
if ($type == 'hasAndBelongsToMany') {
|
||||||
$uniqueIds = $merge = array();
|
$uniqueIds = $merge = array();
|
||||||
|
|
||||||
foreach($fetch as $j => $data) {
|
foreach ($fetch as $j => $data) {
|
||||||
if (
|
if (
|
||||||
(isset($data[$with]) && $data[$with][$foreignKey] === $row[$model->alias][$model->primaryKey]) &&
|
(isset($data[$with]) && $data[$with][$foreignKey] === $row[$model->alias][$model->primaryKey]) &&
|
||||||
(!in_array($data[$with][$joinKeys[1]], $uniqueIds))
|
(!in_array($data[$with][$joinKeys[1]], $uniqueIds))
|
||||||
|
@ -1074,7 +1074,7 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
$assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']);
|
$assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']);
|
||||||
|
|
||||||
switch($type) {
|
switch ($type) {
|
||||||
case 'hasOne':
|
case 'hasOne':
|
||||||
case 'belongsTo':
|
case 'belongsTo':
|
||||||
$conditions = $this->__mergeConditions(
|
$conditions = $this->__mergeConditions(
|
||||||
|
|
|
@ -63,7 +63,7 @@ class AclNode extends AppModel {
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$config = Configure::read('Acl.database');
|
$config = Configure::read('Acl.database');
|
||||||
if(isset($config)) {
|
if (isset($config)) {
|
||||||
$this->useDbConfig = $config;
|
$this->useDbConfig = $config;
|
||||||
}
|
}
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
|
@ -593,7 +593,7 @@ class Model extends Overloadable {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __constructLinkedModel($assoc, $className = null) {
|
function __constructLinkedModel($assoc, $className = null) {
|
||||||
if(empty($className)) {
|
if (empty($className)) {
|
||||||
$className = $assoc;
|
$className = $assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ class Model extends Overloadable {
|
||||||
if (!isset($this->{$type}[$assocKey][$key]) || $this->{$type}[$assocKey][$key] === null) {
|
if (!isset($this->{$type}[$assocKey][$key]) || $this->{$type}[$assocKey][$key] === null) {
|
||||||
$data = '';
|
$data = '';
|
||||||
|
|
||||||
switch($key) {
|
switch ($key) {
|
||||||
case 'fields':
|
case 'fields':
|
||||||
$data = '';
|
$data = '';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -221,7 +221,7 @@ class CakeSchema extends Object {
|
||||||
unset($currentTables[$key]);
|
unset($currentTables[$key]);
|
||||||
}
|
}
|
||||||
if (!empty($Object->hasAndBelongsToMany)) {
|
if (!empty($Object->hasAndBelongsToMany)) {
|
||||||
foreach($Object->hasAndBelongsToMany as $Assoc => $assocData) {
|
foreach ($Object->hasAndBelongsToMany as $Assoc => $assocData) {
|
||||||
if (isset($assocData['with'])) {
|
if (isset($assocData['with'])) {
|
||||||
$class = $assocData['with'];
|
$class = $assocData['with'];
|
||||||
} elseif ($assocData['_with']) {
|
} elseif ($assocData['_with']) {
|
||||||
|
@ -243,7 +243,7 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($currentTables)) {
|
if (!empty($currentTables)) {
|
||||||
foreach($currentTables as $table) {
|
foreach ($currentTables as $table) {
|
||||||
if ($prefix) {
|
if ($prefix) {
|
||||||
if (strpos($table, $prefix) !== 0) {
|
if (strpos($table, $prefix) !== 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ class Multibyte extends Object {
|
||||||
function __find($char, $type = 'lower') {
|
function __find($char, $type = 'lower') {
|
||||||
$value = false;
|
$value = false;
|
||||||
$found = array();
|
$found = array();
|
||||||
if(!isset($this->__codeRange[$char])) {
|
if (!isset($this->__codeRange[$char])) {
|
||||||
$range = $this->__codepoint($char);
|
$range = $this->__codepoint($char);
|
||||||
if ($range === false) {
|
if ($range === false) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1093,7 +1093,7 @@ class Multibyte extends Object {
|
||||||
$this->__table = $this->__codeRange[$char];
|
$this->__table = $this->__codeRange[$char];
|
||||||
$count = count($this->__caseFold[$this->__table]);
|
$count = count($this->__caseFold[$this->__table]);
|
||||||
|
|
||||||
for($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
if ($type === 'lower' && $this->__caseFold[$this->__table][$i][$type][0] === $char) {
|
if ($type === 'lower' && $this->__caseFold[$this->__table][$i][$type][0] === $char) {
|
||||||
$found[] = $this->__caseFold[$this->__table][$i];
|
$found[] = $this->__caseFold[$this->__table][$i];
|
||||||
} elseif ($type === 'upper' && $this->__caseFold[$this->__table][$i][$type] === $char) {
|
} elseif ($type === 'upper' && $this->__caseFold[$this->__table][$i][$type] === $char) {
|
||||||
|
|
|
@ -265,7 +265,7 @@ class Object {
|
||||||
$file = CACHE . 'persistent' . DS . strtolower($name) . '.php';
|
$file = CACHE . 'persistent' . DS . strtolower($name) . '.php';
|
||||||
include($file);
|
include($file);
|
||||||
|
|
||||||
switch($type) {
|
switch ($type) {
|
||||||
case 'registry':
|
case 'registry':
|
||||||
$vars = unserialize(${$name});
|
$vars = unserialize(${$name});
|
||||||
foreach ($vars['0'] as $key => $value) {
|
foreach ($vars['0'] as $key => $value) {
|
||||||
|
|
|
@ -870,7 +870,7 @@ class Router extends Object {
|
||||||
array_unshift($urlOut, $url['plugin']);
|
array_unshift($urlOut, $url['plugin']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_this->__admin && isset($url[$_this->__admin])) {
|
if ($_this->__admin && isset($url[$_this->__admin])) {
|
||||||
array_unshift($urlOut, $_this->__admin);
|
array_unshift($urlOut, $_this->__admin);
|
||||||
}
|
}
|
||||||
$output = join('/', $urlOut) . '/';
|
$output = join('/', $urlOut) . '/';
|
||||||
|
@ -1036,7 +1036,7 @@ class Router extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __mapRoute($route, $params = array()) {
|
function __mapRoute($route, $params = array()) {
|
||||||
if(isset($params['plugin']) && isset($params['controller']) && $params['plugin'] === $params['controller']) {
|
if (isset($params['plugin']) && isset($params['controller']) && $params['plugin'] === $params['controller']) {
|
||||||
unset($params['controller']);
|
unset($params['controller']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ class Sanitize {
|
||||||
|
|
||||||
if (isset($colData['formatter']) || isset($colData['format'])) {
|
if (isset($colData['formatter']) || isset($colData['format'])) {
|
||||||
|
|
||||||
switch(strtolower($colData['formatter'])) {
|
switch (strtolower($colData['formatter'])) {
|
||||||
case 'date':
|
case 'date':
|
||||||
$data = date($colData['format'], strtotime($data));
|
$data = date($colData['format'], strtotime($data));
|
||||||
break;
|
break;
|
||||||
|
@ -284,7 +284,7 @@ class Sanitize {
|
||||||
}
|
}
|
||||||
$model->data[$name][$column]=$data;
|
$model->data[$name][$column]=$data;
|
||||||
/*
|
/*
|
||||||
switch($colType) {
|
switch ($colType) {
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'int':
|
case 'int':
|
||||||
return $data;
|
return $data;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Security extends Object {
|
||||||
*/
|
*/
|
||||||
function inactiveMins() {
|
function inactiveMins() {
|
||||||
$_this =& Security::getInstance();
|
$_this =& Security::getInstance();
|
||||||
switch(Configure::read('Security.level')) {
|
switch (Configure::read('Security.level')) {
|
||||||
case 'high':
|
case 'high':
|
||||||
return 10;
|
return 10;
|
||||||
break;
|
break;
|
||||||
|
@ -87,7 +87,7 @@ class Security extends Object {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function generateAuthKey() {
|
function generateAuthKey() {
|
||||||
if(!class_exists('String')) {
|
if (!class_exists('String')) {
|
||||||
App::import('Core', 'String');
|
App::import('Core', 'String');
|
||||||
}
|
}
|
||||||
return Security::hash(String::uuid());
|
return Security::hash(String::uuid());
|
||||||
|
|
|
@ -247,7 +247,7 @@ class CakeSession extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __overwrite(&$old, $new) {
|
function __overwrite(&$old, $new) {
|
||||||
if(!empty($old)) {
|
if (!empty($old)) {
|
||||||
foreach ($old as $key => $var) {
|
foreach ($old as $key => $var) {
|
||||||
if (!isset($new[$key])) {
|
if (!isset($new[$key])) {
|
||||||
unset($old[$key]);
|
unset($old[$key]);
|
||||||
|
@ -422,22 +422,22 @@ class CakeSession extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __initSession() {
|
function __initSession() {
|
||||||
$ini_set = function_exists('ini_set');
|
$iniSet = function_exists('ini_set');
|
||||||
|
|
||||||
if ($ini_set && env('HTTPS')) {
|
if ($iniSet && env('HTTPS')) {
|
||||||
ini_set('session.cookie_secure', 1);
|
ini_set('session.cookie_secure', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($this->security) {
|
switch ($this->security) {
|
||||||
case 'high':
|
case 'high':
|
||||||
$this->cookieLifeTime = 0;
|
$this->cookieLifeTime = 0;
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.referer_check', $this->host);
|
ini_set('session.referer_check', $this->host);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'medium':
|
case 'medium':
|
||||||
$this->cookieLifeTime = 7 * 86400;
|
$this->cookieLifeTime = 7 * 86400;
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.referer_check', $this->host);
|
ini_set('session.referer_check', $this->host);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -447,10 +447,10 @@ class CakeSession extends Object {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(Configure::read('Session.save')) {
|
switch (Configure::read('Session.save')) {
|
||||||
case 'cake':
|
case 'cake':
|
||||||
if (!isset($_SESSION)) {
|
if (!isset($_SESSION)) {
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.use_trans_sid', 0);
|
ini_set('session.use_trans_sid', 0);
|
||||||
ini_set('url_rewriter.tags', '');
|
ini_set('url_rewriter.tags', '');
|
||||||
ini_set('session.serialize_handler', 'php');
|
ini_set('session.serialize_handler', 'php');
|
||||||
|
@ -471,7 +471,7 @@ class CakeSession extends Object {
|
||||||
} elseif (Configure::read('Session.database') === null) {
|
} elseif (Configure::read('Session.database') === null) {
|
||||||
Configure::write('Session.database', 'default');
|
Configure::write('Session.database', 'default');
|
||||||
}
|
}
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.use_trans_sid', 0);
|
ini_set('session.use_trans_sid', 0);
|
||||||
ini_set('url_rewriter.tags', '');
|
ini_set('url_rewriter.tags', '');
|
||||||
ini_set('session.save_handler', 'user');
|
ini_set('session.save_handler', 'user');
|
||||||
|
@ -492,7 +492,7 @@ class CakeSession extends Object {
|
||||||
break;
|
break;
|
||||||
case 'php':
|
case 'php':
|
||||||
if (!isset($_SESSION)) {
|
if (!isset($_SESSION)) {
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.use_trans_sid', 0);
|
ini_set('session.use_trans_sid', 0);
|
||||||
ini_set('session.name', Configure::read('Session.cookie'));
|
ini_set('session.name', Configure::read('Session.cookie'));
|
||||||
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
|
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
|
||||||
|
@ -505,7 +505,7 @@ class CakeSession extends Object {
|
||||||
if (!class_exists('Cache')) {
|
if (!class_exists('Cache')) {
|
||||||
uses('Cache');
|
uses('Cache');
|
||||||
}
|
}
|
||||||
if ($ini_set) {
|
if ($iniSet) {
|
||||||
ini_set('session.use_trans_sid', 0);
|
ini_set('session.use_trans_sid', 0);
|
||||||
ini_set('url_rewriter.tags', '');
|
ini_set('url_rewriter.tags', '');
|
||||||
ini_set('session.save_handler', 'user');
|
ini_set('session.save_handler', 'user');
|
||||||
|
@ -683,7 +683,7 @@ class CakeSession extends Object {
|
||||||
function __close() {
|
function __close() {
|
||||||
$probability = mt_rand(1, 150);
|
$probability = mt_rand(1, 150);
|
||||||
if ($probability <= 3) {
|
if ($probability <= 3) {
|
||||||
switch(Configure::read('Session.save')) {
|
switch (Configure::read('Session.save')) {
|
||||||
case 'cache':
|
case 'cache':
|
||||||
Cache::gc();
|
Cache::gc();
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +728,7 @@ class CakeSession extends Object {
|
||||||
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
|
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
|
||||||
$table = $db->fullTableName(Configure::read('Session.table'));
|
$table = $db->fullTableName(Configure::read('Session.table'));
|
||||||
|
|
||||||
switch(Configure::read('Security.level')) {
|
switch (Configure::read('Security.level')) {
|
||||||
case 'high':
|
case 'high':
|
||||||
$factor = 10;
|
$factor = 10;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -191,25 +191,25 @@ class Set extends Object {
|
||||||
$out[$key] = Set::__map($value, $class);
|
$out[$key] = Set::__map($value, $class);
|
||||||
if (is_object($out[$key])) {
|
if (is_object($out[$key])) {
|
||||||
if ($primary !== true && is_array($value) && Set::countDim($value, true) === 2) {
|
if ($primary !== true && is_array($value) && Set::countDim($value, true) === 2) {
|
||||||
if(!isset($out[$key]->_name_)) {
|
if (!isset($out[$key]->_name_)) {
|
||||||
$out[$key]->_name_ = $primary;
|
$out[$key]->_name_ = $primary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (is_array($value)) {
|
} elseif (is_array($value)) {
|
||||||
if ($primary === true) {
|
if ($primary === true) {
|
||||||
if(!isset($out->_name_)) {
|
if (!isset($out->_name_)) {
|
||||||
$out->_name_ = $key;
|
$out->_name_ = $key;
|
||||||
}
|
}
|
||||||
$primary = false;
|
$primary = false;
|
||||||
foreach($value as $key2 => $value2) {
|
foreach ($value as $key2 => $value2) {
|
||||||
$out->{$key2} = Set::__map($value2, true);
|
$out->{$key2} = Set::__map($value2, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!is_numeric($key)) {
|
if (!is_numeric($key)) {
|
||||||
$out->{$key} = Set::__map($value, true, $key);
|
$out->{$key} = Set::__map($value, true, $key);
|
||||||
if (is_object($out->{$key}) && !is_numeric($key)) {
|
if (is_object($out->{$key}) && !is_numeric($key)) {
|
||||||
if(!isset($out->{$key}->_name_)) {
|
if (!isset($out->{$key}->_name_)) {
|
||||||
$out->{$key}->_name_ = $key;
|
$out->{$key}->_name_ = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ class String extends Object {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
|
function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
|
||||||
if(empty($data) || is_array($data)) {
|
if (empty($data) || is_array($data)) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ class Validation extends Object {
|
||||||
}
|
}
|
||||||
$operator = str_replace(array(" ", "\t", "\n", "\r", "\0", "\x0B"), "", strtolower($operator));
|
$operator = str_replace(array(" ", "\t", "\n", "\r", "\0", "\x0B"), "", strtolower($operator));
|
||||||
|
|
||||||
switch($operator) {
|
switch ($operator) {
|
||||||
case 'isgreater':
|
case 'isgreater':
|
||||||
case '>':
|
case '>':
|
||||||
if ($check1 > $check2) {
|
if ($check1 > $check2) {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<?php
|
<?php
|
||||||
$content = explode("\n", $content);
|
$content = explode("\n", $content);
|
||||||
|
|
||||||
foreach($content as $line):
|
foreach ($content as $line):
|
||||||
echo '<p> ' . $line . '</p>';
|
echo '<p> ' . $line . '</p>';
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
|
@ -371,11 +371,11 @@ class Helper extends Overloadable {
|
||||||
|
|
||||||
switch (count($parts)) {
|
switch (count($parts)) {
|
||||||
case 1:
|
case 1:
|
||||||
if($view->modelScope === false) {
|
if ($view->modelScope === false) {
|
||||||
$view->model = $parts[0];
|
$view->model = $parts[0];
|
||||||
} else {
|
} else {
|
||||||
$view->field = $parts[0];
|
$view->field = $parts[0];
|
||||||
if($sameScope === false) {
|
if ($sameScope === false) {
|
||||||
$view->association = $parts[0];
|
$view->association = $parts[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ class Helper extends Overloadable {
|
||||||
|
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
$view =& ClassRegistry::getObject('view');
|
$view =& ClassRegistry::getObject('view');
|
||||||
if(isset($result[$view->fieldSuffix])) {
|
if (isset($result[$view->fieldSuffix])) {
|
||||||
$result = $result[$view->fieldSuffix];
|
$result = $result[$view->fieldSuffix];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,7 @@ class AjaxHelper extends AppHelper {
|
||||||
$options = $this->_optionsToString($options, array('axis', 'handleImage', 'handleDisabled'));
|
$options = $this->_optionsToString($options, array('axis', 'handleImage', 'handleDisabled'));
|
||||||
$callbacks = array('change', 'slide');
|
$callbacks = array('change', 'slide');
|
||||||
|
|
||||||
foreach($callbacks as $callback) {
|
foreach ($callbacks as $callback) {
|
||||||
if (isset($options[$callback])) {
|
if (isset($options[$callback])) {
|
||||||
$options['on' . ucfirst($callback)] = 'function(value) {' . $options[$callback] . '}';
|
$options['on' . ucfirst($callback)] = 'function(value) {' . $options[$callback] . '}';
|
||||||
unset($options[$callback]);
|
unset($options[$callback]);
|
||||||
|
@ -680,7 +680,7 @@ class AjaxHelper extends AppHelper {
|
||||||
$jsOptions = array_merge($jsOptions, array_intersect_key($options, array_flip(array('contentType', 'encoding', 'method', 'postBody'))));
|
$jsOptions = array_merge($jsOptions, array_intersect_key($options, array_flip(array('contentType', 'encoding', 'method', 'postBody'))));
|
||||||
|
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
switch($key) {
|
switch ($key) {
|
||||||
case 'type':
|
case 'type':
|
||||||
$jsOptions['asynchronous'] = ($value == 'synchronous') ? 'false' : 'true';
|
$jsOptions['asynchronous'] = ($value == 'synchronous') ? 'false' : 'true';
|
||||||
break;
|
break;
|
||||||
|
@ -787,7 +787,7 @@ class AjaxHelper extends AppHelper {
|
||||||
if (isset($options[$callback])) {
|
if (isset($options[$callback])) {
|
||||||
$name = 'on' . ucfirst($callback);
|
$name = 'on' . ucfirst($callback);
|
||||||
$code = $options[$callback];
|
$code = $options[$callback];
|
||||||
switch($name) {
|
switch ($name) {
|
||||||
case 'onComplete':
|
case 'onComplete':
|
||||||
$callbacks[$name] = "function(request, json) {" . $code . "}";
|
$callbacks[$name] = "function(request, json) {" . $code . "}";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ class FormHelper extends AppHelper {
|
||||||
$opt = implode($separator, $selects);
|
$opt = implode($separator, $selects);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($timeFormat) {
|
switch ($timeFormat) {
|
||||||
case '24':
|
case '24':
|
||||||
$selectMinuteAttr['interval'] = $interval;
|
$selectMinuteAttr['interval'] = $interval;
|
||||||
$opt .= $this->hour($fieldName, true, $hour, $selectHourAttr, $showEmpty) . ':' .
|
$opt .= $this->hour($fieldName, true, $hour, $selectHourAttr, $showEmpty) . ':' .
|
||||||
|
|
|
@ -624,7 +624,7 @@ class HtmlHelper extends AppHelper {
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
$index = 1;
|
$index = 1;
|
||||||
foreach($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
$item = $key . $this->nestedList($item, $attributes, $itemAttributes, $tag);
|
$item = $key . $this->nestedList($item, $attributes, $itemAttributes, $tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class JsHelper extends Overloadable2 {
|
||||||
return 'alert("' . $this->escape($message) . '");';
|
return 'alert("' . $this->escape($message) . '");';
|
||||||
}
|
}
|
||||||
|
|
||||||
function if_($if, $then, $else = null, $elseif = array()) {
|
function if_($if, $then, $else = null, $elseIf = array()) {
|
||||||
$len = strlen($if) - 1;
|
$len = strlen($if) - 1;
|
||||||
if ($if{$len} == ';') {
|
if ($if{$len} == ';') {
|
||||||
$if{$len} = null;
|
$if{$len} = null;
|
||||||
|
@ -89,7 +89,7 @@ class JsHelper extends Overloadable2 {
|
||||||
|
|
||||||
$out = 'if (' . $if . ') { ' . $then . ' }';
|
$out = 'if (' . $if . ') { ' . $then . ' }';
|
||||||
|
|
||||||
foreach ($elseif as $cond => $exec) {
|
foreach ($elseIf as $cond => $exec) {
|
||||||
//$out .=
|
//$out .=
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class NumberHelper extends AppHelper {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function toReadableSize($size) {
|
function toReadableSize($size) {
|
||||||
switch($size) {
|
switch ($size) {
|
||||||
case 0:
|
case 0:
|
||||||
return '0 Bytes';
|
return '0 Bytes';
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -185,7 +185,7 @@ class NumberHelper extends AppHelper {
|
||||||
$result = $this->format($abs, $options);
|
$result = $this->format($abs, $options);
|
||||||
|
|
||||||
if ($number < 0 ) {
|
if ($number < 0 ) {
|
||||||
if($options['negative'] == '()') {
|
if ($options['negative'] == '()') {
|
||||||
$result = '(' . $result .')';
|
$result = '(' . $result .')';
|
||||||
} else {
|
} else {
|
||||||
$result = $options['negative'] . $result;
|
$result = $options['negative'] . $result;
|
||||||
|
|
|
@ -195,7 +195,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function __start() {
|
function __start() {
|
||||||
if(!parent::started()) {
|
if (!parent::started()) {
|
||||||
parent::start();
|
parent::start();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -38,8 +38,8 @@ class TimeHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Converts given time (in server's time zone) to user's local time, given his/her offset from GMT.
|
* Converts given time (in server's time zone) to user's local time, given his/her offset from GMT.
|
||||||
*
|
*
|
||||||
* @param string $server_time UNIX timestamp
|
* @param string $serverTime UNIX timestamp
|
||||||
* @param int $user_offset User's offset from GMT (in hours)
|
* @param int $userOffset User's offset from GMT (in hours)
|
||||||
* @return string UNIX timestamp
|
* @return string UNIX timestamp
|
||||||
*/
|
*/
|
||||||
function convert($serverTime, $userOffset) {
|
function convert($serverTime, $userOffset) {
|
||||||
|
@ -317,8 +317,8 @@ class TimeHelper extends AppHelper {
|
||||||
if (!is_null($userOffset)) {
|
if (!is_null($userOffset)) {
|
||||||
$now = $this->convert(time(), $userOffset);
|
$now = $this->convert(time(), $userOffset);
|
||||||
}
|
}
|
||||||
$in_seconds = $this->fromString($dateTime, $userOffset);
|
$inSeconds = $this->fromString($dateTime, $userOffset);
|
||||||
$backwards = ($in_seconds > $now);
|
$backwards = ($inSeconds > $now);
|
||||||
|
|
||||||
$format = 'j/n/y';
|
$format = 'j/n/y';
|
||||||
$end = '+1 month';
|
$end = '+1 month';
|
||||||
|
@ -337,22 +337,22 @@ class TimeHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($backwards) {
|
if ($backwards) {
|
||||||
$future_time = $in_seconds;
|
$futureTime = $inSeconds;
|
||||||
$past_time = $now;
|
$pastTime = $now;
|
||||||
} else {
|
} else {
|
||||||
$future_time = $now;
|
$futureTime = $now;
|
||||||
$past_time = $in_seconds;
|
$pastTime = $inSeconds;
|
||||||
}
|
}
|
||||||
$diff = $future_time - $past_time;
|
$diff = $futureTime - $pastTime;
|
||||||
|
|
||||||
// If more than a week, then take into account the length of months
|
// If more than a week, then take into account the length of months
|
||||||
if ($diff >= 604800) {
|
if ($diff >= 604800) {
|
||||||
$current = array();
|
$current = array();
|
||||||
$date = array();
|
$date = array();
|
||||||
|
|
||||||
list($future['H'], $future['i'], $future['s'], $future['d'], $future['m'], $future['Y']) = explode('/', date('H/i/s/d/m/Y', $future_time));
|
list($future['H'], $future['i'], $future['s'], $future['d'], $future['m'], $future['Y']) = explode('/', date('H/i/s/d/m/Y', $futureTime));
|
||||||
|
|
||||||
list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $past_time));
|
list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $pastTime));
|
||||||
$years = $months = $weeks = $days = $hours = $minutes = $seconds = 0;
|
$years = $months = $weeks = $days = $hours = $minutes = $seconds = 0;
|
||||||
|
|
||||||
if ($future['Y'] == $past['Y'] && $future['m'] == $past['m']) {
|
if ($future['Y'] == $past['Y'] && $future['m'] == $past['m']) {
|
||||||
|
@ -379,13 +379,13 @@ class TimeHelper extends AppHelper {
|
||||||
if ($future['d'] >= $past['d']) {
|
if ($future['d'] >= $past['d']) {
|
||||||
$days = $future['d'] - $past['d'];
|
$days = $future['d'] - $past['d'];
|
||||||
} else {
|
} else {
|
||||||
$days_in_past_month = date('t', $past_time);
|
$daysInPastMonth = date('t', $pastTime);
|
||||||
$days_in_future_month = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, $future['Y']));
|
$daysInFutureMonth = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, $future['Y']));
|
||||||
|
|
||||||
if (!$backwards) {
|
if (!$backwards) {
|
||||||
$days = ($days_in_past_month - $past['d']) + $future['d'];
|
$days = ($daysInPastMonth - $past['d']) + $future['d'];
|
||||||
} else {
|
} else {
|
||||||
$days = ($days_in_future_month - $past['d']) + $future['d'];
|
$days = ($daysInFutureMonth - $past['d']) + $future['d'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($future['m'] != $past['m']) {
|
if ($future['m'] != $past['m']) {
|
||||||
|
@ -393,7 +393,7 @@ class TimeHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($months == 0 && $years >= 1 && $diff < ($years * 31536000)){
|
if ($months == 0 && $years >= 1 && $diff < ($years * 31536000)) {
|
||||||
$months = 11;
|
$months = 11;
|
||||||
$years --;
|
$years --;
|
||||||
}
|
}
|
||||||
|
@ -420,48 +420,48 @@ class TimeHelper extends AppHelper {
|
||||||
$diff = $diff - ($minutes * 60);
|
$diff = $diff - ($minutes * 60);
|
||||||
$seconds = $diff;
|
$seconds = $diff;
|
||||||
}
|
}
|
||||||
$relative_date = '';
|
$relativeDate = '';
|
||||||
$diff = $future_time - $past_time;
|
$diff = $futureTime - $pastTime;
|
||||||
|
|
||||||
if ($diff > abs($now - $this->fromString($end))) {
|
if ($diff > abs($now - $this->fromString($end))) {
|
||||||
$relative_date = sprintf(__('on %s',true), date($format, $in_seconds));
|
$relativeDate = sprintf(__('on %s',true), date($format, $inSeconds));
|
||||||
} else {
|
} else {
|
||||||
if ($years > 0) {
|
if ($years > 0) {
|
||||||
// years and months and days
|
// years and months and days
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $years . ' ' . __n('year', 'years', $years, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $years . ' ' . __n('year', 'years', $years, true);
|
||||||
$relative_date .= $months > 0 ? ($relative_date ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true) : '';
|
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true) : '';
|
||||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
|
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
|
||||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
||||||
} elseif (abs($months) > 0) {
|
} elseif (abs($months) > 0) {
|
||||||
// months, weeks and days
|
// months, weeks and days
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true);
|
||||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
|
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
|
||||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
||||||
} elseif (abs($weeks) > 0) {
|
} elseif (abs($weeks) > 0) {
|
||||||
// weeks and days
|
// weeks and days
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true);
|
||||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
|
||||||
} elseif (abs($days) > 0) {
|
} elseif (abs($days) > 0) {
|
||||||
// days and hours
|
// days and hours
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true);
|
||||||
$relative_date .= $hours > 0 ? ($relative_date ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true) : '';
|
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true) : '';
|
||||||
} elseif (abs($hours) > 0) {
|
} elseif (abs($hours) > 0) {
|
||||||
// hours and minutes
|
// hours and minutes
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true);
|
||||||
$relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true) : '';
|
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true) : '';
|
||||||
} elseif (abs($minutes) > 0) {
|
} elseif (abs($minutes) > 0) {
|
||||||
// minutes only
|
// minutes only
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true);
|
||||||
} else {
|
} else {
|
||||||
// seconds only
|
// seconds only
|
||||||
$relative_date .= ($relative_date ? ', ' : '') . $seconds . ' ' . __n('second', 'seconds', $seconds, true);
|
$relativeDate .= ($relativeDate ? ', ' : '') . $seconds . ' ' . __n('second', 'seconds', $seconds, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$backwards) {
|
if (!$backwards) {
|
||||||
$relative_date = sprintf(__('%s ago', true), $relative_date);
|
$relativeDate = sprintf(__('%s ago', true), $relativeDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->output($relative_date);
|
return $this->output($relativeDate);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Alias for timeAgoInWords
|
* Alias for timeAgoInWords
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
|
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
|
||||||
<a href="https://trac.cakephp.org/wiki/notes/1.2.x.x"><?php __('Read the release notes and get the latest version'); ?> </a>
|
<a href="https://trac.cakephp.org/wiki/notes/1.2.x.x"><?php __('Read the release notes and get the latest version'); ?> </a>
|
||||||
<?php
|
<?php
|
||||||
if(Configure::read() > 0):
|
if (Configure::read() > 0):
|
||||||
Debugger::checkSessionKey();
|
Debugger::checkSessionKey();
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<?php
|
<?php
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $_type => $_data) {
|
foreach ($associations as $_type => $_data) {
|
||||||
foreach($_data as $_alias => $_details) {
|
foreach ($_data as $_alias => $_details) {
|
||||||
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
||||||
|
|
|
@ -49,16 +49,16 @@ echo "\n";
|
||||||
echo "\t<tr{$class}>\n";
|
echo "\t<tr{$class}>\n";
|
||||||
foreach ($scaffoldFields as $_field) {
|
foreach ($scaffoldFields as $_field) {
|
||||||
$isKey = false;
|
$isKey = false;
|
||||||
if(!empty($associations['belongsTo'])) {
|
if (!empty($associations['belongsTo'])) {
|
||||||
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
||||||
if($_field === $_details['foreignKey']) {
|
if ($_field === $_details['foreignKey']) {
|
||||||
$isKey = true;
|
$isKey = true;
|
||||||
echo "\t\t<td>\n\t\t\t" . $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" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller'=> $_details['controller'], 'action'=>'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t</td>\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($isKey !== true) {
|
if ($isKey !== true) {
|
||||||
echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$_field] . " \n\t\t</td>\n";
|
echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$_field] . " \n\t\t</td>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ echo "\n";
|
||||||
<?php
|
<?php
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $_type => $_data) {
|
foreach ($associations as $_type => $_data) {
|
||||||
foreach($_data as $_alias => $_details) {
|
foreach ($_data as $_alias => $_details) {
|
||||||
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
||||||
|
|
|
@ -35,9 +35,9 @@ foreach ($scaffoldFields as $_field) {
|
||||||
$class = ' class="altrow"';
|
$class = ' class="altrow"';
|
||||||
}
|
}
|
||||||
$isKey = false;
|
$isKey = false;
|
||||||
if(!empty($associations['belongsTo'])) {
|
if (!empty($associations['belongsTo'])) {
|
||||||
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
||||||
if($_field === $_details['foreignKey']) {
|
if ($_field === $_details['foreignKey']) {
|
||||||
$isKey = true;
|
$isKey = true;
|
||||||
echo "\t\t<dt{$class}>".Inflector::humanize($_alias)."</dt>\n";
|
echo "\t\t<dt{$class}>".Inflector::humanize($_alias)."</dt>\n";
|
||||||
echo "\t\t<dd{$class}>\n\t\t\t" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller'=> $_details['controller'], 'action'=>'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t </dd>\n";
|
echo "\t\t<dd{$class}>\n\t\t\t" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller'=> $_details['controller'], 'action'=>'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t </dd>\n";
|
||||||
|
@ -45,7 +45,7 @@ foreach ($scaffoldFields as $_field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($isKey !== true) {
|
if ($isKey !== true) {
|
||||||
echo "\t\t<dt{$class}>".Inflector::humanize($_field)."</dt>\n";
|
echo "\t\t<dt{$class}>".Inflector::humanize($_field)."</dt>\n";
|
||||||
echo "\t\t<dd{$class}>\n\t\t\t{${$singularVar}[$modelClass][$_field]}\n \t\t</dd>\n";
|
echo "\t\t<dd{$class}>\n\t\t\t{${$singularVar}[$modelClass][$_field]}\n \t\t</dd>\n";
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ foreach ($scaffoldFields as $_field) {
|
||||||
|
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($associations as $_type => $_data) {
|
foreach ($associations as $_type => $_data) {
|
||||||
foreach($_data as $_alias => $_details) {
|
foreach ($_data as $_alias => $_details) {
|
||||||
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
||||||
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
||||||
|
@ -75,7 +75,7 @@ foreach ($scaffoldFields as $_field) {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($associations['hasOne'])) :
|
if (!empty($associations['hasOne'])) :
|
||||||
foreach ($associations['hasOne'] as $_alias => $_details): ?>
|
foreach ($associations['hasOne'] as $_alias => $_details): ?>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
<h3><?php echo sprintf(__("Related %s", true), Inflector::humanize($_details['controller']));?></h3>
|
<h3><?php echo sprintf(__("Related %s", true), Inflector::humanize($_details['controller']));?></h3>
|
||||||
|
@ -105,10 +105,10 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if(empty($associations['hasMany'])) {
|
if (empty($associations['hasMany'])) {
|
||||||
$associations['hasMany'] = array();
|
$associations['hasMany'] = array();
|
||||||
}
|
}
|
||||||
if(empty($associations['hasAndBelongsToMany'])) {
|
if (empty($associations['hasAndBelongsToMany'])) {
|
||||||
$associations['hasAndBelongsToMany'] = array();
|
$associations['hasAndBelongsToMany'] = array();
|
||||||
}
|
}
|
||||||
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class ThemeView extends View {
|
||||||
$paths = array_merge($themePaths, $paths);
|
$paths = array_merge($themePaths, $paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->__paths)) {
|
if (empty($this->__paths)) {
|
||||||
$this->__paths = $paths;
|
$this->__paths = $paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ class View extends Object {
|
||||||
* @return mixed Rendered output, or false on error
|
* @return mixed Rendered output, or false on error
|
||||||
*/
|
*/
|
||||||
function renderLayout($content_for_layout, $layout = null) {
|
function renderLayout($content_for_layout, $layout = null) {
|
||||||
$layout_fn = $this->_getLayoutFileName($layout);
|
$layoutFileName = $this->_getLayoutFileName($layout);
|
||||||
$debug = '';
|
$debug = '';
|
||||||
|
|
||||||
if (isset($this->viewVars['cakeDebug']) && Configure::read() > 2) {
|
if (isset($this->viewVars['cakeDebug']) && Configure::read() > 2) {
|
||||||
|
@ -447,15 +447,15 @@ class View extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($layout_fn, -3) === 'ctp' || substr($layout_fn, -5) === 'thtml') {
|
if (substr($layoutFileName, -3) === 'ctp' || substr($layoutFileName, -5) === 'thtml') {
|
||||||
$this->output = View::_render($layout_fn, $data_for_layout, $loadHelpers, true);
|
$this->output = View::_render($layoutFileName, $data_for_layout, $loadHelpers, true);
|
||||||
} else {
|
} else {
|
||||||
$this->output = $this->_render($layout_fn, $data_for_layout, $loadHelpers);
|
$this->output = $this->_render($layoutFileName, $data_for_layout, $loadHelpers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->output === false) {
|
if ($this->output === false) {
|
||||||
$this->output = $this->_render($layout_fn, $data_for_layout);
|
$this->output = $this->_render($layoutFileName, $data_for_layout);
|
||||||
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>", true), $layout_fn, $this->output), E_USER_ERROR);
|
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>", true), $layoutFileName, $this->output), E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ class XmlNode extends Object {
|
||||||
|
|
||||||
if (is_array($value) || is_object($value)) {
|
if (is_array($value) || is_object($value)) {
|
||||||
$this->normalize($value);
|
$this->normalize($value);
|
||||||
} elseif(!empty($value) || $value === 0 || $value === '0') {
|
} elseif (!empty($value) || $value === 0 || $value === '0') {
|
||||||
$this->createTextNode($value);
|
$this->createTextNode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ class Xml extends XmlNode {
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$data = $vals[$i];
|
$data = $vals[$i];
|
||||||
$data = array_merge(array('tag' => null, 'value' => null, 'attributes' => array()), $data);
|
$data = array_merge(array('tag' => null, 'value' => null, 'attributes' => array()), $data);
|
||||||
switch($data['type']) {
|
switch ($data['type']) {
|
||||||
case "open" :
|
case "open" :
|
||||||
$xml =& $xml->createElement($data['tag'], $data['value'], $data['attributes']);
|
$xml =& $xml->createElement($data['tag'], $data['value'], $data['attributes']);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue