mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
reverting last 2 commits
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1650 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7858d0a1d8
commit
510dc8bac2
9 changed files with 114 additions and 137 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.4.1649_beta
|
||||
0.10.4.1645_beta
|
|
@ -229,12 +229,10 @@ class Dispatcher extends Object
|
|||
$output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
|
||||
if ($controller->autoRender)
|
||||
{
|
||||
return $controller->render();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $output;
|
||||
$controller->render();
|
||||
exit;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,20 +58,23 @@ class PagesController extends AppController{
|
|||
*/
|
||||
function display()
|
||||
{
|
||||
if (!func_num_args())
|
||||
{
|
||||
$this->redirect('/');
|
||||
}
|
||||
$path = func_get_args();
|
||||
if (!count($path))
|
||||
{
|
||||
$this->redirect('/');
|
||||
}
|
||||
$this->set('page', $path[0]);
|
||||
$this->set('subpage', empty($path[1])? null: $path[1]);
|
||||
$this->set('title', ucfirst($path[count($path)-1]));
|
||||
$this->render(join('/', $path));
|
||||
$this->autoRender = false;
|
||||
if (!func_num_args())
|
||||
{
|
||||
$this->redirect('/');
|
||||
}
|
||||
|
||||
$path = func_get_args();
|
||||
|
||||
if (!count($path))
|
||||
{
|
||||
$this->redirect('/');
|
||||
}
|
||||
$this->set('page', $path[0]);
|
||||
$this->set('subpage', empty($path[1])? null: $path[1]);
|
||||
$this->set('title', ucfirst($path[count($path)-1]));
|
||||
$this->render(join('/', $path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -98,11 +98,11 @@ class Object
|
|||
{
|
||||
if(in_array('render', $extra))
|
||||
{
|
||||
$extra['render'] = 1;
|
||||
$extra['render'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra['render'] = 0;
|
||||
$extra['render'] = 1;
|
||||
}
|
||||
$dispatcher =& new Dispatcher();
|
||||
return $dispatcher->dispatch($url, $extra);
|
||||
|
|
|
@ -82,12 +82,6 @@ class CakeSession extends Object
|
|||
*/
|
||||
var $sessionId = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $security = null;
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
@ -112,25 +106,8 @@ class CakeSession extends Object
|
|||
$this->host = substr($this->host,0, strpos($this->host, ':'));
|
||||
}
|
||||
|
||||
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||
{
|
||||
$this->ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
if(!empty($_SERVER['HTTP_USER_AGENT']))
|
||||
{
|
||||
$this->userAgent = md5($_SERVER['HTTP_USER_AGENT']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->userAgent = "";
|
||||
}
|
||||
|
||||
$this->security = CAKE_SECURITY;
|
||||
$this->ip = !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
|
||||
$this->userAgent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
|
||||
$this->_initSession();
|
||||
$this->_begin();
|
||||
parent::__construct();
|
||||
|
@ -332,7 +309,7 @@ class CakeSession extends Object
|
|||
function _initSession()
|
||||
{
|
||||
|
||||
switch ($this->security)
|
||||
switch (CAKE_SECURITY)
|
||||
{
|
||||
case 'high':
|
||||
$this->cookieLifeTime = 0;
|
||||
|
@ -416,7 +393,7 @@ class CakeSession extends Object
|
|||
function _new()
|
||||
{
|
||||
|
||||
if(!ereg("proxy\.aol\.com$", @gethostbyaddr($this->ip)))
|
||||
if(!ereg("proxy\.aol\.com$", gethostbyaddr($this->ip)))
|
||||
{
|
||||
if($this->readSessionVar("Config"))
|
||||
{
|
||||
|
@ -451,7 +428,7 @@ class CakeSession extends Object
|
|||
$this->valid = true;
|
||||
}
|
||||
|
||||
if($this->security == 'high')
|
||||
if(CAKE_SECURITY == 'high')
|
||||
{
|
||||
$this->_regenerateId();
|
||||
}
|
||||
|
@ -502,14 +479,13 @@ class CakeSession extends Object
|
|||
$newSessid = session_id();
|
||||
if (function_exists('session_write_close'))
|
||||
{
|
||||
if($this->security == 'high')
|
||||
if(CAKE_SECURITY == 'high')
|
||||
{
|
||||
if (isset($_COOKIE[session_name()]))
|
||||
{
|
||||
setcookie(CAKE_SESSION_COOKIE, '', time()-42000, $this->path);
|
||||
}
|
||||
$sessionpath = session_save_path();
|
||||
$file = $sessionpath."/sess_$oldSessionId";
|
||||
$file = ini_get('session.save_path')."/sess_$oldSessionId";
|
||||
@unlink($file);
|
||||
}
|
||||
session_write_close();
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
|
||||
/**
|
||||
* Backend for helpers.
|
||||
*
|
||||
*
|
||||
* Internal methods for the Helpers.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2005, Cake Software Foundation, Inc.
|
||||
* Copyright (c) 2005, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2005, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
|
@ -76,11 +76,7 @@ class Helper extends Object
|
|||
*/
|
||||
function Helper()
|
||||
{
|
||||
}
|
||||
|
||||
function loadConfig()
|
||||
{
|
||||
return $this->readConfigFile(CAKE.'config'.DS.'tags.ini.php');
|
||||
$this->tags = $this->readConfigFile(CAKE.'config'.DS.'tags.ini.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +125,7 @@ class Helper extends Object
|
|||
return str_replace('%%'.array_keys($values).'%%', array_values($values),
|
||||
$this->tags[$keyName]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of settings in given INI file.
|
||||
*
|
||||
|
|
|
@ -215,7 +215,7 @@ class FormHelper extends Helper
|
|||
function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected )
|
||||
{
|
||||
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));;
|
||||
$str = $this->Html->dateTimeOptionTag( $tagName, 'MDY' , 'NONE', $selected, $htmlOptions);
|
||||
$str = $this->Html->dateTimeOptionTag( $tagName, 'MDY' , 'NONE', '', $selected, $htmlOptions);
|
||||
$strLabel = $this->labelTag( $tagName, $prompt );
|
||||
|
||||
$divClass = "optional";
|
||||
|
|
|
@ -129,7 +129,7 @@ class HtmlHelper extends Helper
|
|||
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT
|
||||
* and $return.
|
||||
*/
|
||||
function charset($charset, $return = false)
|
||||
function charset($charset, $return)
|
||||
{
|
||||
return $this->output(sprintf($this->tags['charset'], $charset), $return);
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ class HtmlHelper extends Helper
|
|||
function tagValue ($fieldName)
|
||||
{
|
||||
$this->setFormTag($fieldName);
|
||||
return isset($this->params['data'][$this->model][$this->field])? htmlspecialchars($this->params['data'][$this->model][$this->field]): false;
|
||||
return isset($this->params['data'][$this->model][$this->field])? $this->params['data'][$this->model][$this->field]: false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -934,7 +934,16 @@ class HtmlHelper extends Helper
|
|||
{
|
||||
if (!in_array($k, $exclude))
|
||||
{
|
||||
$out[] = "{$k}=\"{$v}\"";
|
||||
$pos = strpos($v, '"');
|
||||
if($pos === false)
|
||||
{
|
||||
$out[] = "{$k}=\"{$v}\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$out[] = "{$k}='{$v}'";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$out = join(' ', $out);
|
||||
|
@ -1434,61 +1443,57 @@ class HtmlHelper extends Helper
|
|||
}
|
||||
$meridian = 'am';
|
||||
$date = explode('-',$selected);
|
||||
$days = explode(' ',$date[2]);
|
||||
$day = explode(' ',$date[2]);
|
||||
$time = explode(':',$day[1]);
|
||||
|
||||
$day = $days[0];
|
||||
$month = $date[1];
|
||||
$year = $date[0];
|
||||
|
||||
if($timeFormat != 'NONE' && !empty($timeFormat))
|
||||
if(($time[0] > 12) && $timeFormat == '12')
|
||||
{
|
||||
$time = explode(':',$days[1]);
|
||||
if(($time[0] > 12) && $timeFormat == '12')
|
||||
{
|
||||
$time[0] = $time[0] - 12;
|
||||
$meridian = 'pm';
|
||||
}
|
||||
elseif($time[0] > 12)
|
||||
{
|
||||
$meridian = 'pm';
|
||||
}
|
||||
$hour = $time[0];
|
||||
$min = $time[1];
|
||||
$time[0] = $time[0] - 12;
|
||||
$meridian = 'pm';
|
||||
}
|
||||
elseif($time[0] > 12)
|
||||
{
|
||||
$meridian = 'pm';
|
||||
}
|
||||
|
||||
$day = $day[0];
|
||||
$month = $date[1];
|
||||
$year = $date[0];
|
||||
$hour = $time[0];
|
||||
$min = $time[1];
|
||||
}
|
||||
|
||||
switch ( $dateFormat )
|
||||
{
|
||||
case 'DMY' :
|
||||
$opt = $this->dayOptionTag( $tagName ,null ,$day) . '-' . $this->monthOptionTag( $tagName, null, $month ) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year );
|
||||
$opt = $this->dayOptionTag( $tagName ,null ,$day) . '-' . $this->monthOptionTag( $tagName, null, $month ) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year );
|
||||
break;
|
||||
case 'MDY' :
|
||||
$opt = $this->monthOptionTag($tagName, null, $month) .'-'.$this->dayOptionTag( $tagName, null, $day ) . '-' . $this->yearOptionTag($tagName, null, null, null, $year);
|
||||
$opt = $this->monthOptionTag($tagName, null, $month) .'-'.$this->dayOptionTag( $tagName, null, $day ) . '-' . $this->yearOptionTag($tagName, null, null, null, $year);
|
||||
break;
|
||||
case 'YMD' :
|
||||
$opt = $this->yearOptionTag($tagName, null, null, null, $year) . '-' . $this->monthOptionTag( $tagName, null, $month ) . '-' . $this->dayOptionTag( $tagName, null, $day );
|
||||
$opt = $this->yearOptionTag($tagName, null, null, null, $year) . '-' . $this->monthOptionTag( $tagName, null, $month ) . '-' . $this->dayOptionTag( $tagName, null, $day );
|
||||
break;
|
||||
case 'NONE':
|
||||
$opt ='';
|
||||
$opt ='';
|
||||
break;
|
||||
default:
|
||||
$opt = '';
|
||||
$opt = '';
|
||||
break;
|
||||
}
|
||||
switch ($timeFormat)
|
||||
{
|
||||
case '24':
|
||||
$opt .= $this->hourOptionTag( $tagName, null , true, $hour) . ':' . $this->minuteOptionTag( $tagName, null, $min );
|
||||
$opt .= $this->hourOptionTag( $tagName, null , true, $hour) . ':' . $this->minuteOptionTag( $tagName, null, $min );
|
||||
break;
|
||||
case '12':
|
||||
$opt .= $this->hourOptionTag( $tagName, null, false, $hour) . ':' . $this->minuteOptionTag( $tagName, null, $min) . ' ' . $this->meridianOptionTag($tagName, null, $meridian);
|
||||
$opt .= $this->hourOptionTag( $tagName, null, false, $hour) . ':' . $this->minuteOptionTag( $tagName, null, $min) . ' ' . $this->meridianOptionTag($tagName, null, $meridian);
|
||||
break;
|
||||
case 'NONE':
|
||||
$opt .='';
|
||||
$opt .='';
|
||||
break;
|
||||
default :
|
||||
$opt .='';
|
||||
|
||||
break;
|
||||
}
|
||||
return $opt;
|
||||
|
|
|
@ -173,19 +173,12 @@ class View extends Object
|
|||
*/
|
||||
var $controller = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $loaded = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
function __construct (&$controller)
|
||||
function View(&$controller)
|
||||
{
|
||||
$this->controller =& $controller;
|
||||
$this->_viewVars =& $this->controller->_viewVars;
|
||||
|
@ -206,9 +199,24 @@ class View extends Object
|
|||
$this->data =& $this->controller->data;
|
||||
$this->displayFields =& $this->controller->displayFields;
|
||||
$this->webservices =& $this->controller->webservices;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view instance (singleton)
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function getInstance()
|
||||
{
|
||||
static $instance;
|
||||
if (!isset($instance))
|
||||
{
|
||||
$instance[0] =& new View();
|
||||
}
|
||||
return $instance[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders view for given action and layout. If $file is given, that is used
|
||||
* for a view filename (e.g. customFunkyView.thtml).
|
||||
|
@ -239,14 +247,11 @@ class View extends Object
|
|||
$this->setLayout($layout);
|
||||
}
|
||||
|
||||
$viewFileName = $this->_getViewFileName($action);
|
||||
if ($file)
|
||||
{
|
||||
$viewFileName = $file;
|
||||
}
|
||||
else
|
||||
{
|
||||
$viewFileName = $this->_getViewFileName($action);
|
||||
}
|
||||
|
||||
if (!is_file($viewFileName))
|
||||
{
|
||||
|
@ -384,8 +389,8 @@ class View extends Object
|
|||
|
||||
if (is_file($layout_fn))
|
||||
{
|
||||
$data_for_layout = array_merge($data_for_layout,$this->loaded); # load all view variables)
|
||||
$out = $this->_render($layout_fn, $data_for_layout, true, false);
|
||||
|
||||
if ($out === false)
|
||||
{
|
||||
$out = $this->_render($layout_fn, $data_for_layout, false);
|
||||
|
@ -458,10 +463,6 @@ class View extends Object
|
|||
{
|
||||
$viewFileName = VIEWS.$this->viewPath.DS.$type.$action.'.thtml';
|
||||
}
|
||||
elseif(file_exists(VIEWS.'errors'.DS.$type.$action.'.thtml'))
|
||||
{
|
||||
$viewFileName = VIEWS.'errors'.DS.$type.$action.'.thtml';
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
|
||||
{
|
||||
$viewFileName = LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml';
|
||||
|
@ -520,30 +521,31 @@ class View extends Object
|
|||
* @return string Rendered output
|
||||
* @access private
|
||||
*/
|
||||
function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
|
||||
{
|
||||
if ($this->helpers != false && $loadHelpers === true)
|
||||
{
|
||||
$loadedHelpers = array();
|
||||
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
|
||||
function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
|
||||
{
|
||||
/**
|
||||
* Fetching helpers
|
||||
*/
|
||||
if ($this->helpers != false && $loadHelpers = true)
|
||||
{
|
||||
$loadedHelpers = array();
|
||||
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
|
||||
|
||||
foreach(array_keys($loadedHelpers) as $helper)
|
||||
{
|
||||
$replace = strtolower(substr($helper, 0, 1));
|
||||
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
|
||||
foreach(array_keys($loadedHelpers) as $helper)
|
||||
{
|
||||
$replace = strtolower(substr($helper, 0, 1));
|
||||
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
|
||||
|
||||
${$camelBackedHelper} =& $loadedHelpers[$helper];
|
||||
|
||||
if(isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
|
||||
{
|
||||
foreach(${$camelBackedHelper}->helpers as $subHelper)
|
||||
{
|
||||
${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
|
||||
}
|
||||
}
|
||||
$this->loaded[$camelBackedHelper] = (${$camelBackedHelper});
|
||||
}
|
||||
}
|
||||
${$camelBackedHelper} =& $loadedHelpers[$helper];
|
||||
if(isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
|
||||
{
|
||||
foreach(${$camelBackedHelper}->helpers as $subHelper)
|
||||
{
|
||||
${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extract($___data_for_view, EXTR_SKIP); # load all view variables
|
||||
/**
|
||||
|
@ -577,8 +579,6 @@ class View extends Object
|
|||
*/
|
||||
function &_loadHelpers(&$loaded, $helpers)
|
||||
{
|
||||
$helperTags = new Helper();
|
||||
$tags = $helperTags->loadConfig();
|
||||
foreach ($helpers as $helper)
|
||||
{
|
||||
$helperCn = $helper.'Helper';
|
||||
|
@ -622,7 +622,6 @@ class View extends Object
|
|||
${$camelBackedHelper}->params = $this->params;
|
||||
${$camelBackedHelper}->action = $this->action;
|
||||
${$camelBackedHelper}->data = $this->data;
|
||||
${$camelBackedHelper}->tags = $tags;
|
||||
|
||||
if(!empty($this->validationErrors))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue