Correcting issues with Sessions and Controller::redirect()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5999 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-11-16 03:52:14 +00:00
parent 2726d97cfb
commit 18c7a00a47
3 changed files with 38 additions and 11 deletions

View file

@ -88,7 +88,7 @@ class SessionComponent extends CakeSession {
* @access public
*/
function startup(&$controller) {
if ($this->__started = false) {
if ($this->__started === false) {
$this->__start();
}
}
@ -296,8 +296,8 @@ class SessionComponent extends CakeSession {
if ($this->__started === false) {
if ($this->__bare === 0) {
if (!$this->id() && parent::start()) {
parent::_checkValid();
$this->__started = true;
parent::_checkValid();
} else {
$this->__started = parent::start();
}

View file

@ -167,8 +167,18 @@ class CakeSession extends Object {
session_write_close();
}
$this->__initSession();
$this->__startSession();
return true;
return $this->__startSession();
}
/**
* Determine if Session has been started.
*
* @access public
*/
function started(){
if (isset($_SESSION)) {
return true;
}
return false;
}
/**
* Returns true if given variable is set in session.
@ -538,10 +548,14 @@ class CakeSession extends Object {
if (!isset($_SESSION)) {
$_SESSION = array();
}
} else {
return false;
} elseif (!isset($_SESSION)) {
session_cache_limiter ("must-revalidate");
session_start();
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
return true;
} else {
return true;
}
}
/**

View file

@ -59,7 +59,6 @@ class SessionHelper extends CakeSession {
function __construct($base = null) {
if (Configure::read('Session.start') === true) {
parent::__construct($base, false);
parent::start();
} else {
$this->__active = false;
}
@ -84,7 +83,7 @@ class SessionHelper extends CakeSession {
* @access public
*/
function read($name = null) {
if ($this->__active === true) {
if ($this->__active === true && $this->__start()) {
return parent::read($name);
}
return false;
@ -99,7 +98,7 @@ class SessionHelper extends CakeSession {
* @access public
*/
function check($name) {
if ($this->__active === true) {
if ($this->__active === true && $this->__start()) {
return parent::check($name);
}
return false;
@ -113,7 +112,7 @@ class SessionHelper extends CakeSession {
* @access public
*/
function error() {
if ($this->__active === true) {
if ($this->__active === true && $this->__start()) {
return parent::error();
}
return false;
@ -129,7 +128,7 @@ class SessionHelper extends CakeSession {
* @access public
*/
function flash($key = 'flash') {
if ($this->__active === true) {
if ($this->__active === true && $this->__start()) {
if (parent::check('Message.' . $key)) {
$flash = parent::read('Message.' . $key);
@ -158,7 +157,7 @@ class SessionHelper extends CakeSession {
* @access public
*/
function valid() {
if ($this->__active === true) {
if ($this->__active === true && $this->__start()) {
return parent::valid();
}
}
@ -181,5 +180,19 @@ class SessionHelper extends CakeSession {
function id() {
return parent::id();
}
/**
* Determine if Session has been started
* and attempt to start it if not
*
* @return boolean true if Session is already started, false if
* Session could not be started
* @access public
*/
function __start() {
if(!parent::started()) {
parent::start();
}
return true;
}
}
?>