]> git.wh0rd.org - tt-rss.git/blobdiff - modules/backend-rpc.php
tag editor: autocomplete
[tt-rss.git] / modules / backend-rpc.php
index 868d464451d69991e3e099c4dcbf1806b0f7a77e..3303b25f9e49c5d0a572ae3880703ba51007f715 100644 (file)
 
                        $result = db_query($link, "UPDATE ttrss_user_entries SET marked = $mark
                                WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+
+                       print "<rpc-reply><mark>$id</mark></rpc-reply>";
+
+               }
+
+               if ($subop == "publ") {
+                       $pub = $_GET["pub"];
+                       $id = db_escape_string($_GET["id"]);
+
+                       if ($pub == "1") {
+                               $pub = "true";
+                       } else {
+                               $pub = "false";
+                       }
+
+                       // FIXME this needs collision testing
+
+                       $result = db_query($link, "UPDATE ttrss_user_entries SET published = $pub
+                               WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+
+                       print "<rpc-reply><pub>$id</pub></rpc-reply>";
+
                }
 
                if ($subop == "updateFeed") {
 
                        print "<rpc-reply>";
                        print "<counters>";
-                       getAllCounters($link);
+                       getAllCounters($link, $_GET["omode"]);
                        print "</counters>";
                        print_runtime_info($link);
                        print "</rpc-reply>";
 
                        print "<rpc-reply>";
                        print "<counters>";
-                       getAllCounters($link);
+                       getAllCounters($link, $_GET["omode"]);
+                       print "</counters>";
+                       print_runtime_info($link);
+                       print "</rpc-reply>";
+               }
+
+               if ($subop == "publishSelected") {
+
+                       $ids = split(",", db_escape_string($_GET["ids"]));
+                       $cmode = sprintf("%d", $_GET["cmode"]);
+
+                       publishArticlesById($link, $ids, $cmode);
+
+                       print "<rpc-reply>";
+                       print "<counters>";
+                       getAllCounters($link, $_GET["omode"]);
                        print "</counters>";
                        print_runtime_info($link);
                        print "</rpc-reply>";
 
                        if (db_num_rows($result) == 1) {
                                $link = strip_tags(db_fetch_result($result, 0, "link"));
-                               print "<rpc-reply><link>$link</link></rpc-reply>";
+                               print "<rpc-reply><link>$link</link><id>$id</id></rpc-reply>";
                        } else {
                                print "<rpc-reply><error>Article not found</error></rpc-reply>";
                        }
                                                continue;
                                        }
 
-//                                     print "<!-- $tag -->";
+                                       print "<!-- $id : $int_id : $tag -->";
                                        
                                        if ($tag != '') {
                                                db_query($link, "INSERT INTO ttrss_tags 
 
                }
 
+               if ($subop == "regenPubKey") {
+
+                       print "<rpc-reply>";
+
+                       set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key());
+
+                       $new_link = article_publish_url($link);         
+
+                       print "<link><![CDATA[$new_link]]></link>";
+
+                       print "</rpc-reply>";
+
+               }
+
                if ($subop == "logout") {
                        logout_user();
                        print_error_xml(6);
                }
 
+               if ($subop == "completeTags") {
+
+                       $search = db_escape_string($_REQUEST["search"]);
+
+                       $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags 
+                               WHERE owner_uid = '".$_SESSION["uid"]."' AND
+                               tag_name LIKE '$search%' ORDER BY tag_name
+                               LIMIT 10");
+
+                       print "<ul>";
+                       while ($line = db_fetch_assoc($result)) {
+                               print "<li>" . $line["tag_name"] . "</li>";
+                       }
+                       print "</ul>";
+
+               }
+
        }
 ?>