]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/feeds.php
experimentally rebase labels; make base index configurable
[tt-rss.git] / classes / pref / feeds.php
index ceda133742273ac12ce339fdc4b182c71e278cfd..a6811f3fc1bfeda80e54ba0e574ebb6b7bf66d13 100644 (file)
@@ -55,7 +55,7 @@ class Pref_Feeds extends Handler_Protected {
 
                        $cat['items'] = $this->get_category_items($line['id']);
 
-                       $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+                       $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
 
                        if (count($cat['items']) > 0 || $show_empty_cats)
                                array_push($items, $cat);
@@ -134,7 +134,7 @@ class Pref_Feeds extends Handler_Protected {
 
                                while ($line = db_fetch_assoc($result)) {
 
-                                       $label_id = -$line['id'] - 11;
+                                       $label_id = label_to_feed_id($line['id']);
 
                                        $feed = $this->feedlist_init_feed($label_id, false, 0);
 
@@ -172,7 +172,7 @@ class Pref_Feeds extends Handler_Protected {
 
                                $cat['items'] = $this->get_category_items($line['id']);
 
-                               $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+                               $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
 
                                if (count($cat['items']) > 0 || $show_empty_cats)
                                        array_push($root['items'], $cat);
@@ -214,13 +214,13 @@ class Pref_Feeds extends Handler_Protected {
                                array_push($cat['items'], $feed);
                        }
 
-                       $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+                       $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
 
                        if (count($cat['items']) > 0 || $show_empty_cats)
                                array_push($root['items'], $cat);
 
                        $root['param'] += count($cat['items']);
-                       $root['param'] = T_sprintf('(%d feeds)', $root['param']);
+                       $root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
 
                } else {
                        $feed_result = db_query($this->link, "SELECT id, title, last_error,
@@ -245,7 +245,7 @@ class Pref_Feeds extends Handler_Protected {
                                array_push($root['items'], $feed);
                        }
 
-                       $root['param'] = T_sprintf('(%d feeds)', count($root['items']));
+                       $root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
                }
 
                $fl = array();
@@ -1012,7 +1012,7 @@ class Pref_Feeds extends Handler_Protected {
                $ids = split(",", db_escape_string($this->link, $_REQUEST["ids"]));
 
                foreach ($ids as $id) {
-                       $this->remove_feed($this->link, $id, $_SESSION["uid"]);
+                       Pref_Feeds::remove_feed($this->link, $id, $_SESSION["uid"]);
                }
 
                return;
@@ -1657,7 +1657,7 @@ class Pref_Feeds extends Handler_Protected {
                ccache_remove($link, $id, $owner_uid, true);
        }
 
-       private function remove_feed($link, $id, $owner_uid) {
+       static function remove_feed($link, $id, $owner_uid) {
 
                if ($id > 0) {
 
@@ -1700,8 +1700,8 @@ class Pref_Feeds extends Handler_Protected {
                        ccache_remove($link, $id, $owner_uid);
 
                } else {
-                       label_remove($link, -11-$id, $owner_uid);
-                       ccache_remove($link, -11-$id, $owner_uid);
+                       label_remove($link, feed_to_label_id($id), $owner_uid);
+                       //ccache_remove($link, $id, $owner_uid); don't think labels are cached
                }
        }