mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.4
Conflicts: lib/Cake/Test/Case/Network/CakeRequestTest.php
This commit is contained in:
commit
c597855fe4
59 changed files with 484 additions and 421 deletions
|
@ -82,7 +82,7 @@ class AclShell extends AppShell {
|
||||||
$out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
|
$out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
|
||||||
$out .= "--------------------------------------------------\n";
|
$out .= "--------------------------------------------------\n";
|
||||||
$this->err($out);
|
$this->err($out);
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->command) {
|
if ($this->command) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ApiShell extends AppShell {
|
||||||
if (isset($this->params['method'])) {
|
if (isset($this->params['method'])) {
|
||||||
if (!isset($parsed[$this->params['method']])) {
|
if (!isset($parsed[$this->params['method']])) {
|
||||||
$this->err(__d('cake_console', '%s::%s() could not be found', $class, $this->params['method']));
|
$this->err(__d('cake_console', '%s::%s() could not be found', $class, $this->params['method']));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
$method = $parsed[$this->params['method']];
|
$method = $parsed[$this->params['method']];
|
||||||
$this->out($class . '::' . $method['method'] . $method['parameters']);
|
$this->out($class . '::' . $method['method'] . $method['parameters']);
|
||||||
|
|
|
@ -123,8 +123,7 @@ class BakeShell extends AppShell {
|
||||||
$this->Test->execute();
|
$this->Test->execute();
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
exit(0);
|
return $this->_stop();
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,7 +345,6 @@ class ConsoleShell extends AppShell {
|
||||||
default:
|
default:
|
||||||
$this->out(__d('cake_console', "Invalid command"));
|
$this->out(__d('cake_console', "Invalid command"));
|
||||||
$this->out();
|
$this->out();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$command = '';
|
$command = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,7 @@ class I18nShell extends AppShell {
|
||||||
$this->out($this->OptionParser->help());
|
$this->out($this->OptionParser->help());
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
exit(0);
|
return $this->_stop();
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,12 +106,11 @@ class SchemaShell extends AppShell {
|
||||||
$File = new File($this->Schema->path . DS . $this->params['file']);
|
$File = new File($this->Schema->path . DS . $this->params['file']);
|
||||||
if ($File->exists()) {
|
if ($File->exists()) {
|
||||||
$this->out($File->read());
|
$this->out($File->read());
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} else {
|
}
|
||||||
$file = $this->Schema->path . DS . $this->params['file'];
|
$file = $this->Schema->path . DS . $this->params['file'];
|
||||||
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
|
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,11 +190,10 @@ class SchemaShell extends AppShell {
|
||||||
|
|
||||||
if ($this->Schema->write($content)) {
|
if ($this->Schema->write($content)) {
|
||||||
$this->out(__d('cake_console', 'Schema file: %s generated', $content['file']));
|
$this->out(__d('cake_console', 'Schema file: %s generated', $content['file']));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} else {
|
|
||||||
$this->err(__d('cake_console', 'Schema file: %s generated'));
|
|
||||||
$this->_stop();
|
|
||||||
}
|
}
|
||||||
|
$this->err(__d('cake_console', 'Schema file: %s generated'));
|
||||||
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,7 +210,7 @@ class SchemaShell extends AppShell {
|
||||||
$Schema = $this->Schema->load();
|
$Schema = $this->Schema->load();
|
||||||
if (!$Schema) {
|
if (!$Schema) {
|
||||||
$this->err(__d('cake_console', 'Schema could not be loaded'));
|
$this->err(__d('cake_console', 'Schema could not be loaded'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
if (!empty($this->params['write'])) {
|
if (!empty($this->params['write'])) {
|
||||||
if ($this->params['write'] == 1) {
|
if ($this->params['write'] == 1) {
|
||||||
|
@ -236,10 +234,10 @@ class SchemaShell extends AppShell {
|
||||||
|
|
||||||
if ($File->write($contents)) {
|
if ($File->write($contents)) {
|
||||||
$this->out(__d('cake_console', 'SQL dump file created in %s', $File->pwd()));
|
$this->out(__d('cake_console', 'SQL dump file created in %s', $File->pwd()));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} else {
|
} else {
|
||||||
$this->err(__d('cake_console', 'SQL dump could not be created'));
|
$this->err(__d('cake_console', 'SQL dump could not be created'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->out($contents);
|
$this->out($contents);
|
||||||
|
@ -297,7 +295,7 @@ class SchemaShell extends AppShell {
|
||||||
$this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
|
$this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
|
||||||
$this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
|
$this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
|
||||||
$this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
|
$this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
$table = null;
|
$table = null;
|
||||||
if (isset($this->args[1])) {
|
if (isset($this->args[1])) {
|
||||||
|
@ -330,13 +328,13 @@ class SchemaShell extends AppShell {
|
||||||
}
|
}
|
||||||
if (empty($drop) || empty($create)) {
|
if (empty($drop) || empty($create)) {
|
||||||
$this->out(__d('cake_console', 'Schema is up to date.'));
|
$this->out(__d('cake_console', 'Schema is up to date.'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
|
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
|
||||||
$this->out(array_keys($drop));
|
$this->out(array_keys($drop));
|
||||||
|
|
||||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
|
if ($this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y') {
|
||||||
$this->out(__d('cake_console', 'Dropping table(s).'));
|
$this->out(__d('cake_console', 'Dropping table(s).'));
|
||||||
$this->_run($drop, 'drop', $Schema);
|
$this->_run($drop, 'drop', $Schema);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +342,7 @@ class SchemaShell extends AppShell {
|
||||||
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
|
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
|
||||||
$this->out(array_keys($create));
|
$this->out(array_keys($create));
|
||||||
|
|
||||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
|
if ($this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y') {
|
||||||
$this->out(__d('cake_console', 'Creating table(s).'));
|
$this->out(__d('cake_console', 'Creating table(s).'));
|
||||||
$this->_run($create, 'create', $Schema);
|
$this->_run($create, 'create', $Schema);
|
||||||
}
|
}
|
||||||
|
@ -390,12 +388,12 @@ class SchemaShell extends AppShell {
|
||||||
|
|
||||||
if (empty($contents)) {
|
if (empty($contents)) {
|
||||||
$this->out(__d('cake_console', 'Schema is up to date.'));
|
$this->out(__d('cake_console', 'Schema is up to date.'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
|
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
|
||||||
$this->out(array_map('trim', $contents));
|
$this->out(array_map('trim', $contents));
|
||||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
|
if ($this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y') {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__d('cake_console', 'Updating Database...'));
|
$this->out(__d('cake_console', 'Updating Database...'));
|
||||||
$this->_run($contents, 'update', $Schema);
|
$this->_run($contents, 'update', $Schema);
|
||||||
|
|
|
@ -289,7 +289,7 @@ class ControllerTask extends BakeTask {
|
||||||
App::uses($modelImport, $plugin . 'Model');
|
App::uses($modelImport, $plugin . 'Model');
|
||||||
if (!class_exists($modelImport)) {
|
if (!class_exists($modelImport)) {
|
||||||
$this->err(__d('cake_console', 'You must have a model for this class to build basic methods. Please try again.'));
|
$this->err(__d('cake_console', 'You must have a model for this class to build basic methods. Please try again.'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$modelObj = ClassRegistry::init($currentModelName);
|
$modelObj = ClassRegistry::init($currentModelName);
|
||||||
|
|
|
@ -77,7 +77,7 @@ class DbConfigTask extends AppShell {
|
||||||
public function execute() {
|
public function execute() {
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
$this->_interactive();
|
$this->_interactive();
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ class ExtractTask extends AppShell {
|
||||||
$response = $this->in($message, null, rtrim($this->_paths[0], DS) . DS . 'Locale');
|
$response = $this->in($message, null, rtrim($this->_paths[0], DS) . DS . 'Locale');
|
||||||
if (strtoupper($response) === 'Q') {
|
if (strtoupper($response) === 'Q') {
|
||||||
$this->out(__d('cake_console', 'Extract Aborted'));
|
$this->out(__d('cake_console', 'Extract Aborted'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} elseif ($this->_isPathUsable($response)) {
|
} elseif ($this->_isPathUsable($response)) {
|
||||||
$this->_output = $response . DS;
|
$this->_output = $response . DS;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -681,7 +681,7 @@ class ModelTask extends BakeTask {
|
||||||
$prompt = "{$model->name} {$type} {$assoc['alias']}?";
|
$prompt = "{$model->name} {$type} {$assoc['alias']}?";
|
||||||
$response = $this->in($prompt, array('y', 'n'), 'y');
|
$response = $this->in($prompt, array('y', 'n'), 'y');
|
||||||
|
|
||||||
if ('n' == strtolower($response)) {
|
if (strtolower($response) === 'n') {
|
||||||
unset($associations[$type][$i]);
|
unset($associations[$type][$i]);
|
||||||
} elseif ($type === 'hasMany') {
|
} elseif ($type === 'hasMany') {
|
||||||
unset($associations['hasOne'][$i]);
|
unset($associations['hasOne'][$i]);
|
||||||
|
@ -938,7 +938,7 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
$this->err(__d('cake_console', 'Your database does not have any tables.'));
|
$this->err(__d('cake_console', 'Your database does not have any tables.'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
@ -960,7 +960,7 @@ class ModelTask extends BakeTask {
|
||||||
|
|
||||||
if ($enteredModel === 'q') {
|
if ($enteredModel === 'q') {
|
||||||
$this->out(__d('cake_console', 'Exit'));
|
$this->out(__d('cake_console', 'Exit'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$enteredModel || intval($enteredModel) > count($this->_modelNames)) {
|
if (!$enteredModel || intval($enteredModel) > count($this->_modelNames)) {
|
||||||
|
|
|
@ -65,9 +65,8 @@ class PluginTask extends AppShell {
|
||||||
$this->out(__d('cake_console', 'Plugin: %s already exists, no action taken', $plugin));
|
$this->out(__d('cake_console', 'Plugin: %s already exists, no action taken', $plugin));
|
||||||
$this->out(__d('cake_console', 'Path: %s', $pluginPath));
|
$this->out(__d('cake_console', 'Path: %s', $pluginPath));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
$this->_interactive($plugin);
|
|
||||||
}
|
}
|
||||||
|
$this->_interactive($plugin);
|
||||||
} else {
|
} else {
|
||||||
return $this->_interactive();
|
return $this->_interactive();
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,12 +368,9 @@ class ProjectTask extends AppShell {
|
||||||
if ($File->write($result)) {
|
if ($File->write($result)) {
|
||||||
Configure::write('Routing.prefixes', array($name));
|
Configure::write('Routing.prefixes', array($name));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -417,7 +414,7 @@ class ProjectTask extends AppShell {
|
||||||
$this->out(__d('cake_console', 'You need to enable %s in %s to use prefix routing.',
|
$this->out(__d('cake_console', 'You need to enable %s in %s to use prefix routing.',
|
||||||
'Configure::write(\'Routing.prefixes\', array(\'admin\'))',
|
'Configure::write(\'Routing.prefixes\', array(\'admin\'))',
|
||||||
'/app/Config/core.php'));
|
'/app/Config/core.php'));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
return $admin . '_';
|
return $admin . '_';
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ class ViewTask extends BakeTask {
|
||||||
if (!class_exists($controllerClassName)) {
|
if (!class_exists($controllerClassName)) {
|
||||||
$file = $controllerClassName . '.php';
|
$file = $controllerClassName . '.php';
|
||||||
$this->err(__d('cake_console', "The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
$this->err(__d('cake_console', "The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
$controllerObj = new $controllerClassName();
|
$controllerObj = new $controllerClassName();
|
||||||
$controllerObj->plugin = $this->plugin;
|
$controllerObj->plugin = $this->plugin;
|
||||||
|
@ -334,10 +334,9 @@ class ViewTask extends BakeTask {
|
||||||
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
|
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
|
||||||
if (strtolower($looksGood) === 'y') {
|
if (strtolower($looksGood) === 'y') {
|
||||||
$this->bake($action, ' ');
|
$this->bake($action, ' ');
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} else {
|
|
||||||
$this->out(__d('cake_console', 'Bake Aborted.'));
|
|
||||||
}
|
}
|
||||||
|
$this->out(__d('cake_console', 'Bake Aborted.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ConsoleErrorHandler {
|
||||||
$exception->getMessage(),
|
$exception->getMessage(),
|
||||||
$exception->getTraceAsString()
|
$exception->getTraceAsString()
|
||||||
));
|
));
|
||||||
$this->_stop($exception->getCode() ? $exception->getCode() : 1);
|
return $this->_stop($exception->getCode() ? $exception->getCode() : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ class ConsoleErrorHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($log === LOG_ERR) {
|
if ($log === LOG_ERR) {
|
||||||
$this->_stop(1);
|
return $this->_stop(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ class Shell extends Object {
|
||||||
$result = $this->stdin->read();
|
$result = $this->stdin->read();
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$this->_stop(1);
|
return $this->_stop(1);
|
||||||
}
|
}
|
||||||
$result = trim($result);
|
$result = trim($result);
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ class Shell extends Object {
|
||||||
if (!empty($message)) {
|
if (!empty($message)) {
|
||||||
$this->err($message);
|
$this->err($message);
|
||||||
}
|
}
|
||||||
$this->_stop(1);
|
return $this->_stop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -699,7 +699,7 @@ class Shell extends Object {
|
||||||
|
|
||||||
if (strtolower($key) === 'q') {
|
if (strtolower($key) === 'q') {
|
||||||
$this->out(__d('cake_console', '<error>Quitting</error>.'), 2);
|
$this->out(__d('cake_console', '<error>Quitting</error>.'), 2);
|
||||||
$this->_stop();
|
return $this->_stop();
|
||||||
} elseif (strtolower($key) !== 'y') {
|
} elseif (strtolower($key) !== 'y') {
|
||||||
$this->out(__d('cake_console', 'Skip `%s`', $path), 2);
|
$this->out(__d('cake_console', 'Skip `%s`', $path), 2);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class ShellDispatcher {
|
||||||
*/
|
*/
|
||||||
public static function run($argv) {
|
public static function run($argv) {
|
||||||
$dispatcher = new ShellDispatcher($argv);
|
$dispatcher = new ShellDispatcher($argv);
|
||||||
$dispatcher->_stop($dispatcher->dispatch() === false ? 1 : 0);
|
return $dispatcher->_stop($dispatcher->dispatch() === false ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FormAuthenticate extends BaseAuthenticate {
|
||||||
/**
|
/**
|
||||||
* Authenticates the identity contained in a request. Will use the `settings.userModel`, and `settings.fields`
|
* Authenticates the identity contained in a request. Will use the `settings.userModel`, and `settings.fields`
|
||||||
* to find POST data that is used to find a matching record in the `settings.userModel`. Will return false if
|
* to find POST data that is used to find a matching record in the `settings.userModel`. Will return false if
|
||||||
* there is no post data, either username or password is missing, of if the scope conditions have not been met.
|
* there is no post data, either username or password is missing, or if the scope conditions have not been met.
|
||||||
*
|
*
|
||||||
* @param CakeRequest $request The request that contains login information.
|
* @param CakeRequest $request The request that contains login information.
|
||||||
* @param CakeResponse $response Unused response object.
|
* @param CakeResponse $response Unused response object.
|
||||||
|
|
|
@ -250,15 +250,13 @@ class Scaffold {
|
||||||
$success
|
$success
|
||||||
);
|
);
|
||||||
return $this->_sendMessage($message);
|
return $this->_sendMessage($message);
|
||||||
} else {
|
}
|
||||||
return $this->controller->afterScaffoldSaveError($action);
|
return $this->controller->afterScaffoldSaveError($action);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ($this->_validSession) {
|
if ($this->_validSession) {
|
||||||
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($request->data)) {
|
if (empty($request->data)) {
|
||||||
if ($this->ScaffoldModel->id) {
|
if ($this->ScaffoldModel->id) {
|
||||||
|
@ -309,14 +307,13 @@ class Scaffold {
|
||||||
if ($this->ScaffoldModel->delete()) {
|
if ($this->ScaffoldModel->delete()) {
|
||||||
$message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
|
$message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||||
return $this->_sendMessage($message);
|
return $this->_sendMessage($message);
|
||||||
} else {
|
}
|
||||||
$message = __d('cake',
|
$message = __d('cake',
|
||||||
'There was an error deleting the %1$s with id: %2$s',
|
'There was an error deleting the %1$s with id: %2$s',
|
||||||
Inflector::humanize($this->modelClass),
|
Inflector::humanize($this->modelClass),
|
||||||
$id
|
$id
|
||||||
);
|
);
|
||||||
return $this->_sendMessage($message);
|
return $this->_sendMessage($message);
|
||||||
}
|
|
||||||
} elseif ($this->controller->scaffoldError('delete') === false) {
|
} elseif ($this->controller->scaffoldError('delete') === false) {
|
||||||
return $this->_scaffoldError();
|
return $this->_scaffoldError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,6 +535,9 @@ class App {
|
||||||
if (!isset(self::$_classMap[$className])) {
|
if (!isset(self::$_classMap[$className])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (strpos($className, '..') !== false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$parts = explode('.', self::$_classMap[$className], 2);
|
$parts = explode('.', self::$_classMap[$className], 2);
|
||||||
list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts));
|
list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts));
|
||||||
|
|
|
@ -219,7 +219,7 @@ class ErrorHandler {
|
||||||
'path' => Debugger::trimPath($file)
|
'path' => Debugger::trimPath($file)
|
||||||
);
|
);
|
||||||
return Debugger::getInstance()->outputError($data);
|
return Debugger::getInstance()->outputError($data);
|
||||||
} else {
|
}
|
||||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||||
if (!empty($errorConfig['trace'])) {
|
if (!empty($errorConfig['trace'])) {
|
||||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||||
|
@ -227,7 +227,6 @@ class ErrorHandler {
|
||||||
}
|
}
|
||||||
return CakeLog::write($log, $message);
|
return CakeLog::write($log, $message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an error page when some fatal error happens.
|
* Generate an error page when some fatal error happens.
|
||||||
|
|
|
@ -822,7 +822,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
array($Model->escapeField() => $id)
|
array($Model->escapeField() => $id)
|
||||||
);
|
);
|
||||||
return $Model->delete($id);
|
return $Model->delete($id);
|
||||||
} else {
|
}
|
||||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||||
if ($node[$right] == $edge) {
|
if ($node[$right] == $edge) {
|
||||||
$edge = $edge - 2;
|
$edge = $edge - 2;
|
||||||
|
@ -833,7 +833,6 @@ class TreeBehavior extends ModelBehavior {
|
||||||
array('callbacks' => false, 'validate' => false)
|
array('callbacks' => false, 'validate' => false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current tree is valid.
|
* Check if the current tree is valid.
|
||||||
|
|
|
@ -200,7 +200,7 @@ class Mysql extends DboSource {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
return array();
|
return array();
|
||||||
} else {
|
}
|
||||||
$tables = array();
|
$tables = array();
|
||||||
|
|
||||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||||
|
@ -211,7 +211,6 @@ class Mysql extends DboSource {
|
||||||
parent::listSources($tables);
|
parent::listSources($tables);
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a map of the columns contained in a result
|
* Builds a map of the columns contained in a result
|
||||||
|
@ -684,7 +683,7 @@ class Mysql extends DboSource {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
return array();
|
return array();
|
||||||
} else {
|
}
|
||||||
$tables = array();
|
$tables = array();
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
$tables[$row['Name']] = (array)$row;
|
$tables[$row['Name']] = (array)$row;
|
||||||
|
@ -702,7 +701,6 @@ class Mysql extends DboSource {
|
||||||
}
|
}
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts database-layer column types to basic types
|
* Converts database-layer column types to basic types
|
||||||
|
|
|
@ -305,9 +305,8 @@ class Postgres extends DboSource {
|
||||||
}
|
}
|
||||||
if (isset($this->_sequenceMap[$table][$field])) {
|
if (isset($this->_sequenceMap[$table][$field])) {
|
||||||
return $this->_sequenceMap[$table][$field];
|
return $this->_sequenceMap[$table][$field];
|
||||||
} else {
|
|
||||||
return "{$table}_{$field}_seq";
|
|
||||||
}
|
}
|
||||||
|
return "{$table}_{$field}_seq";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -760,15 +759,13 @@ class Postgres extends DboSource {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$resultRow[$table][$column] = $row[$index];
|
$resultRow[$table][$column] = $row[$index];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $resultRow;
|
return $resultRow;
|
||||||
} else {
|
}
|
||||||
$this->_result->closeCursor();
|
$this->_result->closeCursor();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates between PHP boolean values and PostgreSQL boolean values
|
* Translates between PHP boolean values and PostgreSQL boolean values
|
||||||
|
@ -793,7 +790,6 @@ class Postgres extends DboSource {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$result = (bool)$data;
|
$result = (bool)$data;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($quote) {
|
if ($quote) {
|
||||||
|
|
|
@ -362,11 +362,10 @@ class Sqlite extends DboSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $resultRow;
|
return $resultRow;
|
||||||
} else {
|
}
|
||||||
$this->_result->closeCursor();
|
$this->_result->closeCursor();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a limit statement in the correct format for the particular database.
|
* Returns a limit statement in the correct format for the particular database.
|
||||||
|
|
|
@ -172,7 +172,7 @@ class Sqlserver extends DboSource {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
return array();
|
return array();
|
||||||
} else {
|
}
|
||||||
$tables = array();
|
$tables = array();
|
||||||
|
|
||||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||||
|
@ -183,7 +183,6 @@ class Sqlserver extends DboSource {
|
||||||
parent::listSources($tables);
|
parent::listSources($tables);
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of the fields in given table name.
|
* Returns an array of the fields in given table name.
|
||||||
|
@ -318,9 +317,8 @@ class Sqlserver extends DboSource {
|
||||||
$result[] = $prepend . $fields[$i];
|
$result[] = $prepend . $fields[$i];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -539,10 +537,8 @@ class Sqlserver extends DboSource {
|
||||||
";
|
";
|
||||||
} elseif (strpos($limit, 'FETCH') !== false) {
|
} elseif (strpos($limit, 'FETCH') !== false) {
|
||||||
return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}";
|
return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}";
|
||||||
} else {
|
|
||||||
return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}";
|
|
||||||
}
|
}
|
||||||
break;
|
return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}";
|
||||||
case "schema":
|
case "schema":
|
||||||
extract($data);
|
extract($data);
|
||||||
|
|
||||||
|
|
|
@ -592,13 +592,12 @@ class DboSource extends DataSource {
|
||||||
$recursive = $params[5 + $off];
|
$recursive = $params[5 + $off];
|
||||||
}
|
}
|
||||||
return $args[2]->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
|
return $args[2]->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
|
||||||
} else {
|
}
|
||||||
if (isset($params[3 + $off])) {
|
if (isset($params[3 + $off])) {
|
||||||
$recursive = $params[3 + $off];
|
$recursive = $params[3 + $off];
|
||||||
}
|
}
|
||||||
return $args[2]->find('first', compact('conditions', 'fields', 'order', 'recursive'));
|
return $args[2]->find('first', compact('conditions', 'fields', 'order', 'recursive'));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (isset($args[1]) && $args[1] === true) {
|
if (isset($args[1]) && $args[1] === true) {
|
||||||
return $this->fetchAll($args[0], true);
|
return $this->fetchAll($args[0], true);
|
||||||
} elseif (isset($args[1]) && !is_array($args[1])) {
|
} elseif (isset($args[1]) && !is_array($args[1])) {
|
||||||
|
@ -612,7 +611,6 @@ class DboSource extends DataSource {
|
||||||
return $this->fetchAll($args[0], $args[1], array('cache' => $cache));
|
return $this->fetchAll($args[0], $args[1], array('cache' => $cache));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a row from current resultset as an array
|
* Returns a row from current resultset as an array
|
||||||
|
@ -632,9 +630,8 @@ class DboSource extends DataSource {
|
||||||
$this->fetchVirtualField($resultRow);
|
$this->fetchVirtualField($resultRow);
|
||||||
}
|
}
|
||||||
return $resultRow;
|
return $resultRow;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1255,11 +1255,11 @@ class Model extends Object implements CakeEventListener {
|
||||||
isset($data['meridian']) &&
|
isset($data['meridian']) &&
|
||||||
!empty($data['hour']) &&
|
!empty($data['hour']) &&
|
||||||
$data['hour'] != 12 &&
|
$data['hour'] != 12 &&
|
||||||
'pm' == $data['meridian']
|
$data['meridian'] === 'pm'
|
||||||
) {
|
) {
|
||||||
$data['hour'] = $data['hour'] + 12;
|
$data['hour'] = $data['hour'] + 12;
|
||||||
}
|
}
|
||||||
if (isset($data['hour']) && isset($data['meridian']) && $data['hour'] == 12 && 'am' == $data['meridian']) {
|
if (isset($data['hour']) && isset($data['meridian']) && $data['hour'] == 12 && $data['meridian'] === 'am') {
|
||||||
$data['hour'] = '00';
|
$data['hour'] = '00';
|
||||||
}
|
}
|
||||||
if ($type === 'time') {
|
if ($type === 'time') {
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Permission extends AppModel {
|
||||||
|
|
||||||
if (empty($perms)) {
|
if (empty($perms)) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
$perms = Hash::extract($perms, '{n}.' . $this->alias);
|
$perms = Hash::extract($perms, '{n}.' . $this->alias);
|
||||||
foreach ($perms as $perm) {
|
foreach ($perms as $perm) {
|
||||||
if ($action === '*') {
|
if ($action === '*') {
|
||||||
|
@ -153,7 +153,6 @@ class Permission extends AppModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,9 +148,8 @@ class CakeValidationRule {
|
||||||
if (in_array($this->required, array('create', 'update'), true)) {
|
if (in_array($this->required, array('create', 'update'), true)) {
|
||||||
if ($this->required === 'create' && !$this->isUpdate() || $this->required === 'update' && $this->isUpdate()) {
|
if ($this->required === 'create' && !$this->isUpdate() || $this->required === 'update' && $this->isUpdate()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->required;
|
return $this->required;
|
||||||
|
|
|
@ -257,7 +257,15 @@ class CakeRequest implements ArrayAccess {
|
||||||
list($uri) = explode('?', $uri, 2);
|
list($uri) = explode('?', $uri, 2);
|
||||||
}
|
}
|
||||||
if (empty($uri) || $uri === '/' || $uri === '//' || $uri === '/index.php') {
|
if (empty($uri) || $uri === '/' || $uri === '//' || $uri === '/index.php') {
|
||||||
return '/';
|
$uri = '/';
|
||||||
|
}
|
||||||
|
$endsWithIndex = '/webroot/index.php';
|
||||||
|
$endsWithLength = strlen($endsWithIndex);
|
||||||
|
if (
|
||||||
|
strlen($uri) >= $endsWithLength &&
|
||||||
|
substr($uri, -$endsWithLength) === $endsWithIndex
|
||||||
|
) {
|
||||||
|
$uri = '/';
|
||||||
}
|
}
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +273,12 @@ class CakeRequest implements ArrayAccess {
|
||||||
/**
|
/**
|
||||||
* Returns a base URL and sets the proper webroot
|
* Returns a base URL and sets the proper webroot
|
||||||
*
|
*
|
||||||
|
* If CakePHP is called with index.php in the URL even though
|
||||||
|
* URL Rewriting is activated (and thus not needed) it swallows
|
||||||
|
* the unnecessary part from $base to prevent issue #3318.
|
||||||
|
*
|
||||||
* @return string Base URL
|
* @return string Base URL
|
||||||
|
* @link https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3318
|
||||||
*/
|
*/
|
||||||
protected function _base() {
|
protected function _base() {
|
||||||
$dir = $webroot = null;
|
$dir = $webroot = null;
|
||||||
|
@ -283,6 +296,10 @@ class CakeRequest implements ArrayAccess {
|
||||||
if (!$baseUrl) {
|
if (!$baseUrl) {
|
||||||
$base = dirname(env('PHP_SELF'));
|
$base = dirname(env('PHP_SELF'));
|
||||||
|
|
||||||
|
$indexPos = strpos($base, '/webroot/index.php');
|
||||||
|
if ($indexPos !== false) {
|
||||||
|
$base = substr($base, 0, $indexPos) . '/webroot';
|
||||||
|
}
|
||||||
if ($webroot === 'webroot' && $webroot === basename($base)) {
|
if ($webroot === 'webroot' && $webroot === basename($base)) {
|
||||||
$base = dirname($base);
|
$base = dirname($base);
|
||||||
}
|
}
|
||||||
|
@ -295,6 +312,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
}
|
}
|
||||||
$base = implode('/', array_map('rawurlencode', explode('/', $base)));
|
$base = implode('/', array_map('rawurlencode', explode('/', $base)));
|
||||||
$this->webroot = $base . '/';
|
$this->webroot = $base . '/';
|
||||||
|
|
||||||
return $this->base = $base;
|
return $this->base = $base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,11 +382,10 @@ class CakeSocket {
|
||||||
if ($enableCryptoResult === true) {
|
if ($enableCryptoResult === true) {
|
||||||
$this->encrypted = $enable;
|
$this->encrypted = $enable;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
$errorMessage = __d('cake_dev', 'Unable to perform enableCrypto operation on CakeSocket');
|
$errorMessage = __d('cake_dev', 'Unable to perform enableCrypto operation on CakeSocket');
|
||||||
$this->setLastError(null, $errorMessage);
|
$this->setLastError(null, $errorMessage);
|
||||||
throw new SocketException($errorMessage);
|
throw new SocketException($errorMessage);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1092,8 +1092,6 @@ class CakeEmail {
|
||||||
$content = implode("\n", $content) . "\n";
|
$content = implode("\n", $content) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_textMessage = $this->_htmlMessage = '';
|
|
||||||
$this->_createBoundary();
|
|
||||||
$this->_message = $this->_render($this->_wrap($content));
|
$this->_message = $this->_render($this->_wrap($content));
|
||||||
|
|
||||||
$contents = $this->transportClass()->send($this);
|
$contents = $this->transportClass()->send($this);
|
||||||
|
@ -1477,9 +1475,12 @@ class CakeEmail {
|
||||||
* @return array Email body ready to be sent
|
* @return array Email body ready to be sent
|
||||||
*/
|
*/
|
||||||
protected function _render($content) {
|
protected function _render($content) {
|
||||||
|
$this->_textMessage = $this->_htmlMessage = '';
|
||||||
|
|
||||||
$content = implode("\n", $content);
|
$content = implode("\n", $content);
|
||||||
$rendered = $this->_renderTemplates($content);
|
$rendered = $this->_renderTemplates($content);
|
||||||
|
|
||||||
|
$this->_createBoundary();
|
||||||
$msg = array();
|
$msg = array();
|
||||||
|
|
||||||
$contentIds = array_filter((array)Hash::extract($this->_attachments, '{s}.contentId'));
|
$contentIds = array_filter((array)Hash::extract($this->_attachments, '{s}.contentId'));
|
||||||
|
@ -1649,9 +1650,8 @@ class CakeEmail {
|
||||||
$charset = strtoupper($this->charset);
|
$charset = strtoupper($this->charset);
|
||||||
if (array_key_exists($charset, $this->_contentTypeCharset)) {
|
if (array_key_exists($charset, $this->_contentTypeCharset)) {
|
||||||
return strtoupper($this->_contentTypeCharset[$charset]);
|
return strtoupper($this->_contentTypeCharset[$charset]);
|
||||||
} else {
|
|
||||||
return strtoupper($this->charset);
|
|
||||||
}
|
}
|
||||||
|
return strtoupper($this->charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,8 @@ class AclPerson extends CakeTestModel {
|
||||||
}
|
}
|
||||||
if (!$motherId) {
|
if (!$motherId) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
return array('AclPerson' => array('id' => $motherId));
|
|
||||||
}
|
}
|
||||||
|
return array('AclPerson' => array('id' => $motherId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3672,12 +3672,11 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
if (!is_array($Model)) {
|
if (!is_array($Model)) {
|
||||||
$result = $Model->containments($contain);
|
$result = $Model->containments($contain);
|
||||||
return $this->_containments($result['models']);
|
return $this->_containments($result['models']);
|
||||||
} else {
|
}
|
||||||
$result = $Model;
|
$result = $Model;
|
||||||
foreach ($result as $i => $containment) {
|
foreach ($result as $i => $containment) {
|
||||||
$result[$i] = array_diff_key($containment, array('instance' => true));
|
$result[$i] = array_diff_key($containment, array('instance' => true));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,12 @@ App::uses('CakeRequest', 'Network');
|
||||||
*/
|
*/
|
||||||
class TestCakeRequest extends CakeRequest {
|
class TestCakeRequest extends CakeRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reConstruct method
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @param bool $parseEnvironment
|
||||||
|
*/
|
||||||
public function reConstruct($url = 'some/path', $parseEnvironment = true) {
|
public function reConstruct($url = 'some/path', $parseEnvironment = true) {
|
||||||
$this->_base();
|
$this->_base();
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
|
@ -49,10 +55,13 @@ class TestCakeRequest extends CakeRequest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CakeRequestTest
|
||||||
|
*/
|
||||||
class CakeRequestTest extends CakeTestCase {
|
class CakeRequestTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setup callback
|
* Setup callback
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +78,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown
|
* TearDown
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +91,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the autoparse = false constructor works.
|
* Test that the autoparse = false constructor works.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +104,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test construction
|
* Test construction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -153,7 +162,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test addParams() method
|
* Test addParams() method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -170,7 +179,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test splicing in paths.
|
* Test splicing in paths.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -190,7 +199,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test parsing POST data into the object.
|
* Test parsing POST data into the object.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -241,7 +250,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test parsing PUT data into the object.
|
* Test parsing PUT data into the object.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -315,7 +324,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test parsing json PUT data into the object.
|
* Test parsing json PUT data into the object.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -332,7 +341,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test parsing of FILES array
|
* Test parsing of FILES array
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -621,7 +630,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test method overrides coming in from POST data.
|
* Test method overrides coming in from POST data.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -640,7 +649,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the clientIp method.
|
* Test the clientIp method.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -663,7 +672,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the referer function.
|
* Test the referrer function.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -782,7 +791,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the method() method.
|
* Test the method() method.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -794,7 +803,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test host retrieval.
|
* Test host retrieval.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -806,7 +815,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test domain retrieval.
|
* Test domain retrieval.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -821,7 +830,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getting subdomains for a host.
|
* Test getting subdomains for a host.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -842,7 +851,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test ajax, flash and friends
|
* Test ajax, flash and friends
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -876,7 +885,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test __call expcetions
|
* Test __call exceptions
|
||||||
*
|
*
|
||||||
* @expectedException CakeException
|
* @expectedException CakeException
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -887,7 +896,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test is(ssl)
|
* Test is(ssl)
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -920,7 +929,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getting request params with object properties.
|
* Test getting request params with object properties.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -955,7 +964,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the array access implementation
|
* Test the array access implementation
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -986,7 +995,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test adding detectors and having them work.
|
* Test adding detectors and having them work.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1043,16 +1052,17 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* helper function for testing callbacks.
|
* Helper function for testing callbacks.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $request
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function detectCallback($request) {
|
public function detectCallback($request) {
|
||||||
return (bool)$request->return;
|
return (bool)$request->return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getting headers
|
* Test getting headers
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1066,7 +1076,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test accepts() with and without parameters
|
* Test accepts() with and without parameters
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1151,7 +1161,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBaseUrlAndWebrootWithModRewrite method
|
* Test baseUrl and webroot with ModRewrite
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1220,7 +1230,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBaseUrlwithModRewriteAlias method
|
* Test baseUrl with ModRewrite alias
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1248,7 +1258,71 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test base, webroot, and url parsing when there is no url rewriting
|
* Test base, webroot, url and here parsing when there is url rewriting but
|
||||||
|
* CakePHP gets called with index.php in url nonetheless.
|
||||||
|
*
|
||||||
|
* Tests uri with
|
||||||
|
* - index.php/
|
||||||
|
* - index.php/
|
||||||
|
* - index.php/apples/
|
||||||
|
* - index.php/bananas/eat/tasty_banana
|
||||||
|
*
|
||||||
|
* @link https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3318
|
||||||
|
*/
|
||||||
|
public function testBaseUrlWithModRewriteAndIndexPhp() {
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cakephp/app/webroot/index.php';
|
||||||
|
$_SERVER['PHP_SELF'] = '/cakephp/app/webroot/index.php';
|
||||||
|
unset($_SERVER['PATH_INFO']);
|
||||||
|
$request = new CakeRequest();
|
||||||
|
|
||||||
|
$this->assertEquals('/cakephp', $request->base);
|
||||||
|
$this->assertEquals('/cakephp/', $request->webroot);
|
||||||
|
$this->assertEquals('', $request->url);
|
||||||
|
$this->assertEquals('/cakephp/', $request->here);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cakephp/app/webroot/index.php/';
|
||||||
|
$_SERVER['PHP_SELF'] = '/cakephp/app/webroot/index.php/';
|
||||||
|
$_SERVER['PATH_INFO'] = '/';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
|
||||||
|
$this->assertEquals('/cakephp', $request->base);
|
||||||
|
$this->assertEquals('/cakephp/', $request->webroot);
|
||||||
|
$this->assertEquals('', $request->url);
|
||||||
|
$this->assertEquals('/cakephp/', $request->here);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cakephp/app/webroot/index.php/apples';
|
||||||
|
$_SERVER['PHP_SELF'] = '/cakephp/app/webroot/index.php/apples';
|
||||||
|
$_SERVER['PATH_INFO'] = '/apples';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
|
||||||
|
$this->assertEquals('/cakephp', $request->base);
|
||||||
|
$this->assertEquals('/cakephp/', $request->webroot);
|
||||||
|
$this->assertEquals('apples', $request->url);
|
||||||
|
$this->assertEquals('/cakephp/apples', $request->here);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cakephp/app/webroot/index.php/melons/share/';
|
||||||
|
$_SERVER['PHP_SELF'] = '/cakephp/app/webroot/index.php/melons/share/';
|
||||||
|
$_SERVER['PATH_INFO'] = '/melons/share/';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
|
||||||
|
$this->assertEquals('/cakephp', $request->base);
|
||||||
|
$this->assertEquals('/cakephp/', $request->webroot);
|
||||||
|
$this->assertEquals('melons/share/', $request->url);
|
||||||
|
$this->assertEquals('/cakephp/melons/share/', $request->here);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cakephp/app/webroot/index.php/bananas/eat/tasty_banana';
|
||||||
|
$_SERVER['PHP_SELF'] = '/cakephp/app/webroot/index.php/bananas/eat/tasty_banana';
|
||||||
|
$_SERVER['PATH_INFO'] = '/bananas/eat/tasty_banana';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
|
||||||
|
$this->assertEquals('/cakephp', $request->base);
|
||||||
|
$this->assertEquals('/cakephp/', $request->webroot);
|
||||||
|
$this->assertEquals('bananas/eat/tasty_banana', $request->url);
|
||||||
|
$this->assertEquals('/cakephp/bananas/eat/tasty_banana', $request->here);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test base, webroot, and url parsing when there is no url rewriting
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1272,7 +1346,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBaseUrlAndWebrootWithBaseUrl method
|
* Test baseUrl and webroot with baseUrl
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1321,7 +1395,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baseUrl with no rewrite and using the top level index.php.
|
* Test baseUrl with no rewrite and using the top level index.php.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1359,7 +1433,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baseUrl with no rewrite, and using the app/webroot/index.php file as is normal with virtual hosts.
|
* Test baseUrl with no rewrite, and using the app/webroot/index.php file as is normal with virtual hosts.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1405,9 +1479,9 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generator for environment configurations
|
* Generator for environment configurations
|
||||||
*
|
*
|
||||||
* @return void
|
* @return array Environment array
|
||||||
*/
|
*/
|
||||||
public static function environmentGenerator() {
|
public static function environmentGenerator() {
|
||||||
return array(
|
return array(
|
||||||
|
@ -1779,9 +1853,12 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testEnvironmentDetection method
|
* Test environment detection
|
||||||
*
|
*
|
||||||
* @dataProvider environmentGenerator
|
* @dataProvider environmentGenerator
|
||||||
|
* @param $name
|
||||||
|
* @param $env
|
||||||
|
* @param $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEnvironmentDetection($name, $env, $expected) {
|
public function testEnvironmentDetection($name, $env, $expected) {
|
||||||
|
@ -1798,7 +1875,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the query() method
|
* Test the query() method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1816,7 +1893,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the query() method with arrays passed via $_GET
|
* Test the query() method with arrays passed via $_GET
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1857,7 +1934,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the data() method reading
|
* Test the data() method reading
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1876,7 +1953,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test writing with data()
|
* Test writing with data()
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1898,7 +1975,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test writing falsey values.
|
* Test writing falsey values.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1919,7 +1996,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test accept language
|
* Test accept language
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -1962,7 +2039,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the here() method
|
* Test the here() method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -2065,7 +2142,7 @@ XML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestOnlyAllow
|
* Test onlyAllow method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -2080,7 +2157,7 @@ XML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestOnlyAllow throwing exception
|
* Test onlyAllow throwing exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testOnlyAllowException() {
|
public function testOnlyAllowException() {
|
||||||
|
|
|
@ -65,6 +65,14 @@ class TestCakeEmail extends CakeEmail {
|
||||||
return $this->_encode($text);
|
return $this->_encode($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render to protected method
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function render($content) {
|
||||||
|
return $this->_render($content);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1578,6 +1586,22 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testRender method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testRenderWithLayoutAndAttachment() {
|
||||||
|
$this->CakeEmail->emailFormat('html');
|
||||||
|
$this->CakeEmail->template('html', 'default');
|
||||||
|
$this->CakeEmail->attachments(array(CAKE . 'basics.php'));
|
||||||
|
$result = $this->CakeEmail->render(array());
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
|
||||||
|
$result = $this->CakeEmail->getBoundary();
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testConstructWithConfigArray method
|
* testConstructWithConfigArray method
|
||||||
*
|
*
|
||||||
|
|
|
@ -122,9 +122,8 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
||||||
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
|
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
|
||||||
} elseif (!isset($result) || $result->errorCount() > 0) {
|
} elseif (!isset($result) || $result->errorCount() > 0) {
|
||||||
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
|
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
|
||||||
} else {
|
|
||||||
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
|
|
||||||
}
|
}
|
||||||
|
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ class CakeTestModel extends Model {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$queryData['order'] = array($this->alias . '.' . $this->primaryKey => 'ASC');
|
$queryData['order'] = array($this->alias . '.' . $this->primaryKey => 'ASC');
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $queryData;
|
return $queryData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,14 +97,13 @@ class CakeTime {
|
||||||
*
|
*
|
||||||
* @param string $name Variable name
|
* @param string $name Variable name
|
||||||
* @param mixes $value Variable value
|
* @param mixes $value Variable value
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __set($name, $value) {
|
public function __set($name, $value) {
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'niceFormat':
|
case 'niceFormat':
|
||||||
self::${$name} = $value;
|
self::${$name} = $value;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -516,13 +516,12 @@ class Folder {
|
||||||
umask($old);
|
umask($old);
|
||||||
$this->_messages[] = __d('cake_dev', '%s created', $pathname);
|
$this->_messages[] = __d('cake_dev', '%s created', $pathname);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
umask($old);
|
umask($old);
|
||||||
$this->_errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
$this->_errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,9 +809,8 @@ class Folder {
|
||||||
if (!empty($newparts)) {
|
if (!empty($newparts)) {
|
||||||
array_pop($newparts);
|
array_pop($newparts);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
$newparts[] = $part;
|
$newparts[] = $part;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Hash {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,7 +334,6 @@ class Inflector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::${$var}['rules'] = $rules + self::${$var}['rules'];
|
self::${$var}['rules'] = $rules + self::${$var}['rules'];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,6 @@ class Validation {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for Validation::comparison()');
|
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for Validation::comparison()');
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -822,9 +821,8 @@ class Validation {
|
||||||
protected static function _check($check, $regex) {
|
protected static function _check($check, $regex) {
|
||||||
if (is_string($regex) && preg_match($regex, $check)) {
|
if (is_string($regex) && preg_match($regex, $check)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -665,15 +665,13 @@ class Helper extends Object {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$name = 'data[' . implode('][', $this->entity()) . ']';
|
$name = 'data[' . implode('][', $this->entity()) . ']';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
$options[$key] = $name;
|
$options[$key] = $name;
|
||||||
return $options;
|
return $options;
|
||||||
} else {
|
|
||||||
return $name;
|
|
||||||
}
|
}
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -729,9 +727,8 @@ class Helper extends Object {
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
$options[$key] = $result;
|
$options[$key] = $result;
|
||||||
return $options;
|
return $options;
|
||||||
} else {
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -920,7 +917,7 @@ class Helper extends Object {
|
||||||
do {
|
do {
|
||||||
$oldstring = $this->_cleaned;
|
$oldstring = $this->_cleaned;
|
||||||
$this->_cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->_cleaned);
|
$this->_cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->_cleaned);
|
||||||
} while ($oldstring != $this->_cleaned);
|
} while ($oldstring !== $this->_cleaned);
|
||||||
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,9 +205,8 @@ class FormHelper extends AppHelper {
|
||||||
return $this->fieldset[$model]['fields'];
|
return $this->fieldset[$model]['fields'];
|
||||||
} elseif (isset($this->fieldset[$model]['fields'][$field])) {
|
} elseif (isset($this->fieldset[$model]['fields'][$field])) {
|
||||||
return $this->fieldset[$model]['fields'][$field];
|
return $this->fieldset[$model]['fields'][$field];
|
||||||
} else {
|
|
||||||
return isset($object->hasAndBelongsToMany[$field]) ? array('type' => 'multiple') : null;
|
|
||||||
}
|
}
|
||||||
|
return isset($object->hasAndBelongsToMany[$field]) ? array('type' => 'multiple') : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key === 'errors' && !isset($this->validationErrors[$model])) {
|
if ($key === 'errors' && !isset($this->validationErrors[$model])) {
|
||||||
|
@ -232,12 +231,11 @@ class FormHelper extends AppHelper {
|
||||||
if ($key === 'validates') {
|
if ($key === 'validates') {
|
||||||
if (empty($field)) {
|
if (empty($field)) {
|
||||||
return $this->fieldset[$model]['validates'];
|
return $this->fieldset[$model]['validates'];
|
||||||
} else {
|
}
|
||||||
return isset($this->fieldset[$model]['validates'][$field]) ?
|
return isset($this->fieldset[$model]['validates'][$field]) ?
|
||||||
$this->fieldset[$model]['validates'] : null;
|
$this->fieldset[$model]['validates'] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if a field is required to be filled based on validation properties from the validating object.
|
* Returns if a field is required to be filled based on validation properties from the validating object.
|
||||||
|
@ -420,7 +418,6 @@ class FormHelper extends AppHelper {
|
||||||
));
|
));
|
||||||
default:
|
default:
|
||||||
$htmlAttributes['method'] = 'post';
|
$htmlAttributes['method'] = 'post';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$this->requestType = strtolower($options['type']);
|
$this->requestType = strtolower($options['type']);
|
||||||
|
|
||||||
|
@ -734,9 +731,8 @@ class FormHelper extends AppHelper {
|
||||||
$tag = is_string($options['wrap']) ? $options['wrap'] : 'div';
|
$tag = is_string($options['wrap']) ? $options['wrap'] : 'div';
|
||||||
unset($options['wrap']);
|
unset($options['wrap']);
|
||||||
return $this->Html->tag($tag, $error, $options);
|
return $this->Html->tag($tag, $error, $options);
|
||||||
} else {
|
|
||||||
return $error;
|
|
||||||
}
|
}
|
||||||
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2581,9 +2577,8 @@ class FormHelper extends AppHelper {
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
$options[$key] = $name;
|
$options[$key] = $name;
|
||||||
return $options;
|
return $options;
|
||||||
} else {
|
|
||||||
return $name;
|
|
||||||
}
|
}
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
return parent::_name($options, $field, $key);
|
return parent::_name($options, $field, $key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,9 +289,8 @@ class HtmlHelper extends AppHelper {
|
||||||
|
|
||||||
if (empty($options['block'])) {
|
if (empty($options['block'])) {
|
||||||
return $out;
|
return $out;
|
||||||
} else {
|
|
||||||
$this->_View->append($options['block'], $out);
|
|
||||||
}
|
}
|
||||||
|
$this->_View->append($options['block'], $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -473,9 +472,8 @@ class HtmlHelper extends AppHelper {
|
||||||
|
|
||||||
if (empty($options['block'])) {
|
if (empty($options['block'])) {
|
||||||
return $out;
|
return $out;
|
||||||
} else {
|
|
||||||
$this->_View->append($options['block'], $out);
|
|
||||||
}
|
}
|
||||||
|
$this->_View->append($options['block'], $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -696,9 +694,8 @@ class HtmlHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return implode($separator, $out);
|
return implode($separator, $out);
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -165,7 +165,6 @@ abstract class JsBaseEngineHelper extends AppHelper {
|
||||||
if ($quoteString) {
|
if ($quoteString) {
|
||||||
$val = '"' . $val . '"';
|
$val = '"' . $val . '"';
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,7 +507,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
$link = $this->link($title, $url, compact('escape', 'model') + $options);
|
$link = $this->link($title, $url, compact('escape', 'model') + $options);
|
||||||
return $this->Html->tag($tag, $link, compact('class'));
|
return $this->Html->tag($tag, $link, compact('class'));
|
||||||
} else {
|
}
|
||||||
unset($options['rel']);
|
unset($options['rel']);
|
||||||
if (!$tag) {
|
if (!$tag) {
|
||||||
if ($disabledTag) {
|
if ($disabledTag) {
|
||||||
|
@ -523,7 +523,6 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
return $this->Html->tag($tag, $title, compact('escape', 'class') + $options);
|
return $this->Html->tag($tag, $title, compact('escape', 'class') + $options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given result set is not at the first page
|
* Returns true if the given result set is not at the first page
|
||||||
|
@ -664,7 +663,6 @@ class PaginatorHelper extends AppHelper {
|
||||||
'{:page}', '{:pages}', '{:current}', '{:count}', '{:start}', '{:end}', '{:model}'
|
'{:page}', '{:pages}', '{:current}', '{:count}', '{:start}', '{:end}', '{:model}'
|
||||||
);
|
);
|
||||||
$out = str_replace($newKeys, array_values($map), $out);
|
$out = str_replace($newKeys, array_values($map), $out);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ class TimeHelper extends AppHelper {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->{$name} = $value;
|
$this->{$name} = $value;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -564,9 +564,8 @@ class View extends Object {
|
||||||
//@codingStandardsIgnoreEnd
|
//@codingStandardsIgnoreEnd
|
||||||
unset($out);
|
unset($out);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
return substr($out, strlen($match[0]));
|
|
||||||
}
|
}
|
||||||
|
return substr($out, strlen($match[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ if (!function_exists('clearCache')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
$cache = array(
|
$cache = array(
|
||||||
CACHE . $type . DS . '*' . $params . $ext,
|
CACHE . $type . DS . '*' . $params . $ext,
|
||||||
CACHE . $type . DS . '*' . $params . '_*' . $ext
|
CACHE . $type . DS . '*' . $params . '_*' . $ext
|
||||||
|
@ -503,7 +503,7 @@ if (!function_exists('clearCache')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
} elseif (is_array($params)) {
|
} elseif (is_array($params)) {
|
||||||
foreach ($params as $file) {
|
foreach ($params as $file) {
|
||||||
clearCache($file, $type, $ext);
|
clearCache($file, $type, $ext);
|
||||||
|
|
Loading…
Reference in a new issue