]>
git.wh0rd.org - tt-rss.git/blob - plugins/digest/digest.php
2 class Digest
extends Plugin
implements IHandler
{
9 "Digest mode for tt-rss (tablet friendly UI)",
14 function init($host) {
15 $this->link
= $host->get_link();
18 $host->add_handler("digest", "*", $this);
22 header("Content-type: text/html; charset=utf-8");
24 login_sequence($this->link
);
29 require_once dirname(__FILE__
) . "/digest_body.php";
32 /* function get_js() {
33 return file_get_contents(dirname(__FILE__) . "/digest.js");
36 function csrf_ignore($method) {
37 return in_array($method, array("index"));
40 function before($method) {
48 function digestgetcontents() {
49 $article_id = db_escape_string($_REQUEST['article_id']);
51 $result = db_query($this->link
, "SELECT content,title,link,marked,published
52 FROM ttrss_entries, ttrss_user_entries
53 WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']);
55 $content = sanitize($this->link
, db_fetch_result($result, 0, "content"));
56 $title = strip_tags(db_fetch_result($result, 0, "title"));
57 $article_url = htmlspecialchars(db_fetch_result($result, 0, "link"));
58 $marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked"));
59 $published = sql_bool_to_bool(db_fetch_result($result, 0, "published"));
61 print json_encode(array("article" =>
62 array("id" => $article_id, "url" => $article_url,
63 "tags" => get_article_tags($this->link
, $article_id),
64 "marked" => $marked, "published" => $published,
65 "title" => $title, "content" => $content)));
68 function digestupdate() {
69 $feed_id = db_escape_string($_REQUEST['feed_id']);
70 $offset = db_escape_string($_REQUEST['offset']);
71 $seq = db_escape_string($_REQUEST['seq']);
73 if (!$feed_id) $feed_id = -4;
74 if (!$offset) $offset = 0;
80 $headlines = api_get_headlines($this->link
, $feed_id, 30, $offset,
81 '', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0);
83 $reply['headlines'] = array();
84 $reply['headlines']['title'] = getFeedTitle($this->link
, $feed_id);
85 $reply['headlines']['content'] = $headlines;
87 print json_encode($reply);
90 function digestinit() {
91 $tmp_feeds = api_get_feeds($this->link
, -4, true, false, 0);
95 foreach ($tmp_feeds as $f) {
96 if ($f['id'] > 0 ||
$f['id'] == -4) array_push($feeds, $f);
99 print json_encode(array("feeds" => $feeds));