mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Refactoring code and updating method references
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3841 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
13c579292a
commit
075891f1f9
3 changed files with 14 additions and 7 deletions
|
@ -119,7 +119,7 @@ class Component extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($componentCn == 'SessionComponent') {
|
if ($componentCn == 'SessionComponent') {
|
||||||
$param = strip_plugin($this->controller->base, $this->controller->plugin) . '/';
|
$param = Router::stripPlugin($this->controller->base, $this->controller->plugin) . '/';
|
||||||
} else {
|
} else {
|
||||||
$param = null;
|
$param = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,12 @@ class Controller extends Object {
|
||||||
*/
|
*/
|
||||||
var $data = array();
|
var $data = array();
|
||||||
/**
|
/**
|
||||||
* POST'ed model data
|
* Pagination defaults
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $paginate = array('limit' => 20);
|
var $paginate = array('limit' => 20, 'page' => 1);
|
||||||
/**
|
/**
|
||||||
* Sub-path for view files
|
* Sub-path for view files
|
||||||
*
|
*
|
||||||
|
@ -417,7 +417,9 @@ class Controller extends Object {
|
||||||
header("HTTP/1.1 {$status} " . $codes[$status]);
|
header("HTTP/1.1 {$status} " . $codes[$status]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Location: ' . Router::url($url, defined('SERVER_IIS')));
|
if ($url !== null) {
|
||||||
|
header('Location: ' . Router::url($url, defined('SERVER_IIS')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Saves a variable to use inside a template.
|
* Saves a variable to use inside a template.
|
||||||
|
@ -560,8 +562,10 @@ class Controller extends Object {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
* @see Controller::set
|
||||||
*/
|
*/
|
||||||
function _setTitle($pageTitle) {
|
function _setTitle($pageTitle) {
|
||||||
|
trigger_error('Deprecated: Use Controller::set("title", "...") instead', E_USER_WARNING);
|
||||||
$this->pageTitle = $pageTitle;
|
$this->pageTitle = $pageTitle;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -933,7 +937,6 @@ class Controller extends Object {
|
||||||
* Handles automatic pagination of model records
|
* Handles automatic pagination of model records
|
||||||
*
|
*
|
||||||
* @param mixed $object
|
* @param mixed $object
|
||||||
* @param array $options
|
|
||||||
* @param mixed $scope
|
* @param mixed $scope
|
||||||
* @param array $whitelist
|
* @param array $whitelist
|
||||||
* @return array Model query results
|
* @return array Model query results
|
||||||
|
@ -1016,7 +1019,7 @@ class Controller extends Object {
|
||||||
$defaults['conditions'] = array();
|
$defaults['conditions'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
extract(am($defaults, $options));
|
extract(am(array('page' => 1, 'limit' => 20), $defaults, $options));
|
||||||
if ((is_array($scope) || is_string($scope)) && !empty($scope)) {
|
if ((is_array($scope) || is_string($scope)) && !empty($scope)) {
|
||||||
$conditions = array($conditions, $scope);
|
$conditions = array($conditions, $scope);
|
||||||
}
|
}
|
||||||
|
|
|
@ -716,7 +716,7 @@ class Model extends Overloadable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($one)) {
|
if (is_array($one)) {
|
||||||
if (countdim($one) == 1) {
|
if (Set::countDim($one) == 1) {
|
||||||
$data = array($this->name => $one);
|
$data = array($this->name => $one);
|
||||||
} else {
|
} else {
|
||||||
$data = $one;
|
$data = $one;
|
||||||
|
@ -1260,6 +1260,10 @@ class Model extends Overloadable {
|
||||||
$this->id = $this->getID();
|
$this->id = $this->getID();
|
||||||
$offset = null;
|
$offset = null;
|
||||||
|
|
||||||
|
if (empty($page) || !is_numeric($page) || intval($page) < 1) {
|
||||||
|
$page = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($page > 1 && $limit != null) {
|
if ($page > 1 && $limit != null) {
|
||||||
$offset = ($page - 1) * $limit;
|
$offset = ($page - 1) * $limit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue