mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Refactoring View and SecurityComponent
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3327 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a75f33f430
commit
2b69e99ae3
2 changed files with 15 additions and 30 deletions
|
@ -48,7 +48,7 @@ class SecurityComponent extends Object {
|
|||
|
||||
var $requireLogin = array();
|
||||
|
||||
var $loginOptions = array();
|
||||
var $loginOptions = array('type' => '');
|
||||
|
||||
var $loginUsers = array();
|
||||
|
||||
|
@ -116,9 +116,6 @@ class SecurityComponent extends Object {
|
|||
if (is_array($this->requireLogin) && !empty($this->requireLogin)) {
|
||||
if (in_array($controller->action, $this->requireLogin) || $this->requireLogin == array('*')) {
|
||||
|
||||
if (!isset($this->loginOptions['type'])) {
|
||||
$this->loginOptions['type'] = '';
|
||||
}
|
||||
$login = $this->loginCredentials($this->loginOptions['type']);
|
||||
if ($login == null) {
|
||||
// User hasn't been authenticated yet
|
||||
|
|
|
@ -207,31 +207,21 @@ class View extends Object{
|
|||
*/
|
||||
var $plugin = null;
|
||||
|
||||
var $__passedVars = array('_viewVars', 'action', 'autoLayout', 'autoRender', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'viewPath', 'params', 'data', 'webservices', 'plugin', 'namedArgs', 'argSeparator');
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
function __construct(&$controller) {
|
||||
if(is_object($controller)){
|
||||
if(is_object($controller)) {
|
||||
$this->controller =& $controller;
|
||||
$this->_viewVars = $this->controller->_viewVars;
|
||||
$this->action = $this->controller->action;
|
||||
$this->autoLayout = $this->controller->autoLayout;
|
||||
$this->autoRender = $this->controller->autoRender;
|
||||
$this->base = $this->controller->base;
|
||||
$this->webroot = $this->controller->webroot;
|
||||
$this->helpers = $this->controller->helpers;
|
||||
$this->here = $this->controller->here;
|
||||
$this->layout = $this->controller->layout;
|
||||
$this->modelNames = $this->controller->modelNames;
|
||||
$this->name = $this->controller->name;
|
||||
$this->pageTitle = $this->controller->pageTitle;
|
||||
$this->viewPath = $this->controller->viewPath;
|
||||
$this->params = $this->controller->params;
|
||||
$this->data = $this->controller->data;
|
||||
$this->webservices = $this->controller->webservices;
|
||||
$this->plugin = $this->controller->plugin;
|
||||
|
||||
$c = count($this->__passedVars);
|
||||
for ($j = 0; $j < $c; $j++) {
|
||||
$var = $this->__passedVars[$j];
|
||||
$this->{$var} = $controller->{$var};
|
||||
}
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
|
@ -663,15 +653,13 @@ class View extends Object{
|
|||
|
||||
${$camelBackedHelper} =& new $helperCn;
|
||||
${$camelBackedHelper}->view =& $this;
|
||||
${$camelBackedHelper}->base = $this->base;
|
||||
${$camelBackedHelper}->webroot = $this->webroot;
|
||||
${$camelBackedHelper}->here = $this->here;
|
||||
${$camelBackedHelper}->params = $this->params;
|
||||
${$camelBackedHelper}->action = $this->action;
|
||||
${$camelBackedHelper}->data = $this->data;
|
||||
${$camelBackedHelper}->themeWeb = $this->themeWeb;
|
||||
${$camelBackedHelper}->tags = $tags;
|
||||
${$camelBackedHelper}->plugin = $this->plugin;
|
||||
|
||||
$vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin', 'namedArgs', 'argSeparator');
|
||||
$c = count($vars);
|
||||
for ($j = 0; $j < $c; $j++) {
|
||||
${$camelBackedHelper}->{$vars[$j]} = $this->{$vars[$j]};
|
||||
}
|
||||
|
||||
if (!empty($this->validationErrors)) {
|
||||
${$camelBackedHelper}->validationErrors = $this->validationErrors;
|
||||
|
|
Loading…
Reference in a new issue