mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch '2.7' into 2.8
This commit is contained in:
commit
40d628530a
16 changed files with 130 additions and 35 deletions
|
@ -42,7 +42,7 @@ $cakeVersion = __d('cake_dev', 'CakePHP %s', Configure::version())
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
||||||
<?php echo $this->Session->flash(); ?>
|
<?php echo $this->Flash->render(); ?>
|
||||||
|
|
||||||
<?php echo $this->fetch('content'); ?>
|
<?php echo $this->fetch('content'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -384,9 +384,9 @@ class ControllerTask extends BakeTask {
|
||||||
* @return array Components the user wants to use.
|
* @return array Components the user wants to use.
|
||||||
*/
|
*/
|
||||||
public function doComponents() {
|
public function doComponents() {
|
||||||
$components = array('Paginator');
|
$components = array('Paginator', 'Flash');
|
||||||
return array_merge($components, $this->_doPropertyChoices(
|
return array_merge($components, $this->_doPropertyChoices(
|
||||||
__d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent?"),
|
__d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent and FlashComponent?"),
|
||||||
__d('cake_console', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
|
__d('cake_console', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,10 @@
|
||||||
$this-><?php echo $currentModelName; ?>->create();
|
$this-><?php echo $currentModelName; ?>->create();
|
||||||
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
||||||
<?php if ($wannaUseSession): ?>
|
<?php if ($wannaUseSession): ?>
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
$this->Flash->success(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
$this->Flash->error(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -94,10 +94,10 @@
|
||||||
if ($this->request->is(array('post', 'put'))) {
|
if ($this->request->is(array('post', 'put'))) {
|
||||||
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
||||||
<?php if ($wannaUseSession): ?>
|
<?php if ($wannaUseSession): ?>
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
$this->Flash->success(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
$this->Flash->error(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -138,9 +138,9 @@
|
||||||
$this->request->allowMethod('post', 'delete');
|
$this->request->allowMethod('post', 'delete');
|
||||||
if ($this-><?php echo $currentModelName; ?>->delete()) {
|
if ($this-><?php echo $currentModelName; ?>->delete()) {
|
||||||
<?php if ($wannaUseSession): ?>
|
<?php if ($wannaUseSession): ?>
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.'));
|
$this->Flash->success(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be deleted. Please, try again.'));
|
$this->Flash->error(__('The <?php echo strtolower($singularHumanName); ?> could not be deleted. Please, try again.'));
|
||||||
}
|
}
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
|
@ -2895,6 +2895,10 @@ class Model extends Object implements CakeEventListener {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->useTable === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (bool)$this->find('count', array(
|
return (bool)$this->find('count', array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
$this->alias . '.' . $this->primaryKey => $id
|
$this->alias . '.' . $this->primaryKey => $id
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ class CakeResponse {
|
||||||
'download' => null
|
'download' => null
|
||||||
);
|
);
|
||||||
|
|
||||||
if (strpos($path, '..' . DS) !== false) {
|
if (strpos($path, '../') !== false || strpos($path, '..\\') !== false) {
|
||||||
throw new NotFoundException(__d(
|
throw new NotFoundException(__d(
|
||||||
'cake_dev',
|
'cake_dev',
|
||||||
'The requested file contains `..` and will not be read.'
|
'The requested file contains `..` and will not be read.'
|
||||||
|
|
|
@ -222,7 +222,7 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
public function testDoComponentsNo() {
|
public function testDoComponentsNo() {
|
||||||
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
|
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
|
||||||
$result = $this->Task->doComponents();
|
$result = $this->Task->doComponents();
|
||||||
$this->assertSame(array('Paginator'), $result);
|
$this->assertSame(array('Paginator', 'Flash'), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security '));
|
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security '));
|
||||||
|
|
||||||
$result = $this->Task->doComponents();
|
$result = $this->Task->doComponents();
|
||||||
$expected = array('Paginator', 'RequestHandler', 'Security');
|
$expected = array('Paginator', 'Flash', 'RequestHandler', 'Security');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security, , '));
|
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security, , '));
|
||||||
|
|
||||||
$result = $this->Task->doComponents();
|
$result = $this->Task->doComponents();
|
||||||
$expected = array('Paginator', 'RequestHandler', 'Security');
|
$expected = array('Paginator', 'Flash', 'RequestHandler', 'Security');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1334,7 +1334,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$Article->useTable = false;
|
$Article->useTable = false;
|
||||||
$Article->id = 1;
|
$Article->id = 1;
|
||||||
$result = $Article->exists();
|
$result = $Article->exists();
|
||||||
$this->assertTrue($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -554,6 +554,44 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that validates() still performs correctly when useTable = false on the model.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testValidatesWithNoTable() {
|
||||||
|
$TestModel = new TheVoid();
|
||||||
|
$TestModel->validate = array(
|
||||||
|
'title' => array(
|
||||||
|
'notEmpty' => array(
|
||||||
|
'rule' => array('notBlank'),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
'tooShort' => array(
|
||||||
|
'rule' => array('minLength', 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$data = array(
|
||||||
|
'TheVoid' => array(
|
||||||
|
'title' => 'too short',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$TestModel->create($data);
|
||||||
|
$result = $TestModel->validates();
|
||||||
|
$this->assertFalse($result);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'TheVoid' => array(
|
||||||
|
'id' => '1',
|
||||||
|
'title' => 'A good title',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$TestModel->create($data);
|
||||||
|
$result = $TestModel->validates();
|
||||||
|
$this->assertTrue($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that validates() checks all the 'with' associations as well for validation
|
* test that validates() checks all the 'with' associations as well for validation
|
||||||
* as this can cause partial/wrong data insertion.
|
* as this can cause partial/wrong data insertion.
|
||||||
|
|
|
@ -2785,18 +2785,9 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel = new TheVoid();
|
$TestModel = new TheVoid();
|
||||||
$this->assertFalse($TestModel->exists());
|
$this->assertFalse($TestModel->exists());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* testRecordExistsMissingTable method
|
|
||||||
*
|
|
||||||
* @expectedException PDOException
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testRecordExistsMissingTable() {
|
|
||||||
$TestModel = new TheVoid();
|
|
||||||
$TestModel->id = 5;
|
$TestModel->id = 5;
|
||||||
$TestModel->exists();
|
$this->assertFalse($TestModel->exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1167,17 +1167,29 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test file with ..
|
* test file with ../
|
||||||
*
|
*
|
||||||
* @expectedException NotFoundException
|
* @expectedException NotFoundException
|
||||||
* @expectedExceptionMessage The requested file contains `..` and will not be read.
|
* @expectedExceptionMessage The requested file contains `..` and will not be read.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFileWithPathTraversal() {
|
public function testFileWithForwardSlashPathTraversal() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$response->file('my/../cat.gif');
|
$response->file('my/../cat.gif');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test file with ..\
|
||||||
|
*
|
||||||
|
* @expectedException NotFoundException
|
||||||
|
* @expectedExceptionMessage The requested file contains `..` and will not be read.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testFileWithBackwardSlashPathTraversal() {
|
||||||
|
$response = new CakeResponse();
|
||||||
|
$response->file('my\..\cat.gif');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Although unlikely, a file may contain dots in its filename.
|
* Although unlikely, a file may contain dots in its filename.
|
||||||
* This should be allowed, as long as the dots doesn't specify a path (../ or ..\)
|
* This should be allowed, as long as the dots doesn't specify a path (../ or ..\)
|
||||||
|
|
|
@ -19,17 +19,28 @@
|
||||||
App::uses('CakeText', 'Utility');
|
App::uses('CakeText', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CakeTextTest class
|
* CakeText Tests
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.Utility
|
* @package Cake.Test.Case.Utility
|
||||||
|
* @coversDefaultClass CakeText
|
||||||
*/
|
*/
|
||||||
class CakeTextTest extends CakeTestCase {
|
class CakeTextTest extends CakeTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup object under test
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->Text = new CakeText();
|
$this->Text = new CakeText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down object under test
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
unset($this->Text);
|
unset($this->Text);
|
||||||
|
@ -39,6 +50,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* testUuidGeneration method
|
* testUuidGeneration method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::uuid
|
||||||
*/
|
*/
|
||||||
public function testUuidGeneration() {
|
public function testUuidGeneration() {
|
||||||
$result = CakeText::uuid();
|
$result = CakeText::uuid();
|
||||||
|
@ -51,6 +63,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* testMultipleUuidGeneration method
|
* testMultipleUuidGeneration method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::uuid
|
||||||
*/
|
*/
|
||||||
public function testMultipleUuidGeneration() {
|
public function testMultipleUuidGeneration() {
|
||||||
$check = array();
|
$check = array();
|
||||||
|
@ -70,6 +83,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* testInsert method
|
* testInsert method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::insert
|
||||||
*/
|
*/
|
||||||
public function testInsert() {
|
public function testInsert() {
|
||||||
$string = 'some string';
|
$string = 'some string';
|
||||||
|
@ -231,6 +245,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* test Clean Insert
|
* test Clean Insert
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::cleanInsert
|
||||||
*/
|
*/
|
||||||
public function testCleanInsert() {
|
public function testCleanInsert() {
|
||||||
$result = CakeText::cleanInsert(':incomplete', array(
|
$result = CakeText::cleanInsert(':incomplete', array(
|
||||||
|
@ -271,6 +286,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* CakeText::insert().
|
* CakeText::insert().
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::insert
|
||||||
*/
|
*/
|
||||||
public function testAutoIgnoreBadInsertData() {
|
public function testAutoIgnoreBadInsertData() {
|
||||||
$data = array('foo' => 'alpha', 'bar' => 'beta', 'fale' => array());
|
$data = array('foo' => 'alpha', 'bar' => 'beta', 'fale' => array());
|
||||||
|
@ -282,6 +298,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* testTokenize method
|
* testTokenize method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::tokenize
|
||||||
*/
|
*/
|
||||||
public function testTokenize() {
|
public function testTokenize() {
|
||||||
$result = CakeText::tokenize('A,(short,boring test)');
|
$result = CakeText::tokenize('A,(short,boring test)');
|
||||||
|
@ -318,6 +335,7 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* testReplaceWithQuestionMarkInString method
|
* testReplaceWithQuestionMarkInString method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::insert
|
||||||
*/
|
*/
|
||||||
public function testReplaceWithQuestionMarkInString() {
|
public function testReplaceWithQuestionMarkInString() {
|
||||||
$string = ':a, :b and :c?';
|
$string = ':a, :b and :c?';
|
||||||
|
@ -331,6 +349,8 @@ class CakeTextTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @dataProvider wordWrapProvider
|
* @dataProvider wordWrapProvider
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::wordWrap
|
||||||
|
* @covers ::_wordWrap
|
||||||
*/
|
*/
|
||||||
public function testWordWrap($text, $width, $break = "\n", $cut = false) {
|
public function testWordWrap($text, $width, $break = "\n", $cut = false) {
|
||||||
$result = CakeText::wordWrap($text, $width, $break, $cut);
|
$result = CakeText::wordWrap($text, $width, $break, $cut);
|
||||||
|
@ -364,6 +384,8 @@ class CakeTextTest extends CakeTestCase {
|
||||||
* test that wordWrap() properly handle unicode strings.
|
* test that wordWrap() properly handle unicode strings.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::wordWrap
|
||||||
|
* @covers ::_wordWrap
|
||||||
*/
|
*/
|
||||||
public function testWordWrapUnicodeAware() {
|
public function testWordWrapUnicodeAware() {
|
||||||
$text = 'Но вим омниюм факёльиси элыктрам, мюнырэ лэгыры векж ыт. Выльёт квюандо нюмквуам ты кюм. Зыд эю рыбюм.';
|
$text = 'Но вим омниюм факёльиси элыктрам, мюнырэ лэгыры векж ыт. Выльёт квюандо нюмквуам ты кюм. Зыд эю рыбюм.';
|
||||||
|
@ -391,6 +413,8 @@ TEXT;
|
||||||
* test that wordWrap() properly handle newline characters.
|
* test that wordWrap() properly handle newline characters.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::wordWrap
|
||||||
|
* @covers ::_wordWrap
|
||||||
*/
|
*/
|
||||||
public function testWordWrapNewlineAware() {
|
public function testWordWrapNewlineAware() {
|
||||||
$text = 'This is a line that is almost the 55 chars long.
|
$text = 'This is a line that is almost the 55 chars long.
|
||||||
|
@ -408,6 +432,9 @@ TEXT;
|
||||||
* test wrap method.
|
* test wrap method.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::wrap
|
||||||
|
* @covers ::wordWrap
|
||||||
|
* @covers ::_wordWrap
|
||||||
*/
|
*/
|
||||||
public function testWrap() {
|
public function testWrap() {
|
||||||
$text = 'This is the song that never ends. This is the song that never ends. This is the song that never ends.';
|
$text = 'This is the song that never ends. This is the song that never ends. This is the song that never ends.';
|
||||||
|
@ -443,6 +470,9 @@ TEXT;
|
||||||
* test wrap() indenting
|
* test wrap() indenting
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::wrap
|
||||||
|
* @covers ::wordWrap
|
||||||
|
* @covers ::_wordWrap
|
||||||
*/
|
*/
|
||||||
public function testWrapIndent() {
|
public function testWrapIndent() {
|
||||||
$text = 'This is the song that never ends. This is the song that never ends. This is the song that never ends.';
|
$text = 'This is the song that never ends. This is the song that never ends. This is the song that never ends.';
|
||||||
|
@ -459,6 +489,7 @@ TEXT;
|
||||||
* testTruncate method
|
* testTruncate method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::truncate
|
||||||
*/
|
*/
|
||||||
public function testTruncate() {
|
public function testTruncate() {
|
||||||
$text1 = 'The quick brown fox jumps over the lazy dog';
|
$text1 = 'The quick brown fox jumps over the lazy dog';
|
||||||
|
@ -564,6 +595,7 @@ podeís adquirirla.</span></p>
|
||||||
* testTruncate method with non utf8 sites
|
* testTruncate method with non utf8 sites
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::truncate
|
||||||
*/
|
*/
|
||||||
public function testTruncateLegacy() {
|
public function testTruncateLegacy() {
|
||||||
Configure::write('App.encoding', 'ISO-8859-1');
|
Configure::write('App.encoding', 'ISO-8859-1');
|
||||||
|
@ -587,6 +619,7 @@ podeís adquirirla.</span></p>
|
||||||
* testTail method
|
* testTail method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::tail
|
||||||
*/
|
*/
|
||||||
public function testTail() {
|
public function testTail() {
|
||||||
$text1 = 'The quick brown fox jumps over the lazy dog';
|
$text1 = 'The quick brown fox jumps over the lazy dog';
|
||||||
|
@ -630,6 +663,7 @@ podeís adquirirla.</span></p>
|
||||||
* testHighlight method
|
* testHighlight method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::highlight
|
||||||
*/
|
*/
|
||||||
public function testHighlight() {
|
public function testHighlight() {
|
||||||
$text = 'This is a test text';
|
$text = 'This is a test text';
|
||||||
|
@ -664,6 +698,7 @@ podeís adquirirla.</span></p>
|
||||||
* testHighlightHtml method
|
* testHighlightHtml method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::highlight
|
||||||
*/
|
*/
|
||||||
public function testHighlightHtml() {
|
public function testHighlightHtml() {
|
||||||
$text1 = '<p>strongbow isn’t real cider</p>';
|
$text1 = '<p>strongbow isn’t real cider</p>';
|
||||||
|
@ -690,6 +725,7 @@ podeís adquirirla.</span></p>
|
||||||
* testHighlightMulti method
|
* testHighlightMulti method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::highlight
|
||||||
*/
|
*/
|
||||||
public function testHighlightMulti() {
|
public function testHighlightMulti() {
|
||||||
$text = 'This is a test text';
|
$text = 'This is a test text';
|
||||||
|
@ -703,6 +739,7 @@ podeís adquirirla.</span></p>
|
||||||
* testStripLinks method
|
* testStripLinks method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::stripLinks
|
||||||
*/
|
*/
|
||||||
public function testStripLinks() {
|
public function testStripLinks() {
|
||||||
$text = 'This is a test text';
|
$text = 'This is a test text';
|
||||||
|
@ -730,6 +767,7 @@ podeís adquirirla.</span></p>
|
||||||
* testHighlightCaseInsensitivity method
|
* testHighlightCaseInsensitivity method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::highlight
|
||||||
*/
|
*/
|
||||||
public function testHighlightCaseInsensitivity() {
|
public function testHighlightCaseInsensitivity() {
|
||||||
$text = 'This is a Test text';
|
$text = 'This is a Test text';
|
||||||
|
@ -746,6 +784,7 @@ podeís adquirirla.</span></p>
|
||||||
* testExcerpt method
|
* testExcerpt method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::excerpt
|
||||||
*/
|
*/
|
||||||
public function testExcerpt() {
|
public function testExcerpt() {
|
||||||
$text = 'This is a phrase with test text to play with';
|
$text = 'This is a phrase with test text to play with';
|
||||||
|
@ -786,6 +825,7 @@ podeís adquirirla.</span></p>
|
||||||
* testExcerptCaseInsensitivity method
|
* testExcerptCaseInsensitivity method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::excerpt
|
||||||
*/
|
*/
|
||||||
public function testExcerptCaseInsensitivity() {
|
public function testExcerptCaseInsensitivity() {
|
||||||
$text = 'This is a phrase with test text to play with';
|
$text = 'This is a phrase with test text to play with';
|
||||||
|
@ -803,6 +843,7 @@ podeís adquirirla.</span></p>
|
||||||
* testListGeneration method
|
* testListGeneration method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @covers ::toList
|
||||||
*/
|
*/
|
||||||
public function testListGeneration() {
|
public function testListGeneration() {
|
||||||
$result = $this->Text->toList(array());
|
$result = $this->Text->toList(array());
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$this->BakeArticle->create();
|
$this->BakeArticle->create();
|
||||||
if ($this->BakeArticle->save($this->request->data)) {
|
if ($this->BakeArticle->save($this->request->data)) {
|
||||||
$this->Session->setFlash(__('The bake article has been saved.'));
|
$this->Flash->success(__('The bake article has been saved.'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
|
$this->Flash->error(__('The bake article could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
||||||
|
@ -56,10 +56,10 @@
|
||||||
}
|
}
|
||||||
if ($this->request->is(array('post', 'put'))) {
|
if ($this->request->is(array('post', 'put'))) {
|
||||||
if ($this->BakeArticle->save($this->request->data)) {
|
if ($this->BakeArticle->save($this->request->data)) {
|
||||||
$this->Session->setFlash(__('The bake article has been saved.'));
|
$this->Flash->success(__('The bake article has been saved.'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
|
$this->Flash->error(__('The bake article could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
||||||
|
@ -83,9 +83,9 @@
|
||||||
}
|
}
|
||||||
$this->request->allowMethod('post', 'delete');
|
$this->request->allowMethod('post', 'delete');
|
||||||
if ($this->BakeArticle->delete()) {
|
if ($this->BakeArticle->delete()) {
|
||||||
$this->Session->setFlash(__('The bake article has been deleted.'));
|
$this->Flash->success(__('The bake article has been deleted.'));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The bake article could not be deleted. Please, try again.'));
|
$this->Flash->error(__('The bake article could not be deleted. Please, try again.'));
|
||||||
}
|
}
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
<div id="<?php echo $key; ?>Message" class="<?php echo !empty($params['class']) ? $params['class'] : 'message'; ?>"><?php echo $message; ?></div>
|
<?php
|
||||||
|
$class = 'message';
|
||||||
|
if (!empty($params['class'])) {
|
||||||
|
$class .= ' ' . $params['class'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div id="<?php echo h($key) ?>Message" class="<?php echo h($class) ?>"><?php echo h($message) ?></div>
|
||||||
|
|
1
lib/Cake/View/Elements/Flash/error.ctp
Normal file
1
lib/Cake/View/Elements/Flash/error.ctp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<div id="<?php echo h($key) ?>Message" class="message error"><?php echo h($message) ?></div>
|
1
lib/Cake/View/Elements/Flash/success.ctp
Normal file
1
lib/Cake/View/Elements/Flash/success.ctp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<div id="<?php echo h($key) ?>Message" class="message success"><?php echo h($message) ?></div>
|
|
@ -84,6 +84,7 @@ class FlashHelper extends AppHelper {
|
||||||
|
|
||||||
$flash = $options + $flash;
|
$flash = $options + $flash;
|
||||||
CakeSession::delete("Message.$key");
|
CakeSession::delete("Message.$key");
|
||||||
|
$flash['key'] = $key;
|
||||||
|
|
||||||
return $this->_View->element($flash['element'], $flash);
|
return $this->_View->element($flash['element'], $flash);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue