Starting to change all core code that uses $this->params

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3859 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-11-12 00:12:34 +00:00
parent 99a420c8ef
commit f95285d75f
5 changed files with 41 additions and 44 deletions

View file

@ -288,10 +288,10 @@ class Controller extends Object {
* *
*/ */
function constructClasses() { function constructClasses() {
if (empty($this->params['pass']) || !isset($this->params['pass']['0'])) { if (empty($this->passedArgs) || !isset($this->passedArgs['0'])) {
$id = false; $id = false;
} else { } else {
$id = $this->params['pass']['0']; $id = $this->passedArgs['0'];
} }
$cached = false; $cached = false;
$object = null; $object = null;
@ -883,51 +883,51 @@ class Controller extends Object {
foreach($this->{$modelClass}->_tableInfo as $table) { foreach($this->{$modelClass}->_tableInfo as $table) {
foreach($table as $field) { foreach($table as $field) {
if ('date' == $field['type'] && isset($this->params['data'][$modelClass][$field['name'] . '_year'])) { if ('date' == $field['type'] && isset($this->data[$modelClass][$field['name'] . '_year'])) {
$newDate = $this->params['data'][$modelClass][$field['name'] . '_year'] . '-'; $newDate = $this->data[$modelClass][$field['name'] . '_year'] . '-';
$newDate .= $this->params['data'][$modelClass][$field['name'] . '_month'] . '-'; $newDate .= $this->data[$modelClass][$field['name'] . '_month'] . '-';
$newDate .= $this->params['data'][$modelClass][$field['name'] . '_day']; $newDate .= $this->data[$modelClass][$field['name'] . '_day'];
unset($this->params['data'][$modelClass][$field['name'] . '_year']); unset($this->data[$modelClass][$field['name'] . '_year']);
unset($this->params['data'][$modelClass][$field['name'] . '_month']); unset($this->data[$modelClass][$field['name'] . '_month']);
unset($this->params['data'][$modelClass][$field['name'] . '_day']); unset($this->data[$modelClass][$field['name'] . '_day']);
unset($this->params['data'][$modelClass][$field['name'] . '_hour']); unset($this->data[$modelClass][$field['name'] . '_hour']);
unset($this->params['data'][$modelClass][$field['name'] . '_min']); unset($this->data[$modelClass][$field['name'] . '_min']);
unset($this->params['data'][$modelClass][$field['name'] . '_meridian']); unset($this->data[$modelClass][$field['name'] . '_meridian']);
$this->params['data'][$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
$this->data[$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
} elseif('datetime' == $field['type'] && isset($this->params['data'][$modelClass][$field['name'] . '_year'])) { } elseif('datetime' == $field['type'] && isset($this->data[$modelClass][$field['name'] . '_year'])) {
$hour = $this->params['data'][$modelClass][$field['name'] . '_hour']; $hour = $this->data[$modelClass][$field['name'] . '_hour'];
if ($hour != 12 && (isset($this->params['data'][$modelClass][$field['name'] . '_meridian']) && 'pm' == $this->params['data'][$modelClass][$field['name'] . '_meridian'])) { if ($hour != 12 && (isset($this->data[$modelClass][$field['name'] . '_meridian']) && 'pm' == $this->data[$modelClass][$field['name'] . '_meridian'])) {
$hour = $hour + 12; $hour = $hour + 12;
} }
$newDate = $this->params['data'][$modelClass][$field['name'] . '_year'] . '-'; $newDate = $this->data[$modelClass][$field['name'] . '_year'] . '-';
$newDate .= $this->params['data'][$modelClass][$field['name'] . '_month'] . '-'; $newDate .= $this->data[$modelClass][$field['name'] . '_month'] . '-';
$newDate .= $this->params['data'][$modelClass][$field['name'] . '_day'] . ' '; $newDate .= $this->data[$modelClass][$field['name'] . '_day'] . ' ';
$newDate .= $hour . ':' . $this->params['data'][$modelClass][$field['name'] . '_min'] . ':00'; $newDate .= $hour . ':' . $this->data[$modelClass][$field['name'] . '_min'] . ':00';
unset($this->params['data'][$modelClass][$field['name'] . '_year']); unset($this->data[$modelClass][$field['name'] . '_year']);
unset($this->params['data'][$modelClass][$field['name'] . '_month']); unset($this->data[$modelClass][$field['name'] . '_month']);
unset($this->params['data'][$modelClass][$field['name'] . '_day']); unset($this->data[$modelClass][$field['name'] . '_day']);
unset($this->params['data'][$modelClass][$field['name'] . '_hour']); unset($this->data[$modelClass][$field['name'] . '_hour']);
unset($this->params['data'][$modelClass][$field['name'] . '_min']); unset($this->data[$modelClass][$field['name'] . '_min']);
unset($this->params['data'][$modelClass][$field['name'] . '_meridian']); unset($this->data[$modelClass][$field['name'] . '_meridian']);
$this->params['data'][$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
$this->data[$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
} elseif('time' == $field['type'] && isset($this->params['data'][$modelClass][$field['name'] . '_hour'])) { } elseif('time' == $field['type'] && isset($this->data[$modelClass][$field['name'] . '_hour'])) {
$hour = $this->params['data'][$modelClass][$field['name'] . '_hour']; $hour = $this->data[$modelClass][$field['name'] . '_hour'];
if ($hour != 12 && (isset($this->params['data'][$modelClass][$field['name'] . '_meridian']) && 'pm' == $this->params['data'][$modelClass][$field['name'] . '_meridian'])) { if ($hour != 12 && (isset($this->data[$modelClass][$field['name'] . '_meridian']) && 'pm' == $this->data[$modelClass][$field['name'] . '_meridian'])) {
$hour = $hour + 12; $hour = $hour + 12;
} }
$newDate = $hour . ':' . $this->params['data'][$modelClass][$field['name'] . '_min'] . ':00'; $newDate = $hour . ':' . $this->data[$modelClass][$field['name'] . '_min'] . ':00';
unset($this->params['data'][$modelClass][$field['name'] . '_hour']); unset($this->data[$modelClass][$field['name'] . '_hour']);
unset($this->params['data'][$modelClass][$field['name'] . '_min']); unset($this->data[$modelClass][$field['name'] . '_min']);
unset($this->params['data'][$modelClass][$field['name'] . '_meridian']); unset($this->data[$modelClass][$field['name'] . '_meridian']);
$this->params['data'][$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
$this->data[$modelClass][$field['name']] = $newDate; $this->data[$modelClass][$field['name']] = $newDate;
} }
} }

View file

@ -344,6 +344,7 @@ class Validation extends Object {
$regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])(\\/|-|\\.|\\x20)(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2(\\/|-|\\.|\\x20)29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.|\\x20)(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; $regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])(\\/|-|\\.|\\x20)(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2(\\/|-|\\.|\\x20)29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.|\\x20)(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
$regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.|\\x20)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.|\\x20)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.|\\x20)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%'; $regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.|\\x20)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.|\\x20)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.|\\x20)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
$regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\\/|-|\\.|\\x20)(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.|\\x20)(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%'; $regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\\/|-|\\.|\\x20)(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.|\\x20)(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%';
$regex['dMy'] = '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\ ((1[6-9]|[2-9]\\d)\\d{2})$/';
foreach ($search as $key){ foreach ($search as $key){
$this->regex = $regex[$key]; $this->regex = $regex[$key];

View file

@ -288,9 +288,7 @@ class Helper extends Overloadable {
} }
$result = null; $result = null;
if (isset($this->params['data'][$this->model()][$this->field()])) { if (isset($this->data[$this->model()][$this->field()])) {
$result = h($this->params['data'][$this->model()][$this->field()]);
} elseif(isset($this->data[$this->model()][$this->field()])) {
$result = h($this->data[$this->model()][$this->field()]); $result = h($this->data[$this->model()][$this->field()]);
} }

View file

@ -485,9 +485,7 @@ class HtmlHelper extends AppHelper {
*/ */
function tagValue($fieldName) { function tagValue($fieldName) {
$this->setFormTag($fieldName); $this->setFormTag($fieldName);
if (isset($this->params['data'][$this->model()][$this->field()])) { if (isset($this->data[$this->model()][$this->field()])) {
return h($this->params['data'][$this->model()][$this->field()]);
} elseif(isset($this->data[$this->model()][$this->field()])) {
return h($this->data[$this->model()][$this->field()]); return h($this->data[$this->model()][$this->field()]);
} }
return false; return false;

View file

@ -727,7 +727,7 @@ class View extends Object {
$cache->base = $this->base; $cache->base = $this->base;
$cache->here = $this->here; $cache->here = $this->here;
$cache->action = $this->action; $cache->action = $this->action;
$cache->controllerName = $this->params['controller']; $cache->controllerName = $this->name;
$cache->cacheAction = $this->controller->cacheAction; $cache->cacheAction = $this->controller->cacheAction;
$cache->cache($___viewFn, $out, $cached); $cache->cache($___viewFn, $out, $cached);
} }