]> git.wh0rd.org - tt-rss.git/blobdiff - modules/backend-rpc.php
implement assign-to-label in subtoolbar
[tt-rss.git] / modules / backend-rpc.php
index 4d65ee23ed924943ed866324d76ae86dc401cce0..691771f736ccb2665c3d0e90333ff6a5d1095745 100644 (file)
                        return;
                }
 
+               if ($subop == "assignToLabel") {
+
+                       $ids = split(",", db_escape_string($_REQUEST["ids"]));
+                       $label_id = db_escape_string($_REQUEST["lid"]);
+
+                       $label = label_find_caption($link, $label_id, $_SESSION["uid"]);
+
+                       if ($label) {
+
+                               foreach ($ids as $id) {
+                                       label_add_article($link, $id, $label, $_SESSION["uid"]);
+                               }
+                       }
+
+                       print "<rpc-reply><counters>";
+
+                       if ($label) {
+                               getGlobalCounters($link);
+                               getLabelCounters($link);
+                               if (get_pref($link, 'ENABLE_FEED_CATS')) {
+                                       getCategoryCounters($link);
+                               }
+                       }
+
+                       print "</counters></rpc-reply>";
+
+                       return;
+               }
+
                print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
        }
 ?>