]> git.wh0rd.org - tt-rss.git/blobdiff - modules/backend-rpc.php
add tweet button to digest, misc digest fixes; rework article tweeting to use ajax...
[tt-rss.git] / modules / backend-rpc.php
index e7c1f5721f881248c33aea6a3d6ecf3326232dea..e93571207c50423635a7b4303d7e84b21fbc9977 100644 (file)
                        return;
                }
 
+               if ($subop == "getTweetInfo") {
+                       header("Content-Type: text/html");
+                       $id = db_escape_string($_REQUEST['id']);
+
+                       $result = db_query($link, "SELECT title, link 
+                               FROM ttrss_entries, ttrss_user_entries
+                               WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
+
+                       if (db_num_rows($result) != 0) {
+                               $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')),
+                                       100, '...');
+                               $article_link = db_fetch_result($result, 0, 'link');
+                       }
+
+                       print json_encode(array("title" => $title, "link" => $article_link,
+                               "id" => $id));
+
+                       return;
+               }
+
                print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
        }
 ?>