private function tryCookie()
{
S::kill('auth_by_cookie');
- if (Cookie::v('ORGaccess') == '' || !Cookie::has('ORGuid')) {
+ if (Cookie::v('access') == '' || !Cookie::has('uid')) {
return -1;
}
$res = XDB::query('SELECT user_id, password
FROM auth_user_md5
WHERE user_id = {?} AND perms IN(\'admin\', \'user\')',
- Cookie::i('ORGuid'));
+ Cookie::i('uid'));
if ($res->numRows() != 0) {
list($uid, $password) = $res->fetchOneRow();
require_once 'secure_hash.inc.php';
$expected_value = hash_encrypt($password);
- if ($expected_value == Cookie::v('ORGaccess')) {
+ if ($expected_value == Cookie::v('access')) {
S::set('auth_by_cookie', $uid);
return 0;
} else {
if (!S::has('suid')) {
if (Post::has('domain')) {
if (($domain = Post::v('domain', 'login')) == 'alias') {
- setcookie('ORGdomain', "alias", (time() + 25920000), '/', '', 0);
+ Cookie::set('domain', 'alias', 300);
} else {
- setcookie('ORGdomain', '', (time() - 3600), '/', '', 0);
+ Cookie::kill('domain');
}
- // pour que la modification soit effective dans le reste de la page
- $_COOKIE['ORGdomain'] = $domain;
}
}
S::kill('challenge');
} else {
$logger = S::logger($uid);
$logger->saveLastSession();
- setcookie('ORGuid', $uid, (time() + 25920000), '/', '', 0);
+ Cookie::set('uid', $uid, 300);
if (S::i('auth_by_cookie') == $uid || Post::v('remember', 'false') == 'true') {
- $cookie = hash_encrypt($sess['password']);
- setcookie('ORGaccess', $cookie, (time() + 25920000), '/', '', 0);
+ Cookie::set('access', hash_encrypt($sess['password']), 300);
if (S::i('auth_by_cookie') != $uid) {
$logger->log("cookie_on");
}
} else {
- setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
+ Cookie::kill('access');
$logger->log("cookie_off");
}
}
-Subproject commit d7dfb18e275c1ed834ea8f0f4001399b0a17ce9f
+Subproject commit f09d3319de8a65f5eb11ce0e73a3dc08a72c4091
$log =& S::v('log');
S::logger()->log('passwd', '');
- if (Cookie::v('ORGaccess')) {
- setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0);
+ if (Cookie::v('access')) {
+ Cookie::set('access', sha1($password), 300);
S::logger()->log('cookie_on', '');
}
}
if ($level == 'forget' || $level == 'forgetall') {
- setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGaccess');
+ Cookie::kill('access');
S::logger()->log("cookie_off");
}
if ($level == 'forgetuid' || $level == 'forgetall') {
- setcookie('ORGuid', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGuid');
- setcookie('ORGdomain', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGdomain');
+ Cookie::kill('uid');
+ Cookie::kill('domain');
}
$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$log = S::v('log');
S::logger()->log('passwd', '');
- if (Cookie::v('ORGaccess')) {
+ if (Cookie::v('access')) {
require_once('secure_hash.inc.php');
- setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0);
+ Cookie::set('access', hash_encrypt($password), 300);
S::logger()->log('cookie_on', '');
}
function smarty_insert_getName()
{
- $uid = Cookie::v('ORGuid', -1);
+ $uid = Cookie::v('uid', -1);
if ($uid < 0) {
return "";
}
{
global $globals;
- $id = Cookie::i('ORGuid', -1);
+ $id = Cookie::i('uid', -1);
$id = S::v($_SESSION['uid'], $id);
if ($id<0) {
return "";
}
- if (Cookie::v('ORGdomain', 'login') != 'alias') {
+ if (Cookie::v('domain', 'login') != 'alias') {
$res = XDB::query("SELECT alias FROM aliases
WHERE id={?} AND (type IN ('a_vie','alias') AND FIND_IN_SET('bestalias', flags))", $id);
return $res->fetchOneCell();