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:
phpnut 2005-12-28 02:58:49 +00:00
parent 7858d0a1d8
commit 510dc8bac2
9 changed files with 114 additions and 137 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.4.1649_beta
0.10.4.1645_beta

View file

@ -229,13 +229,11 @@ 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();
$controller->render();
exit;
}
else
{
return $output;
}
}
/**
* Returns array of GET and POST parameters. GET parameters are taken from given URL.

View file

@ -62,7 +62,9 @@ class PagesController extends AppController{
{
$this->redirect('/');
}
$path = func_get_args();
if (!count($path))
{
$this->redirect('/');
@ -71,7 +73,8 @@ class PagesController extends AppController{
$this->set('subpage', empty($path[1])? null: $path[1]);
$this->set('title', ucfirst($path[count($path)-1]));
$this->render(join('/', $path));
$this->autoRender = false;
}
}
?>

View file

@ -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);

View file

@ -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();

View file

@ -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');
}
/**

View 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";

View file

@ -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;
}
/**
@ -933,9 +933,18 @@ class HtmlHelper extends Helper
foreach ($options as $k=>$v)
{
if (!in_array($k, $exclude))
{
$pos = strpos($v, '"');
if($pos === false)
{
$out[] = "{$k}=\"{$v}\"";
}
else
{
$out[] = "{$k}='{$v}'";
}
}
}
$out = join(' ', $out);
return $out? $insert_before.$out.$insert_after: null;
@ -1434,15 +1443,9 @@ 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))
{
$time = explode(':',$days[1]);
if(($time[0] > 12) && $timeFormat == '12')
{
$time[0] = $time[0] - 12;
@ -1452,12 +1455,14 @@ class HtmlHelper extends Helper
{
$meridian = 'pm';
}
$day = $day[0];
$month = $date[1];
$year = $date[0];
$hour = $time[0];
$min = $time[1];
}
}
switch ( $dateFormat )
{
case 'DMY' :
@ -1488,7 +1493,7 @@ class HtmlHelper extends Helper
$opt .='';
break;
default :
$opt .='';
break;
}
return $opt;

View file

@ -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';
@ -522,7 +523,10 @@ class View extends Object
*/
function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
{
if ($this->helpers != false && $loadHelpers === true)
/**
* Fetching helpers
*/
if ($this->helpers != false && $loadHelpers = true)
{
$loadedHelpers = array();
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
@ -533,7 +537,6 @@ class View extends Object
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
${$camelBackedHelper} =& $loadedHelpers[$helper];
if(isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
{
foreach(${$camelBackedHelper}->helpers as $subHelper)
@ -541,7 +544,6 @@ class View extends Object
${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
}
}
$this->loaded[$camelBackedHelper] = (${$camelBackedHelper});
}
}
@ -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))
{