]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
use real link to article in headlines list (for middle click)
[tt-rss.git] / backend.php
index b078250ad6b348b4d6a8f62395b7dc9050dcd786..254dcbc5deb338248d4b7e2f3a93070d3af7f319 100644 (file)
        if ((!$op || $op == "rpc" || $op == "rss" || $op == "view" || 
                        $op == "digestSend" || $op == "viewfeed" || $op == "publish" ||
                        $op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) {
-               header("Content-Type: application/xml; charset=utf-8");
+                               header("Content-Type: application/xml; charset=utf-8");
+
+                               if (ENABLE_GZIP_OUTPUT) {
+                                       ob_start("ob_gzhandler");
+                               }
+                               
                } else {
                if (!$_REQUEST["noxml"]) {
                        header("Content-Type: text/html; charset=utf-8");
 
        $access_level_names = array(
                0 => __("User"), 
+               5 => __("Power User"),
                10 => __("Administrator"));
 
        require_once "modules/pref-prefs.php";
                break; // rpc
 
                case "feeds":
+                       if (ENABLE_GZIP_OUTPUT) {
+                               ob_start("ob_gzhandler");
+                       }
+
                        $tags = $_GET["tags"];
 
                        $subop = $_GET["subop"];
                        $mode = db_escape_string($_GET["mode"]);
                        $omode = db_escape_string($_GET["omode"]);
 
+                       $csync = $_GET["csync"];
+
                        print "<reply>";
 
                        // in prefetch mode we only output requested cids, main article 
                                }
                        }
 
-                       if ($mode != "prefetch_old") {
+                       if ($mode != "prefetch_old" || $csync) {
                                print "<counters>";
                                getAllCounters($link, $omode);
                                print "</counters>";
                        $cat_view = db_escape_string($_GET["cat"]);
                        $next_unread_feed = db_escape_string($_GET["nuf"]);
                        $offset = db_escape_string($_GET["skip"]);
+                       $vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
+                       $csync = $_GET["csync"];
 
                        set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
                        set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
                        } else {
 
                                $ret = outputHeadlinesList($link, $feed, $subop, 
-                                       $view_mode, $limit, $cat_view, $next_unread_feed, $offset);
+                                       $view_mode, $limit, $cat_view, $next_unread_feed, $offset, 
+                                       $vgroup_last_feed);
        
                                $topmost_article_ids = $ret[0];
                                $headlines_count = $ret[1];
                                $returned_feed = $ret[2];
                                $disable_cache = $ret[3];
+                               $vgroup_last_feed = $ret[4];
        
                                print "]]></headlines>";
        
                                print "<headlines-count value=\"$headlines_count\"/>";
-       
+                               print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
+
                                $headlines_unread = getFeedUnread($link, $returned_feed);
        
                                print "<headlines-unread value=\"$headlines_unread\"/>";
 
                        if ($_GET["debug"]) $timing_info = print_checkpoint("20", $timing_info);
 
-                       print "<counters>";
-                       getAllCounters($link, $omode, $feed);
-                       print "</counters>";
+                       $viewfeed_ctr_interval = 300;
+
+                       if ($csync) {
+                               $viewfeed_ctr_interval = 60;
+                       }
+
+                       if (time() - $_SESSION["get_all_counters_stamp"] > $viewfeed_ctr_interval) {
+                               print "<counters>";
+                               getAllCounters($link, $omode, $feed);
+                               print "</counters>";
+                       }
 
                        if ($_GET["debug"]) $timing_info = print_checkpoint("30", $timing_info);
 
                case "globalUpdateFeeds":
                        // update feeds of all users, may be used anonymously
 
+                       print "<!--";
                        // Update all feeds needing a update.
-                       update_daemon_common($link, 0, true, false);
+                       update_daemon_common($link, 0, true, true);
+                       print " -->";
 
                        // FIXME : old feed update way. To be removed.
                        //$result = db_query($link, "SELECT id FROM ttrss_users");
                        print "<div class='infoBoxContents'>";
 
                        $result = db_query($link, "SELECT login,
-                               SUBSTRING(last_login,1,16) AS last_login,
+                               ".SUBSTRING_FOR_DATE."(last_login,1,16) AS last_login,
                                access_level,
                                (SELECT COUNT(int_id) FROM ttrss_user_entries 
                                        WHERE owner_uid = id) AS stored_articles,
-                               SUBSTRING(created,1,16) AS created
+                               ".SUBSTRING_FOR_DATE."(created,1,16) AS created
                                FROM ttrss_users 
                                WHERE id = '$uid'");