Merge branch '1.2' of github.com:cakephp/cakephp1x into 1.2

This commit is contained in:
Mark Story 2010-02-02 20:39:25 -05:00
commit 7daad4acaf
9 changed files with 40 additions and 28 deletions

View file

@ -1 +1 @@
1.2.5 1.2.6

View file

@ -21,5 +21,5 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
return $config['Cake.version'] = '1.2.5'; return $config['Cake.version'] = '1.2.6';
?> ?>

View file

@ -366,21 +366,24 @@ class Dispatcher extends Object {
$this->webroot = $base .'/'; $this->webroot = $base .'/';
return $base; return $base;
} }
$file = '/' . basename($baseUrl);
$base = dirname($baseUrl);
if ($base === DS || $base === '.') { $file = '/' . basename($baseUrl);
$base = ''; $base = dirname($baseUrl);
}
$this->webroot = $base .'/';
if ($base === DS || $base === '.') {
$base = '';
}
$this->webroot = $base .'/';
if (!empty($base)) {
if (strpos($this->webroot, $dir) === false) { if (strpos($this->webroot, $dir) === false) {
$this->webroot .= $dir . '/' ; $this->webroot .= $dir . '/' ;
} }
if (strpos($this->webroot, $webroot) === false) { if (strpos($this->webroot, $webroot) === false) {
$this->webroot .= $webroot . '/'; $this->webroot .= $webroot . '/';
} }
return $base . $file; }
return $base . $file;
} }
/** /**
* Restructure params in case we're serving a plugin. * Restructure params in case we're serving a plugin.

View file

@ -807,11 +807,16 @@ class TreeBehavior extends ModelBehavior {
$this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created); $this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
$this->__sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created); $this->__sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
} else { } else {
$parentNode = array_values($Model->find('first', array( $values = $Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $parentId), 'conditions' => array($scope, $Model->escapeField() => $parentId),
'fields' => array($Model->primaryKey, $left, $right), 'fields' => array($Model->primaryKey, $left, $right),
'recursive' => $recursive 'recursive' => $recursive
))); ));
if ($values === false) {
return false;
}
$parentNode = array_values($values);
if (empty($parentNode) || empty($parentNode[0])) { if (empty($parentNode) || empty($parentNode[0])) {
return false; return false;

View file

@ -1824,14 +1824,15 @@ class Model extends Overloadable {
*/ */
function _deleteLinks($id) { function _deleteLinks($id) {
foreach ($this->hasAndBelongsToMany as $assoc => $data) { foreach ($this->hasAndBelongsToMany as $assoc => $data) {
$records = $this->{$data['with']}->find('all', array( $joinModel = $data['with'];
'conditions' => array_merge(array($this->{$data['with']}->escapeField($data['foreignKey']) => $id)), $records = $this->{$joinModel}->find('all', array(
'fields' => $this->{$data['with']}->primaryKey, 'conditions' => array_merge(array($this->{$joinModel}->escapeField($data['foreignKey']) => $id)),
'fields' => $this->{$joinModel}->primaryKey,
'recursive' => -1 'recursive' => -1
)); ));
if (!empty($records)) { if (!empty($records)) {
foreach ($records as $record) { foreach ($records as $record) {
$this->{$data['with']}->delete($record[$this->{$data['with']}->alias][$this->{$data['with']}->primaryKey]); $this->{$joinModel}->delete($record[$this->{$joinModel}->alias][$this->{$joinModel}->primaryKey]);
} }
} }
} }

View file

@ -167,7 +167,7 @@ class TextHelper extends AppHelper {
if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) { if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
return $text; return $text;
} }
$totalLength = mb_strlen($ending); $totalLength = mb_strlen(strip_tags($ending));
$openTags = array(); $openTags = array();
$truncate = ''; $truncate = '';
preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
@ -209,7 +209,6 @@ class TextHelper extends AppHelper {
break; break;
} }
} }
} else { } else {
if (mb_strlen($text) <= $length) { if (mb_strlen($text) <= $length) {
return $text; return $text;

View file

@ -25,7 +25,7 @@ if (Configure::read() == 0):
endif; endif;
?> ?>
<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="http://code.cakephp.org/wiki/changelog/1_2_x_x"><?php __('Read the changelog'); ?> </a> <a href="http://cakephp.lighthouseapp.com/projects/42648/changelog-1-2-6"><?php __('Read the changelog'); ?> </a>
<?php <?php
if (Configure::read() > 0): if (Configure::read() > 0):
Debugger::checkSessionKey(); Debugger::checkSessionKey();
@ -135,8 +135,10 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
<ul><li><?php __('Community mailing list'); ?></li></ul></li> <ul><li><?php __('Community mailing list'); ?></li></ul></li>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a> <li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
<ul><li><?php __('Live chat about CakePHP'); ?></li></ul></li> <ul><li><?php __('Live chat about CakePHP'); ?></li></ul></li>
<li><a href="https://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a> <li><a href="http://github.com/cakephp/"><?php __('CakePHP Code'); ?> </a>
<ul><li><?php __('For the Development of CakePHP (Tickets, Git browser, Roadmap, Changelogs)'); ?></li></ul></li> <ul><li><?php __('For the Development of CakePHP Git repository, Downloads'); ?></li></ul></li>
<li><a href="http://cakephp.lighthouseapp.com/"><?php __('CakePHP Lighthouse'); ?> </a>
<ul><li><?php __('CakePHP Tickets, Wiki pages, Roadmap'); ?></li></ul></li>
<li><a href="http://www.cakeforge.org"><?php __('CakeForge'); ?> </a> <li><a href="http://www.cakeforge.org"><?php __('CakeForge'); ?> </a>
<ul><li><?php __('Open Development for CakePHP'); ?></li></ul></li> <ul><li><?php __('Open Development for CakePHP'); ?></li></ul></li>
<li><a href="http://astore.amazon.com/cakesoftwaref-20/"><?php __('Book Store'); ?> </a> <li><a href="http://astore.amazon.com/cakesoftwaref-20/"><?php __('Book Store'); ?> </a>

View file

@ -1102,7 +1102,7 @@ class DispatcherTest extends CakeTestCase {
$result = $Dispatcher->baseUrl(); $result = $Dispatcher->baseUrl();
$expected = '/index.php'; $expected = '/index.php';
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$expectedWebroot = '/app/webroot/'; $expectedWebroot = '/';
$this->assertEqual($expectedWebroot, $Dispatcher->webroot); $this->assertEqual($expectedWebroot, $Dispatcher->webroot);
Configure::write('App.baseUrl', '/CakeBB/app/webroot/index.php'); Configure::write('App.baseUrl', '/CakeBB/app/webroot/index.php');
@ -1173,12 +1173,12 @@ class DispatcherTest extends CakeTestCase {
*/ */
function testMissingController() { function testMissingController() {
$Dispatcher =& new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl', '/index.php');
$url = 'some_controller/home/param:value/param2:value2'; $url = 'some_controller/home/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
$expected = array('missingController', array(array( $expected = array('missingController', array(array(
'className' => 'SomeControllerController', 'className' => 'SomeControllerController',
'webroot' => '/app/webroot/', 'webroot' => '/',
'url' => 'some_controller/home/param:value/param2:value2', 'url' => 'some_controller/home/param:value/param2:value2',
'base' => '/index.php' 'base' => '/index.php'
))); )));
@ -1200,7 +1200,7 @@ class DispatcherTest extends CakeTestCase {
$expected = array('privateAction', array(array( $expected = array('privateAction', array(array(
'className' => 'SomePagesController', 'className' => 'SomePagesController',
'action' => '_protected', 'action' => '_protected',
'webroot' => '/app/webroot/', 'webroot' => '/',
'url' => 'some_pages/_protected/param:value/param2:value2', 'url' => 'some_pages/_protected/param:value/param2:value2',
'base' => '/index.php' 'base' => '/index.php'
))); )));
@ -1214,7 +1214,7 @@ class DispatcherTest extends CakeTestCase {
*/ */
function testMissingAction() { function testMissingAction() {
$Dispatcher =& new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl', '/index.php');
$url = 'some_pages/home/param:value/param2:value2'; $url = 'some_pages/home/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return'=> 1)); $controller = $Dispatcher->dispatch($url, array('return'=> 1));
@ -1222,7 +1222,7 @@ class DispatcherTest extends CakeTestCase {
$expected = array('missingAction', array(array( $expected = array('missingAction', array(array(
'className' => 'SomePagesController', 'className' => 'SomePagesController',
'action' => 'home', 'action' => 'home',
'webroot' => '/app/webroot/', 'webroot' => '/',
'url' => '/index.php/some_pages/home/param:value/param2:value2', 'url' => '/index.php/some_pages/home/param:value/param2:value2',
'base' => '/index.php' 'base' => '/index.php'
))); )));
@ -1237,7 +1237,7 @@ class DispatcherTest extends CakeTestCase {
$expected = array('missingAction', array(array( $expected = array('missingAction', array(array(
'className' => 'SomePagesController', 'className' => 'SomePagesController',
'action' => 'redirect', 'action' => 'redirect',
'webroot' => '/app/webroot/', 'webroot' => '/',
'url' => '/index.php/some_pages/redirect/param:value/param2:value2', 'url' => '/index.php/some_pages/redirect/param:value/param2:value2',
'base' => '/index.php' 'base' => '/index.php'
))); )));

View file

@ -99,6 +99,8 @@ class TextHelperTest extends CakeTestCase {
$this->assertIdentical($this->Text->{$m}($text7, 255), $text7); $this->assertIdentical($this->Text->{$m}($text7, 255), $text7);
$this->assertIdentical($this->Text->{$m}($text7, 15), 'El moño está...'); $this->assertIdentical($this->Text->{$m}($text7, 15), 'El moño está...');
$this->assertIdentical($this->Text->{$m}($text8, 15), 'Vive la R'.chr(195).chr(169).'pu...'); $this->assertIdentical($this->Text->{$m}($text8, 15), 'Vive la R'.chr(195).chr(169).'pu...');
$this->assertIdentical($this->Text->{$m}($text1, 25, 'Read more'), 'The quick brown Read more');
$this->assertIdentical($this->Text->{$m}($text1, 25, '<a href="http://www.google.com/">Read more</a>', true, true), 'The quick brown <a href="http://www.google.com/">Read more</a>');
if ($this->method == 'truncate') { if ($this->method == 'truncate') {
$this->method = 'trim'; $this->method = 'trim';