]>
git.wh0rd.org - tt-rss.git/blob - plugins/digest/init.php
2 // TODO: digest should register digest specific hotkey actions within tt-rss
3 class Digest
extends Plugin
implements IHandler
{
8 "Digest mode for tt-rss (tablet friendly UI)",
13 function init($host) {
16 $host->add_handler("digest", "*", $this);
20 header("Content-type: text/html; charset=utf-8");
24 require_once dirname(__FILE__
) . "/digest_body.php";
27 /* function get_js() {
28 return file_get_contents(dirname(__FILE__) . "/digest.js");
31 function csrf_ignore($method) {
32 return in_array($method, array("index"));
35 function before($method) {
43 function digestgetcontents() {
44 $article_id = db_escape_string( $_REQUEST['article_id']);
46 $result = db_query( "SELECT content,title,link,marked,published
47 FROM ttrss_entries, ttrss_user_entries
48 WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']);
50 $content = sanitize( db_fetch_result($result, 0, "content"));
51 $title = strip_tags(db_fetch_result($result, 0, "title"));
52 $article_url = htmlspecialchars(db_fetch_result($result, 0, "link"));
53 $marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked"));
54 $published = sql_bool_to_bool(db_fetch_result($result, 0, "published"));
56 print json_encode(array("article" =>
57 array("id" => $article_id, "url" => $article_url,
58 "tags" => get_article_tags( $article_id),
59 "marked" => $marked, "published" => $published,
60 "title" => $title, "content" => $content)));
63 function digestupdate() {
64 $feed_id = db_escape_string( $_REQUEST['feed_id']);
65 $offset = db_escape_string( $_REQUEST['offset']);
66 $seq = db_escape_string( $_REQUEST['seq']);
68 if (!$feed_id) $feed_id = -4;
69 if (!$offset) $offset = 0;
75 $headlines = API
::api_get_headlines( $feed_id, 30, $offset,
76 '', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0);
78 $reply['headlines'] = array();
79 $reply['headlines']['title'] = getFeedTitle( $feed_id);
80 $reply['headlines']['content'] = $headlines;
82 print json_encode($reply);
85 function digestinit() {
86 $tmp_feeds = API
::api_get_feeds( -4, true, false, 0);
91 foreach ($tmp_feeds as $f) {
92 if ($f['id'] > 0 ||
$f['id'] == -4) array_push($feeds, $f);
95 if ($_REQUEST["init"] == 1) {
96 $params["hotkeys"] = get_hotkeys_map();
98 $params["feeds"] = $feeds;
100 print json_encode($params);