Removed redundant lib2/cookie.inc.php, changed all uses to new Cookie service. Except lib1 - should be phased out anyway.
This commit is contained in:
@ -90,42 +90,52 @@ class Cookie
|
||||
}
|
||||
}
|
||||
|
||||
function set($name, $value, $default=null)
|
||||
private function setSession($name, $value, $default = null)
|
||||
{
|
||||
if (!isset($_SESSION[$name]) || $_SESSION[$name] != $value) {
|
||||
if ($value == $default) {
|
||||
if (isset($_SESSION[$name])) {
|
||||
unset($_SESSION[$name]);
|
||||
$this->changed = true;
|
||||
}
|
||||
} else {
|
||||
$this->initSession();
|
||||
$_SESSION[$name] = $value;
|
||||
$this->changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setCookie($name, $value, $default = null)
|
||||
{
|
||||
// Store cookie value in internal array. OcSmarty will call this->header()
|
||||
// to actually set the cookie.
|
||||
|
||||
if (!isset($this->values[$name]) || $this->values[$name] != $value) {
|
||||
if ($value == $default) {
|
||||
if (isset($this->values[$name])) {
|
||||
unset($this->values[$name]);
|
||||
$this->changed = true;
|
||||
}
|
||||
} else {
|
||||
$this->values[$name] = $value;
|
||||
$this->changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function set($name, $value, $default = null)
|
||||
{
|
||||
global $opt;
|
||||
|
||||
if ($opt['session']['mode'] == SAVE_SESSION) {
|
||||
if (!isset($_SESSION[$name]) || $_SESSION[$name] != $value) {
|
||||
if ($value == $default) {
|
||||
if (isset($_SESSION[$name])) {
|
||||
unset($_SESSION[$name]);
|
||||
$this->changed = true;
|
||||
}
|
||||
} else {
|
||||
$this->initSession();
|
||||
$_SESSION[$name] = $value;
|
||||
$this->changed = true;
|
||||
}
|
||||
}
|
||||
$this->setSession($name, $value, $default);
|
||||
} else {
|
||||
// Store cookie value in internal array. OcSmarty will call this->header()
|
||||
// to actually set the cookie.
|
||||
|
||||
if (!isset($this->values[$name]) || $this->values[$name] != $value) {
|
||||
if ($value == $default) {
|
||||
if (isset($this->values[$name])) {
|
||||
unset($this->values[$name]);
|
||||
$this->changed = true;
|
||||
}
|
||||
} else {
|
||||
$this->values[$name] = $value;
|
||||
$this->changed = true;
|
||||
}
|
||||
}
|
||||
$this->setCookie($name, $value, $default);
|
||||
}
|
||||
}
|
||||
|
||||
function get($name, $default='')
|
||||
public function get($name, $default = '')
|
||||
{
|
||||
global $opt;
|
||||
|
||||
@ -147,7 +157,7 @@ class Cookie
|
||||
}
|
||||
}
|
||||
|
||||
function un_set($name)
|
||||
public function un_set($name)
|
||||
{
|
||||
global $opt;
|
||||
|
||||
|
Reference in New Issue
Block a user