]> git.wh0rd.org - tt-rss.git/blobdiff - classes/rpc.php
rpc: move setArticleTags to article
[tt-rss.git] / classes / rpc.php
index d61b2891ad3c5286d85195e12a54e3d88e4d4bae..a78e079caf6934a057c3607c440e185f6bebb396 100644 (file)
@@ -347,79 +347,6 @@ class RPC extends Handler_Protected {
                print json_encode($reply);
        }
 
-       function setArticleTags() {
-
-               $id = db_escape_string($this->link, $_REQUEST["id"]);
-
-               $tags_str = db_escape_string($this->link, $_REQUEST["tags_str"]);
-               $tags = array_unique(trim_array(explode(",", $tags_str)));
-
-               db_query($this->link, "BEGIN");
-
-               $result = db_query($this->link, "SELECT int_id FROM ttrss_user_entries WHERE
-                               ref_id = '$id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1");
-
-               if (db_num_rows($result) == 1) {
-
-                       $tags_to_cache = array();
-
-                       $int_id = db_fetch_result($result, 0, "int_id");
-
-                       db_query($this->link, "DELETE FROM ttrss_tags WHERE
-                               post_int_id = $int_id AND owner_uid = '".$_SESSION["uid"]."'");
-
-                       foreach ($tags as $tag) {
-                               $tag = sanitize_tag($tag);
-
-                               if (!tag_is_valid($tag)) {
-                                       continue;
-                               }
-
-                               if (preg_match("/^[0-9]*$/", $tag)) {
-                                       continue;
-                               }
-
-                               //                                      print "<!-- $id : $int_id : $tag -->";
-
-                               if ($tag != '') {
-                                       db_query($this->link, "INSERT INTO ttrss_tags
-                                                               (post_int_id, owner_uid, tag_name) VALUES ('$int_id', '".$_SESSION["uid"]."', '$tag')");
-                               }
-
-                               array_push($tags_to_cache, $tag);
-                       }
-
-                       /* update tag cache */
-
-                       sort($tags_to_cache);
-                       $tags_str = join(",", $tags_to_cache);
-
-                       db_query($this->link, "UPDATE ttrss_user_entries
-                               SET tag_cache = '$tags_str' WHERE ref_id = '$id'
-                                               AND owner_uid = " . $_SESSION["uid"]);
-               }
-
-               db_query($this->link, "COMMIT");
-
-               $tags = get_article_tags($this->link, $id);
-               $tags_str = format_tags_string($tags, $id);
-               $tags_str_full = join(", ", $tags);
-
-               if (!$tags_str_full) $tags_str_full = __("no tags");
-
-               print json_encode(array("id" => (int)$id,
-                               "content" => $tags_str, "content_full" => $tags_str_full));
-       }
-
-       function regenOPMLKey() {
-               $this->update_feed_access_key($this->link, 'OPML:Publish',
-               false, $_SESSION["uid"]);
-
-               $new_link = Opml::opml_publish_url($this->link);
-
-               print json_encode(array("link" => $new_link));
-       }
-
        function completeLabels() {
                $search = db_escape_string($this->link, $_REQUEST["search"]);
 
@@ -609,21 +536,6 @@ class RPC extends Handler_Protected {
                print_feed_cat_select($this->link, "cat_id", $id);
        }
 
-       function regenFeedKey() {
-               $feed_id = db_escape_string($this->link, $_REQUEST['id']);
-               $is_cat = db_escape_string($this->link, $_REQUEST['is_cat']) == "true";
-
-               $new_key = $this->update_feed_access_key($this->link, $feed_id, $is_cat);
-
-               print json_encode(array("link" => $new_key));
-       }
-
-       // Silent
-       function clearKeys() {
-               db_query($this->link, "DELETE FROM ttrss_access_keys WHERE
-                       owner_uid = " . $_SESSION["uid"]);
-       }
-
        // Silent
        function clearArticleKeys() {
                db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '' WHERE
@@ -716,29 +628,6 @@ class RPC extends Handler_Protected {
 
        }
 
-       function update_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false) {
-               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
-
-               $sql_is_cat = bool_to_sql_bool($is_cat);
-
-               $result = db_query($link, "SELECT access_key FROM ttrss_access_keys
-                       WHERE feed_id = '$feed_id'      AND is_cat = $sql_is_cat
-                       AND owner_uid = " . $owner_uid);
-
-               if (db_num_rows($result) == 1) {
-                       $key = db_escape_string($this->link, sha1(uniqid(rand(), true)));
-
-                       db_query($link, "UPDATE ttrss_access_keys SET access_key = '$key'
-                               WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat
-                               AND owner_uid = " . $owner_uid);
-
-                       return $key;
-
-               } else {
-                       return get_feed_access_key($link, $feed_id, $is_cat, $owner_uid);
-               }
-       }
-
        private function markArticlesById($link, $ids, $cmode) {
 
                $tmp_ids = array();