mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge branch '2.0' into 2.0-request
Conflicts: cake/dispatcher.php cake/libs/controller/components/request_handler.php cake/libs/view/helpers/form.php cake/tests/cases/libs/controller/components/request_handler.test.php cake/tests/cases/libs/controller/controller.test.php cake/tests/cases/libs/view/helpers/js.test.php cake/tests/cases/libs/view/helpers/paginator.test.php
This commit is contained in:
commit
ecf7811b7a
329 changed files with 1885 additions and 898 deletions
|
@ -1,7 +1,7 @@
|
||||||
;<?php die() ?>
|
;<?php die() ?>
|
||||||
; SVN FILE: $Id$
|
; SVN FILE: $Id$
|
||||||
;/**
|
;/**
|
||||||
; * Short description for file.
|
; * ACL configuration
|
||||||
; *
|
; *
|
||||||
; *
|
; *
|
||||||
; * PHP versions 4 and 5
|
; * PHP versions 4 and 5
|
||||||
|
|
|
@ -157,6 +157,11 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of CakePHP's session cookie.
|
* The name of CakePHP's session cookie.
|
||||||
|
*
|
||||||
|
* Note the guidelines for Session names states: "The session name references
|
||||||
|
* the session id in cookies and URLs. It should contain only alphanumeric
|
||||||
|
* characters."
|
||||||
|
* @link http://php.net/session_name
|
||||||
*/
|
*/
|
||||||
Configure::write('Session.cookie', 'CAKEPHP');
|
Configure::write('Session.cookie', 'CAKEPHP');
|
||||||
|
|
||||||
|
@ -183,8 +188,8 @@
|
||||||
* Valid values:
|
* Valid values:
|
||||||
*
|
*
|
||||||
* 'high' Session timeout in 'Session.timeout' x 10
|
* 'high' Session timeout in 'Session.timeout' x 10
|
||||||
* 'medium' Session timeout in 'Session.timeout' x 100
|
* 'medium' Session timeout in 'Session.timeout' x 5040
|
||||||
* 'low' Session timeout in 'Session.timeout' x 300
|
* 'low' Session timeout in 'Session.timeout' x 2628000
|
||||||
*
|
*
|
||||||
* CakePHP session IDs are also regenerated between requests if
|
* CakePHP session IDs are also regenerated between requests if
|
||||||
* 'Security.level' is set to 'high'.
|
* 'Security.level' is set to 'high'.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Routes configuration
|
||||||
*
|
*
|
||||||
* In this file, you set up routes to your controllers and their actions.
|
* In this file, you set up routes to your controllers and their actions.
|
||||||
* Routes are very important mechanism that allows you to freely connect
|
* Routes are very important mechanism that allows you to freely connect
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* CSS helping functions
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -21,14 +21,16 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
header('HTTP/1.1 404 Not Found');
|
header('HTTP/1.1 404 Not Found');
|
||||||
exit('File Not Found');
|
exit('File Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Ensure required classes are available.
|
||||||
*/
|
*/
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
uses('file');
|
uses('file');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Make clean CSS
|
||||||
*
|
*
|
||||||
* @param unknown_type $path
|
* @param unknown_type $path
|
||||||
* @param unknown_type $name
|
* @param unknown_type $name
|
||||||
|
@ -44,7 +46,7 @@ if (!class_exists('File')) {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Write CSS cache
|
||||||
*
|
*
|
||||||
* @param unknown_type $path
|
* @param unknown_type $path
|
||||||
* @param unknown_type $content
|
* @param unknown_type $content
|
||||||
|
|
|
@ -82,6 +82,3 @@
|
||||||
$Dispatcher = new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->dispatch();
|
$Dispatcher->dispatch();
|
||||||
}
|
}
|
||||||
if (Configure::read() > 0) {
|
|
||||||
echo "<!-- " . round(microtime(true) - $TIME_START, 4) . "s -->";
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.libs
|
* @subpackage cake.app.webroot
|
||||||
* @since CakePHP(tm) v 1.2.0.4433
|
* @since CakePHP(tm) v 1.2.0.4433
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,5 +18,5 @@
|
||||||
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
// +--------------------------------------------------------------------------------------------+ //
|
// +--------------------------------------------------------------------------------------------+ //
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
1.3.0
|
1.3.2
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,4 @@
|
||||||
* @since CakePHP(tm) v 1.1.11.4062
|
* @since CakePHP(tm) v 1.1.11.4062
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
return $config['Cake.version'] = '1.3.0';
|
return $config['Cake.version'] = '1.3.2';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Path configuration
|
||||||
*
|
*
|
||||||
* In this file you set paths to different directories used by Cake.
|
* In this file you set paths to different directories used by Cake.
|
||||||
*
|
*
|
||||||
|
|
|
@ -432,7 +432,7 @@ class ShellDispatcher {
|
||||||
$printOptions = '(' . implode('/', $options) . ')';
|
$printOptions = '(' . implode('/', $options) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($default == null) {
|
if ($default === null) {
|
||||||
$this->stdout($prompt . " $printOptions \n" . '> ', false);
|
$this->stdout($prompt . " $printOptions \n" . '> ', false);
|
||||||
} else {
|
} else {
|
||||||
$this->stdout($prompt . " $printOptions \n" . "[$default] > ", false);
|
$this->stdout($prompt . " $printOptions \n" . "[$default] > ", false);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* CakePHP Console Shell
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Internationalization Management Shell
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -551,13 +551,13 @@ class Shell extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the proper singular model key for associations
|
* Creates the proper underscored model key for associations
|
||||||
*
|
*
|
||||||
* @param string $name Controller class name
|
* @param string $name Model class name
|
||||||
* @return string Singular model key
|
* @return string Singular model key
|
||||||
*/
|
*/
|
||||||
protected function _modelKey($name) {
|
protected function _modelKey($name) {
|
||||||
return Inflector::underscore(Inflector::singularize($name)) . '_id';
|
return Inflector::underscore($name) . '_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ControllerTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
$this->_interactive();
|
return $this->_interactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->args[0])) {
|
if (isset($this->args[0])) {
|
||||||
|
@ -175,7 +175,7 @@ class ControllerTask extends BakeTask {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list($wannaBakeCrud, $wannaBakeCrud) = $this->_askAboutMethods();
|
list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($wannaBakeCrud) == 'y') {
|
if (strtolower($wannaBakeCrud) == 'y') {
|
||||||
|
@ -186,6 +186,7 @@ class ControllerTask extends BakeTask {
|
||||||
$actions .= $this->bakeActions($controllerName, $admin, strtolower($wannaUseSession) == 'y');
|
$actions .= $this->bakeActions($controllerName, $admin, strtolower($wannaUseSession) == 'y');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$baked = false;
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
|
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
||||||
|
@ -202,6 +203,7 @@ class ControllerTask extends BakeTask {
|
||||||
$this->bakeTest($controllerName);
|
$this->bakeTest($controllerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $baked;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,7 +284,7 @@ class ControllerTask extends BakeTask {
|
||||||
$controllerPath = $this->_controllerPath($controllerName);
|
$controllerPath = $this->_controllerPath($controllerName);
|
||||||
$pluralName = $this->_pluralName($currentModelName);
|
$pluralName = $this->_pluralName($currentModelName);
|
||||||
$singularName = Inflector::variable($currentModelName);
|
$singularName = Inflector::variable($currentModelName);
|
||||||
$singularHumanName = $this->_singularHumanName($currentModelName);
|
$singularHumanName = $this->_singularHumanName($controllerName);
|
||||||
$pluralHumanName = $this->_pluralName($controllerName);
|
$pluralHumanName = $this->_pluralName($controllerName);
|
||||||
|
|
||||||
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
|
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
|
||||||
|
|
|
@ -487,7 +487,7 @@ class ExtractTask extends Shell {
|
||||||
foreach ($this->__paths as $path) {
|
foreach ($this->__paths as $path) {
|
||||||
$Folder = new Folder($path);
|
$Folder = new Folder($path);
|
||||||
$files = $Folder->findRecursive('.*\.(php|ctp|thtml|inc|tpl)', true);
|
$files = $Folder->findRecursive('.*\.(php|ctp|thtml|inc|tpl)', true);
|
||||||
$this->__files += $files;
|
$this->__files = array_merge($this->__files, $files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ class TemplateTask extends Shell {
|
||||||
protected function _findThemes() {
|
protected function _findThemes() {
|
||||||
$paths = App::path('shells');
|
$paths = App::path('shells');
|
||||||
$core = array_pop($paths);
|
$core = array_pop($paths);
|
||||||
$core = str_replace('libs' . DS, '', $core);
|
$separator = DS === '/' ? '/' : '\\\\';
|
||||||
|
$core = preg_replace('#libs' . $separator . '$#', '', $core);
|
||||||
$paths[] = $core;
|
$paths[] = $core;
|
||||||
$Folder =& new Folder($core . 'templates' . DS . 'default');
|
$Folder =& new Folder($core . 'templates' . DS . 'default');
|
||||||
$contents = $Folder->read();
|
$contents = $Folder->read();
|
||||||
|
|
|
@ -94,14 +94,12 @@ class TestTask extends BakeTask {
|
||||||
$this->out(sprintf(__('Path: %s'), $this->path));
|
$this->out(sprintf(__('Path: %s'), $this->path));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$selection = null;
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$type = Inflector::camelize($type);
|
$type = Inflector::camelize($type);
|
||||||
if (!in_array($type, $this->classTypes)) {
|
if (!in_array($type, $this->classTypes)) {
|
||||||
unset($type);
|
$this->error(sprintf('Incorrect type provided. Please choose one of %s', implode(', ', $this->classTypes)));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
if (!$type) {
|
|
||||||
$type = $this->getObjectType();
|
$type = $this->getObjectType();
|
||||||
}
|
}
|
||||||
$className = $this->getClassName($type);
|
$className = $this->getClassName($type);
|
||||||
|
|
|
@ -195,6 +195,7 @@ class ViewTask extends BakeTask {
|
||||||
$actions = $this->_methodsToBake();
|
$actions = $this->_methodsToBake();
|
||||||
}
|
}
|
||||||
$this->bakeActions($actions, $vars);
|
$this->bakeActions($actions, $vars);
|
||||||
|
$actions = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +291,7 @@ class ViewTask extends BakeTask {
|
||||||
$primaryKey = $modelObj->primaryKey;
|
$primaryKey = $modelObj->primaryKey;
|
||||||
$displayField = $modelObj->displayField;
|
$displayField = $modelObj->displayField;
|
||||||
$singularVar = Inflector::variable($modelClass);
|
$singularVar = Inflector::variable($modelClass);
|
||||||
$singularHumanName = $this->_singularHumanName($modelClass);
|
$singularHumanName = $this->_singularHumanName($this->controllerName);
|
||||||
$schema = $modelObj->schema(true);
|
$schema = $modelObj->schema(true);
|
||||||
$fields = array_keys($schema);
|
$fields = array_keys($schema);
|
||||||
$associations = $this->__associations($modelObj);
|
$associations = $this->__associations($modelObj);
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs
|
* @subpackage cake.cake.console.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4433
|
* @since CakePHP(tm) v 1.2.0.4433
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Application level Controller
|
||||||
*
|
*
|
||||||
* This file is application-wide controller file. You can put all
|
* This file is application-wide controller file. You can put all
|
||||||
* application-wide controller-related methods here.
|
* application-wide controller-related methods here.
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for class.
|
* Application Controller
|
||||||
*
|
*
|
||||||
* Add your application-wide methods in the class below, your controllers
|
* Add your application-wide methods in the class below, your controllers
|
||||||
* will inherit them.
|
* will inherit them.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Application level View Helper
|
||||||
*
|
*
|
||||||
* This file is application-wide helper file. You can put all
|
* This file is application-wide helper file. You can put all
|
||||||
* application-wide helper-related methods here.
|
* application-wide helper-related methods here.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;<?php exit() ?>
|
;<?php exit() ?>
|
||||||
; SVN FILE: $Id$
|
; SVN FILE: $Id$
|
||||||
;/**
|
;/**
|
||||||
; * Short description for file.
|
; * ACL Configuration
|
||||||
; *
|
; *
|
||||||
; *
|
; *
|
||||||
; * PHP versions 4 and 5
|
; * PHP versions 4 and 5
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Routes Configuration
|
||||||
*
|
*
|
||||||
* In this file, you set up routes to your controllers and their actions.
|
* In this file, you set up routes to your controllers and their actions.
|
||||||
* Routes are very important mechanism that allows you to freely connect
|
* Routes are very important mechanism that allows you to freely connect
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* CSS Functions
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -23,14 +23,14 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Ensure required files are included
|
||||||
*/
|
*/
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
require LIBS . 'file.php';
|
require LIBS . 'file.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Make clean CSS
|
||||||
*
|
*
|
||||||
* @param unknown_type $path
|
* @param unknown_type $path
|
||||||
* @param unknown_type $name
|
* @param unknown_type $name
|
||||||
|
@ -47,7 +47,7 @@ if (!class_exists('File')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Write CSS cache
|
||||||
*
|
*
|
||||||
* @param unknown_type $path
|
* @param unknown_type $path
|
||||||
* @param unknown_type $content
|
* @param unknown_type $content
|
||||||
|
|
|
@ -82,6 +82,3 @@
|
||||||
$Dispatcher = new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->dispatch();
|
$Dispatcher->dispatch();
|
||||||
}
|
}
|
||||||
if (Configure::read() > 0) {
|
|
||||||
echo "<!-- " . round(microtime(true) - $TIME_START, 4) . "s -->";
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.libs
|
* @subpackage cake.cake.tests.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4433
|
* @since CakePHP(tm) v 1.2.0.4433
|
||||||
|
|
|
@ -147,6 +147,7 @@ class Dispatcher extends Object {
|
||||||
'base' => $request->base
|
'base' => $request->base
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_invoke($controller, $request);
|
return $this->_invoke($controller, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
cake/libs/cache/file.php
vendored
4
cake/libs/cache/file.php
vendored
|
@ -210,7 +210,11 @@ class FileEngine extends CacheEngine {
|
||||||
$now = time();
|
$now = time();
|
||||||
$threshold = $now - $this->settings['duration'];
|
$threshold = $now - $this->settings['duration'];
|
||||||
}
|
}
|
||||||
|
$prefixLength = strlen($this->settings['prefix']);
|
||||||
while (($entry = $dir->read()) !== false) {
|
while (($entry = $dir->read()) !== false) {
|
||||||
|
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($this->_setKey($entry) === false) {
|
if ($this->_setKey($entry) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ class CakeLog {
|
||||||
*
|
*
|
||||||
* For an explaination of these parameters, see CakeLog::write()
|
* For an explaination of these parameters, see CakeLog::write()
|
||||||
*
|
*
|
||||||
* @param string $key The keyname for this logger, used to revmoe the logger later.
|
* @param string $key The keyname for this logger, used to remove the logger later.
|
||||||
* @param array $config Array of configuration information for the logger
|
* @param array $config Array of configuration information for the logger
|
||||||
* @return boolean success of configuration.
|
* @return boolean success of configuration.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
@ -114,14 +114,6 @@ class CakeSession extends Object {
|
||||||
*/
|
*/
|
||||||
public $id = null;
|
public $id = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Session Started
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $_started = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hostname
|
* Hostname
|
||||||
*
|
*
|
||||||
|
@ -130,6 +122,14 @@ class CakeSession extends Object {
|
||||||
*/
|
*/
|
||||||
public $host = null;
|
public $host = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session timeout multiplier factor
|
||||||
|
*
|
||||||
|
* @var ineteger
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $timeout = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -206,7 +206,7 @@ class CakeSession extends Object {
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
$this->__initSession();
|
$this->__initSession();
|
||||||
$this->_started = $this->__startSession();
|
$this->__startSession();
|
||||||
return $this->started();
|
return $this->started();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class CakeSession extends Object {
|
||||||
* @return boolean True if session has been started.
|
* @return boolean True if session has been started.
|
||||||
*/
|
*/
|
||||||
function started() {
|
function started() {
|
||||||
if (isset($_SESSION) && $this->_started) {
|
if (isset($_SESSION) && session_id()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -448,29 +448,13 @@ class CakeSession extends Object {
|
||||||
*/
|
*/
|
||||||
function __initSession() {
|
function __initSession() {
|
||||||
$iniSet = function_exists('ini_set');
|
$iniSet = function_exists('ini_set');
|
||||||
|
|
||||||
if ($iniSet && env('HTTPS')) {
|
if ($iniSet && env('HTTPS')) {
|
||||||
ini_set('session.cookie_secure', 1);
|
ini_set('session.cookie_secure', 1);
|
||||||
}
|
}
|
||||||
|
if ($iniSet && ($this->security === 'high' || $this->security === 'medium')) {
|
||||||
switch ($this->security) {
|
ini_set('session.referer_check', $this->host);
|
||||||
case 'high':
|
|
||||||
$this->cookieLifeTime = 0;
|
|
||||||
if ($iniSet) {
|
|
||||||
ini_set('session.referer_check', $this->host);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'medium':
|
|
||||||
$this->cookieLifeTime = 7 * 86400;
|
|
||||||
if ($iniSet) {
|
|
||||||
ini_set('session.referer_check', $this->host);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'low':
|
|
||||||
default:
|
|
||||||
$this->cookieLifeTime = 788940000;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();
|
||||||
|
|
||||||
switch (Configure::read('Session.save')) {
|
switch (Configure::read('Session.save')) {
|
||||||
case 'cake':
|
case 'cake':
|
||||||
|
@ -591,15 +575,14 @@ class CakeSession extends Object {
|
||||||
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
|
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
|
||||||
$time = $this->read('Config.time');
|
$time = $this->read('Config.time');
|
||||||
$this->write('Config.time', $this->sessionTime);
|
$this->write('Config.time', $this->sessionTime);
|
||||||
|
|
||||||
if (Configure::read('Security.level') === 'high') {
|
if (Configure::read('Security.level') === 'high') {
|
||||||
$check = $this->read('Config.timeout');
|
$check = $this->read('Config.timeout');
|
||||||
$check = $check - 1;
|
$check -= 1;
|
||||||
$this->write('Config.timeout', $check);
|
$this->write('Config.timeout', $check);
|
||||||
|
|
||||||
if (time() > ($time - (Security::inactiveMins() * Configure::read('Session.timeout')) + 2) || $check < 1) {
|
if (time() > ($time - (Security::inactiveMins() * Configure::read('Session.timeout')) + 2) || $check < 1) {
|
||||||
$this->renew();
|
$this->renew();
|
||||||
$this->write('Config.timeout', 10);
|
$this->write('Config.timeout', Security::inactiveMins());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->valid = true;
|
$this->valid = true;
|
||||||
|
@ -611,7 +594,7 @@ class CakeSession extends Object {
|
||||||
} else {
|
} else {
|
||||||
$this->write('Config.userAgent', $this->_userAgent);
|
$this->write('Config.userAgent', $this->_userAgent);
|
||||||
$this->write('Config.time', $this->sessionTime);
|
$this->write('Config.time', $this->sessionTime);
|
||||||
$this->write('Config.timeout', 10);
|
$this->write('Config.timeout', Security::inactiveMins());
|
||||||
$this->valid = true;
|
$this->valid = true;
|
||||||
$this->__setError(1, 'Session is valid');
|
$this->__setError(1, 'Session is valid');
|
||||||
}
|
}
|
||||||
|
@ -738,21 +721,7 @@ class CakeSession extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __write($id, $data) {
|
function __write($id, $data) {
|
||||||
switch (Configure::read('Security.level')) {
|
$expires = time() + Configure::read('Session.timeout') * Security::inactiveMins();
|
||||||
case 'medium':
|
|
||||||
$factor = 100;
|
|
||||||
break;
|
|
||||||
case 'low':
|
|
||||||
$factor = 300;
|
|
||||||
break;
|
|
||||||
case 'high':
|
|
||||||
default:
|
|
||||||
$factor = 10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$expires = time() + Configure::read('Session.timeout') * $factor;
|
|
||||||
|
|
||||||
$model =& ClassRegistry::getObject('Session');
|
$model =& ClassRegistry::getObject('Session');
|
||||||
$return = $model->save(compact('id', 'data', 'expires'));
|
$return = $model->save(compact('id', 'data', 'expires'));
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -788,5 +757,5 @@ class CakeSession extends Object {
|
||||||
|
|
||||||
$return = $model->deleteAll(array($model->alias . ".expires <" => $expires), false, false);
|
$return = $model->deleteAll(array($model->alias . ".expires <" => $expires), false, false);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Application level Controller
|
||||||
*
|
*
|
||||||
* This file is application-wide controller file. You can put all
|
* This file is application-wide controller file. You can put all
|
||||||
* application-wide controller-related methods here.
|
* application-wide controller-related methods here.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs.controller
|
* @subpackage cake.cake.libs.controller
|
||||||
* @link http://book.cakephp.org/view/62/Components
|
* @link http://book.cakephp.org/view/993/Components
|
||||||
*/
|
*/
|
||||||
class Component extends Object {
|
class Component extends Object {
|
||||||
|
|
||||||
|
|
|
@ -456,7 +456,7 @@ class AuthComponent extends Object {
|
||||||
'loginAction' => array(
|
'loginAction' => array(
|
||||||
'controller' => Inflector::underscore(Inflector::pluralize($model)),
|
'controller' => Inflector::underscore(Inflector::pluralize($model)),
|
||||||
'action' => 'login',
|
'action' => 'login',
|
||||||
'plugin' => $plugin,
|
'plugin' => Inflector::underscore($plugin),
|
||||||
),
|
),
|
||||||
'sessionKey' => 'Auth.' . $model,
|
'sessionKey' => 'Auth.' . $model,
|
||||||
'logoutRedirect' => $this->loginAction,
|
'logoutRedirect' => $this->loginAction,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Cookie Component
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Email Component
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -228,9 +228,7 @@ class EmailComponent extends Object{
|
||||||
* @access public
|
* @access public
|
||||||
* @link http://book.cakephp.org/view/1290/Sending-A-Message-Using-SMTP
|
* @link http://book.cakephp.org/view/1290/Sending-A-Message-Using-SMTP
|
||||||
*/
|
*/
|
||||||
public $smtpOptions = array(
|
public $smtpOptions = array();
|
||||||
'port'=> 25, 'host' => 'localhost', 'timeout' => 30
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Placeholder for any errors that might happen with the
|
* Placeholder for any errors that might happen with the
|
||||||
|
@ -355,7 +353,11 @@ class EmailComponent extends Object{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $this->_wrap($content);
|
if ($this->sendAs === 'text') {
|
||||||
|
$message = $this->_wrap($content);
|
||||||
|
} else {
|
||||||
|
$message = $this->_wrap($content, 998);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->template === null) {
|
if ($this->template === null) {
|
||||||
$message = $this->_formatMessage($message);
|
$message = $this->_formatMessage($message);
|
||||||
|
@ -674,10 +676,11 @@ class EmailComponent extends Object{
|
||||||
* Wrap the message using EmailComponent::$lineLength
|
* Wrap the message using EmailComponent::$lineLength
|
||||||
*
|
*
|
||||||
* @param string $message Message to wrap
|
* @param string $message Message to wrap
|
||||||
|
* @param integer $lineLength Max length of line
|
||||||
* @return array Wrapped message
|
* @return array Wrapped message
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function _wrap($message) {
|
function _wrap($message, $lineLength = null) {
|
||||||
$message = $this->_strip($message, true);
|
$message = $this->_strip($message, true);
|
||||||
$message = str_replace(array("\r\n","\r"), "\n", $message);
|
$message = str_replace(array("\r\n","\r"), "\n", $message);
|
||||||
$lines = explode("\n", $message);
|
$lines = explode("\n", $message);
|
||||||
|
@ -688,11 +691,15 @@ class EmailComponent extends Object{
|
||||||
$this->lineLength = $this->_lineLength;
|
$this->lineLength = $this->_lineLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$lineLength) {
|
||||||
|
$lineLength = $this->lineLength;
|
||||||
|
}
|
||||||
|
|
||||||
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, $lineLength, "\n", true)));
|
||||||
}
|
}
|
||||||
$formatted[] = '';
|
$formatted[] = '';
|
||||||
return $formatted;
|
return $formatted;
|
||||||
|
@ -785,7 +792,14 @@ class EmailComponent extends Object{
|
||||||
function _smtp() {
|
function _smtp() {
|
||||||
App::import('Core', array('CakeSocket'));
|
App::import('Core', array('CakeSocket'));
|
||||||
|
|
||||||
$this->__smtpConnection =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->smtpOptions));
|
$defaults = array(
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => 25,
|
||||||
|
'protocol' => 'smtp',
|
||||||
|
'timeout' => 30
|
||||||
|
);
|
||||||
|
$this->smtpOptions = array_merge($defaults, $this->smtpOptions);
|
||||||
|
$this->__smtpConnection =& new CakeSocket($this->smtpOptions);
|
||||||
|
|
||||||
if (!$this->__smtpConnection->connect()) {
|
if (!$this->__smtpConnection->connect()) {
|
||||||
$this->smtpError = $this->__smtpConnection->lastError();
|
$this->smtpError = $this->__smtpConnection->lastError();
|
||||||
|
@ -804,7 +818,7 @@ class EmailComponent extends Object{
|
||||||
$host = 'localhost';
|
$host = 'localhost';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_smtpSend("HELO {$host}", '250')) {
|
if (!$this->_smtpSend("EHLO {$host}", '250') && !$this->_smtpSend("HELO {$host}", '250')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,22 +878,34 @@ class EmailComponent extends Object{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private method for sending data to SMTP connection
|
* Protected method for sending data to SMTP connection
|
||||||
*
|
*
|
||||||
* @param string $data data to be sent to SMTP server
|
* @param string $data data to be sent to SMTP server
|
||||||
* @param mixed $checkCode code to check for in server response, false to skip
|
* @param mixed $checkCode code to check for in server response, false to skip
|
||||||
* @return bool Success
|
* @return bool Success
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function _smtpSend($data, $checkCode = '250') {
|
function _smtpSend($data, $checkCode = '250') {
|
||||||
if (!is_null($data)) {
|
if (!is_null($data)) {
|
||||||
$this->__smtpConnection->write($data . "\r\n");
|
$this->__smtpConnection->write($data . "\r\n");
|
||||||
}
|
}
|
||||||
if ($checkCode !== false) {
|
while ($checkCode !== false) {
|
||||||
$response = $this->__smtpConnection->read();
|
$response = '';
|
||||||
|
$startTime = time();
|
||||||
|
while (substr($response, -2) !== "\r\n" && ((time() - $startTime) < $this->smtpOptions['timeout'])) {
|
||||||
|
$response .= $this->__smtpConnection->read();
|
||||||
|
}
|
||||||
|
if (substr($response, -2) !== "\r\n") {
|
||||||
|
$this->smtpError = 'timeout';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$response = end(explode("\r\n", rtrim($response, "\r\n")));
|
||||||
|
|
||||||
if (preg_match('/^(' . $checkCode . ')/', $response, $code)) {
|
if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
|
||||||
return $code[0];
|
if ($code[2] === '-') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return $code[1];
|
||||||
}
|
}
|
||||||
$this->smtpError = $response;
|
$this->smtpError = $response;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -224,8 +224,9 @@ class RequestHandlerComponent extends Object {
|
||||||
*
|
*
|
||||||
* @param object $controller A reference to the controller
|
* @param object $controller A reference to the controller
|
||||||
* @param mixed $url A string or array containing the redirect location
|
* @param mixed $url A string or array containing the redirect location
|
||||||
|
* @param mixed HTTP Status for redirect
|
||||||
*/
|
*/
|
||||||
public function beforeRedirect(&$controller, $url) {
|
public function beforeRedirect(&$controller, $url, $status = null) {
|
||||||
if (!$this->request->is('ajax')) {
|
if (!$this->request->is('ajax')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +236,13 @@ class RequestHandlerComponent extends Object {
|
||||||
if (is_array($url)) {
|
if (is_array($url)) {
|
||||||
$url = Router::url($url + array('base' => false));
|
$url = Router::url($url + array('base' => false));
|
||||||
}
|
}
|
||||||
echo $this->requestAction($url, array('return'));
|
if (!empty($status)) {
|
||||||
|
$statusCode = $controller->httpCodes($status);
|
||||||
|
$code = key($statusCode);
|
||||||
|
$msg = $statusCode[$code];
|
||||||
|
$controller->header("HTTP/1.1 {$code} {$msg}");
|
||||||
|
}
|
||||||
|
echo $this->requestAction($url, array('return', 'bare' => false));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Security Component
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -18,8 +18,9 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', array('String', 'Security'));
|
App::import('Core', array('String', 'Security'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* SecurityComponent
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs.controller.components
|
* @subpackage cake.cake.libs.controller.components
|
||||||
|
@ -109,7 +110,6 @@ class SecurityComponent extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An associative array of usernames/passwords used for HTTP-authenticated logins.
|
* An associative array of usernames/passwords used for HTTP-authenticated logins.
|
||||||
* If using digest authentication, passwords should be MD5-hashed.
|
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
|
|
|
@ -841,8 +841,11 @@ class Controller extends Object {
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
$this->{$object->alias}->set($object->data);
|
if (isset($this->{$object->alias})) {
|
||||||
$errors = array_merge($errors, $this->{$object->alias}->invalidFields());
|
$object =& $this->{$object->alias};
|
||||||
|
}
|
||||||
|
$object->set($object->data);
|
||||||
|
$errors = array_merge($errors, $object->invalidFields());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->validationErrors = (!empty($errors) ? $errors : false);
|
return $this->validationErrors = (!empty($errors) ? $errors : false);
|
||||||
|
|
|
@ -474,11 +474,17 @@ if (!class_exists('ThemeView')) {
|
||||||
App::import('View', 'Theme');
|
App::import('View', 'Theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ScaffoldView provides specific view file loading features for scaffolded views.
|
||||||
|
*
|
||||||
|
* @package cake.libs.view
|
||||||
|
*/
|
||||||
class ScaffoldView extends ThemeView {
|
class ScaffoldView extends ThemeView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override _getViewFileName
|
* Override _getViewFileName Appends special scaffolding views in.
|
||||||
*
|
*
|
||||||
|
* @param string $name name of the view file to get.
|
||||||
* @return string action
|
* @return string action
|
||||||
*/
|
*/
|
||||||
protected function _getViewFileName($name = null) {
|
protected function _getViewFileName($name = null) {
|
||||||
|
|
|
@ -178,7 +178,6 @@ class File {
|
||||||
while (!feof($this->handle)) {
|
while (!feof($this->handle)) {
|
||||||
$data .= fgets($this->handle, 4096);
|
$data .= fgets($this->handle, 4096);
|
||||||
}
|
}
|
||||||
$data = trim($data);
|
|
||||||
|
|
||||||
if ($this->lock !== null) {
|
if ($this->lock !== null) {
|
||||||
flock($this->handle, LOCK_UN);
|
flock($this->handle, LOCK_UN);
|
||||||
|
@ -186,7 +185,7 @@ class File {
|
||||||
if ($bytes === false) {
|
if ($bytes === false) {
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
return $data;
|
return trim($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -957,7 +957,7 @@ class HttpSocket extends CakeSocket {
|
||||||
foreach ($cookies as $name => $cookie) {
|
foreach ($cookies as $name => $cookie) {
|
||||||
$header[] = $name.'='.$this->_escapeToken($cookie['value'], array(';'));
|
$header[] = $name.'='.$this->_escapeToken($cookie['value'], array(';'));
|
||||||
}
|
}
|
||||||
$header = $this->_buildHeader(array('Cookie' => $header), 'pragmatic');
|
$header = $this->_buildHeader(array('Cookie' => implode('; ', $header)), 'pragmatic');
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Internationalization
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Inflector {
|
||||||
'/(shoe|slave)s$/i' => '\1',
|
'/(shoe|slave)s$/i' => '\1',
|
||||||
'/(o)es$/i' => '\1',
|
'/(o)es$/i' => '\1',
|
||||||
'/ouses$/' => 'ouse',
|
'/ouses$/' => 'ouse',
|
||||||
'/uses$/' => 'us',
|
'/([^a])uses$/' => '\1us',
|
||||||
'/([m|l])ice$/i' => '\1ouse',
|
'/([m|l])ice$/i' => '\1ouse',
|
||||||
'/(x|ch|ss|sh)es$/i' => '\1',
|
'/(x|ch|ss|sh)es$/i' => '\1',
|
||||||
'/(m)ovies$/i' => '\1\2ovie',
|
'/(m)ovies$/i' => '\1\2ovie',
|
||||||
|
@ -367,7 +367,10 @@ class Inflector {
|
||||||
} else {
|
} else {
|
||||||
$_this->{$var}[$rule] = array_merge($pattern, $_this->{$var}[$rule]);
|
$_this->{$var}[$rule] = array_merge($pattern, $_this->{$var}[$rule]);
|
||||||
}
|
}
|
||||||
unset($rules[$rule], $_this->{$var}['cache' . ucfirst($rule)], $_this->{$var}['merged'][$rule]);
|
unset($rules[$rule], $_this->{$var}['cache' . ucfirst($rule)]);
|
||||||
|
if (isset($_this->{$var}['merged'][$rule])) {
|
||||||
|
unset($_this->{$var}['merged'][$rule]);
|
||||||
|
}
|
||||||
if ($type === 'plural') {
|
if ($type === 'plural') {
|
||||||
$_this->_pluralized = $_this->_tableize = array();
|
$_this->_pluralized = $_this->_tableize = array();
|
||||||
} elseif ($type === 'singular') {
|
} elseif ($type === 'singular') {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Localization
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Localization
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs
|
* @subpackage cake.cake.libs
|
||||||
|
@ -172,6 +172,7 @@ class L10n {
|
||||||
/* Urdu */ 'urd' => 'ur',
|
/* Urdu */ 'urd' => 'ur',
|
||||||
/* Venda */ 'ven' => 've',
|
/* Venda */ 'ven' => 've',
|
||||||
/* Vietnamese */ 'vie' => 'vi',
|
/* Vietnamese */ 'vie' => 'vi',
|
||||||
|
/* Welsh */ 'cym' => 'cy',
|
||||||
/* Xhosa */ 'xho' => 'xh',
|
/* Xhosa */ 'xho' => 'xh',
|
||||||
/* Yiddish */ 'yid' => 'yi',
|
/* Yiddish */ 'yid' => 'yi',
|
||||||
/* Zulu */ 'zul' => 'zu');
|
/* Zulu */ 'zul' => 'zu');
|
||||||
|
@ -315,6 +316,7 @@ class L10n {
|
||||||
'ur' => array('language' => 'Urdu', 'locale' => 'urd', 'localeFallback' => 'urd', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
'ur' => array('language' => 'Urdu', 'locale' => 'urd', 'localeFallback' => 'urd', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||||
've' => array('language' => 'Venda', 'locale' => 'ven', 'localeFallback' => 'ven', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
've' => array('language' => 'Venda', 'locale' => 'ven', 'localeFallback' => 'ven', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
'vi' => array('language' => 'Vietnamese', 'locale' => 'vie', 'localeFallback' => 'vie', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
'vi' => array('language' => 'Vietnamese', 'locale' => 'vie', 'localeFallback' => 'vie', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
|
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
'xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
'xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
'yi' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
'yi' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
'zh' => array('language' => 'Chinese', 'locale' => 'chi', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
'zh' => array('language' => 'Chinese', 'locale' => 'chi', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file
|
* ACL behavior
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs.model.behaviors
|
* @subpackage cake.cake.libs.model.behaviors
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Translate behavior
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Translate behavior
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs.model.behaviors
|
* @subpackage cake.cake.libs.model.behaviors
|
||||||
|
@ -29,6 +29,8 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for runtime configuration of model
|
* Used for runtime configuration of model
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $runtime = array();
|
public $runtime = array();
|
||||||
|
|
||||||
|
@ -45,7 +47,8 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
* $config could be empty - and translations configured dynamically by
|
* $config could be empty - and translations configured dynamically by
|
||||||
* bindTranslation() method
|
* bindTranslation() method
|
||||||
*
|
*
|
||||||
* @param array $config
|
* @param Model $model Model the behavior is being attached to.
|
||||||
|
* @param array $config Array of configuration information.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function setup(&$model, $config = array()) {
|
public function setup(&$model, $config = array()) {
|
||||||
|
@ -65,8 +68,9 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback
|
* Cleanup Callback unbinds bound translations and deletes setting information.
|
||||||
*
|
*
|
||||||
|
* @param Model $model Model being detached.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function cleanup(&$model) {
|
public function cleanup(&$model) {
|
||||||
|
@ -78,7 +82,8 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* beforeFind Callback
|
* beforeFind Callback
|
||||||
*
|
*
|
||||||
* @param array $query
|
* @param Model $model Model find is being run on.
|
||||||
|
* @param array $query Array of Query parameters.
|
||||||
* @return array Modified query
|
* @return array Modified query
|
||||||
*/
|
*/
|
||||||
public function beforeFind(&$model, $query) {
|
public function beforeFind(&$model, $query) {
|
||||||
|
@ -202,8 +207,9 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* afterFind Callback
|
* afterFind Callback
|
||||||
*
|
*
|
||||||
* @param array $results
|
* @param Model $model Model find was run on
|
||||||
* @param boolean $primary
|
* @param array $results Array of model results.
|
||||||
|
* @param boolean $primary Did the find originate on $model.
|
||||||
* @return array Modified results
|
* @return array Modified results
|
||||||
*/
|
*/
|
||||||
public function afterFind(&$model, $results, $primary) {
|
public function afterFind(&$model, $results, $primary) {
|
||||||
|
@ -246,6 +252,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* beforeValidate Callback
|
* beforeValidate Callback
|
||||||
*
|
*
|
||||||
|
* @param Model $model Model invalidFields was called on.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function beforeValidate(&$model) {
|
public function beforeValidate(&$model) {
|
||||||
|
@ -278,7 +285,8 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* afterSave Callback
|
* afterSave Callback
|
||||||
*
|
*
|
||||||
* @param boolean $created
|
* @param Model $model Model the callback is called on
|
||||||
|
* @param boolean $created Whether or not the save created a record.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function afterSave(&$model, $created) {
|
public function afterSave(&$model, $created) {
|
||||||
|
@ -321,6 +329,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* afterDelete Callback
|
* afterDelete Callback
|
||||||
*
|
*
|
||||||
|
* @param Model $model Model the callback was run on.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function afterDelete(&$model) {
|
public function afterDelete(&$model) {
|
||||||
|
@ -332,6 +341,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* Get selected locale for model
|
* Get selected locale for model
|
||||||
*
|
*
|
||||||
|
* @param Model $model Model the locale needs to be set/get on.
|
||||||
* @return mixed string or false
|
* @return mixed string or false
|
||||||
*/
|
*/
|
||||||
protected function _getLocale(&$model) {
|
protected function _getLocale(&$model) {
|
||||||
|
@ -348,8 +358,12 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get instance of model for translations
|
* Get instance of model for translations.
|
||||||
*
|
*
|
||||||
|
* If the model has a translateModel property set, this will be used as the class
|
||||||
|
* name to find/use. If no translateModel property is found 'I18nModel' will be used.
|
||||||
|
*
|
||||||
|
* @param Model $model Model to get a translatemodel for.
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function &translateModel(&$model) {
|
public function &translateModel(&$model) {
|
||||||
|
@ -452,8 +466,9 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
* Unbind translation for fields, optionally unbinds hasMany association for
|
* Unbind translation for fields, optionally unbinds hasMany association for
|
||||||
* fake field
|
* fake field
|
||||||
*
|
*
|
||||||
* @param object instance of model
|
* @param object $model instance of model
|
||||||
* @param mixed string with field, or array(field1, field2=>AssocName, field3), or null for unbind all original translations
|
* @param mixed $fields string with field, or array(field1, field2=>AssocName, field3), or null for
|
||||||
|
* unbind all original translations
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function unbindTranslation(&$model, $fields = null) {
|
function unbindTranslation(&$model, $fields = null) {
|
||||||
|
|
|
@ -241,7 +241,6 @@ class CakeSchema extends Object {
|
||||||
if (is_object($Object) && $Object->useTable !== false) {
|
if (is_object($Object) && $Object->useTable !== false) {
|
||||||
$Object->setDataSource($connection);
|
$Object->setDataSource($connection);
|
||||||
$table = $db->fullTableName($Object, false);
|
$table = $db->fullTableName($Object, false);
|
||||||
|
|
||||||
if (in_array($table, $currentTables)) {
|
if (in_array($table, $currentTables)) {
|
||||||
$key = array_search($table, $currentTables);
|
$key = array_search($table, $currentTables);
|
||||||
if (empty($tables[$table])) {
|
if (empty($tables[$table])) {
|
||||||
|
@ -258,7 +257,7 @@ class CakeSchema extends Object {
|
||||||
if (is_object($Object->$class)) {
|
if (is_object($Object->$class)) {
|
||||||
$withTable = $db->fullTableName($Object->$class, false);
|
$withTable = $db->fullTableName($Object->$class, false);
|
||||||
if (in_array($withTable, $currentTables)) {
|
if (in_array($withTable, $currentTables)) {
|
||||||
$key = array_search($table, $currentTables);
|
$key = array_search($withTable, $currentTables);
|
||||||
$tables[$withTable] = $this->__columns($Object->$class);
|
$tables[$withTable] = $this->__columns($Object->$class);
|
||||||
$tables[$withTable]['indexes'] = $db->index($Object->$class);
|
$tables[$withTable]['indexes'] = $db->index($Object->$class);
|
||||||
$tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);
|
$tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);
|
||||||
|
@ -444,7 +443,7 @@ class CakeSchema extends Object {
|
||||||
$tables = array();
|
$tables = array();
|
||||||
foreach ($new as $table => $fields) {
|
foreach ($new as $table => $fields) {
|
||||||
if ($table == 'missing') {
|
if ($table == 'missing') {
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
if (!array_key_exists($table, $old)) {
|
if (!array_key_exists($table, $old)) {
|
||||||
$tables[$table]['add'] = $fields;
|
$tables[$table]['add'] = $fields;
|
||||||
|
|
|
@ -272,9 +272,12 @@ class ConnectionManager extends Object {
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$filename = Inflector::underscore($classname);
|
$filename = Inflector::underscore($classname);
|
||||||
} else {
|
} else {
|
||||||
$filename = $config['datasource'] . '_source';
|
$filename = Inflector::underscore($config['datasource']);
|
||||||
$classname = Inflector::camelize(strtolower($filename));
|
|
||||||
}
|
}
|
||||||
|
if (substr($filename, -7) != '_source') {
|
||||||
|
$filename .= '_source';
|
||||||
|
}
|
||||||
|
$classname = Inflector::camelize(strtolower($filename));
|
||||||
}
|
}
|
||||||
return compact('filename', 'classname', 'parent', 'plugin');
|
return compact('filename', 'classname', 'parent', 'plugin');
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ class DataSource extends Object {
|
||||||
public $endQuote = null;
|
public $endQuote = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Result
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access protected
|
* @access protected
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for class.
|
* MS SQL layer for DBO
|
||||||
*
|
*
|
||||||
* Long description for class
|
* Long description for class
|
||||||
*
|
*
|
||||||
|
|
|
@ -507,9 +507,9 @@ class DboMysqlBase extends DboSource {
|
||||||
class DboMysql extends DboMysqlBase {
|
class DboMysql extends DboMysqlBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Datasource description
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $description = "MySQL DBO Driver";
|
public $description = "MySQL DBO Driver";
|
||||||
|
|
||||||
|
@ -726,8 +726,8 @@ class DboMysql extends DboMysqlBase {
|
||||||
$j = 0;
|
$j = 0;
|
||||||
|
|
||||||
while ($j < $numFields) {
|
while ($j < $numFields) {
|
||||||
$column = mysql_fetch_field($results,$j);
|
$column = mysql_fetch_field($results, $j);
|
||||||
if (!empty($column->table)) {
|
if (!empty($column->table) && strpos($column->name, $this->virtualFieldSeparator) === false) {
|
||||||
$this->map[$index++] = array($column->table, $column->name);
|
$this->map[$index++] = array($column->table, $column->name);
|
||||||
} else {
|
} else {
|
||||||
$this->map[$index++] = array(0, $column->name);
|
$this->map[$index++] = array(0, $column->name);
|
||||||
|
|
|
@ -30,9 +30,9 @@ App::import('Datasource', 'DboMysql');
|
||||||
class DboMysqli extends DboMysqlBase {
|
class DboMysqli extends DboMysqlBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Datasource Description
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $description = "Mysqli DBO Driver";
|
public $description = "Mysqli DBO Driver";
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for class.
|
* Oracle layer for DBO.
|
||||||
*
|
*
|
||||||
* Long description for class
|
* Long description for class
|
||||||
*
|
*
|
||||||
|
@ -29,17 +29,17 @@
|
||||||
class DboOracle extends DboSource {
|
class DboOracle extends DboSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Configuration options
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $config = array();
|
public $config = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Alias
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $alias = '';
|
public $alias = '';
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ class DboOracle extends DboSource {
|
||||||
private $__transactionStarted = false;
|
private $__transactionStarted = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Column definitions
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $columns = array(
|
public $columns = array(
|
||||||
|
@ -77,25 +77,25 @@ class DboOracle extends DboSource {
|
||||||
'inet' => array('name' => 'inet'));
|
'inet' => array('name' => 'inet'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Connection object
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var mixed
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
public $connection;
|
public $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Query limit
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var int
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $_limit = -1;
|
protected $_limit = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Query offset
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var int
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $_offset = 0;
|
protected $_offset = 0;
|
||||||
|
@ -109,25 +109,25 @@ class DboOracle extends DboSource {
|
||||||
protected $_map;
|
protected $_map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Current Row
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var mixed
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $_currentRow;
|
protected $_currentRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Number of rows
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var int
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $_numRows;
|
protected $_numRows;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Query results
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var mixed
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $_results;
|
protected $_results;
|
||||||
|
@ -372,9 +372,10 @@ class DboOracle extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Fetch result row
|
||||||
*
|
*
|
||||||
* @return unknown
|
* @return array
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function fetchRow() {
|
public function fetchRow() {
|
||||||
if ($this->_currentRow >= $this->_numRows) {
|
if ($this->_currentRow >= $this->_numRows) {
|
||||||
|
@ -435,10 +436,11 @@ class DboOracle extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Create trigger
|
||||||
*
|
*
|
||||||
* @param unknown_type $table
|
* @param string $table
|
||||||
* @return unknown
|
* @return mixed
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function createTrigger($table) {
|
public function createTrigger($table) {
|
||||||
$sql = "CREATE OR REPLACE TRIGGER pk_$table" . "_trigger BEFORE INSERT ON $table FOR EACH ROW BEGIN SELECT pk_$table.NEXTVAL INTO :NEW.ID FROM DUAL; END;";
|
$sql = "CREATE OR REPLACE TRIGGER pk_$table" . "_trigger BEFORE INSERT ON $table FOR EACH ROW BEGIN SELECT pk_$table.NEXTVAL INTO :NEW.ID FROM DUAL; END;";
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
class DboSqlite extends DboSource {
|
class DboSqlite extends DboSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Datasource Description
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $description = "SQLite DBO Driver";
|
public $description = "SQLite DBO Driver";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Dbo Source
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -97,6 +97,13 @@ class DboSource extends DataSource {
|
||||||
'rollback' => 'ROLLBACK'
|
'rollback' => 'ROLLBACK'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separator string for virtualField composition
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $virtualFieldSeparator = '__';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of table engine specific parameters used on table creating
|
* List of table engine specific parameters used on table creating
|
||||||
*
|
*
|
||||||
|
@ -422,10 +429,10 @@ class DboSource extends DataSource {
|
||||||
public function fetchVirtualField(&$result) {
|
public function fetchVirtualField(&$result) {
|
||||||
if (isset($result[0]) && is_array($result[0])) {
|
if (isset($result[0]) && is_array($result[0])) {
|
||||||
foreach ($result[0] as $field => $value) {
|
foreach ($result[0] as $field => $value) {
|
||||||
if (strpos($field, '__') === false) {
|
if (strpos($field, $this->virtualFieldSeparator) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list($alias, $virtual) = explode('__', $field);
|
list($alias, $virtual) = explode($this->virtualFieldSeparator, $field);
|
||||||
|
|
||||||
if (!ClassRegistry::isKeySet($alias)) {
|
if (!ClassRegistry::isKeySet($alias)) {
|
||||||
return;
|
return;
|
||||||
|
@ -898,6 +905,7 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($ins)) {
|
if (!empty($ins)) {
|
||||||
|
$ins = array_unique($ins);
|
||||||
$fetch = $this->fetchAssociated($model, $query, $ins);
|
$fetch = $this->fetchAssociated($model, $query, $ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,10 +937,10 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($ins)) {
|
if (!empty($ins)) {
|
||||||
|
$ins = array_unique($ins);
|
||||||
if (count($ins) > 1) {
|
if (count($ins) > 1) {
|
||||||
$query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query);
|
$query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query);
|
||||||
$query = str_replace('= (', 'IN (', $query);
|
$query = str_replace('= (', 'IN (', $query);
|
||||||
$query = str_replace('= (', 'IN (', $query);
|
|
||||||
} else {
|
} else {
|
||||||
$query = str_replace('{$__cakeID__$}',$ins[0], $query);
|
$query = str_replace('{$__cakeID__$}',$ins[0], $query);
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1041,6 @@ class DboSource extends DataSource {
|
||||||
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
|
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
|
||||||
if (count($ids) > 1) {
|
if (count($ids) > 1) {
|
||||||
$query = str_replace('= (', 'IN (', $query);
|
$query = str_replace('= (', 'IN (', $query);
|
||||||
$query = str_replace('= (', 'IN (', $query);
|
|
||||||
}
|
}
|
||||||
return $this->fetchAll($query, $model->cacheQueries, $model->alias);
|
return $this->fetchAll($query, $model->cacheQueries, $model->alias);
|
||||||
}
|
}
|
||||||
|
@ -1865,7 +1872,7 @@ class DboSource extends DataSource {
|
||||||
protected function _constructVirtualFields(&$model, $alias, $fields) {
|
protected function _constructVirtualFields(&$model, $alias, $fields) {
|
||||||
$virtual = array();
|
$virtual = array();
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$virtualField = $this->name("{$alias}__{$field}");
|
$virtualField = $this->name($alias . $this->virtualFieldSeparator . $field);
|
||||||
$expression = $this->__quoteFields($model->getVirtualField($field));
|
$expression = $this->__quoteFields($model->getVirtualField($field));
|
||||||
$virtual[] = '(' .$expression . ") {$this->alias} {$virtualField}";
|
$virtual[] = '(' .$expression . ") {$this->alias} {$virtualField}";
|
||||||
}
|
}
|
||||||
|
@ -2132,7 +2139,7 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
} elseif (is_array($value) && !empty($value) && !$valueInsert) {
|
} elseif (is_array($value) && !empty($value) && !$valueInsert) {
|
||||||
$keys = array_keys($value);
|
$keys = array_keys($value);
|
||||||
if (array_keys($value) === array_values(array_keys($value))) {
|
if ($keys === array_values($keys)) {
|
||||||
$count = count($value);
|
$count = count($value);
|
||||||
if ($count === 1) {
|
if ($count === 1) {
|
||||||
$data = $this->__quoteFields($key) . ' = (';
|
$data = $this->__quoteFields($key) . ' = (';
|
||||||
|
@ -2362,6 +2369,9 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
} elseif (is_object($key) && isset($key->type) && $key->type === 'expression') {
|
||||||
|
$result[] = $key->value;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/\\x20(ASC|DESC).*/i', $key, $_dir)) {
|
if (preg_match('/\\x20(ASC|DESC).*/i', $key, $_dir)) {
|
||||||
|
@ -2369,17 +2379,17 @@ class DboSource extends DataSource {
|
||||||
$key = preg_replace('/\\x20(ASC|DESC).*/i', '', $key);
|
$key = preg_replace('/\\x20(ASC|DESC).*/i', '', $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$key = trim($key);
|
||||||
|
|
||||||
|
if (is_object($model) && $model->isVirtualField($key)) {
|
||||||
|
$key = '(' . $this->__quoteFields($model->getVirtualField($key)) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($key, '.')) {
|
if (strpos($key, '.')) {
|
||||||
$key = preg_replace_callback('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', array(&$this, '__quoteMatchedField'), $key);
|
$key = preg_replace_callback('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', array(&$this, '__quoteMatchedField'), $key);
|
||||||
}
|
}
|
||||||
|
if (!preg_match('/\s/', $key) && !strpos($key, '.')) {
|
||||||
$key = trim($key);
|
$key = $this->name($key);
|
||||||
if (!preg_match('/\s/', $key) && !strpos($key,'.')) {
|
|
||||||
if (is_object($model) && $model->isVirtualField($key)) {
|
|
||||||
$key = '('.$this->__quoteFields($model->getVirtualField($key)).')';
|
|
||||||
} else {
|
|
||||||
$key = $this->name($key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$key .= ' ' . trim($dir);
|
$key .= ' ' . trim($dir);
|
||||||
$result[] = $key;
|
$result[] = $key;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
App::import('Model', 'App');
|
App::import('Model', 'App');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* ACL Node
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
|
|
|
@ -1263,7 +1263,7 @@ class Model extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->data[$this->alias][$this->primaryKey]) && empty($this->data[$this->alias][$this->primaryKey])) {
|
if (empty($this->data[$this->alias][$this->primaryKey])) {
|
||||||
unset($this->data[$this->alias][$this->primaryKey]);
|
unset($this->data[$this->alias][$this->primaryKey]);
|
||||||
}
|
}
|
||||||
$fields = $values = array();
|
$fields = $values = array();
|
||||||
|
@ -1602,7 +1602,6 @@ class Model extends Object {
|
||||||
case ($options['validate'] === 'first'):
|
case ($options['validate'] === 'first'):
|
||||||
$options['validate'] = true;
|
$options['validate'] = true;
|
||||||
$return = array();
|
$return = array();
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ($options['atomic']) {
|
if ($options['atomic']) {
|
||||||
|
@ -1616,6 +1615,10 @@ class Model extends Object {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($options['atomic'] && !$validates) {
|
||||||
|
$db->rollback($this);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
$associations = $this->getAssociated();
|
$associations = $this->getAssociated();
|
||||||
|
|
|
@ -80,7 +80,8 @@ class ModelBehavior extends Object {
|
||||||
*
|
*
|
||||||
* @param object $model Model using this behavior
|
* @param object $model Model using this behavior
|
||||||
* @param array $queryData Data used to execute this query, i.e. conditions, order, etc.
|
* @param array $queryData Data used to execute this query, i.e. conditions, order, etc.
|
||||||
* @return boolean True if the operation should continue, false if it should abort
|
* @return mixed False if the operation should abort. An array will replace the value of $query.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function beforeFind(&$model, $query) { }
|
public function beforeFind(&$model, $query) { }
|
||||||
|
|
||||||
|
@ -90,7 +91,8 @@ class ModelBehavior extends Object {
|
||||||
* @param object $model Model using this behavior
|
* @param object $model Model using this behavior
|
||||||
* @param mixed $results The results of the find operation
|
* @param mixed $results The results of the find operation
|
||||||
* @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
|
* @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
|
||||||
* @return mixed Result of the find operation
|
* @return mixed An array value will replace the value of $results - any other value will be ignored.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function afterFind(&$model, $results, $primary) { }
|
public function afterFind(&$model, $results, $primary) { }
|
||||||
|
|
||||||
|
@ -98,7 +100,8 @@ class ModelBehavior extends Object {
|
||||||
* Before validate callback
|
* Before validate callback
|
||||||
*
|
*
|
||||||
* @param object $model Model using this behavior
|
* @param object $model Model using this behavior
|
||||||
* @return boolean True if validate operation should continue, false to abort
|
* @return mixed False if the operation should abort. Any other result will continue.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function beforeValidate(&$model) { }
|
public function beforeValidate(&$model) { }
|
||||||
|
|
||||||
|
@ -106,7 +109,8 @@ class ModelBehavior extends Object {
|
||||||
* Before save callback
|
* Before save callback
|
||||||
*
|
*
|
||||||
* @param object $model Model using this behavior
|
* @param object $model Model using this behavior
|
||||||
* @return boolean True if the operation should continue, false if it should abort
|
* @return mixed False if the operation should abort. Any other result will continue.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function beforeSave(&$model) { }
|
public function beforeSave(&$model) { }
|
||||||
|
|
||||||
|
@ -123,7 +127,8 @@ class ModelBehavior extends Object {
|
||||||
*
|
*
|
||||||
* @param object $model Model using this behavior
|
* @param object $model Model using this behavior
|
||||||
* @param boolean $cascade If true records that depend on this record will also be deleted
|
* @param boolean $cascade If true records that depend on this record will also be deleted
|
||||||
* @return boolean True if the operation should continue, false if it should abort
|
* @return mixed False if the operation should abort. Any other result will continue.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function beforeDelete(&$model, $cascade = true) { }
|
public function beforeDelete(&$model, $cascade = true) { }
|
||||||
|
|
||||||
|
@ -167,7 +172,7 @@ class ModelBehavior extends Object {
|
||||||
case 5:
|
case 5:
|
||||||
return $this->{$method}($model, $params[0], $params[1], $params[2], $params[3], $params[4]);
|
return $this->{$method}($model, $params[0], $params[1], $params[2], $params[3], $params[4]);
|
||||||
default:
|
default:
|
||||||
array_unshift($params, $model);
|
$params = array_merge(array(&$model), $params);
|
||||||
return call_user_func_array(array(&$this, $method), $params);
|
return call_user_func_array(array(&$this, $method), $params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -361,6 +366,7 @@ class BehaviorCollection extends Object {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function detach($name) {
|
public function detach($name) {
|
||||||
|
list($plugin, $name) = pluginSplit($name);
|
||||||
if (isset($this->{$name})) {
|
if (isset($this->{$name})) {
|
||||||
$this->{$name}->cleanup(ClassRegistry::getObject($this->modelName));
|
$this->{$name}->cleanup(ClassRegistry::getObject($this->modelName));
|
||||||
unset($this->{$name});
|
unset($this->{$name});
|
||||||
|
@ -466,7 +472,6 @@ class BehaviorCollection extends Object {
|
||||||
if (empty($this->_attached)) {
|
if (empty($this->_attached)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$_params = $params;
|
|
||||||
$options = array_merge(array('break' => false, 'breakOn' => array(null, false), 'modParams' => false), $options);
|
$options = array_merge(array('break' => false, 'breakOn' => array(null, false), 'modParams' => false), $options);
|
||||||
$count = count($this->_attached);
|
$count = count($this->_attached);
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Sanitize {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
public static function stripScripts($str) {
|
public static function stripScripts($str) {
|
||||||
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/i', '', $str);
|
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/is', '', $str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Core Security
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -381,13 +381,13 @@ class Validation {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return === true && preg_match('/@(' . self::$__pattern['hostname'] . ')$/i', $check, $regs)) {
|
if ($return === true && preg_match('/@(' . self::$__pattern['hostname'] . ')$/i', $check, $regs)) {
|
||||||
$host = gethostbynamel($regs[1]);
|
if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
|
||||||
$return = is_array($host);
|
return true;
|
||||||
$isWindows = (DIRECTORY_SEPARATOR === '\\');
|
|
||||||
if (!$isWindows || (version_compare(PHP_VERSION, '5.3.0', '>=') && $isWindows)) {
|
|
||||||
$return = $return && getmxrr($regs[1], $mxhosts);
|
|
||||||
}
|
}
|
||||||
return $return;
|
if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return is_array(gethostbynamel($regs[1]));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,9 +290,10 @@ class Helper extends Object {
|
||||||
*
|
*
|
||||||
* And its value is one of:
|
* And its value is one of:
|
||||||
*
|
*
|
||||||
* - 1
|
* - '1' (string)
|
||||||
* - true
|
* - 1 (integer)
|
||||||
* - 'true'
|
* - true (boolean)
|
||||||
|
* - 'true' (string)
|
||||||
*
|
*
|
||||||
* Then the value will be reset to be identical with key's name.
|
* Then the value will be reset to be identical with key's name.
|
||||||
* If the value is not one of these 3, the parameter is not output.
|
* If the value is not one of these 3, the parameter is not output.
|
||||||
|
@ -351,7 +352,7 @@ class Helper extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($key, $minimizedAttributes)) {
|
if (in_array($key, $minimizedAttributes)) {
|
||||||
if ($value === 1 || $value === true || $value === 'true' || $value == $key) {
|
if ($value === 1 || $value === true || $value === 'true' || $value === '1' || $value == $key) {
|
||||||
$attribute = sprintf($attributeFormat, $key, $key);
|
$attribute = sprintf($attributeFormat, $key, $key);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Application level View Helper
|
||||||
*
|
*
|
||||||
* This file is application-wide helper file. You can put all
|
* This file is application-wide helper file. You can put all
|
||||||
* application-wide helper-related methods here.
|
* application-wide helper-related methods here.
|
||||||
|
|
|
@ -211,7 +211,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$object =& $this->_introspectModel($model);
|
$object = $this->_introspectModel($model);
|
||||||
$this->setEntity($model . '.', true);
|
$this->setEntity($model . '.', true);
|
||||||
|
|
||||||
$modelEntity = $this->model();
|
$modelEntity = $this->model();
|
||||||
|
@ -304,6 +304,7 @@ class FormHelper extends AppHelper {
|
||||||
unset($options['default']);
|
unset($options['default']);
|
||||||
$htmlAttributes = array_merge($options, $htmlAttributes);
|
$htmlAttributes = array_merge($options, $htmlAttributes);
|
||||||
|
|
||||||
|
$this->fields = array();
|
||||||
if (isset($this->request['_Token']) && !empty($this->request['_Token'])) {
|
if (isset($this->request['_Token']) && !empty($this->request['_Token'])) {
|
||||||
$append .= $this->hidden('_Token.key', array(
|
$append .= $this->hidden('_Token.key', array(
|
||||||
'value' => $this->request['_Token']['key'], 'id' => 'Token' . mt_rand())
|
'value' => $this->request['_Token']['key'], 'id' => 'Token' . mt_rand())
|
||||||
|
@ -680,9 +681,10 @@ class FormHelper extends AppHelper {
|
||||||
* - `after` - Content to place after the label + input.
|
* - `after` - Content to place after the label + input.
|
||||||
* - `between` - Content to place between the label + input.
|
* - `between` - Content to place between the label + input.
|
||||||
* - `format` - format template for element order. Any element that is not in the array, will not be in the output.
|
* - `format` - format template for element order. Any element that is not in the array, will not be in the output.
|
||||||
* Default input format order: array('before', 'label', 'between', 'input', 'after', 'error')
|
* - Default input format order: array('before', 'label', 'between', 'input', 'after', 'error')
|
||||||
* Default checkbox format order: array('before', 'input', 'between', 'label', 'after', 'error')
|
* - Default checkbox format order: array('before', 'input', 'between', 'label', 'after', 'error')
|
||||||
* Hidden input will not be formatted
|
* - Hidden input will not be formatted
|
||||||
|
* - Radio buttons cannot have the order of input and label elements controlled with these settings.
|
||||||
*
|
*
|
||||||
* @param string $fieldName This should be "Modelname.fieldname"
|
* @param string $fieldName This should be "Modelname.fieldname"
|
||||||
* @param array $options Each type of input takes different options.
|
* @param array $options Each type of input takes different options.
|
||||||
|
@ -735,7 +737,7 @@ class FormHelper extends AppHelper {
|
||||||
$options['type'] = 'hidden';
|
$options['type'] = 'hidden';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preg_match('/_id$/', $fieldKey)) {
|
if (preg_match('/_id$/', $fieldKey) && $options['type'] !== 'hidden') {
|
||||||
$options['type'] = 'select';
|
$options['type'] = 'select';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,9 +252,13 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
||||||
if (isset($options['update'])) {
|
if (isset($options['update'])) {
|
||||||
$wrapCallbacks = isset($options['wrapCallbacks']) ? $options['wrapCallbacks'] : true;
|
$wrapCallbacks = isset($options['wrapCallbacks']) ? $options['wrapCallbacks'] : true;
|
||||||
if ($wrapCallbacks) {
|
if ($wrapCallbacks) {
|
||||||
$success = '$("' . $options['update'] . '").html(data);';
|
$success = $this->jQueryObject . '("' . $options['update'] . '").html(data);';
|
||||||
} else {
|
} else {
|
||||||
$success = 'function (data, textStatus) {$("' . $options['update'] . '").html(data);}';
|
$success = sprintf(
|
||||||
|
'function (data, textStatus) {%s("%s").html(data);}',
|
||||||
|
$this->jQueryObject,
|
||||||
|
$options['update']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$options['dataType'] = 'html';
|
$options['dataType'] = 'html';
|
||||||
$options['success'] = $success;
|
$options['success'] = $success;
|
||||||
|
@ -267,7 +271,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
||||||
}
|
}
|
||||||
$options = $this->_prepareCallbacks('request', $options);
|
$options = $this->_prepareCallbacks('request', $options);
|
||||||
$options = $this->_parseOptions($options, $callbacks);
|
$options = $this->_parseOptions($options, $callbacks);
|
||||||
return '$.ajax({' . $options .'});';
|
return $this->jQueryObject . '.ajax({' . $options .'});';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -302,17 +302,22 @@ class JsHelper extends AppHelper {
|
||||||
list($options, $htmlOptions) = $this->_getHtmlOptions($options);
|
list($options, $htmlOptions) = $this->_getHtmlOptions($options);
|
||||||
$out = $this->Html->link($title, $url, $htmlOptions);
|
$out = $this->Html->link($title, $url, $htmlOptions);
|
||||||
$this->get('#' . $htmlOptions['id']);
|
$this->get('#' . $htmlOptions['id']);
|
||||||
$requestString = '';
|
$requestString = $event = '';
|
||||||
if (isset($options['confirm'])) {
|
if (isset($options['confirm'])) {
|
||||||
$requestString = $this->confirmReturn($options['confirm']);
|
$requestString = $this->confirmReturn($options['confirm']);
|
||||||
unset($options['confirm']);
|
unset($options['confirm']);
|
||||||
}
|
}
|
||||||
|
$buffer = isset($options['buffer']) ? $options['buffer'] : null;
|
||||||
|
$safe = isset($options['safe']) ? $options['safe'] : true;
|
||||||
|
unset($options['buffer'], $options['safe']);
|
||||||
|
|
||||||
$requestString .= $this->request($url, $options);
|
$requestString .= $this->request($url, $options);
|
||||||
|
|
||||||
if (!empty($requestString)) {
|
if (!empty($requestString)) {
|
||||||
$event = $this->event('click', $requestString, $options);
|
$event = $this->event('click', $requestString, $options + array('buffer' => $buffer));
|
||||||
}
|
}
|
||||||
if (isset($options['buffer']) && $options['buffer'] == false) {
|
if (isset($buffer) && !$buffer) {
|
||||||
$opts = array_intersect_key(array('safe' => null), $options);
|
$opts = array('safe' => $safe);
|
||||||
$out .= $this->Html->scriptBlock($event, $opts);
|
$out .= $this->Html->scriptBlock($event, $opts);
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
|
@ -352,8 +357,16 @@ class JsHelper extends AppHelper {
|
||||||
* Forms submitting with this method, cannot send files. Files do not transfer over XmlHttpRequest
|
* Forms submitting with this method, cannot send files. Files do not transfer over XmlHttpRequest
|
||||||
* and require an iframe or flash.
|
* and require an iframe or flash.
|
||||||
*
|
*
|
||||||
|
* ### Options
|
||||||
|
*
|
||||||
|
* - `url` The url you wish the XHR request to submit to.
|
||||||
|
* - `confirm` A string to use for a confirm() message prior to submitting the request.
|
||||||
|
* - `method` The method you wish the form to send by, defaults to POST
|
||||||
|
* - `buffer` Whether or not you wish the script code to be buffered, defaults to true.
|
||||||
|
* - Also see options for JsHelper::request() and JsHelper::event()
|
||||||
|
*
|
||||||
* @param string $title The display text of the submit button.
|
* @param string $title The display text of the submit button.
|
||||||
* @param array $options Array of options to use.
|
* @param array $options Array of options to use. See the options for the above mentioned methods.
|
||||||
* @return string Completed submit button.
|
* @return string Completed submit button.
|
||||||
*/
|
*/
|
||||||
public function submit($caption = null, $options = array()) {
|
public function submit($caption = null, $options = array()) {
|
||||||
|
@ -380,12 +393,17 @@ class JsHelper extends AppHelper {
|
||||||
$options['method'] = 'post';
|
$options['method'] = 'post';
|
||||||
}
|
}
|
||||||
$options['dataExpression'] = true;
|
$options['dataExpression'] = true;
|
||||||
|
|
||||||
|
$buffer = isset($options['buffer']) ? $options['buffer'] : null;
|
||||||
|
$safe = isset($options['safe']) ? $options['safe'] : true;
|
||||||
|
unset($options['buffer'], $options['safe']);
|
||||||
|
|
||||||
$requestString .= $this->request($url, $options);
|
$requestString .= $this->request($url, $options);
|
||||||
if (!empty($requestString)) {
|
if (!empty($requestString)) {
|
||||||
$event = $this->event('click', $requestString, $options);
|
$event = $this->event('click', $requestString, $options + array('buffer' => $buffer));
|
||||||
}
|
}
|
||||||
if (isset($options['buffer']) && $options['buffer'] == false) {
|
if (isset($buffer) && !$buffer) {
|
||||||
$opts = array_intersect_key(array('safe' => null), $options);
|
$opts = array('safe' => $safe);
|
||||||
$out .= $this->Html->scriptBlock($event, $opts);
|
$out .= $this->Html->scriptBlock($event, $opts);
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
|
@ -423,7 +441,7 @@ class JsHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* @package cake.view.helpers
|
* @package cake.view.helpers
|
||||||
*/
|
*/
|
||||||
class JsBaseEngineHelper extends AppHelper {
|
abstract class JsBaseEngineHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Determines whether native JSON extension is used for encoding. Set by object constructor.
|
* Determines whether native JSON extension is used for encoding. Set by object constructor.
|
||||||
*
|
*
|
||||||
|
@ -749,10 +767,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param string $selector The selector that is targeted
|
* @param string $selector The selector that is targeted
|
||||||
* @return object instance of $this. Allows chained methods.
|
* @return object instance of $this. Allows chained methods.
|
||||||
*/
|
*/
|
||||||
public function get($selector) {
|
abstract public function get($selector);
|
||||||
trigger_error(sprintf(__('%s does not have get() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an event to the script cache. Operates on the currently selected elements.
|
* Add an event to the script cache. Operates on the currently selected elements.
|
||||||
|
@ -767,9 +782,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options Options for the event.
|
* @param array $options Options for the event.
|
||||||
* @return string completed event handler
|
* @return string completed event handler
|
||||||
*/
|
*/
|
||||||
public function event($type, $callback, $options = array()) {
|
abstract public function event($type, $callback, $options = array());
|
||||||
trigger_error(sprintf(__('%s does not have event() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a domReady event. This is a special event in many libraries
|
* Create a domReady event. This is a special event in many libraries
|
||||||
|
@ -777,9 +790,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param string $functionBody The code to run on domReady
|
* @param string $functionBody The code to run on domReady
|
||||||
* @return string completed domReady method
|
* @return string completed domReady method
|
||||||
*/
|
*/
|
||||||
public function domReady($functionBody) {
|
abstract public function domReady($functionBody);
|
||||||
trigger_error(sprintf(__('%s does not have domReady() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an iteration over the current selection result.
|
* Create an iteration over the current selection result.
|
||||||
|
@ -787,9 +798,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param string $callback The function body you wish to apply during the iteration.
|
* @param string $callback The function body you wish to apply during the iteration.
|
||||||
* @return string completed iteration
|
* @return string completed iteration
|
||||||
*/
|
*/
|
||||||
function each($callback) {
|
abstract public function each($callback);
|
||||||
trigger_error(sprintf(__('%s does not have each() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger an Effect.
|
* Trigger an Effect.
|
||||||
|
@ -814,9 +823,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options Array of options for the effect.
|
* @param array $options Array of options for the effect.
|
||||||
* @return string completed string with effect.
|
* @return string completed string with effect.
|
||||||
*/
|
*/
|
||||||
public function effect($name, $options) {
|
abstract public function effect($name, $options);
|
||||||
trigger_error(sprintf(__('%s does not have effect() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make an XHR request
|
* Make an XHR request
|
||||||
|
@ -843,9 +850,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options Array of options. See above for cross library supported options
|
* @param array $options Array of options. See above for cross library supported options
|
||||||
* @return string XHR request.
|
* @return string XHR request.
|
||||||
*/
|
*/
|
||||||
public function request($url, $options = array()) {
|
abstract public function request($url, $options = array());
|
||||||
trigger_error(sprintf(__('%s does not have request() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a draggable element. Works on the currently selected element.
|
* Create a draggable element. Works on the currently selected element.
|
||||||
|
@ -866,9 +871,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options Options array see above.
|
* @param array $options Options array see above.
|
||||||
* @return string Completed drag script
|
* @return string Completed drag script
|
||||||
*/
|
*/
|
||||||
public function drag($options = array()) {
|
abstract public function drag($options = array());
|
||||||
trigger_error(sprintf(__('%s does not have drag() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a droppable element. Allows for draggable elements to be dropped on it.
|
* Create a droppable element. Allows for draggable elements to be dropped on it.
|
||||||
|
@ -887,9 +890,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* @return string Completed drop script
|
* @return string Completed drop script
|
||||||
*/
|
*/
|
||||||
public function drop($options = array()) {
|
abstract public function drop($options = array());
|
||||||
trigger_error(sprintf(__('%s does not have drop() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a sortable element.
|
* Create a sortable element.
|
||||||
|
@ -912,9 +913,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options Array of options for the sortable. See above.
|
* @param array $options Array of options for the sortable. See above.
|
||||||
* @return string Completed sortable script.
|
* @return string Completed sortable script.
|
||||||
*/
|
*/
|
||||||
public function sortable() {
|
abstract public function sortable();
|
||||||
trigger_error(sprintf(__('%s does not have sortable() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a slider UI widget. Comprised of a track and knob.
|
* Create a slider UI widget. Comprised of a track and knob.
|
||||||
|
@ -936,10 +935,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* @return string Completed slider script
|
* @return string Completed slider script
|
||||||
*/
|
*/
|
||||||
public function slider() {
|
abstract public function slider();
|
||||||
trigger_error(sprintf(__('%s does not have slider() implemented'), get_class($this)), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the form attached to $selector.
|
* Serialize the form attached to $selector.
|
||||||
* Pass `true` for $isForm if the current selection is a form element.
|
* Pass `true` for $isForm if the current selection is a form element.
|
||||||
|
@ -954,11 +950,7 @@ class JsBaseEngineHelper extends AppHelper {
|
||||||
* @param array $options options for serialization generation.
|
* @param array $options options for serialization generation.
|
||||||
* @return string completed form serialization script
|
* @return string completed form serialization script
|
||||||
*/
|
*/
|
||||||
public function serializeForm() {
|
abstract public function serializeForm();
|
||||||
trigger_error(
|
|
||||||
sprintf(__('%s does not have serializeForm() implemented'), get_class($this)), E_USER_WARNING
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse an options assoc array into an Javascript object literal.
|
* Parse an options assoc array into an Javascript object literal.
|
||||||
|
|
|
@ -69,7 +69,7 @@ class NumberHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* @param float $number A floating point number.
|
* @param float $number A floating point number.
|
||||||
* @param integer $precision The precision of the returned number.
|
* @param integer $precision The precision of the returned number.
|
||||||
* @return float Enter description here...
|
* @return float Formatted float.
|
||||||
* @access public
|
* @access public
|
||||||
* @link http://book.cakephp.org/view/1454/precision
|
* @link http://book.cakephp.org/view/1454/precision
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -191,18 +191,10 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['sort']) && !empty($options['sort'])) {
|
if (isset($options['sort']) && !empty($options['sort'])) {
|
||||||
if (preg_match('/(?:\w+\.)?(\w+)/', $options['sort'], $result) && isset($result[1])) {
|
|
||||||
if ($result[0] == $this->defaultModel()) {
|
|
||||||
return $result[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $options['sort'];
|
return $options['sort'];
|
||||||
} elseif (isset($options['order']) && is_array($options['order'])) {
|
} elseif (isset($options['order']) && is_array($options['order'])) {
|
||||||
return key($options['order']);
|
return key($options['order']);
|
||||||
} elseif (isset($options['order']) && is_string($options['order'])) {
|
} elseif (isset($options['order']) && is_string($options['order'])) {
|
||||||
if (preg_match('/(?:\w+\.)?(\w+)/', $options['order'], $result) && isset($result[1])) {
|
|
||||||
return $result[1];
|
|
||||||
}
|
|
||||||
return $options['order'];
|
return $options['order'];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -303,13 +295,18 @@ class PaginatorHelper extends AppHelper {
|
||||||
unset($options['direction']);
|
unset($options['direction']);
|
||||||
|
|
||||||
$sortKey = $this->sortKey($options['model']);
|
$sortKey = $this->sortKey($options['model']);
|
||||||
$isSorted = ($sortKey === $key || $sortKey === $this->defaultModel() . '.' . $key);
|
$defaultModel = $this->defaultModel();
|
||||||
|
$isSorted = (
|
||||||
|
$sortKey === $key ||
|
||||||
|
$sortKey === $defaultModel . '.' . $key ||
|
||||||
|
$key === $defaultModel . '.' . $sortKey
|
||||||
|
);
|
||||||
|
|
||||||
if ($isSorted) {
|
if ($isSorted) {
|
||||||
$dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
|
$dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
|
||||||
$class = $dir === 'asc' ? 'desc' : 'asc';
|
$class = $dir === 'asc' ? 'desc' : 'asc';
|
||||||
if (!empty($options['class'])) {
|
if (!empty($options['class'])) {
|
||||||
$options['class'] .= $class;
|
$options['class'] .= ' ' . $class;
|
||||||
} else {
|
} else {
|
||||||
$options['class'] = $class;
|
$options['class'] = $class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ class TextHelper extends AppHelper {
|
||||||
'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text);
|
'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text);
|
||||||
|
|
||||||
return preg_replace_callback('#(?<!href="|">)(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])(?<!\))#i',
|
return preg_replace_callback('#(?<!href="|">)(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])(?<!\))#i',
|
||||||
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text);
|
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . $matches[0],' . $options . ');'), $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,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://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-0"><?php echo __('Read the changelog'); ?> </a>
|
<a href="http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-2"><?php __('Read the changelog'); ?> </a>
|
||||||
<?php
|
<?php
|
||||||
if (Configure::read() > 0):
|
if (Configure::read() > 0):
|
||||||
Debugger::checkSecurityKeys();
|
Debugger::checkSecurityKeys();
|
||||||
|
@ -106,8 +106,8 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
echo $this->Html->link(
|
echo $this->Html->link(
|
||||||
sprintf('<strong>%s</strong>%s', __('new'), __('CakePHP 1.2 Docs')),
|
sprintf('<strong>%s</strong>%s', __('new', true), __('CakePHP 1.3 Docs', true)),
|
||||||
'http://book.cakephp.org',
|
'http://book.cakephp.org/view/875/x1-3-Collection',
|
||||||
array('target' => '_blank', 'escape' => false)
|
array('target' => '_blank', 'escape' => false)
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -35,7 +35,8 @@ class ThemeView extends View {
|
||||||
/**
|
/**
|
||||||
* Constructor for ThemeView sets $this->theme.
|
* Constructor for ThemeView sets $this->theme.
|
||||||
*
|
*
|
||||||
* @param Controller $controller
|
* @param Controller $controller Controller object to be rendered.
|
||||||
|
* @param boolean $register Should the view be registered in the registry.
|
||||||
*/
|
*/
|
||||||
function __construct(&$controller, $register = true) {
|
function __construct(&$controller, $register = true) {
|
||||||
parent::__construct($controller, $register);
|
parent::__construct($controller, $register);
|
||||||
|
@ -45,7 +46,7 @@ class ThemeView extends View {
|
||||||
/**
|
/**
|
||||||
* Return all possible paths to find view files in order
|
* Return all possible paths to find view files in order
|
||||||
*
|
*
|
||||||
* @param string $plugin
|
* @param string $plugin The name of the plugin views are being found for.
|
||||||
* @param boolean $cached Set to true to force dir scan.
|
* @param boolean $cached Set to true to force dir scan.
|
||||||
* @return array paths
|
* @return array paths
|
||||||
* @access protected
|
* @access protected
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases
|
* @subpackage cake.tests.cases
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.console
|
* @subpackage cake.tests.cases.console
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
|
|
|
@ -310,20 +310,20 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('Invalid %s'), 'article'));") !== false);
|
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Invalid article'));") !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function add()') !== false);
|
$this->assertTrue(strpos($result, 'function add()') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s has been saved'), 'article'));") !== false);
|
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article has been saved'));") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.'), 'article'));") !== false);
|
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article could not be saved. Please, try again.'));") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('%s deleted'), 'Article'));") !== false);
|
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Article deleted'));") !== false);
|
||||||
|
|
||||||
$result = $this->Task->bakeActions('Articles', 'admin_', true);
|
$result = $this->Task->bakeActions('Articles', 'admin_', true);
|
||||||
|
|
||||||
|
@ -352,13 +352,13 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('Invalid %s'), 'article'), array('action' => 'index'))") !== false);
|
$this->assertTrue(strpos($result, "\$this->flash(__('Invalid article'), array('action' => 'index'))") !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function add()') !== false);
|
$this->assertTrue(strpos($result, 'function add()') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('The %s has been saved.'), 'article'), array('action' => 'index'))") !== false);
|
$this->assertTrue(strpos($result, "\$this->flash(__('The article has been saved.'), array('action' => 'index'))") !== false);
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
|
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
|
||||||
|
@ -366,7 +366,7 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('%s deleted'), 'Article'), array('action' => 'index'))") !== false);
|
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted'), array('action' => 'index'))") !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,6 +411,35 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test Interactive mode.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function testInteractiveAdminMethodsNotInteractive() {
|
||||||
|
$this->Task->connection = 'test_suite';
|
||||||
|
$this->Task->interactive = true;
|
||||||
|
$this->Task->path = '/my/path';
|
||||||
|
$this->Task->setReturnValue('in', '1');
|
||||||
|
$this->Task->setReturnValueAt(1, 'in', 'y'); // build interactive
|
||||||
|
$this->Task->setReturnValueAt(2, 'in', 'n'); // build no scaffolds
|
||||||
|
$this->Task->setReturnValueAt(3, 'in', 'y'); // build normal methods
|
||||||
|
$this->Task->setReturnValueAt(4, 'in', 'y'); // build admin methods
|
||||||
|
$this->Task->setReturnValueAt(5, 'in', 'n'); // helpers?
|
||||||
|
$this->Task->setReturnValueAt(6, 'in', 'n'); // components?
|
||||||
|
$this->Task->setReturnValueAt(7, 'in', 'y'); // use sessions
|
||||||
|
$this->Task->setReturnValueAt(8, 'in', 'y'); // looks good
|
||||||
|
$this->Task->setReturnValue('createFile', true);
|
||||||
|
$this->Task->Project->setReturnValue('getPrefix', 'admin_');
|
||||||
|
|
||||||
|
$result = $this->Task->execute();
|
||||||
|
$this->assertPattern('/admin_index/', $result);
|
||||||
|
|
||||||
|
$filename = '/my/path/articles_controller.php';
|
||||||
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute runs all when the first arg == all
|
* test that execute runs all when the first arg == all
|
||||||
*
|
*
|
||||||
|
|
|
@ -152,4 +152,33 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
$Folder = new Folder($path);
|
$Folder = new Folder($path);
|
||||||
$Folder->delete();
|
$Folder->delete();
|
||||||
}
|
}
|
||||||
|
function getTests() {
|
||||||
|
return array('start', 'startCase', 'testExtractMultiplePaths', 'endCase', 'end');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test extract can read more than one path.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testExtractMultiplePaths() {
|
||||||
|
$path = TMP . 'tests' . DS . 'extract_task_test';
|
||||||
|
new Folder($path . DS . 'locale', true);
|
||||||
|
|
||||||
|
$this->Task->interactive = false;
|
||||||
|
|
||||||
|
$this->Task->params['paths'] =
|
||||||
|
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'pages,' .
|
||||||
|
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'posts';
|
||||||
|
|
||||||
|
$this->Task->params['output'] = $path . DS;
|
||||||
|
$this->Task->Dispatch->expectNever('stderr');
|
||||||
|
$this->Task->Dispatch->expectNever('_stop');
|
||||||
|
$this->Task->execute();
|
||||||
|
|
||||||
|
$result = file_get_contents($path . DS . 'default.pot');
|
||||||
|
|
||||||
|
$pattern = '/msgid "Add User"/';
|
||||||
|
$this->assertPattern($pattern, $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -627,8 +627,7 @@ array(
|
||||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||||
),
|
),
|
||||||
STRINGEND;
|
STRINGEND;
|
||||||
|
$this->assertPattern('/' . preg_quote(str_replace("\r\n", "\n", $expected), '/') . '/', $result);
|
||||||
$this->assertPattern('/' . preg_quote($expected, '/') . '/', $result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -286,10 +286,10 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->Task->getContent('view', $vars);
|
$result = $this->Task->getContent('view', $vars);
|
||||||
|
|
||||||
$this->assertPattern('/Delete .+Test View Model/', $result);
|
$this->assertPattern('/Delete Test View Model/', $result);
|
||||||
$this->assertPattern('/Edit .+Test View Model/', $result);
|
$this->assertPattern('/Edit Test View Model/', $result);
|
||||||
$this->assertPattern('/List .+Test View Models/', $result);
|
$this->assertPattern('/List Test View Models/', $result);
|
||||||
$this->assertPattern('/New .+Test View Model/', $result);
|
$this->assertPattern('/New Test View Model/', $result);
|
||||||
|
|
||||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||||
|
@ -318,10 +318,10 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = $this->Task->getContent('admin_view', $vars);
|
$result = $this->Task->getContent('admin_view', $vars);
|
||||||
|
|
||||||
$this->assertPattern('/Delete .+Test View Model/', $result);
|
$this->assertPattern('/Delete Test View Model/', $result);
|
||||||
$this->assertPattern('/Edit .+Test View Model/', $result);
|
$this->assertPattern('/Edit Test View Model/', $result);
|
||||||
$this->assertPattern('/List .+Test View Models/', $result);
|
$this->assertPattern('/List Test View Models/', $result);
|
||||||
$this->assertPattern('/New .+Test View Model/', $result);
|
$this->assertPattern('/New Test View Model/', $result);
|
||||||
|
|
||||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||||
|
@ -330,7 +330,7 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getContent('admin_add', $vars);
|
$result = $this->Task->getContent('admin_add', $vars);
|
||||||
$this->assertPattern("/input\('name'\)/", $result);
|
$this->assertPattern("/input\('name'\)/", $result);
|
||||||
$this->assertPattern("/input\('body'\)/", $result);
|
$this->assertPattern("/input\('body'\)/", $result);
|
||||||
$this->assertPattern('/List .+Test View Models/', $result);
|
$this->assertPattern('/List Test View Models/', $result);
|
||||||
|
|
||||||
Configure::write('Routing', $_back);
|
Configure::write('Routing', $_back);
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(1, 'createFile', array(
|
$this->Task->expectAt(1, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||||
new PatternExpectation('/Edit .+View Task Comment/')
|
new PatternExpectation('/Edit View Task Comment/')
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(2, 'createFile', array(
|
$this->Task->expectAt(2, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'index.ctp',
|
TMP . 'view_task_comments' . DS . 'index.ctp',
|
||||||
|
@ -552,11 +552,11 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(2, 'createFile', array(
|
$this->Task->expectAt(2, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'add.ctp',
|
TMP . 'view_task_comments' . DS . 'add.ctp',
|
||||||
new PatternExpectation('/Add .+View Task Comment/')
|
new PatternExpectation('/Add View Task Comment/')
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(3, 'createFile', array(
|
$this->Task->expectAt(3, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||||
new PatternExpectation('/Edit .+View Task Comment/')
|
new PatternExpectation('/Edit View Task Comment/')
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
|
@ -607,11 +607,11 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(2, 'createFile', array(
|
$this->Task->expectAt(2, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
|
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
|
||||||
new PatternExpectation('/Add .+View Task Comment/')
|
new PatternExpectation('/Add View Task Comment/')
|
||||||
));
|
));
|
||||||
$this->Task->expectAt(3, 'createFile', array(
|
$this->Task->expectAt(3, 'createFile', array(
|
||||||
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
|
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
|
||||||
new PatternExpectation('/Edit .+View Task Comment/')
|
new PatternExpectation('/Edit View Task Comment/')
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
|
@ -634,4 +634,5 @@ class ViewTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getTemplate('admin_add');
|
$result = $this->Task->getTemplate('admin_add');
|
||||||
$this->assertEqual($result, 'form');
|
$this->assertEqual($result, 'form');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases
|
* @subpackage cake.tests.cases
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
|
|
4
cake/tests/cases/libs/cache/apc.test.php
vendored
4
cake/tests/cases/libs/cache/apc.test.php
vendored
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.cache
|
* @subpackage cake.tests.cases.libs.cache
|
||||||
* @since CakePHP(tm) v 1.2.0.5434
|
* @since CakePHP(tm) v 1.2.0.5434
|
||||||
|
|
32
cake/tests/cases/libs/cache/file.test.php
vendored
32
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.cache
|
* @subpackage cake.tests.cases.libs.cache
|
||||||
* @since CakePHP(tm) v 1.2.0.5434
|
* @since CakePHP(tm) v 1.2.0.5434
|
||||||
|
@ -273,6 +273,34 @@ class FileEngineTest extends CakeTestCase {
|
||||||
Cache::config('default', array('engine' => 'File', 'path' => CACHE));
|
Cache::config('default', array('engine' => 'File', 'path' => CACHE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that clear() doesn't wipe files not in the current engine's prefix.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testClearWithPrefixes() {
|
||||||
|
$FileOne =& new FileEngine();
|
||||||
|
$FileOne->init(array(
|
||||||
|
'prefix' => 'prefix_one_',
|
||||||
|
'duration' => DAY
|
||||||
|
));
|
||||||
|
$FileTwo =& new FileEngine();
|
||||||
|
$FileTwo->init(array(
|
||||||
|
'prefix' => 'prefix_two_',
|
||||||
|
'duration' => DAY
|
||||||
|
));
|
||||||
|
|
||||||
|
$data1 = $data2 = $expected = 'content to cache';
|
||||||
|
$FileOne->write('key_one', $data1, DAY);
|
||||||
|
$FileTwo->write('key_two', $data2, DAY);
|
||||||
|
|
||||||
|
$this->assertEqual($FileOne->read('key_one'), $expected);
|
||||||
|
$this->assertEqual($FileTwo->read('key_two'), $expected);
|
||||||
|
|
||||||
|
$FileOne->clear(false);
|
||||||
|
$this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testKeyPath method
|
* testKeyPath method
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.cache
|
* @subpackage cake.tests.cases.libs.cache
|
||||||
* @since CakePHP(tm) v 1.2.0.5434
|
* @since CakePHP(tm) v 1.2.0.5434
|
||||||
|
|
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.cache
|
* @subpackage cake.tests.cases.libs.cache
|
||||||
* @since CakePHP(tm) v 1.2.0.5434
|
* @since CakePHP(tm) v 1.2.0.5434
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
@ -175,6 +175,10 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
$_SESSION = null;
|
$_SESSION = null;
|
||||||
$this->assertFalse($this->Session->started());
|
$this->assertFalse($this->Session->started());
|
||||||
$this->assertTrue($this->Session->start());
|
$this->assertTrue($this->Session->start());
|
||||||
|
|
||||||
|
$session = new CakeSession(null, false);
|
||||||
|
$this->assertTrue($session->started());
|
||||||
|
unset($session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.libs
|
* @subpackage cake.cake.tests.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4667
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
@ -114,6 +114,14 @@ class FixtureImportTestModel extends Model {
|
||||||
public $useTable = 'fixture_tests';
|
public $useTable = 'fixture_tests';
|
||||||
public $useDbConfig = 'test_suite';
|
public $useDbConfig = 'test_suite';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FixturePrefixTest extends Model {
|
||||||
|
public $name = 'FixturePrefix';
|
||||||
|
public $useTable = '_tests';
|
||||||
|
public $tablePrefix = 'fixture';
|
||||||
|
public $useDbConfig = 'test_suite';
|
||||||
|
}
|
||||||
|
|
||||||
Mock::generate('DboSource', 'FixtureMockDboSource');
|
Mock::generate('DboSource', 'FixtureMockDboSource');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +170,14 @@ class CakeTestFixtureTest extends CakeTestCase {
|
||||||
$Fixture->primaryKey = 'my_random_key';
|
$Fixture->primaryKey = 'my_random_key';
|
||||||
$Fixture->init();
|
$Fixture->init();
|
||||||
$this->assertEqual($Fixture->primaryKey, 'my_random_key');
|
$this->assertEqual($Fixture->primaryKey, 'my_random_key');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that init() correctly sets the fixture table when the connection or model have prefixes defined.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testInitDbPrefix() {
|
||||||
$this->_initDb();
|
$this->_initDb();
|
||||||
$Source =& new CakeTestFixtureTestFixture();
|
$Source =& new CakeTestFixtureTestFixture();
|
||||||
$Source->create($this->db);
|
$Source->create($this->db);
|
||||||
|
@ -194,6 +209,30 @@ class CakeTestFixtureTest extends CakeTestCase {
|
||||||
$Source->drop($this->db);
|
$Source->drop($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test init with a model that has a tablePrefix declared.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testInitModelTablePrefix() {
|
||||||
|
$this->_initDb();
|
||||||
|
$Source =& new CakeTestFixtureTestFixture();
|
||||||
|
$Source->create($this->db);
|
||||||
|
$Source->insert($this->db);
|
||||||
|
|
||||||
|
$Fixture =& new CakeTestFixtureImportFixture();
|
||||||
|
unset($Fixture->table);
|
||||||
|
$Fixture->fields = $Fixture->records = null;
|
||||||
|
$Fixture->import = array('model' => 'FixturePrefixTest', 'connection' => 'test_suite', 'records' => false);
|
||||||
|
$Fixture->init();
|
||||||
|
$this->assertEqual($Fixture->table, 'fixture_tests');
|
||||||
|
|
||||||
|
$keys = array_flip(ClassRegistry::keys());
|
||||||
|
$this->assertFalse(array_key_exists('fixtureimporttestmodel', $keys));
|
||||||
|
|
||||||
|
$Source->drop($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testImport
|
* testImport
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller
|
* @subpackage cake.tests.cases.libs.controller
|
||||||
* @since CakePHP(tm) v 1.2.0.5436
|
* @since CakePHP(tm) v 1.2.0.5436
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller.components
|
* @subpackage cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5435
|
* @since CakePHP(tm) v 1.2.0.5435
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.cases.libs.controller.components
|
* @subpackage cake.cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5347
|
* @since CakePHP(tm) v 1.2.0.5347
|
||||||
|
@ -1427,6 +1427,16 @@ class AuthTest extends CakeTestCase {
|
||||||
$sessionKey = $this->Controller->Auth->sessionKey;
|
$sessionKey = $this->Controller->Auth->sessionKey;
|
||||||
$this->assertEqual('Auth.TestPluginAuthUser', $sessionKey);
|
$this->assertEqual('Auth.TestPluginAuthUser', $sessionKey);
|
||||||
|
|
||||||
|
$this->Controller->Auth->loginAction = null;
|
||||||
|
$this->Controller->Auth->__setDefaults();
|
||||||
|
$loginAction = $this->Controller->Auth->loginAction;
|
||||||
|
$expected = array(
|
||||||
|
'controller' => 'test_plugin_auth_users',
|
||||||
|
'action' => 'login',
|
||||||
|
'plugin' => 'test_plugin'
|
||||||
|
);
|
||||||
|
$this->assertEqual($loginAction, $expected);
|
||||||
|
|
||||||
// Reverting changes
|
// Reverting changes
|
||||||
Cache::delete('object_map', '_cake_core_');
|
Cache::delete('object_map', '_cake_core_');
|
||||||
App::build();
|
App::build();
|
||||||
|
@ -1451,7 +1461,7 @@ class AuthTest extends CakeTestCase {
|
||||||
$Dispatcher =& new Dispatcher();
|
$Dispatcher =& new Dispatcher();
|
||||||
$Dispatcher->dispatch('/ajax_auth/add', array('return' => 1));
|
$Dispatcher->dispatch('/ajax_auth/add', array('return' => 1));
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertEqual("Ajax!\nthis is the test element", $result);
|
$this->assertEqual("Ajax!\nthis is the test element", str_replace("\r\n", "\n", $result));
|
||||||
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller.components
|
* @subpackage cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5435
|
* @since CakePHP(tm) v 1.2.0.5435
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.cases.libs.controller.components
|
* @subpackage cake.cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5347
|
* @since CakePHP(tm) v 1.2.0.5347
|
||||||
|
@ -109,6 +109,16 @@ class EmailTestComponent extends EmailComponent {
|
||||||
return $this->__message;
|
return $this->__message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience getter for testing.
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function _getMessage() {
|
||||||
|
return $this->__message;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method for testing.
|
* Convenience method for testing.
|
||||||
*
|
*
|
||||||
|
@ -234,6 +244,30 @@ class EmailComponentTest extends CakeTestCase {
|
||||||
return str_replace(array("\r\n", "\r"), "\n", $string);
|
return str_replace(array("\r\n", "\r"), "\n", $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSmtpConfig method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSmtpConfig() {
|
||||||
|
$this->Controller->EmailTest->delivery = 'smtp';
|
||||||
|
$this->Controller->EmailTest->smtpOptions = array();
|
||||||
|
$this->Controller->EmailTest->send('anything');
|
||||||
|
$config = array(
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => 25,
|
||||||
|
'protocol' => 'smtp',
|
||||||
|
'timeout' => 30
|
||||||
|
);
|
||||||
|
$this->assertEqual($config, $this->Controller->EmailTest->smtpOptions);
|
||||||
|
|
||||||
|
$this->Controller->EmailTest->smtpOptions = array('port' => 80);
|
||||||
|
$this->Controller->EmailTest->send('anything');
|
||||||
|
$config['port'] = 80;
|
||||||
|
$this->assertEqual($config, $this->Controller->EmailTest->smtpOptions);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBadSmtpSend method
|
* testBadSmtpSend method
|
||||||
*
|
*
|
||||||
|
@ -295,6 +329,62 @@ TEMPDOC;
|
||||||
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect));
|
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSmtpEhlo method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSmtpEhlo() {
|
||||||
|
if (!$this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$connection =& new CakeSocket(array('protocol'=>'smtp', 'host' => 'localhost', 'port' => 25));
|
||||||
|
$this->Controller->EmailTest->setConnectionSocket($connection);
|
||||||
|
$this->Controller->EmailTest->smtpOptions['timeout'] = 10;
|
||||||
|
$this->assertTrue($connection->connect());
|
||||||
|
$this->assertTrue($this->Controller->EmailTest->smtpSend(null, '220') !== false);
|
||||||
|
$this->skipIf($this->Controller->EmailTest->smtpSend('EHLO locahost', '250') === false, '%s do not support EHLO.');
|
||||||
|
$connection->disconnect();
|
||||||
|
|
||||||
|
$this->Controller->EmailTest->to = 'postmaster@localhost';
|
||||||
|
$this->Controller->EmailTest->from = 'noreply@example.com';
|
||||||
|
$this->Controller->EmailTest->subject = 'Cake SMTP test';
|
||||||
|
$this->Controller->EmailTest->replyTo = 'noreply@example.com';
|
||||||
|
$this->Controller->EmailTest->template = null;
|
||||||
|
|
||||||
|
$this->Controller->EmailTest->delivery = 'smtp';
|
||||||
|
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
||||||
|
|
||||||
|
$this->Controller->EmailTest->_debug = true;
|
||||||
|
$this->Controller->EmailTest->sendAs = 'text';
|
||||||
|
$expect = <<<TEMPDOC
|
||||||
|
<pre>Host: localhost
|
||||||
|
Port: 25
|
||||||
|
Timeout: 30
|
||||||
|
To: postmaster@localhost
|
||||||
|
From: noreply@example.com
|
||||||
|
Subject: Cake SMTP test
|
||||||
|
Header:
|
||||||
|
|
||||||
|
To: postmaster@localhost
|
||||||
|
From: noreply@example.com
|
||||||
|
Reply-To: noreply@example.com
|
||||||
|
Subject: Cake SMTP test
|
||||||
|
X-Mailer: CakePHP Email Component
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 7bitParameters:
|
||||||
|
|
||||||
|
Message:
|
||||||
|
|
||||||
|
This is the body of the message
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
TEMPDOC;
|
||||||
|
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
|
||||||
|
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSmtpSendMultipleTo method
|
* testSmtpSendMultipleTo method
|
||||||
|
@ -545,6 +635,7 @@ TEXTBLOC;
|
||||||
function testSmtpSendSocket() {
|
function testSmtpSendSocket() {
|
||||||
$this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost');
|
$this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost');
|
||||||
|
|
||||||
|
$this->Controller->EmailTest->smtpOptions['timeout'] = 10;
|
||||||
$socket =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->Controller->EmailTest->smtpOptions));
|
$socket =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->Controller->EmailTest->smtpOptions));
|
||||||
$this->Controller->EmailTest->setConnectionSocket($socket);
|
$this->Controller->EmailTest->setConnectionSocket($socket);
|
||||||
|
|
||||||
|
@ -994,4 +1085,35 @@ HTMLBLOC;
|
||||||
$this->assertNoPattern('/Message-ID:/', $result);
|
$this->assertNoPattern('/Message-ID:/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSendMessage method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSendMessage() {
|
||||||
|
$this->Controller->EmailTest->delivery = 'getMessage';
|
||||||
|
$this->Controller->EmailTest->lineLength = 70;
|
||||||
|
|
||||||
|
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
|
||||||
|
$this->Controller->EmailTest->sendAs = 'text';
|
||||||
|
$result = $this->Controller->EmailTest->send($text);
|
||||||
|
$expected = array(
|
||||||
|
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do',
|
||||||
|
'eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
|
$text = 'Lorem ipsum dolor sit amet, <b>consectetur</b> adipisicing elit, sed do <span>eiusmod tempor</span> incididunt ut labore et dolore magna aliqua.';
|
||||||
|
$this->Controller->EmailTest->sendAs = 'html';
|
||||||
|
$result = $this->Controller->EmailTest->send($text);
|
||||||
|
$expected = array(
|
||||||
|
$text,
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller.components
|
* @subpackage cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5435
|
* @since CakePHP(tm) v 1.2.0.5435
|
||||||
|
@ -22,6 +22,7 @@ App::import('Component', array('RequestHandler'));
|
||||||
|
|
||||||
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));
|
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));
|
||||||
Mock::generate('CakeRequest', 'RequestHandlerMockCakeRequest');
|
Mock::generate('CakeRequest', 'RequestHandlerMockCakeRequest');
|
||||||
|
Mock::generatePartial('Controller', 'RequestHandlerMockController', array('header'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RequestHandlerTestController class
|
* RequestHandlerTestController class
|
||||||
|
@ -79,6 +80,18 @@ class RequestHandlerTestController extends Controller {
|
||||||
echo "one: $one two: $two";
|
echo "one: $one two: $two";
|
||||||
$this->autoRender = false;
|
$this->autoRender = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test method for testing layout rendering when isAjax()
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function ajax2_layout() {
|
||||||
|
if ($this->autoLayout) {
|
||||||
|
$this->layout = 'ajax2';
|
||||||
|
}
|
||||||
|
$this->destination();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,6 +550,35 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
App::build();
|
App::build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that ajax requests involving redirects don't force no layout
|
||||||
|
* this would cause the ajax layout to not be rendered.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testAjaxRedirectAsRequestActionStillRenderingLayout() {
|
||||||
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||||
|
$this->_init();
|
||||||
|
App::build(array(
|
||||||
|
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||||
|
), true);
|
||||||
|
|
||||||
|
$this->Controller->RequestHandler = new NoStopRequestHandler($this);
|
||||||
|
$this->Controller->RequestHandler->request = $this->Controller->request;
|
||||||
|
$this->Controller->RequestHandler->expectOnce('_stop');
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$this->Controller->RequestHandler->beforeRedirect(
|
||||||
|
$this->Controller, array('controller' => 'request_handler_test', 'action' => 'ajax2_layout')
|
||||||
|
);
|
||||||
|
$result = ob_get_clean();
|
||||||
|
$this->assertPattern('/posts index/', $result, 'RequestAction redirect failed.');
|
||||||
|
$this->assertPattern('/Ajax!/', $result, 'Layout was not rendered.');
|
||||||
|
|
||||||
|
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
||||||
|
App::build();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the beforeRedirect callback properly converts
|
* test that the beforeRedirect callback properly converts
|
||||||
* array urls into their correct string ones, and adds base => false so
|
* array urls into their correct string ones, and adds base => false so
|
||||||
|
@ -547,11 +589,9 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
function testBeforeRedirectCallbackWithArrayUrl() {
|
function testBeforeRedirectCallbackWithArrayUrl() {
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||||
App::build(array(
|
|
||||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
|
||||||
), true);
|
|
||||||
Router::setRequestInfo(array(
|
Router::setRequestInfo(array(
|
||||||
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'named' => array(), 'form' => array(), 'url' => array('url' => 'accounts/'), 'bare' => 0),
|
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'named' => array(), 'form' => array(), 'url' => array('url' => 'accounts/')),
|
||||||
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/')
|
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -565,7 +605,24 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertEqual($result, 'one: first two: second');
|
$this->assertEqual($result, 'one: first two: second');
|
||||||
App::build();
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assure that beforeRedirect with a status code will correctly set the status header
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testBeforeRedirectCallingHeader() {
|
||||||
|
$controller =& new RequestHandlerMockController();
|
||||||
|
$RequestHandler =& new NoStopRequestHandler();
|
||||||
|
$RequestHandler->request = new RequestHandlerMockCakeRequest();
|
||||||
|
$RequestHandler->request->setReturnValue('is', true, array('ajax'));
|
||||||
|
|
||||||
|
$controller->expectOnce('header', array('HTTP/1.1 403 Forbidden'));
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403);
|
||||||
|
$result = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller.components
|
* @subpackage cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5435
|
* @since CakePHP(tm) v 1.2.0.5435
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller.components
|
* @subpackage cake.tests.cases.libs.controller.components
|
||||||
* @since CakePHP(tm) v 1.2.0.5436
|
* @since CakePHP(tm) v 1.2.0.5436
|
||||||
|
@ -339,4 +339,41 @@ class SessionComponentTest extends CakeTestCase {
|
||||||
$Session->destroy('Test');
|
$Session->destroy('Test');
|
||||||
$this->assertNull($Session->read('Test'));
|
$this->assertNull($Session->read('Test'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSessionTimeout method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSessionTimeout() {
|
||||||
|
|
||||||
|
session_destroy();
|
||||||
|
Configure::write('Security.level', 'low');
|
||||||
|
$Session =& new SessionComponent();
|
||||||
|
$Session->write('Test', 'some value');
|
||||||
|
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||||
|
$this->assertEqual($Session->time, mktime());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||||
|
|
||||||
|
session_destroy();
|
||||||
|
Configure::write('Security.level', 'medium');
|
||||||
|
$Session =& new SessionComponent();
|
||||||
|
$Session->write('Test', 'some value');
|
||||||
|
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||||
|
$this->assertEqual($Session->time, mktime());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||||
|
|
||||||
|
session_destroy();
|
||||||
|
Configure::write('Security.level', 'high');
|
||||||
|
$Session =& new SessionComponent();
|
||||||
|
$Session->write('Test', 'some value');
|
||||||
|
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||||
|
$this->assertEqual($Session->time, mktime());
|
||||||
|
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,6 +1240,7 @@ class ControllerTest extends CakeTestCase {
|
||||||
|
|
||||||
$TestController->ControllerComment->invalidate('some_field', 'error_message');
|
$TestController->ControllerComment->invalidate('some_field', 'error_message');
|
||||||
$TestController->ControllerComment->invalidate('some_field2', 'error_message2');
|
$TestController->ControllerComment->invalidate('some_field2', 'error_message2');
|
||||||
|
|
||||||
$comment = new ControllerComment($request);
|
$comment = new ControllerComment($request);
|
||||||
$comment->set('someVar', 'data');
|
$comment->set('someVar', 'data');
|
||||||
$result = $TestController->validateErrors($comment);
|
$result = $TestController->validateErrors($comment);
|
||||||
|
@ -1248,6 +1249,23 @@ class ControllerTest extends CakeTestCase {
|
||||||
$this->assertEqual($TestController->validate($comment), 2);
|
$this->assertEqual($TestController->validate($comment), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that validateErrors works with any old model.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testValidateErrorsOnArbitraryModels() {
|
||||||
|
$TestController =& new TestController();
|
||||||
|
|
||||||
|
$Post = new ControllerPost();
|
||||||
|
$Post->validate = array('title' => 'notEmpty');
|
||||||
|
$Post->set('title', '');
|
||||||
|
$result = $TestController->validateErrors($Post);
|
||||||
|
|
||||||
|
$expected = array('title' => 'This field cannot be left blank');
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPostConditions method
|
* testPostConditions method
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.libs.controller
|
* @subpackage cake.tests.cases.libs.controller
|
||||||
* @since CakePHP(tm) v 1.2.3
|
* @since CakePHP(tm) v 1.2.3
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue