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

View file

@ -288,9 +288,7 @@ class Helper extends Overloadable {
}
$result = null;
if (isset($this->params['data'][$this->model()][$this->field()])) {
$result = h($this->params['data'][$this->model()][$this->field()]);
} elseif(isset($this->data[$this->model()][$this->field()])) {
if (isset($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) {
$this->setFormTag($fieldName);
if (isset($this->params['data'][$this->model()][$this->field()])) {
return h($this->params['data'][$this->model()][$this->field()]);
} elseif(isset($this->data[$this->model()][$this->field()])) {
if (isset($this->data[$this->model()][$this->field()])) {
return h($this->data[$this->model()][$this->field()]);
}
return false;
@ -836,7 +834,7 @@ class HtmlHelper extends AppHelper {
$hourValue = 12;
}
}
if ($format24Hours) {
$hours = array('00' => '00', '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23');
} else {
@ -908,7 +906,7 @@ class HtmlHelper extends AppHelper {
if (empty($selected)) {
$selected = $this->tagValue($tagName);
}
if (!empty($selected)) {
if (is_int($selected)) {

View file

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