]> git.wh0rd.org - tt-rss.git/blobdiff - classes/rpc.php
move to Article:
[tt-rss.git] / classes / rpc.php
index 9eb8dbd70e3285c19c02fa6539a78a64fbb5f5ca..949a6177aad001f85cd6815b4861548150929ed9 100755 (executable)
@@ -105,7 +105,7 @@ class RPC extends Handler_Protected {
                $login = $this->dbh->escape_string($_REQUEST['login']);
                $pass = trim($_REQUEST['pass']); // escaped later
 
-               $rc = subscribe_to_feed($feed, $cat, $login, $pass);
+               $rc = Feeds::subscribe_to_feed($feed, $cat, $login, $pass);
 
                print json_encode(array("result" => $rc));
        }
@@ -151,7 +151,7 @@ class RPC extends Handler_Protected {
                $this->dbh->query("DELETE FROM ttrss_user_entries
                        WHERE ref_id IN ($ids) AND owner_uid = " . $_SESSION["uid"]);
 
-               purge_orphans();
+               Article::purge_orphans();
 
                print json_encode(array("message" => "UPDATE_COUNTERS"));
        }
@@ -281,7 +281,7 @@ class RPC extends Handler_Protected {
                                "/public.php?op=rss&id=-2&key=" .
                                get_feed_access_key(-2, false);
 
-                       $p = new Publisher(PUBSUBHUBBUB_HUB);
+                       $p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
 
                        $pubsub_result = $p->publish_update($rss_link);
                }
@@ -450,8 +450,10 @@ class RPC extends Handler_Protected {
                $feed_id = $this->dbh->escape_string($_REQUEST['feed_id']);
                $is_cat = $this->dbh->escape_string($_REQUEST['is_cat']) == "true";
                $mode = $this->dbh->escape_string($_REQUEST['mode']);
+               $search_query = $this->dbh->escape_string($_REQUEST['search_query']);
+               $search_lang = $this->dbh->escape_string($_REQUEST['search_lang']);
 
-               catchup_feed($feed_id, $is_cat, false, false, $mode);
+               Feeds::catchup_feed($feed_id, $is_cat, false, $mode, [$search_query, $search_lang]);
 
                print json_encode(array("message" => "UPDATE_COUNTERS"));
        }
@@ -554,7 +556,7 @@ class RPC extends Handler_Protected {
                }
 
                // Purge orphans and cleanup tags
-               purge_orphans();
+               Article::purge_orphans();
                //cleanup_tags(14, 50000);
 
                if ($num_updated > 0) {
@@ -624,7 +626,7 @@ class RPC extends Handler_Protected {
                                "/public.php?op=rss&id=-2&key=" .
                                get_feed_access_key(-2, false);
 
-                       $p = new Publisher(PUBSUBHUBBUB_HUB);
+                       $p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
 
                        /* $pubsub_result = */ $p->publish_update($rss_link);
                }
@@ -647,15 +649,19 @@ class RPC extends Handler_Protected {
        }
 
        function log() {
-               $logmsg = $this->dbh->escape_string($_REQUEST['logmsg']);
+               $msg = $this->dbh->escape_string($_REQUEST['msg']);
+               $file = $this->dbh->escape_string(basename($_REQUEST['file']));
+               $line = (int) $_REQUEST['line'];
+               $context = $this->dbh->escape_string($_REQUEST['context']);
 
-               if ($logmsg) {
+               if ($msg) {
                        Logger::get()->log_error(E_USER_WARNING,
-                               $logmsg, '[client-js]', 0, false);
-               }
+                               $msg, 'client-js:' . $file, $line, $context);
 
-               echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
+                       echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
+               } else {
+                       echo json_encode(array("error" => "MESSAGE_NOT_FOUND"));
+               }
 
        }
-}
-?>
+}
\ No newline at end of file