Skip to content

Commit 5749893

Browse files
author
gwoo
committed
Merge branch 'local/svn/1.2.x.x' into 1.2
2 parents 6535e62 + d2b4995 commit 5749893

File tree

30 files changed

+628
-126
lines changed

30 files changed

+628
-126
lines changed

cake/console/libs/acl.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function setParent() {
205205
extract($this->__dataVars());
206206
$data = array(
207207
$class => array(
208-
'id' => $this->args[1],
208+
'id' => $this->args[1],
209209
'parent_id' => $this->args[2]
210210
)
211211
);
@@ -336,7 +336,12 @@ function view() {
336336
}
337337
$last = $n[$class]['rght'];
338338
$count = count($stack);
339-
$this->out(str_repeat(' ', $count) . "[" . $n[$class]['id'] . "]" . $n[$class]['alias']."\n");
339+
$indent = str_repeat(' ', $count);
340+
if ($n[$class]['alias']) {
341+
$this->out($indent . "[" . $n[$class]['id'] . "]" . $n[$class]['alias']."\n");
342+
} else {
343+
$this->out($indent . "[" . $n[$class]['id'] . "]" . $n[$class]['model'] . '.' . $n[$class]['foreign_key'] . "\n");
344+
}
340345
}
341346
$this->hr();
342347
}

cake/console/libs/tasks/db_config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function bake($configs) {
281281
if ($info['persistent'] === false) {
282282
$info['persistent'] = 'false';
283283
} else {
284-
$info['persistent'] = 'false';
284+
$info['persistent'] = ($info['persistent'] == true) ? 'true' : 'false';
285285
}
286286

287287
$oldConfigs[] = array(

cake/console/libs/templates/views/form.ctp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@
5050
<div class="actions">
5151
<ul>
5252
<?php if ($action != 'add'):?>
53-
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
53+
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
5454
<?php endif;?>
55-
<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index'));?>";?></li>
55+
<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action' => 'index'));?>";?></li>
5656
<?php
5757
$done = array();
5858
foreach ($associations as $type => $data) {
5959
foreach ($data as $alias => $details) {
6060
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
61-
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
62-
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
61+
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
62+
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
6363
$done[] = $details['controller'];
6464
}
6565
}

cake/console/libs/templates/views/index.ctp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ foreach (\${$pluralVar} as \${$singularVar}):
5454
foreach ($associations['belongsTo'] as $alias => $details) {
5555
if ($field === $details['foreignKey']) {
5656
$isKey = true;
57-
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";
57+
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";
5858
break;
5959
}
6060
}
@@ -65,9 +65,9 @@ foreach (\${$pluralVar} as \${$singularVar}):
6565
}
6666

6767
echo "\t\t<td class=\"actions\">\n";
68-
echo "\t\t\t<?php echo \$html->link(__('View', true), array('action'=>'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
69-
echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
70-
echo "\t\t\t<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
68+
echo "\t\t\t<?php echo \$html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
69+
echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
70+
echo "\t\t\t<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
7171
echo "\t\t</td>\n";
7272
echo "\t</tr>\n";
7373

@@ -78,18 +78,18 @@ echo "<?php endforeach; ?>\n";
7878
<div class="paging">
7979
<?php echo "\t<?php echo \$paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
8080
| <?php echo "\t<?php echo \$paginator->numbers();?>\n"?>
81-
<?php echo "\t<?php echo \$paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>\n";?>
81+
<?php echo "\t<?php echo \$paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
8282
</div>
8383
<div class="actions">
8484
<ul>
85-
<li><?php echo "<?php echo \$html->link(__('New {$singularHumanName}', true), array('action'=>'add')); ?>";?></li>
85+
<li><?php echo "<?php echo \$html->link(__('New {$singularHumanName}', true), array('action' => 'add')); ?>";?></li>
8686
<?php
8787
$done = array();
8888
foreach ($associations as $type => $data) {
8989
foreach ($data as $alias => $details) {
9090
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
91-
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
92-
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
91+
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
92+
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
9393
$done[] = $details['controller'];
9494
}
9595
}

cake/console/libs/templates/views/view.ctp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ foreach ($fields as $field) {
3333
if ($field === $details['foreignKey']) {
3434
$isKey = true;
3535
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize(Inflector::underscore($alias))."'); ?></dt>\n";
36-
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&nbsp;\n\t\t</dd>\n";
36+
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&nbsp;\n\t\t</dd>\n";
3737
break;
3838
}
3939
}
@@ -49,17 +49,17 @@ foreach ($fields as $field) {
4949
<div class="actions">
5050
<ul>
5151
<?php
52-
echo "\t\t<li><?php echo \$html->link(__('Edit {$singularHumanName}', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
53-
echo "\t\t<li><?php echo \$html->link(__('Delete {$singularHumanName}', true), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
54-
echo "\t\t<li><?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index')); ?> </li>\n";
55-
echo "\t\t<li><?php echo \$html->link(__('New {$singularHumanName}', true), array('action'=>'add')); ?> </li>\n";
52+
echo "\t\t<li><?php echo \$html->link(__('Edit {$singularHumanName}', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
53+
echo "\t\t<li><?php echo \$html->link(__('Delete {$singularHumanName}', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
54+
echo "\t\t<li><?php echo \$html->link(__('List {$pluralHumanName}', true), array('action' => 'index')); ?> </li>\n";
55+
echo "\t\t<li><?php echo \$html->link(__('New {$singularHumanName}', true), array('action' => 'add')); ?> </li>\n";
5656

5757
$done = array();
5858
foreach ($associations as $type => $data) {
5959
foreach ($data as $alias => $details) {
6060
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
61-
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
62-
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
61+
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
62+
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
6363
$done[] = $details['controller'];
6464
}
6565
}
@@ -84,7 +84,7 @@ if (!empty($associations['hasOne'])) :
8484
<?php echo "<?php endif; ?>\n";?>
8585
<div class="actions">
8686
<ul>
87-
<li><?php echo "<?php echo \$html->link(__('Edit ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
87+
<li><?php echo "<?php echo \$html->link(__('Edit ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
8888
</ul>
8989
</div>
9090
</div>
@@ -131,9 +131,9 @@ echo "\t<?php
131131
}
132132

133133
echo "\t\t\t<td class=\"actions\">\n";
134-
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller'=> '{$details['controller']}', 'action'=>'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
135-
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller'=> '{$details['controller']}', 'action'=>'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
136-
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller'=> '{$details['controller']}', 'action'=>'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
134+
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
135+
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
136+
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
137137
echo "\t\t\t</td>\n";
138138
echo "\t\t</tr>\n";
139139

@@ -143,7 +143,7 @@ echo "\t<?php endforeach; ?>\n";
143143
<?php echo "<?php endif; ?>\n\n";?>
144144
<div class="actions">
145145
<ul>
146-
<li><?php echo "<?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add'));?>";?> </li>
146+
<li><?php echo "<?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
147147
</ul>
148148
</div>
149149
</div>

cake/libs/controller/components/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function startup(&$controller) {
339339
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
340340
if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) {
341341
$query = $controller->params['url'];
342-
unset($query['url']);
342+
unset($query['url'], $query['ext']);
343343
$url .= Router::queryString($query, array());
344344
}
345345
$this->Session->write('Auth.redirect', $url);

cake/libs/controller/scaffold.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ function __construct(&$controller, $params) {
161161
$displayField = $this->ScaffoldModel->displayField;
162162
$singularVar = Inflector::variable($modelClass);
163163
$pluralVar = Inflector::variable($this->controller->name);
164-
$singularHumanName = Inflector::humanize($modelClass);
165-
$pluralHumanName = Inflector::humanize($this->controller->name);
164+
$singularHumanName = Inflector::humanize(Inflector::underscore($modelClass));
165+
$pluralHumanName = Inflector::humanize(Inflector::underscore($this->controller->name));
166166
$scaffoldFields = array_keys($this->ScaffoldModel->schema());
167167
$associations = $this->__associations();
168168

cake/libs/inflector.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ function pluralize($word) {
249249
$_this->pluralRules['regexIrregular'] = $regexIrregular;
250250
}
251251

252-
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
253-
$_this->pluralized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
254-
return $_this->pluralized[$word];
255-
}
256-
257252
if (preg_match('/^(' . $regexUninflected . ')$/i', $word, $regs)) {
258253
$_this->pluralized[$word] = $word;
259254
return $word;
260255
}
261256

257+
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
258+
$_this->pluralized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
259+
return $_this->pluralized[$word];
260+
}
261+
262262
foreach ($pluralRules as $rule => $replacement) {
263263
if (preg_match($rule, $word)) {
264264
$_this->pluralized[$word] = preg_replace($rule, $replacement, $word);
@@ -385,16 +385,16 @@ function singularize($word) {
385385
$_this->singularRules['regexIrregular'] = $regexIrregular;
386386
}
387387

388-
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
389-
$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
390-
return $_this->singularized[$word];
391-
}
392-
393388
if (preg_match('/^(' . $regexUninflected . ')$/i', $word, $regs)) {
394389
$_this->singularized[$word] = $word;
395390
return $word;
396391
}
397392

393+
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
394+
$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
395+
return $_this->singularized[$word];
396+
}
397+
398398
foreach ($singularRules as $rule => $replacement) {
399399
if (preg_match($rule, $word)) {
400400
$_this->singularized[$word] = preg_replace($rule, $replacement, $word);

cake/libs/model/behaviors/tree.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,10 @@ function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
877877
$scope['NOT'][$Model->alias . '.' . $Model->primaryKey] = $Model->id;
878878
}
879879
}
880+
$name = $Model->alias . '.' . $right;
880881
list($edge) = array_values($Model->find('first', array(
881882
'conditions' => $scope,
882-
'fields' => $db->calculate($Model, 'max', array($right)),
883+
'fields' => $db->calculate($Model, 'max', array($name, $right)),
883884
'recursive' => $recursive
884885
)));
885886
return (empty($edge[$right])) ? 0 : $edge[$right];
@@ -895,9 +896,10 @@ function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
895896
*/
896897
function __getMin($Model, $scope, $left, $recursive = -1) {
897898
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
899+
$name = $Model->alias . '.' . $left;
898900
list($edge) = array_values($Model->find('first', array(
899901
'conditions' => $scope,
900-
'fields' => $db->calculate($Model, 'min', array($left)),
902+
'fields' => $db->calculate($Model, 'min', array($name, $left)),
901903
'recursive' => $recursive
902904
)));
903905
return (empty($edge[$left])) ? 0 : $edge[$left];

cake/libs/model/datasources/dbo/dbo_mssql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ function lastError() {
384384
$error = mssql_get_last_message($this->connection);
385385

386386
if ($error) {
387-
if (!preg_match('/contexto de la base de datos a|contesto di database|changed database/i', $error)) {
387+
if (!preg_match('/contexto de la base de datos a|contesto di database|changed database|datenbankkontext/i', $error)) {
388388
return $error;
389389
}
390390
}

0 commit comments

Comments
 (0)