<?php
/**
* A minimal sessions++ stack component
* Does nothing except calling the next in the chain
*/
class nullHandler extends stackSess {
function __construct($shNext=false)
{
if (false!==$shNext) {
$this->addNext($shNext);
}
}
function close ()
{
if ($this->shStackNext) {
return $this->shStackNext->close();
} else {
return false;
}
}
function destroy($session_id)
{
if ($this->shStackNext) {
return $this->shStackNext->destroy($session_id);
} else {
return false;
}
}
function gc($maxlifetime)
{
if ($this->shStackNext) {
return $this->shStackNext->gc($maxlifetime);
} else {
return false;
}
}
function open($save_path, $name)
{
if ($this->shStackNext) {
return $this->shStackNext->open($save_path, $name);
} else {
trigger_error("Null session handler has no storage capability");
return false;
}
}
function read($session_id)
{
if ($this->shStackNext) {
return $this->shStackNext->read($session_id);
} else {
return $session_str;
}
}
function write($session_id, $session_data)
{
if ($this->shStackNext) {
return $this->shStackNext->write($session_id, $session_data);
} else {
return $session_str;
}
}
function create_sid($newlyCreatedSid=false)
{
if (is_callable(array($this->shStackNext,'create_sid'))) {
// we always send down the stack
$newlyCreatedSid=$this->shStackNext->create_sid($newlyCreatedSid);
}
return $newlyCreatedSid;
}
function lastAccessed($lastAccess=false)
{
if (is_callable(array($this->shStackNext,'lastAccessed'))) {
$lastAccess=$this->shStackNext->lastAccessed($lastAccess);
}
if (!$lastAccess || $lastAccess>$this->lastAccess) {
if ($this->lastAccess) {
return $this->lastAccess;
}
}
return $lastAccess;
}
}
|