Permalink
Browse files

Merge branch '2.1' into 2.2

  • Loading branch information...
ceeram committed Apr 23, 2012
2 parents 7fe333c + d98c087 commit 74ee75b0ef7ac24e5fc548858336139df82eb19a
@@ -16,4 +16,4 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
-<?php echo $content_for_layout; ?>
+<?php echo $this->fetch('content'); ?>
@@ -1,2 +1,2 @@
<?php echo $scripts_for_layout; ?>
-<script type="text/javascript"><?php echo $content_for_layout; ?></script>
+<script type="text/javascript"><?php echo $this->fetch('content'); ?></script>
@@ -8,7 +8,7 @@ if (!isset($channel['title'])) {
echo $this->Rss->document(
$this->Rss->channel(
- array(), $channel, $content_for_layout
+ array(), $channel, $this->fetch('content')
)
);
-?>
+?>
@@ -1 +1 @@
-<?php echo $content_for_layout; ?>
+<?php echo $this->fetch('content'); ?>
@@ -24,8 +24,8 @@
</head>
<body>
- <?php echo $content_for_layout;?>
+ <?php echo $this->fetch('content');?>
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
</body>
-</html>
+</html>
@@ -17,6 +17,6 @@
*/
?>
-<?php echo $content_for_layout;?>
+<?php echo $this->fetch('content');?>
This email was sent using the CakePHP Framework, http://cakephp.org.
@@ -16,4 +16,4 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
-<?php echo $content_for_layout; ?>
+<?php echo $this->fetch('content'); ?>
@@ -1,2 +1,2 @@
<?php echo $scripts_for_layout; ?>
-<script type="text/javascript"><?php echo $content_for_layout; ?></script>
+<script type="text/javascript"><?php echo $this->fetch('content'); ?></script>
@@ -8,7 +8,7 @@ if (!isset($channel['title'])) {
echo $this->Rss->document(
$this->Rss->channel(
- array(), $channel, $content_for_layout
+ array(), $channel, $this->fetch('content')
)
);
-?>
+?>
@@ -1 +1 @@
-<?php echo $content_for_layout; ?>
+<?php echo $this->fetch('content'); ?>
View
@@ -1629,7 +1629,7 @@ public function save($data = null, $validate = true, $fieldList = array()) {
if (!array_key_exists('format', $colType)) {
$time = strtotime('now');
} else {
- $time = $colType['formatter']($colType['format']);
+ $time = call_user_func($colType['formatter'], $colType['format']);
}
if (!empty($this->whitelist)) {
$this->whitelist[] = $updateCol;
@@ -320,21 +320,31 @@ protected function _processFiles() {
if (isset($_FILES['data'])) {
foreach ($_FILES['data'] as $key => $data) {
- foreach ($data as $model => $fields) {
- if (is_array($fields)) {
- foreach ($fields as $field => $value) {
- if (is_array($value)) {
- foreach ($value as $k => $v) {
- $this->data[$model][$field][$k][$key] = $v;
- }
- } else {
- $this->data[$model][$field][$key] = $value;
- }
- }
- } else {
- $this->data[$model][$key] = $fields;
- }
- }
+ $this->_processFileData('', $data, $key);
+ }
+ }
+ }
+
+/**
+ * Recursively walks the FILES array restructuring the data
+ * into something sane and useable.
+ *
+ * @param string $path The dot separated path to insert $data into.
+ * @param array $data The data to traverse/insert.
+ * @param string $field The terminal field name, which is the top level key in $_FILES.
+ * @return void
+ */
+ protected function _processFileData($path, $data, $field) {
+ foreach ($data as $key => $fields) {
+ $newPath = $key;
+ if (!empty($path)) {
+ $newPath = $path . '.' . $key;
+ }
+ if (is_array($fields)) {
+ $this->_processFileData($newPath, $fields, $field);
+ } else {
+ $newPath .= '.' . $field;
+ $this->data = Set::insert($this->data, $newPath, $fields);
}
}
}
@@ -1014,7 +1014,8 @@ public static function reverse($params, $full = false) {
public static function normalize($url = '/') {
if (is_array($url)) {
$url = Router::url($url);
- } elseif (preg_match('/^[a-z\-]+:\/\//', $url)) {
+ }
+ if (preg_match('/^[a-z\-]+:\/\//', $url)) {
return $url;
}
$request = Router::getRequest();
@@ -163,7 +163,6 @@ public function testPluginModel() {
), App::RESET);
CakePlugin::load('TestPlugin');
- $ts = date('Y-m-d H:i:s');
$PluginModel = ClassRegistry::init('TestPlugin.TestPluginAuthUser');
$user['id'] = 1;
$user['username'] = 'gwoo';
@@ -185,7 +184,7 @@ public function testPluginModel() {
'username' => 'gwoo',
'created' => '2007-03-17 01:16:23'
);
- $this->assertTrue($result['updated'] >= $ts);
+ $this->assertEquals(self::date(), $result['updated']);
unset($result['updated']);
$this->assertEquals($expected, $result);
CakePlugin::unload();
@@ -1866,7 +1866,6 @@ public function testWithAssociation() {
'doomed' => true
))));
- $ts = date('Y-m-d H:i:s');
$TestModel->save();
$TestModel->hasAndBelongsToMany['SomethingElse']['order'] = 'SomethingElse.id ASC';
@@ -1920,7 +1919,7 @@ public function testWithAssociation() {
)
)
);
- $this->assertTrue($result['Something']['updated'] >= $ts);
+ $this->assertEquals(self::date(), $result['Something']['updated']);
unset($result['Something']['updated']);
$this->assertEquals($expected, $result);
}
Oops, something went wrong.

0 comments on commit 74ee75b

Please sign in to comment.