mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
2726d97cfb
commit
18c7a00a47
3 changed files with 38 additions and 11 deletions
|
@ -88,7 +88,7 @@ class SessionComponent extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function startup(&$controller) {
|
function startup(&$controller) {
|
||||||
if ($this->__started = false) {
|
if ($this->__started === false) {
|
||||||
$this->__start();
|
$this->__start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,8 +296,8 @@ class SessionComponent extends CakeSession {
|
||||||
if ($this->__started === false) {
|
if ($this->__started === false) {
|
||||||
if ($this->__bare === 0) {
|
if ($this->__bare === 0) {
|
||||||
if (!$this->id() && parent::start()) {
|
if (!$this->id() && parent::start()) {
|
||||||
parent::_checkValid();
|
|
||||||
$this->__started = true;
|
$this->__started = true;
|
||||||
|
parent::_checkValid();
|
||||||
} else {
|
} else {
|
||||||
$this->__started = parent::start();
|
$this->__started = parent::start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,8 +167,18 @@ class CakeSession extends Object {
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
$this->__initSession();
|
$this->__initSession();
|
||||||
$this->__startSession();
|
return $this->__startSession();
|
||||||
return true;
|
}
|
||||||
|
/**
|
||||||
|
* 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.
|
* Returns true if given variable is set in session.
|
||||||
|
@ -538,10 +548,14 @@ class CakeSession extends Object {
|
||||||
if (!isset($_SESSION)) {
|
if (!isset($_SESSION)) {
|
||||||
$_SESSION = array();
|
$_SESSION = array();
|
||||||
}
|
}
|
||||||
} else {
|
return false;
|
||||||
|
} elseif (!isset($_SESSION)) {
|
||||||
session_cache_limiter ("must-revalidate");
|
session_cache_limiter ("must-revalidate");
|
||||||
session_start();
|
session_start();
|
||||||
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
|
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,6 @@ class SessionHelper extends CakeSession {
|
||||||
function __construct($base = null) {
|
function __construct($base = null) {
|
||||||
if (Configure::read('Session.start') === true) {
|
if (Configure::read('Session.start') === true) {
|
||||||
parent::__construct($base, false);
|
parent::__construct($base, false);
|
||||||
parent::start();
|
|
||||||
} else {
|
} else {
|
||||||
$this->__active = false;
|
$this->__active = false;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +83,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function read($name = null) {
|
function read($name = null) {
|
||||||
if ($this->__active === true) {
|
if ($this->__active === true && $this->__start()) {
|
||||||
return parent::read($name);
|
return parent::read($name);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -99,7 +98,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function check($name) {
|
function check($name) {
|
||||||
if ($this->__active === true) {
|
if ($this->__active === true && $this->__start()) {
|
||||||
return parent::check($name);
|
return parent::check($name);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,7 +112,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function error() {
|
function error() {
|
||||||
if ($this->__active === true) {
|
if ($this->__active === true && $this->__start()) {
|
||||||
return parent::error();
|
return parent::error();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -129,7 +128,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function flash($key = 'flash') {
|
function flash($key = 'flash') {
|
||||||
if ($this->__active === true) {
|
if ($this->__active === true && $this->__start()) {
|
||||||
if (parent::check('Message.' . $key)) {
|
if (parent::check('Message.' . $key)) {
|
||||||
$flash = parent::read('Message.' . $key);
|
$flash = parent::read('Message.' . $key);
|
||||||
|
|
||||||
|
@ -158,7 +157,7 @@ class SessionHelper extends CakeSession {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function valid() {
|
function valid() {
|
||||||
if ($this->__active === true) {
|
if ($this->__active === true && $this->__start()) {
|
||||||
return parent::valid();
|
return parent::valid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,5 +180,19 @@ class SessionHelper extends CakeSession {
|
||||||
function id() {
|
function id() {
|
||||||
return parent::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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue