]> git.wh0rd.org Git - tt-rss.git/commitdiff
move virt feeds counter display to getVirtCounters()
authorAndrew Dolgov <fox@bah.org.ru>
Wed, 30 Dec 2009 07:07:00 +0000 (10:07 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Wed, 30 Dec 2009 07:07:00 +0000 (10:07 +0300)
api/index.php
functions.php
modules/backend-rpc.php

index 0e07abb4b77334142ce3411549546576f7a2663b..5d749340237d1b388c8dce5a198ba7d0c87a0bc4 100644 (file)
                        /* Virtual feeds */
 
                        if (!$cat_id || $cat_id == -1) {
-                               foreach (array(-1, -2, -3, -4) as $i) {
+                               foreach (array(-1, -2, -3, -4, 0) as $i) {
                                        $unread = getFeedUnread($link, $i);
 
                                        if ($unread || !$unread_only) {
index 2e735e7b9759974f62d5820d03051716d015b2db..3d71566c6dcd9f000535e2f84d4111f8b69fc1a0 100644 (file)
                if (!$omode) $omode = "flc";
        
                getGlobalCounters($link);
-       
+               getVirtCounters($link);
+
                if (strchr($omode, "l")) getLabelCounters($link);
                if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
                if (strchr($omode, "t")) getTagCounters($link);
 
        }
 
-       function getLabelCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
-
-               $age_qpart = getMaxAgeSubquery();
-
-               if ($smart_mode) {
-                       if (!$_SESSION["lctr_last_value"]) {
-                               $_SESSION["lctr_last_value"] = array();
-                       }
-               }
+       function getVirtCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
 
                $ret_arr = array();
 
                                $ret_arr[$i]["counter"] = $count;
                                $ret_arr[$i]["description"] = getFeedTitle($link, $i);
                        }
-       
+               } 
+
+               return $ret_arr;
+       }
+
+       function getLabelCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
+
+               $age_qpart = getMaxAgeSubquery();
+
+               if ($smart_mode) {
+                       if (!$_SESSION["lctr_last_value"]) {
+                               $_SESSION["lctr_last_value"] = array();
+                       }
                }
 
                $old_counters = $_SESSION["lctr_last_value"];
index c9c367165dc243ed17b7f6cd17b0fb7d9eed78ce..8b125212756c432187a6491764fd2825f034b750 100644 (file)
                        return;
                }
 
-               if ($subop == "getLabelCounters") {
-                       $aid = $_REQUEST["aid"];                
-                       print "<rpc-reply>";
-                       print "<counters>";
-                       getLabelCounters($link);
-                       if ($aid) {
-                               getFeedCounter($link, $aid);
-                       }
-                       print "</counters>";
-                       print "</rpc-reply>";
-
-                       return;
-               }
-
-               if ($subop == "getFeedCounters") {
-                       print "<rpc-reply>";
-                       print "<counters>";
-                       getFeedCounters($link);
-                       print "</counters>";
-                       print "</rpc-reply>";
-
-                       return;
-               }
-
                if ($subop == "getAllCounters") {
                        print "<rpc-reply>";                    
                        print "<counters>";
@@ -77,6 +53,7 @@
 
                        print "<rpc-reply><counters>";
                        getGlobalCounters($link);
+                       getVirtCounters($link);
                        getLabelCounters($link);
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                getCategoryCounters($link);
@@ -94,6 +71,7 @@
 
                        print "<rpc-reply><counters>";
                        getGlobalCounters($link);
+                       getVirtCounters($link);
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                getCategoryCounters($link);
                        }
 
                        print "<rpc-reply><counters>";
                        getGlobalCounters($link);
+                       getVirtCounters($link);
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                getCategoryCounters($link);
                        }
 
                        print "<rpc-reply><counters>";
                        getGlobalCounters($link);
+                       getVirtCounters($link);
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                getCategoryCounters($link);
                        }
                        
                        print "<counters>";
                        getGlobalCounters($link);
+                       getVirtCounters($link);
                        getLabelCounters($link);
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                getCategoryCounters($link);
         
                                if (!$omode) $omode = "tflc";
 
+                               getVirtCounters($link);
+
                                if (strchr($omode, "l")) getLabelCounters($link);
 
                                if (strchr($omode, "c")) {