]> git.wh0rd.org Git - tt-rss.git/commitdiff
some UI frontend cookies respect session cookie lifetime, misc cookie cleanups (close...
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 16:53:11 +0000 (17:53 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 16:53:11 +0000 (17:53 +0100)
backend.php
feedlist.js
functions.js
login.php
tt-rss.js

index b83ea44966ccf328ef566e8de412bf78af657162..0d65c1ce7f9b8863983cf7c599427ff3ec07c8cc 100644 (file)
 
        $fetch = $_GET["fetch"];
 
-       setcookie("ttrss_icons_url", ICONS_URL);
+//     setcookie("ttrss_icons_url", ICONS_URL);
 
        if (!sanity_check($link)) { return; }
 
index 1be1020c66ef325c9082f7b0397b371953f33b70..6224e9ce0330e963c81c3db3868b7335e9324ec8 100644 (file)
@@ -65,7 +65,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
                        view_mode = "All Posts";
                }
        
-               setCookie("ttrss_vf_vmode", view_mode);
+               setCookie("ttrss_vf_vmode", view_mode, getCookie("ttrss_cltime"));
        
                var limitbox = doc.getElementById("limitbox");
        
@@ -73,7 +73,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
        
                if (limitbox) {
                        limit = limitbox[limitbox.selectedIndex].text;
-                       setCookie("ttrss_vf_limit", limit);
+                       setCookie("ttrss_vf_limit", limit, getCookie("ttrss_cltime"));
                } else {
                        limit = "All";
                }
index 1d45b1cbf8b03c1f568e5c68719273193439d69f..e016d8c8a603fd7217c6452a73d1a106251b6eea 100644 (file)
@@ -267,7 +267,20 @@ function getFeedIds() {
        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) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
@@ -275,6 +288,16 @@ function setCookie(name, value, expires, path, domain, 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) {
 
        var dc = document.cookie;
index 733be8c9d4f5e7b1803cc6f346c61df535362802..06b95353ff3f4a9a62942a8ba4a6d6d2737867dc 100644 (file)
--- a/login.php
+++ b/login.php
 
                if (authenticate_user($link, $login, $password)) {
                        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) {
                                $return_to = "tt-rss.php";
                        }
index 7648b8e1876694bd469fec512addb5b87fb0cb3a..7958291f9bd7d2e32fe7c9d34ec797a0c151b8a8 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -9,6 +9,7 @@ var daemon_enabled = false;
 var _qfd_deleted_feed = 0;
 var firsttime_update = true;
 var last_refetch = 0;
+var cookie_lifetime = 0;
 
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
@@ -438,6 +439,10 @@ function init_second_stage() {
 
        try {
 
+               cookie_lifetime = getCookie("ttrss_cltime");
+
+               delCookie("ttrss_vf_test");
+
                setCookie("ttrss_vf_actfeed", "");
        
                updateFeedList(false, false);