some UI frontend cookies respect session cookie lifetime, misc cookie cleanups (closes #52)
This commit is contained in:
parent
2055d4a6dc
commit
76b4eae177
5 changed files with 42 additions and 5 deletions
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
$fetch = $_GET["fetch"];
|
$fetch = $_GET["fetch"];
|
||||||
|
|
||||||
setcookie("ttrss_icons_url", ICONS_URL);
|
// setcookie("ttrss_icons_url", ICONS_URL);
|
||||||
|
|
||||||
if (!sanity_check($link)) { return; }
|
if (!sanity_check($link)) { return; }
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
|
||||||
view_mode = "All Posts";
|
view_mode = "All Posts";
|
||||||
}
|
}
|
||||||
|
|
||||||
setCookie("ttrss_vf_vmode", view_mode);
|
setCookie("ttrss_vf_vmode", view_mode, getCookie("ttrss_cltime"));
|
||||||
|
|
||||||
var limitbox = doc.getElementById("limitbox");
|
var limitbox = doc.getElementById("limitbox");
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
|
||||||
|
|
||||||
if (limitbox) {
|
if (limitbox) {
|
||||||
limit = limitbox[limitbox.selectedIndex].text;
|
limit = limitbox[limitbox.selectedIndex].text;
|
||||||
setCookie("ttrss_vf_limit", limit);
|
setCookie("ttrss_vf_limit", limit, getCookie("ttrss_cltime"));
|
||||||
} else {
|
} else {
|
||||||
limit = "All";
|
limit = "All";
|
||||||
}
|
}
|
||||||
|
|
25
functions.js
25
functions.js
|
@ -267,7 +267,20 @@ function getFeedIds() {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookie(name, value, expires, path, domain, secure) {
|
function setCookie(name, value, lifetime, path, domain, secure) {
|
||||||
|
|
||||||
|
var d = false;
|
||||||
|
|
||||||
|
if (lifetime) {
|
||||||
|
d = new Date();
|
||||||
|
d.setTime(lifetime * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
int_setCookie(name, value, d, path, domain, secure);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function int_setCookie(name, value, expires, path, domain, secure) {
|
||||||
document.cookie= name + "=" + escape(value) +
|
document.cookie= name + "=" + escape(value) +
|
||||||
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
||||||
((path) ? "; path=" + path : "") +
|
((path) ? "; path=" + path : "") +
|
||||||
|
@ -275,6 +288,16 @@ function setCookie(name, value, expires, path, domain, secure) {
|
||||||
((secure) ? "; secure" : "");
|
((secure) ? "; secure" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delCookie(name, path, domain) {
|
||||||
|
if (getCookie(name)) {
|
||||||
|
document.cookie = name + "=" +
|
||||||
|
((path) ? ";path=" + path : "") +
|
||||||
|
((domain) ? ";domain=" + domain : "" ) +
|
||||||
|
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getCookie(name) {
|
function getCookie(name) {
|
||||||
|
|
||||||
var dc = document.cookie;
|
var dc = document.cookie;
|
||||||
|
|
|
@ -42,6 +42,15 @@
|
||||||
if (authenticate_user($link, $login, $password)) {
|
if (authenticate_user($link, $login, $password)) {
|
||||||
initialize_user_prefs($link, $_SESSION["uid"]);
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
||||||
|
|
||||||
|
if ($_POST["remember_me"]) {
|
||||||
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME_REMEMBER;
|
||||||
|
} else {
|
||||||
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"],
|
||||||
|
$_SESSION["cookie_lifetime"]);
|
||||||
|
|
||||||
if (!$return_to) {
|
if (!$return_to) {
|
||||||
$return_to = "tt-rss.php";
|
$return_to = "tt-rss.php";
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ var daemon_enabled = false;
|
||||||
var _qfd_deleted_feed = 0;
|
var _qfd_deleted_feed = 0;
|
||||||
var firsttime_update = true;
|
var firsttime_update = true;
|
||||||
var last_refetch = 0;
|
var last_refetch = 0;
|
||||||
|
var cookie_lifetime = 0;
|
||||||
|
|
||||||
/*@cc_on @*/
|
/*@cc_on @*/
|
||||||
/*@if (@_jscript_version >= 5)
|
/*@if (@_jscript_version >= 5)
|
||||||
|
@ -438,6 +439,10 @@ function init_second_stage() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
cookie_lifetime = getCookie("ttrss_cltime");
|
||||||
|
|
||||||
|
delCookie("ttrss_vf_test");
|
||||||
|
|
||||||
setCookie("ttrss_vf_actfeed", "");
|
setCookie("ttrss_vf_actfeed", "");
|
||||||
|
|
||||||
updateFeedList(false, false);
|
updateFeedList(false, false);
|
||||||
|
|
Loading…
Reference in a new issue