mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-19 16:10:54 +00:00
Merge branch '2.0' into 2.1
Conflicts: lib/Cake/Test/Case/Model/ModelReadTest.php lib/Cake/Utility/Debugger.php
This commit is contained in:
commit
389072708a
85 changed files with 533 additions and 431 deletions
|
@ -101,7 +101,7 @@ class ApiShell extends AppShell {
|
|||
$this->_stop();
|
||||
}
|
||||
$method = $parsed[$this->params['method']];
|
||||
$this->out($class .'::'.$method['method'] . $method['parameters']);
|
||||
$this->out($class . '::' . $method['method'] . $method['parameters']);
|
||||
$this->hr();
|
||||
$this->out($method['comment'], true);
|
||||
} else {
|
||||
|
@ -127,7 +127,7 @@ class ApiShell extends AppShell {
|
|||
if (isset($methods[--$number])) {
|
||||
$method = $parsed[$methods[$number]];
|
||||
$this->hr();
|
||||
$this->out($class .'::'.$method['method'] . $method['parameters']);
|
||||
$this->out($class . '::' . $method['method'] . $method['parameters']);
|
||||
$this->hr();
|
||||
$this->out($method['comment'], true);
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class ProjectTask extends AppShell {
|
|||
$contents = $File->read();
|
||||
if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
$string = Security::generateAuthKey();
|
||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents);
|
||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents);
|
||||
if ($File->write($result)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ class ProjectTask extends AppShell {
|
|||
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
App::uses('Security', 'Utility');
|
||||
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
|
||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
|
||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents);
|
||||
if ($File->write($result)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ class ProjectTask extends AppShell {
|
|||
$File = new File($path . 'core.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
|
||||
$result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents);
|
||||
$result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents);
|
||||
if ($File->write($result)) {
|
||||
Configure::write('Routing.prefixes', array($name));
|
||||
return true;
|
||||
|
|
|
@ -222,6 +222,7 @@ class UpgradeShell extends AppShell {
|
|||
$plugins = App::objects('plugin');
|
||||
$pluginHelpers = array();
|
||||
foreach ($plugins as $plugin) {
|
||||
CakePlugin::load($plugin);
|
||||
$pluginHelpers = array_merge(
|
||||
$pluginHelpers,
|
||||
App::objects('helper', App::pluginPath($plugin) . DS . 'views' . DS . 'helpers' . DS, false)
|
||||
|
|
|
@ -488,11 +488,11 @@ class DbAcl extends Object implements AclInterface {
|
|||
}
|
||||
|
||||
return array(
|
||||
'aro' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'),
|
||||
'aco' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'),
|
||||
'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
|
||||
'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'),
|
||||
'link' => $this->Aro->Permission->find('all', array('conditions' => array(
|
||||
$this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'),
|
||||
$this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id')
|
||||
$this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
|
||||
$this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id')
|
||||
)))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ class AuthComponent extends Component {
|
|||
if (!$this->_getUser()) {
|
||||
if (!$request->is('ajax')) {
|
||||
$this->flash($this->authError);
|
||||
$this->Session->write('Auth.redirect', Router::reverse($request));
|
||||
$this->Session->write('Auth.redirect', $request->here());
|
||||
$controller->redirect($loginAction);
|
||||
return false;
|
||||
} elseif (!empty($this->ajaxLogin)) {
|
||||
|
|
|
@ -981,7 +981,7 @@ class Controller extends Object {
|
|||
$arrayOp = is_array($op);
|
||||
foreach ($data as $model => $fields) {
|
||||
foreach ($fields as $field => $value) {
|
||||
$key = $model.'.'.$field;
|
||||
$key = $model . '.' . $field;
|
||||
$fieldOp = $op;
|
||||
if ($arrayOp) {
|
||||
if (array_key_exists($key, $op)) {
|
||||
|
@ -998,9 +998,9 @@ class Controller extends Object {
|
|||
$fieldOp = strtoupper(trim($fieldOp));
|
||||
if ($fieldOp === 'LIKE') {
|
||||
$key = $key.' LIKE';
|
||||
$value = '%'.$value.'%';
|
||||
$value = '%' . $value . '%';
|
||||
} elseif ($fieldOp && $fieldOp != '=') {
|
||||
$key = $key.' '.$fieldOp;
|
||||
$key = $key.' ' . $fieldOp;
|
||||
}
|
||||
$cond[$key] = $value;
|
||||
}
|
||||
|
|
|
@ -681,7 +681,7 @@ class App {
|
|||
}
|
||||
App::uses($extends, $extendType);
|
||||
if ($plugin && in_array($originalType, array('controller', 'model'))) {
|
||||
App::uses($plugin . $extends, $plugin . '.' .$type);
|
||||
App::uses($plugin . $extends, $plugin . '.' . $type);
|
||||
}
|
||||
}
|
||||
if ($plugin) {
|
||||
|
|
|
@ -164,7 +164,7 @@ class I18n {
|
|||
}
|
||||
|
||||
if ($_this->category == 'LC_TIME') {
|
||||
return $_this->_translateTime($singular,$domain);
|
||||
return $_this->_translateTime($singular, $domain);
|
||||
}
|
||||
|
||||
if (!isset($count)) {
|
||||
|
@ -466,7 +466,7 @@ class I18n {
|
|||
} while (!feof($file));
|
||||
fclose($file);
|
||||
$merge[""] = $header;
|
||||
return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations);
|
||||
return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge, $translations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -486,7 +486,7 @@ class I18n {
|
|||
if (empty($line) || $line[0] === $comment) {
|
||||
continue;
|
||||
}
|
||||
$parts = preg_split("/[[:space:]]+/",$line);
|
||||
$parts = preg_split("/[[:space:]]+/", $line);
|
||||
if ($parts[0] === 'comment_char') {
|
||||
$comment = $parts[1];
|
||||
continue;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
App::uses('AppModel', 'Model');
|
||||
App::uses('AclNode', 'Model');
|
||||
|
||||
/**
|
||||
* Access Control Object
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
App::uses('AppModel', 'Model');
|
||||
App::uses('AclNode', 'Model');
|
||||
|
||||
/**
|
||||
* Access Request Object
|
||||
|
|
|
@ -308,10 +308,10 @@ class ContainableBehavior extends ModelBehavior {
|
|||
$val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1));
|
||||
} elseif (preg_match('/ASC|DESC$/', $key)) {
|
||||
$option = 'order';
|
||||
$val = $Model->{$name}->alias.'.'.$key;
|
||||
$val = $Model->{$name}->alias . '.' . $key;
|
||||
} elseif (preg_match('/[ =!]/', $key)) {
|
||||
$option = 'conditions';
|
||||
$val = $Model->{$name}->alias.'.'.$key;
|
||||
$val = $Model->{$name}->alias . '.' . $key;
|
||||
}
|
||||
$children[$option] = is_array($val) ? $val : array($val);
|
||||
$newChildren = null;
|
||||
|
|
|
@ -104,8 +104,8 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$joinTable->table = $RuntimeModel->table;
|
||||
$joinTable->schemaName = $RuntimeModel->getDataSource()->getSchemaName();
|
||||
|
||||
if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) {
|
||||
$query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
|
||||
if (is_string($query['fields']) && 'COUNT(*) AS ' . $db->name('count') == $query['fields']) {
|
||||
$query['fields'] = 'COUNT(DISTINCT(' . $db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
|
||||
$query['joins'][] = array(
|
||||
'type' => 'INNER',
|
||||
'alias' => $RuntimeModel->alias,
|
||||
|
@ -127,7 +127,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
foreach ($fields as $key => $value) {
|
||||
$field = (is_numeric($key)) ? $value : $key;
|
||||
|
||||
if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) {
|
||||
if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.' . $field, $query['fields']) || in_array($field, $query['fields'])) {
|
||||
$addFields[] = $field;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
foreach ($addFields as $_f => $field) {
|
||||
$aliasField = is_numeric($_f) ? $field : $_f;
|
||||
|
||||
foreach (array($aliasField, $model->alias.'.'.$aliasField) as $_field) {
|
||||
foreach (array($aliasField, $model->alias . '.' . $aliasField) as $_field) {
|
||||
$key = array_search($_field, (array)$query['fields']);
|
||||
|
||||
if ($key !== false) {
|
||||
|
@ -148,36 +148,36 @@ class TranslateBehavior extends ModelBehavior {
|
|||
|
||||
if (is_array($locale)) {
|
||||
foreach ($locale as $_locale) {
|
||||
$model->virtualFields['i18n_'.$field.'_'.$_locale] = 'I18n__'.$field.'__'.$_locale.'.content';
|
||||
$model->virtualFields['i18n_' . $field . '_' . $_locale] = 'I18n__' . $field . '__' . $_locale . '.content';
|
||||
if (!empty($query['fields'])) {
|
||||
$query['fields'][] = 'i18n_'.$field.'_'.$_locale;
|
||||
$query['fields'][] = 'i18n_' . $field . '_' . $_locale;
|
||||
}
|
||||
$query['joins'][] = array(
|
||||
'type' => 'LEFT',
|
||||
'alias' => 'I18n__'.$field.'__'.$_locale,
|
||||
'alias' => 'I18n__' . $field . '__' . $_locale,
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
|
||||
'I18n__'.$field.'__'.$_locale.'.model' => $model->name,
|
||||
'I18n__'.$field.'__'.$_locale.'.'.$RuntimeModel->displayField => $aliasField,
|
||||
'I18n__'.$field.'__'.$_locale.'.locale' => $_locale
|
||||
'I18n__' . $field . '__' . $_locale . '.model' => $model->name,
|
||||
'I18n__' . $field . '__' . $_locale . '.' . $RuntimeModel->displayField => $aliasField,
|
||||
'I18n__' . $field . '__' . $_locale . '.locale' => $_locale
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$model->virtualFields['i18n_'.$field] = 'I18n__'.$field.'.content';
|
||||
$model->virtualFields['i18n_' . $field] = 'I18n__' . $field . '.content';
|
||||
if (!empty($query['fields'])) {
|
||||
$query['fields'][] = 'i18n_'.$field;
|
||||
$query['fields'][] = 'i18n_' . $field;
|
||||
}
|
||||
$query['joins'][] = array(
|
||||
'type' => 'INNER',
|
||||
'alias' => 'I18n__'.$field,
|
||||
'alias' => 'I18n__' . $field,
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
|
||||
'I18n__'.$field.'.model' => $model->name,
|
||||
'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField,
|
||||
'I18n__'.$field.'.locale' => $locale
|
||||
'I18n__' . $field . '.model' => $model->name,
|
||||
'I18n__' . $field . '.' . $RuntimeModel->displayField => $aliasField,
|
||||
'I18n__' . $field . '.locale' => $locale
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -212,11 +212,11 @@ class TranslateBehavior extends ModelBehavior {
|
|||
|
||||
if (is_array($locale)) {
|
||||
foreach ($locale as $_locale) {
|
||||
if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_'.$field.'_'.$_locale])) {
|
||||
$row[$model->alias][$aliasField] = $row[$model->alias]['i18n_'.$field.'_'.$_locale];
|
||||
if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_' . $field . '_' . $_locale])) {
|
||||
$row[$model->alias][$aliasField] = $row[$model->alias]['i18n_' . $field . '_' . $_locale];
|
||||
$row[$model->alias]['locale'] = $_locale;
|
||||
}
|
||||
unset($row[$model->alias]['i18n_'.$field.'_'.$_locale]);
|
||||
unset($row[$model->alias]['i18n_' . $field . '_' . $_locale]);
|
||||
}
|
||||
|
||||
if (!isset($row[$model->alias][$aliasField])) {
|
||||
|
@ -421,7 +421,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
foreach (array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany') as $type) {
|
||||
if (isset($model->{$type}[$association]) || isset($model->__backAssociation[$type][$association])) {
|
||||
trigger_error(
|
||||
__d('cake_dev', 'Association %s is already binded to model %s', $association, $model->alias),
|
||||
__d('cake_dev', 'Association %s is already bound to model %s', $association, $model->alias),
|
||||
E_USER_ERROR
|
||||
);
|
||||
return false;
|
||||
|
|
|
@ -163,8 +163,8 @@ class TreeBehavior extends ModelBehavior {
|
|||
$this->_addToWhitelist($Model, $parent);
|
||||
} else {
|
||||
$values = $Model->find('first', array(
|
||||
'conditions' => array($scope,$Model->escapeField() => $Model->id),
|
||||
'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive)
|
||||
'conditions' => array($scope, $Model->escapeField() => $Model->id),
|
||||
'fields' => array($Model->primaryKey, $parent, $left, $right), 'recursive' => $recursive)
|
||||
);
|
||||
|
||||
if ($values === false) {
|
||||
|
@ -503,7 +503,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
extract($this->settings[$Model->alias]);
|
||||
list($node) = array_values($Model->find('first', array(
|
||||
'conditions' => array($scope, $Model->escapeField() => $id),
|
||||
'fields' => array($Model->primaryKey, $left, $right, $parent ), 'recursive' => $recursive
|
||||
'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive
|
||||
)));
|
||||
if ($node[$parent]) {
|
||||
list($parentNode) = array_values($Model->find('first', array(
|
||||
|
@ -527,7 +527,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
}
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
$this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
|
||||
$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]);
|
||||
$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
|
||||
$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
|
||||
if (is_int($number)) {
|
||||
$number--;
|
||||
|
@ -577,7 +577,6 @@ class TreeBehavior extends ModelBehavior {
|
|||
if ($missingParentAction == 'return') {
|
||||
foreach ($missingParents as $id => $display) {
|
||||
$this->errors[] = 'cannot find the parent for ' . $Model->alias . ' with id ' . $id . '(' . $display . ')';
|
||||
|
||||
}
|
||||
return false;
|
||||
} elseif ($missingParentAction == 'delete') {
|
||||
|
@ -588,13 +587,14 @@ class TreeBehavior extends ModelBehavior {
|
|||
}
|
||||
$count = 1;
|
||||
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey), 'order' => $left)) as $array) {
|
||||
$Model->id = $array[$Model->alias][$Model->primaryKey];
|
||||
$lft = $count++;
|
||||
$rght = $count++;
|
||||
$Model->create(false);
|
||||
$Model->id = $array[$Model->alias][$Model->primaryKey];
|
||||
$Model->save(array($left => $lft, $right => $rght), array('callbacks' => false));
|
||||
}
|
||||
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
|
||||
$Model->create();
|
||||
$Model->create(false);
|
||||
$Model->id = $array[$Model->alias][$Model->primaryKey];
|
||||
$this->_setParent($Model, $array[$Model->alias][$parent]);
|
||||
}
|
||||
|
@ -846,11 +846,10 @@ class TreeBehavior extends ModelBehavior {
|
|||
|
||||
if (($Model->id == $parentId)) {
|
||||
return false;
|
||||
|
||||
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
||||
return false;
|
||||
}
|
||||
if (empty ($node[$left]) && empty ($node[$right])) {
|
||||
if (empty($node[$left]) && empty($node[$right])) {
|
||||
$this->_sync($Model, 2, '+', '>= ' . $parentNode[$right], $created);
|
||||
$result = $Model->save(
|
||||
array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId),
|
||||
|
|
|
@ -419,7 +419,7 @@ class Postgres extends DboSource {
|
|||
$match[1] = $this->name($match[1]);
|
||||
}
|
||||
}
|
||||
return '(' . $prepend .$match[1] . ')';
|
||||
return '(' . $prepend . $match[1] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -487,13 +487,13 @@ class Postgres extends DboSource {
|
|||
case 'add':
|
||||
foreach ($column as $field => $col) {
|
||||
$col['name'] = $field;
|
||||
$colList[] = 'ADD COLUMN '.$this->buildColumn($col);
|
||||
$colList[] = 'ADD COLUMN ' . $this->buildColumn($col);
|
||||
}
|
||||
break;
|
||||
case 'drop':
|
||||
foreach ($column as $field => $col) {
|
||||
$col['name'] = $field;
|
||||
$colList[] = 'DROP COLUMN '.$this->name($field);
|
||||
$colList[] = 'DROP COLUMN ' . $this->name($field);
|
||||
}
|
||||
break;
|
||||
case 'change':
|
||||
|
|
|
@ -238,7 +238,7 @@ class Sqlite extends DboSource {
|
|||
if (is_array($real)) {
|
||||
$col = $real['name'];
|
||||
if (isset($real['limit'])) {
|
||||
$col .= '('.$real['limit'].')';
|
||||
$col .= '(' . $real['limit'] . ')';
|
||||
}
|
||||
return $col;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ class Sqlserver extends DboSource {
|
|||
$fieldAlias = $this->name($alias . '__' . $fields[$i]);
|
||||
} else {
|
||||
$build = explode('.', $fields[$i]);
|
||||
$this->_fieldMappings[$build[0] . '__' .$build[1]] = $fields[$i];
|
||||
$this->_fieldMappings[$build[0] . '__' . $build[1]] = $fields[$i];
|
||||
$fieldName = $this->name($build[0] . '.' . $build[1]);
|
||||
$fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]);
|
||||
}
|
||||
|
|
|
@ -787,7 +787,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
$cacheKey = crc32($this->startQuote.$data.$this->endQuote);
|
||||
$cacheKey = crc32($this->startQuote . $data . $this->endQuote);
|
||||
if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) {
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -680,10 +680,7 @@ class Model extends Object {
|
|||
}
|
||||
|
||||
if (is_subclass_of($this, 'AppModel')) {
|
||||
$merge = array('findMethods');
|
||||
if ($this->actsAs !== null || $this->actsAs !== false) {
|
||||
$merge[] = 'actsAs';
|
||||
}
|
||||
$merge = array('actsAs', 'findMethods');
|
||||
$parentClass = get_parent_class($this);
|
||||
if ($parentClass !== 'AppModel') {
|
||||
$this->_mergeVars($merge, $parentClass);
|
||||
|
@ -2454,7 +2451,7 @@ class Model extends Object {
|
|||
* Queries the datasource and returns a result set array.
|
||||
*
|
||||
* Also used to perform notation finds, where the first argument is type of find operation to perform
|
||||
* (all / first / count / neighbors / list / threaded ),
|
||||
* (all / first / count / neighbors / list / threaded),
|
||||
* second parameter options for finding ( indexed array, including: 'conditions', 'limit',
|
||||
* 'recursive', 'page', 'fields', 'offset', 'order')
|
||||
*
|
||||
|
@ -3201,11 +3198,7 @@ class Model extends Object {
|
|||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->id as $id) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
return false;
|
||||
return current($this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,9 +106,9 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
if ($this->config['persistent'] == true) {
|
||||
$this->connection = @pfsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
|
||||
$this->connection = @pfsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
|
||||
} else {
|
||||
$this->connection = @fsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
|
||||
$this->connection = @fsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
|
||||
}
|
||||
|
||||
if (!empty($errNum) || !empty($errStr)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ class Dispatcher {
|
|||
* are encountered.
|
||||
*/
|
||||
public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array()) {
|
||||
if ($this->asset($request->url, $response) || $this->cached($request->here)) {
|
||||
if ($this->asset($request->url, $response) || $this->cached($request->here())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ class Dispatcher {
|
|||
/**
|
||||
* Outputs cached dispatch view cache
|
||||
*
|
||||
* @param string $path Requested URL path
|
||||
* @param string $path Requested URL path with any query string parameters
|
||||
* @return string|boolean False if is not cached or output
|
||||
*/
|
||||
public function cached($path) {
|
||||
|
|
|
@ -289,9 +289,9 @@ class AclShellTest extends CakeTestCase {
|
|||
$first = $node[0]['Aro']['id'];
|
||||
$second = $node[1]['Aro']['id'];
|
||||
$last = $node[2]['Aro']['id'];
|
||||
$this->Task->expects($this->at(2))->method('out')->with('['.$last.'] ROOT');
|
||||
$this->Task->expects($this->at(3))->method('out')->with(' ['.$second.'] admins');
|
||||
$this->Task->expects($this->at(4))->method('out')->with(' ['.$first.'] Elrond');
|
||||
$this->Task->expects($this->at(2))->method('out')->with('[' . $last . '] ROOT');
|
||||
$this->Task->expects($this->at(3))->method('out')->with(' [' . $second . '] admins');
|
||||
$this->Task->expects($this->at(4))->method('out')->with(' [' . $first . '] Elrond');
|
||||
$this->Task->getPath();
|
||||
}
|
||||
|
||||
|
|
|
@ -329,10 +329,10 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
||||
|
||||
$pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field title#', '\\');
|
||||
$pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '#msgid "Post title is required"#';
|
||||
|
@ -369,10 +369,10 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
|
||||
|
||||
$pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field title#', '\\');
|
||||
$pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '#msgid "Post title is required"#';
|
||||
|
|
|
@ -301,7 +301,7 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExecute() {
|
||||
$this->Task->params['skel'] = CAKE . 'Console' . DS. 'Templates' . DS . 'skel';
|
||||
$this->Task->params['skel'] = CAKE . 'Console' . DS . 'Templates' . DS . 'skel';
|
||||
$this->Task->params['working'] = TMP . 'tests' . DS;
|
||||
|
||||
$path = $this->Task->path . 'bake_test_app';
|
||||
|
|
|
@ -795,10 +795,11 @@ class AuthComponentTest extends CakeTestCase {
|
|||
|
||||
//Ticket #4750
|
||||
//named params
|
||||
$this->Controller->request = $this->Auth->request;
|
||||
$this->Auth->Session->delete('Auth');
|
||||
$url = '/posts/index/year:2008/month:feb';
|
||||
$this->Auth->request->addParams(Router::parse($url));
|
||||
$this->Auth->request->url = Router::normalize($url);
|
||||
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
|
||||
$this->Auth->initialize($this->Controller);
|
||||
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
|
||||
$this->Auth->startup($this->Controller);
|
||||
|
@ -809,7 +810,7 @@ class AuthComponentTest extends CakeTestCase {
|
|||
$this->Auth->Session->delete('Auth');
|
||||
$url = '/posts/view/1';
|
||||
$this->Auth->request->addParams(Router::parse($url));
|
||||
$this->Auth->request->url = Router::normalize($url);
|
||||
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
|
||||
$this->Auth->initialize($this->Controller);
|
||||
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
|
||||
$this->Auth->startup($this->Controller);
|
||||
|
@ -819,14 +820,14 @@ class AuthComponentTest extends CakeTestCase {
|
|||
// QueryString parameters
|
||||
$_back = $_GET;
|
||||
$_GET = array(
|
||||
'url' => '/posts/index/29',
|
||||
'print' => 'true',
|
||||
'refer' => 'menu'
|
||||
);
|
||||
$this->Auth->Session->delete('Auth');
|
||||
$url = '/posts/index/29';
|
||||
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
|
||||
$this->Auth->request->addParams(Router::parse($url));
|
||||
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
|
||||
$this->Auth->request->query = $_GET;
|
||||
|
||||
$this->Auth->initialize($this->Controller);
|
||||
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
|
||||
|
@ -834,33 +835,15 @@ class AuthComponentTest extends CakeTestCase {
|
|||
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
|
||||
$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
|
||||
|
||||
$_GET = array(
|
||||
'url' => '/posts/index/29',
|
||||
'print' => 'true',
|
||||
'refer' => 'menu'
|
||||
);
|
||||
$this->Auth->Session->delete('Auth');
|
||||
$url = '/posts/index/29';
|
||||
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
|
||||
$this->Auth->request->addParams(Router::parse($url));
|
||||
|
||||
$this->Auth->initialize($this->Controller);
|
||||
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
|
||||
$this->Auth->startup($this->Controller);
|
||||
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
|
||||
$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
|
||||
$_GET = $_back;
|
||||
|
||||
//external authed action
|
||||
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
|
||||
$_GET = array(
|
||||
'url' => '/posts/edit/1'
|
||||
);
|
||||
$this->Auth->Session->delete('Auth');
|
||||
$url = '/posts/edit/1';
|
||||
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
|
||||
$this->Auth->request->addParams(Router::parse($url));
|
||||
$this->Auth->request->url = Router::normalize($url);
|
||||
$this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
|
||||
$this->Auth->initialize($this->Controller);
|
||||
$this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
|
||||
$this->Auth->startup($this->Controller);
|
||||
|
|
|
@ -751,13 +751,13 @@ class AppTest extends CakeTestCase {
|
|||
$this->assertEquals($text, 'This is a file with dot in file name');
|
||||
|
||||
ob_start();
|
||||
$result = App::import('Vendor', 'TestHello', array('file' => 'Test'.DS.'hello.php'));
|
||||
$result = App::import('Vendor', 'TestHello', array('file' => 'Test' . DS . 'hello.php'));
|
||||
$text = ob_get_clean();
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals($text, 'This is the hello.php file in Test directory');
|
||||
|
||||
ob_start();
|
||||
$result = App::import('Vendor', 'MyTest', array('file' => 'Test'.DS.'MyTest.php'));
|
||||
$result = App::import('Vendor', 'MyTest', array('file' => 'Test' . DS . 'MyTest.php'));
|
||||
$text = ob_get_clean();
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals($text, 'This is the MyTest.php file');
|
||||
|
|
|
@ -173,6 +173,57 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|||
$this->assertSame($result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRecoverUsingParentMode method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRecoverUsingParentMode() {
|
||||
extract($this->settings);
|
||||
$this->Tree = new $modelClass();
|
||||
$this->Tree->Behaviors->disable('Tree');
|
||||
|
||||
$this->Tree->save(array('parent_id' => null, 'name' => 'Main', $parentField => null, $leftField => 0, $rightField => 0));
|
||||
$node1 = $this->Tree->id;
|
||||
|
||||
$this->Tree->create();
|
||||
$this->Tree->save(array('parent_id' => null, 'name' => 'About Us', $parentField => $node1, $leftField => 0, $rightField => 0));
|
||||
$node11 = $this->Tree->id;
|
||||
$this->Tree->create();
|
||||
$this->Tree->save(array('parent_id' => null, 'name' => 'Programs', $parentField => $node1, $leftField => 0, $rightField => 0));
|
||||
$node12 = $this->Tree->id;
|
||||
$this->Tree->create();
|
||||
$this->Tree->save(array('parent_id' => null, 'name' => 'Mission and History', $parentField => $node11, $leftField => 0, $rightField => 0));
|
||||
$this->Tree->create();
|
||||
$this->Tree->save(array('parent_id' => null, 'name' => 'Overview', $parentField => $node12, $leftField => 0, $rightField => 0));
|
||||
|
||||
$this->Tree->Behaviors->enable('Tree');
|
||||
|
||||
$result = $this->Tree->verify();
|
||||
$this->assertNotSame($result, true);
|
||||
|
||||
$result = $this->Tree->recover();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->Tree->verify();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->Tree->find('first', array(
|
||||
'fields' => array('name', $parentField, $leftField, $rightField),
|
||||
'conditions' => array('name' => 'Main'),
|
||||
'recursive' => -1
|
||||
));
|
||||
$expected = array(
|
||||
$modelClass => array(
|
||||
'name' => 'Main',
|
||||
$parentField => null,
|
||||
$leftField => 1,
|
||||
$rightField => 10
|
||||
)
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRecoverFromMissingParent method
|
||||
*
|
||||
|
|
|
@ -3192,7 +3192,7 @@ class MysqlTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$conditions = array('comment_count >' => 2);
|
||||
$query = 'SELECT ' . join(',',$this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
|
||||
$query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
|
||||
' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
|
||||
$result = $this->Dbo->fetchAll($query);
|
||||
$expected = array(array(
|
||||
|
|
|
@ -355,7 +355,7 @@ class AclNodeTest extends CakeTestCase {
|
|||
$result = $Aco->find('all');
|
||||
$expected = array(
|
||||
array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()),
|
||||
array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3', ), 'DbAroTest' => array())
|
||||
array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3'), 'DbAroTest' => array())
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
|
|
@ -2174,7 +2174,6 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
/**
|
||||
* testEscapeField to prove it escapes the field well even when it has part of the alias on it
|
||||
* @see ttp://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/473-escapefield-doesnt-consistently-prepend-modelname
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -2204,6 +2203,30 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
ConnectionManager::drop('mock');
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetID
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetID() {
|
||||
$TestModel = new Test();
|
||||
|
||||
$result = $TestModel->getID();
|
||||
$this->assertFalse($result);
|
||||
|
||||
$TestModel->id = 9;
|
||||
$result = $TestModel->getID();
|
||||
$this->assertEquals(9, $result);
|
||||
|
||||
$TestModel->id = array(10, 9, 8, 7);
|
||||
$result = $TestModel->getID(2);
|
||||
$this->assertEquals(8, $result);
|
||||
|
||||
$TestModel->id = array(array(), 1, 2, 3);
|
||||
$result = $TestModel->getID();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that model->hasMethod checks self and behaviors.
|
||||
*
|
||||
|
|
|
@ -5412,7 +5412,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function testUpdateAllWithoutForeignKey() {
|
||||
public function testUpdateAllWithoutForeignKey() {
|
||||
$this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql');
|
||||
|
||||
$this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll');
|
||||
|
|
|
@ -1360,6 +1360,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
* - Test simple views
|
||||
* - Test views with nocache tags
|
||||
* - Test requests with named + passed params.
|
||||
* - Test requests with query string params
|
||||
* - Test themed views.
|
||||
*
|
||||
* @return array
|
||||
|
@ -1373,6 +1374,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
array('TestCachedPages/test_nocache_tags'),
|
||||
array('test_cached_pages/view/param/param'),
|
||||
array('test_cached_pages/view/foo:bar/value:goo'),
|
||||
array('test_cached_pages/view?q=cakephp'),
|
||||
array('test_cached_pages/themed'),
|
||||
);
|
||||
}
|
||||
|
@ -1405,7 +1407,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$out = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
$dispatcher->cached($request->here);
|
||||
$dispatcher->cached($request->here());
|
||||
$cached = ob_get_clean();
|
||||
|
||||
$result = str_replace(array("\t", "\r\n", "\n"), "", $out);
|
||||
|
@ -1414,7 +1416,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$filename = $this->__cachePath($request->here);
|
||||
$filename = $this->__cachePath($request->here());
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreate() {
|
||||
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp';
|
||||
$tmpFile = TMP.'tests' . DS . 'cakephp.file.test.tmp';
|
||||
$File = new File($tmpFile, true, 0777);
|
||||
$this->assertTrue($File->exists());
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ class FileTest extends CakeTestCase {
|
|||
$r = $TmpFile->append($fragment);
|
||||
$this->assertTrue($r);
|
||||
$this->assertTrue(file_exists($tmpFile));
|
||||
$data = $data.$fragment;
|
||||
$data = $data . $fragment;
|
||||
$this->assertEquals($data, file_get_contents($tmpFile));
|
||||
$TmpFile->close();
|
||||
}
|
||||
|
|
|
@ -431,7 +431,6 @@ class FolderTest extends CakeTestCase {
|
|||
),
|
||||
array(
|
||||
$Folder->path . DS . 'not_hidden.txt',
|
||||
$Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php',
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -143,7 +142,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array('風街ろまん'),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -170,7 +168,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -205,7 +202,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -237,7 +233,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_complex',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -298,7 +293,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->params = array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
|
@ -332,7 +326,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->params = array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
|
@ -368,7 +361,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -411,7 +403,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -443,7 +434,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(1, 2),
|
||||
'named' => array(
|
||||
'name' => 'mark',
|
||||
|
@ -466,6 +456,38 @@ class CacheHelperTest extends CakeTestCase {
|
|||
@unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that query string parameters are included in the cache filename.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCacheWithQueryStringParams() {
|
||||
Router::reload();
|
||||
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
$this->Controller->request->query = array('q' => 'cakephp');
|
||||
$this->Controller->cacheAction = array(
|
||||
'cache_parsing' => 21600
|
||||
);
|
||||
$this->Controller->request->here = '/cache_test/cache_parsing';
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
||||
$this->assertNotRegExp('/cake:nocache/', $result);
|
||||
$this->assertNotRegExp('/php echo/', $result);
|
||||
|
||||
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_q_cakephp.php';
|
||||
$this->assertTrue(file_exists($filename), 'Missing cache file ' . $filename);
|
||||
@unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that custom routes are respected when generating cache files.
|
||||
*
|
||||
|
@ -480,7 +502,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
'lang' => 'en',
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
|
@ -518,7 +539,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->params = array(
|
||||
'controller' => 'cacheTest',
|
||||
'action' => 'cache_name',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
|
@ -603,7 +623,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$this->Controller->params = array(
|
||||
'controller' => 'cacheTest',
|
||||
'action' => 'cache_empty_sections',
|
||||
'url' => array(),
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
|
|
|
@ -185,12 +185,24 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testLink() {
|
||||
Router::connect('/:controller/:action/*');
|
||||
|
||||
$this->Html->request->webroot = '';
|
||||
|
||||
$result = $this->Html->link('/home');
|
||||
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->link(array('action' => 'login', '<[You]>'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/login/%3C%5BYou%5D%3E'),
|
||||
'preg:/\/login\/<\[You\]>/',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
Router::reload();
|
||||
|
||||
$result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
|
||||
$expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
|
@ -574,7 +586,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
Configure::write('debug', 2);
|
||||
Configure::write('Asset.timestamp', true);
|
||||
|
||||
touch(WWW_ROOT . 'js' . DS. '__cake_js_test.js');
|
||||
touch(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
|
||||
$timestamp = substr(strtotime('now'), 0, 8);
|
||||
|
||||
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
||||
|
@ -584,7 +596,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
Configure::write('Asset.timestamp', 'force');
|
||||
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
|
||||
$this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
|
||||
unlink(WWW_ROOT . 'js' . DS. '__cake_js_test.js');
|
||||
unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
|
||||
Configure::write('Asset.timestamp', false);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,15 +118,15 @@ class NumberHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Number->currency(1000.45, NULL, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.'));
|
||||
$expected = 'Kr. 1.000,45';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(0.5, 'USD');
|
||||
$expected = '50c';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(0.5, NULL, array('after' => 'øre'));
|
||||
$expected = '50øre';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(1, null, array('wholeSymbol' => '$ '));
|
||||
$expected = '$ 1.00';
|
||||
|
@ -174,16 +174,16 @@ class NumberHelperTest extends CakeTestCase {
|
|||
$this->Number->addFormat('NOK', array('before' => 'Kr. '));
|
||||
$result = $this->Number->currency(1000, 'NOK');
|
||||
$expected = 'Kr. 1,000.00';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$this->Number->addFormat('Other', array('before' => '$$ ', 'after' => 'c!'));
|
||||
$result = $this->Number->currency(0.22, 'Other');
|
||||
$expected = '22c!';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(-10, 'Other');
|
||||
$expected = '($$ 10.00)';
|
||||
$this->assertEquals($expected,$result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,18 +36,22 @@ class GroupUpdateAllFixture extends CakeTestFixture {
|
|||
array(
|
||||
'id' => 1,
|
||||
'name' => 'group one',
|
||||
'code' => 120),
|
||||
'code' => 120
|
||||
),
|
||||
array(
|
||||
'id' => 2,
|
||||
'name' => 'group two',
|
||||
'code' => 125),
|
||||
'code' => 125
|
||||
),
|
||||
array(
|
||||
'id' => 3,
|
||||
'name' => 'group three',
|
||||
'code' => 130),
|
||||
'code' => 130
|
||||
),
|
||||
array(
|
||||
'id' => 4,
|
||||
'name' => 'group four',
|
||||
'code' => 135)
|
||||
'code' => 135
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -44,16 +44,19 @@ class ProductUpdateAllFixture extends CakeTestFixture {
|
|||
'id' => 2,
|
||||
'name' => 'product two',
|
||||
'groupcode' => 120,
|
||||
'group_id' => 1),
|
||||
'group_id' => 1
|
||||
),
|
||||
array(
|
||||
'id' => 3,
|
||||
'name' => 'product three',
|
||||
'groupcode' => 125,
|
||||
'group_id' => 2),
|
||||
'group_id' => 2
|
||||
),
|
||||
array(
|
||||
'id' => 4,
|
||||
'name' => 'product four',
|
||||
'groupcode' => 135,
|
||||
'group_id' => 4)
|
||||
'group_id' => 4
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');
|
|||
<p>
|
||||
<?php
|
||||
$filePresent = null;
|
||||
if (file_exists(APP . 'Config' . DS.'database.php')):
|
||||
if (file_exists(APP . 'Config' . DS . 'database.php')):
|
||||
echo '<span class="notice success">';
|
||||
echo __d('cake_dev', 'Your database configuration file is present.');
|
||||
$filePresent = true;
|
||||
|
|
|
@ -147,6 +147,9 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
ClassRegistry::flush();
|
||||
}
|
||||
Configure::write($this->_configure);
|
||||
if (isset($_GET['debug']) && $_GET['debug']) {
|
||||
ob_flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -108,9 +108,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
|||
|
||||
try {
|
||||
$result = $runner->doRun($suite, $this->arguments);
|
||||
}
|
||||
|
||||
catch (PHPUnit_Framework_Exception $e) {
|
||||
} catch (PHPUnit_Framework_Exception $e) {
|
||||
print $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ class File {
|
|||
$this->info();
|
||||
}
|
||||
if (isset($this->info['extension'])) {
|
||||
return basename($this->name, '.'.$this->info['extension']);
|
||||
return basename($this->name, '.' . $this->info['extension']);
|
||||
} elseif ($this->name) {
|
||||
return $this->name;
|
||||
}
|
||||
|
|
|
@ -398,7 +398,7 @@ class Folder {
|
|||
* Returns an array of nested directories and files in each directory
|
||||
*
|
||||
* @param string $path the directory path to build the tree from
|
||||
* @param mixed $exceptions Array of files to exclude, defaults to excluding hidden files.
|
||||
* @param mixed $exceptions Array of files to exclude, false to exclude dot files.
|
||||
* @param string $type either file or dir. null returns both files and directories
|
||||
* @return mixed array of nested directories and files in each directory
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::tree
|
||||
|
@ -416,10 +416,14 @@ class Folder {
|
|||
}
|
||||
if (is_array($exceptions)) {
|
||||
$exceptions = array_flip($exceptions);
|
||||
if (isset($exceptions['.'])) {
|
||||
$skipHidden = true;
|
||||
unset($exceptions['.']);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$directory = new RecursiveDirectoryIterator($path);
|
||||
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME | RecursiveDirectoryIterator::CURRENT_AS_SELF | RecursiveDirectoryIterator::SKIP_DOTS);
|
||||
$iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST);
|
||||
} catch (UnexpectedValueException $e) {
|
||||
if ($type === null) {
|
||||
|
@ -427,15 +431,23 @@ class Folder {
|
|||
}
|
||||
return array();
|
||||
}
|
||||
foreach ($iterator as $item) {
|
||||
$name = $item->getFileName();
|
||||
if ($skipHidden && $name[0] === '.' || isset($exceptions[$name])) {
|
||||
$pathLength = strlen($path);
|
||||
foreach ($iterator as $itemPath => $fsIterator) {
|
||||
if ($skipHidden) {
|
||||
$subPathName = $fsIterator->getSubPathname();
|
||||
if ($subPathName{0} == '.' || strpos($subPathName, DS . '.') !== false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$item = $fsIterator->current();
|
||||
if (!empty($exceptions) && isset($exceptions[$item->getFilename()])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item->isFile()) {
|
||||
$files[] = $item->getPathName();
|
||||
} else if ($item->isDir() && !in_array($name, array('.', '..'))) {
|
||||
$directories[] = $item->getPathName();
|
||||
$files[] = $itemPath;
|
||||
} elseif ($item->isDir()) {
|
||||
$directories[] = $itemPath;
|
||||
}
|
||||
}
|
||||
if ($type === null) {
|
||||
|
|
|
@ -529,7 +529,7 @@ class Set {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
list(,$key,$op,$expected) = $match;
|
||||
list(, $key, $op, $expected) = $match;
|
||||
if (!isset($data[$key])) {
|
||||
return false;
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ class Set {
|
|||
$pattern = substr($key, 1, -1);
|
||||
|
||||
foreach ($data as $j => $val) {
|
||||
if (preg_match('/^'.$pattern.'/s', $j) !== 0) {
|
||||
if (preg_match('/^' . $pattern . '/s', $j) !== 0) {
|
||||
$tmpPath = array_slice($path, $i + 1);
|
||||
if (empty($tmpPath)) {
|
||||
$tmp[$j] = $val;
|
||||
|
|
|
@ -247,7 +247,7 @@ class String {
|
|||
}
|
||||
|
||||
if (!isset($options['format']) && isset($options['before'])) {
|
||||
$str = str_replace($options['escape'].$options['before'], $options['before'], $str);
|
||||
$str = str_replace($options['escape'] . $options['before'], $options['before'], $str);
|
||||
}
|
||||
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
|
||||
}
|
||||
|
|
|
@ -166,8 +166,10 @@ class Validation {
|
|||
'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
|
||||
'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
|
||||
'visa' => '/^4\\d{12}(\\d{3})?$/',
|
||||
'voyager' => '/^8699[0-9]{11}$/'),
|
||||
'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/');
|
||||
'voyager' => '/^8699[0-9]{11}$/'
|
||||
),
|
||||
'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
|
||||
);
|
||||
|
||||
if (is_array($type)) {
|
||||
foreach ($type as $value) {
|
||||
|
@ -382,7 +384,7 @@ class Validation {
|
|||
if (is_null($places)) {
|
||||
$regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
|
||||
} else {
|
||||
$regex = '/^[-+]?[0-9]*\\.{1}[0-9]{'.$places.'}$/';
|
||||
$regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
|
||||
}
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
|
|
|
@ -295,7 +295,7 @@ class CacheHelper extends AppHelper {
|
|||
$controller = new ' . $this->_View->name . 'Controller($request, $response);
|
||||
$controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\';
|
||||
$controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\'));
|
||||
$controller->layout = $this->layout = \'' . $this->_View->layout. '\';
|
||||
$controller->layout = $this->layout = \'' . $this->_View->layout . '\';
|
||||
$controller->theme = $this->theme = \'' . $this->_View->theme . '\';
|
||||
$controller->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\'));
|
||||
Router::setRequestInfo($controller->request);
|
||||
|
@ -312,7 +312,7 @@ class CacheHelper extends AppHelper {
|
|||
$this->loadHelpers();
|
||||
extract($this->viewVars, EXTR_SKIP);
|
||||
?>';
|
||||
$content = preg_replace("/(<\\?xml)/", "<?php echo '$1';?>",$content);
|
||||
$content = preg_replace("/(<\\?xml)/", "<?php echo '$1';?>", $content);
|
||||
$file .= $content;
|
||||
return cache('views' . DS . $cache, $file, $timestamp);
|
||||
}
|
||||
|
|
|
@ -1793,10 +1793,6 @@ class FormHelper extends AppHelper {
|
|||
unset($attributes['type']);
|
||||
}
|
||||
|
||||
if (!isset($selected)) {
|
||||
$selected = $attributes['value'];
|
||||
}
|
||||
|
||||
if (!empty($attributes['multiple'])) {
|
||||
$style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null;
|
||||
$template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart';
|
||||
|
|
|
@ -46,7 +46,7 @@ class HtmlHelper extends AppHelper {
|
|||
'hidden' => '<input type="hidden" name="%s"%s/>',
|
||||
'checkbox' => '<input type="checkbox" name="%s" %s/>',
|
||||
'checkboxmultiple' => '<input type="checkbox" name="%s[]"%s />',
|
||||
'radio' => '<input type="radio" name="%s" id="%s" %s />%s',
|
||||
'radio' => '<input type="radio" name="%s" id="%s"%s />%s',
|
||||
'selectstart' => '<select name="%s"%s>',
|
||||
'selectmultiplestart' => '<select name="%s[]"%s>',
|
||||
'selectempty' => '<option value=""%s> </option>',
|
||||
|
@ -345,7 +345,7 @@ class HtmlHelper extends AppHelper {
|
|||
$url = $this->url($url);
|
||||
} else {
|
||||
$url = $this->url($title);
|
||||
$title = $url;
|
||||
$title = h(urldecode($url));
|
||||
$escapeTitle = false;
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ class HtmlHelper extends AppHelper {
|
|||
}
|
||||
$out = array();
|
||||
foreach ($data as $key=> $value) {
|
||||
$out[] = $key.':'.$value.';';
|
||||
$out[] = $key . ':' . $value . ';';
|
||||
}
|
||||
if ($oneline) {
|
||||
return join(' ', $out);
|
||||
|
|
|
@ -342,7 +342,7 @@ class TextHelper extends AppHelper {
|
|||
|
||||
if ($html) {
|
||||
foreach ($openTags as $tag) {
|
||||
$truncate .= '</'.$tag.'>';
|
||||
$truncate .= '</' . $tag . '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class TimeHelper extends AppHelper {
|
|||
case 'p':
|
||||
case 'P':
|
||||
$default = array('am' => 0, 'pm' => 1);
|
||||
$meridiem = $default[date('a',$this->__time)];
|
||||
$meridiem = $default[date('a', $this->__time)];
|
||||
$format = __dc('cake', 'am_pm', 5);
|
||||
if (is_array($format)) {
|
||||
$meridiem = $format[$meridiem];
|
||||
|
@ -142,7 +142,7 @@ class TimeHelper extends AppHelper {
|
|||
case 'r':
|
||||
$complete = __dc('cake', 't_fmt_ampm', 5);
|
||||
if ($complete != 't_fmt_ampm') {
|
||||
return str_replace('%p',$this->_translateSpecifier(array('%p', 'p')),$complete);
|
||||
return str_replace('%p', $this->_translateSpecifier(array('%p', 'p')), $complete);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
|
@ -344,7 +344,7 @@ class TimeHelper extends AppHelper {
|
|||
*/
|
||||
public function isThisMonth($dateString, $userOffset = null) {
|
||||
$date = $this->fromString($dateString);
|
||||
return date('m Y',$date) == date('m Y', time());
|
||||
return date('m Y', $date) == date('m Y', time());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -671,7 +671,7 @@ class TimeHelper extends AppHelper {
|
|||
}
|
||||
|
||||
$date = $this->fromString($dateString, $userOffset);
|
||||
$interval = $this->fromString('-'.$timeInterval);
|
||||
$interval = $this->fromString('-' . $timeInterval);
|
||||
|
||||
if ($date >= $interval && $date <= time()) {
|
||||
return true;
|
||||
|
|
|
@ -45,10 +45,10 @@ foreach ($scaffoldFields as $_field) {
|
|||
<h3><?php echo __d('cake', 'Actions'); ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])). " </li>\n";
|
||||
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n";
|
||||
echo "\t\t<li>" .$this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')). " </li>\n";
|
||||
echo "\t\t<li>" .$this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')). " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])) . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?') . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')) . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')) . " </li>\n";
|
||||
|
||||
$done = array();
|
||||
foreach ($associations as $_type => $_data) {
|
||||
|
|
|
@ -46,52 +46,52 @@ if (!defined('WEBROOT_DIR')) {
|
|||
* Path to the application's directory.
|
||||
*/
|
||||
if (!defined('APP')) {
|
||||
define('APP', ROOT.DS.APP_DIR.DS);
|
||||
define('APP', ROOT . DS . APP_DIR.DS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the application's libs directory.
|
||||
*/
|
||||
define('APPLIBS', APP.'Lib'.DS);
|
||||
define('APPLIBS', APP . 'Lib' . DS);
|
||||
|
||||
/**
|
||||
* Path to the public CSS directory.
|
||||
*/
|
||||
define('CSS', WWW_ROOT.'css'.DS);
|
||||
define('CSS', WWW_ROOT . 'css' . DS);
|
||||
|
||||
/**
|
||||
* Path to the public JavaScript directory.
|
||||
*/
|
||||
define('JS', WWW_ROOT.'js'.DS);
|
||||
define('JS', WWW_ROOT . 'js' . DS);
|
||||
|
||||
/**
|
||||
* Path to the public images directory.
|
||||
*/
|
||||
define('IMAGES', WWW_ROOT.'img'.DS);
|
||||
define('IMAGES', WWW_ROOT . 'img' . DS);
|
||||
|
||||
/**
|
||||
* Path to the tests directory.
|
||||
*/
|
||||
if (!defined('TESTS')) {
|
||||
define('TESTS', APP.'Test'.DS);
|
||||
define('TESTS', APP . 'Test' . DS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the temporary files directory.
|
||||
*/
|
||||
if (!defined('TMP')) {
|
||||
define('TMP', APP.'tmp'.DS);
|
||||
define('TMP', APP . 'tmp' . DS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the logs directory.
|
||||
*/
|
||||
define('LOGS', TMP.'logs'.DS);
|
||||
define('LOGS', TMP . 'logs' . DS);
|
||||
|
||||
/**
|
||||
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||
*/
|
||||
define('CACHE', TMP.'cache'.DS);
|
||||
define('CACHE', TMP . 'cache' . DS);
|
||||
|
||||
/**
|
||||
* Path to the vendors directory.
|
||||
|
@ -143,13 +143,13 @@ Configure::bootstrap(isset($boot) ? $boot : true);
|
|||
if (!defined('FULL_BASE_URL')) {
|
||||
$s = null;
|
||||
if (env('HTTPS')) {
|
||||
$s ='s';
|
||||
$s = 's';
|
||||
}
|
||||
|
||||
$httpHost = env('HTTP_HOST');
|
||||
|
||||
if (isset($httpHost)) {
|
||||
define('FULL_BASE_URL', 'http'.$s.'://'.$httpHost);
|
||||
define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
|
||||
}
|
||||
unset($httpHost, $s);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue