Файл: adultscript-2.0.3-pro/files/libraries/framework/cookie.php
Строк: 35
<?php
defined('_VALID') or die('Restricted Access!');
class VCookie
{
public static function set($name, $value=NULL, $expire=NULL, $path=NULL, $domain=NULL, $secure=NULL, $httponly=NULL)
{
if (headers_sent()) {
return FALSE;
}
$cfg = VF::cfg('library.cookie');
foreach (array('domain', 'path', 'expire', 'secure', 'httponly') as $item) {
if ($$item === NULL AND isset($cfg[$item])) {
$$item = $cfg[$item];
}
}
$expire = ($expire === 0) ? 0 : time() + (int) $expire;
setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
}
public static function get($name, $return=TRUE)
{
if (isset($_COOKIE[$name])) {
return VF::factory('filter')->get($name, 'STRING', 'COOKIE');
}
if ($return) {
return FALSE;
}
}
public static function delete($name, $path = NULL, $domain = NULL)
{
if (!isset($_COOKIE[$name])) {
return FALSE;
}
unset($_COOKIE[$name]);
return self::set($name, '', -86400, $path, $domain, FALSE, FALSE);
}
}
?>