do not use session cookie lifetime for additional cookies

This commit is contained in:
Andrew Dolgov 2013-04-29 13:03:28 +04:00
parent a845a3d5e5
commit e57a1507ae
4 changed files with 6 additions and 8 deletions

View File

@ -114,7 +114,7 @@ class Pref_Prefs extends Handler_Protected {
if ($pref_name == "language") { if ($pref_name == "language") {
if ($_SESSION["language"] != $value) { if ($_SESSION["language"] != $value) {
setcookie("ttrss_lang", $value, setcookie("ttrss_lang", $value,
time() + SESSION_COOKIE_LIFETIME); time() + COOKIE_LIFETIME_LONG);
$_SESSION["language"] = $value; $_SESSION["language"] = $value;
$need_reload = true; $need_reload = true;

View File

@ -479,7 +479,7 @@ class RPC extends Handler_Protected {
$wide = (int) $_REQUEST["wide"]; $wide = (int) $_REQUEST["wide"];
setcookie("ttrss_widescreen", $wide, setcookie("ttrss_widescreen", $wide,
time() + SESSION_COOKIE_LIFETIME); time() + COOKIE_LIFETIME_LONG);
print json_encode(array("wide" => $wide)); print json_encode(array("wide" => $wide));
} }

View File

@ -139,10 +139,6 @@
define('SESSION_COOKIE_LIFETIME', 86400); define('SESSION_COOKIE_LIFETIME', 86400);
// Default lifetime of a session (e.g. login) cookie. In seconds, // Default lifetime of a session (e.g. login) cookie. In seconds,
// 0 means cookie will be deleted when browser closes. // 0 means cookie will be deleted when browser closes.
// Setting this to zero will affect several user preferences
// like widescreen mode not saving and disable "remember me".
// Note that if remember me is not checked, session cookie
// will always expire with browser session.
define('SESSION_CHECK_ADDRESS', 1); define('SESSION_CHECK_ADDRESS', 1);
// Check client IP address when validating session: // Check client IP address when validating session:

View File

@ -5,6 +5,8 @@
define('LABEL_BASE_INDEX', -1024); define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128); define('PLUGIN_FEED_BASE_INDEX', -128);
define('COOKIE_LIFETIME_LONG', 86400*365);
$fetch_last_error = false; $fetch_last_error = false;
$fetch_last_error_code = false; $fetch_last_error_code = false;
$fetch_last_content_type = false; $fetch_last_content_type = false;
@ -796,9 +798,9 @@
$_SESSION["last_login_update"] = time(); $_SESSION["last_login_update"] = time();
} }
if ($_SESSION["uid"] && $_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) { if ($_SESSION["uid"] && $_SESSION["language"]) {
setcookie("ttrss_lang", $_SESSION["language"], setcookie("ttrss_lang", $_SESSION["language"],
time() + SESSION_COOKIE_LIFETIME); time() + COOKIE_LIFETIME_LONG);
} }
if ($_SESSION["uid"]) { if ($_SESSION["uid"]) {