From 6322ac79a020ab584d412d782d62b2ee77d7c6cf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 16:23:15 +0400 Subject: remove $link --- plugins/digest/init.php | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'plugins/digest/init.php') diff --git a/plugins/digest/init.php b/plugins/digest/init.php index e65ae13d7..5b84fec16 100644 --- a/plugins/digest/init.php +++ b/plugins/digest/init.php @@ -1,8 +1,6 @@ link = $host->get_link(); $this->host = $host; $host->add_handler("digest", "*", $this); @@ -22,10 +19,7 @@ class Digest extends Plugin implements IHandler { function index() { header("Content-type: text/html; charset=utf-8"); - login_sequence($this->link); - - global $link; - $link = $this->link; + login_sequence(); require_once dirname(__FILE__) . "/digest_body.php"; } @@ -47,13 +41,13 @@ class Digest extends Plugin implements IHandler { } function digestgetcontents() { - $article_id = db_escape_string($this->link, $_REQUEST['article_id']); + $article_id = db_escape_string( $_REQUEST['article_id']); - $result = db_query($this->link, "SELECT content,title,link,marked,published + $result = db_query( "SELECT content,title,link,marked,published FROM ttrss_entries, ttrss_user_entries WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']); - $content = sanitize($this->link, db_fetch_result($result, 0, "content")); + $content = sanitize( db_fetch_result($result, 0, "content")); $title = strip_tags(db_fetch_result($result, 0, "title")); $article_url = htmlspecialchars(db_fetch_result($result, 0, "link")); $marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked")); @@ -61,15 +55,15 @@ class Digest extends Plugin implements IHandler { print json_encode(array("article" => array("id" => $article_id, "url" => $article_url, - "tags" => get_article_tags($this->link, $article_id), + "tags" => get_article_tags( $article_id), "marked" => $marked, "published" => $published, "title" => $title, "content" => $content))); } function digestupdate() { - $feed_id = db_escape_string($this->link, $_REQUEST['feed_id']); - $offset = db_escape_string($this->link, $_REQUEST['offset']); - $seq = db_escape_string($this->link, $_REQUEST['seq']); + $feed_id = db_escape_string( $_REQUEST['feed_id']); + $offset = db_escape_string( $_REQUEST['offset']); + $seq = db_escape_string( $_REQUEST['seq']); if (!$feed_id) $feed_id = -4; if (!$offset) $offset = 0; @@ -78,18 +72,18 @@ class Digest extends Plugin implements IHandler { $reply['seq'] = $seq; - $headlines = API::api_get_headlines($this->link, $feed_id, 30, $offset, + $headlines = API::api_get_headlines( $feed_id, 30, $offset, '', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0); $reply['headlines'] = array(); - $reply['headlines']['title'] = getFeedTitle($this->link, $feed_id); + $reply['headlines']['title'] = getFeedTitle( $feed_id); $reply['headlines']['content'] = $headlines; print json_encode($reply); } function digestinit() { - $tmp_feeds = API::api_get_feeds($this->link, -4, true, false, 0); + $tmp_feeds = API::api_get_feeds( -4, true, false, 0); $params = array(); $feeds = array(); @@ -99,7 +93,7 @@ class Digest extends Plugin implements IHandler { } if ($_REQUEST["init"] == 1) { - $params["hotkeys"] = get_hotkeys_map($this->link); + $params["hotkeys"] = get_hotkeys_map(); } $params["feeds"] = $feeds; -- cgit v1.2.3 From a42c55f02b7e313ab61bf826794d0888f2dceae1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 18:34:18 +0400 Subject: fix blank character after opening bracket in function calls --- plugins/digest/init.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'plugins/digest/init.php') diff --git a/plugins/digest/init.php b/plugins/digest/init.php index 5b84fec16..b06097171 100644 --- a/plugins/digest/init.php +++ b/plugins/digest/init.php @@ -41,13 +41,13 @@ class Digest extends Plugin implements IHandler { } function digestgetcontents() { - $article_id = db_escape_string( $_REQUEST['article_id']); + $article_id = db_escape_string($_REQUEST['article_id']); - $result = db_query( "SELECT content,title,link,marked,published + $result = db_query("SELECT content,title,link,marked,published FROM ttrss_entries, ttrss_user_entries WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']); - $content = sanitize( db_fetch_result($result, 0, "content")); + $content = sanitize(db_fetch_result($result, 0, "content")); $title = strip_tags(db_fetch_result($result, 0, "title")); $article_url = htmlspecialchars(db_fetch_result($result, 0, "link")); $marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked")); @@ -55,15 +55,15 @@ class Digest extends Plugin implements IHandler { print json_encode(array("article" => array("id" => $article_id, "url" => $article_url, - "tags" => get_article_tags( $article_id), + "tags" => get_article_tags($article_id), "marked" => $marked, "published" => $published, "title" => $title, "content" => $content))); } function digestupdate() { - $feed_id = db_escape_string( $_REQUEST['feed_id']); - $offset = db_escape_string( $_REQUEST['offset']); - $seq = db_escape_string( $_REQUEST['seq']); + $feed_id = db_escape_string($_REQUEST['feed_id']); + $offset = db_escape_string($_REQUEST['offset']); + $seq = db_escape_string($_REQUEST['seq']); if (!$feed_id) $feed_id = -4; if (!$offset) $offset = 0; @@ -72,18 +72,18 @@ class Digest extends Plugin implements IHandler { $reply['seq'] = $seq; - $headlines = API::api_get_headlines( $feed_id, 30, $offset, + $headlines = API::api_get_headlines($feed_id, 30, $offset, '', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0); $reply['headlines'] = array(); - $reply['headlines']['title'] = getFeedTitle( $feed_id); + $reply['headlines']['title'] = getFeedTitle($feed_id); $reply['headlines']['content'] = $headlines; print json_encode($reply); } function digestinit() { - $tmp_feeds = API::api_get_feeds( -4, true, false, 0); + $tmp_feeds = API::api_get_feeds(-4, true, false, 0); $params = array(); $feeds = array(); -- cgit v1.2.3 From 106a3de91c7c8c6c275323152de414253f01127a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Apr 2013 17:31:56 +0400 Subject: plugins: bump API version --- plugins/digest/init.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/digest/init.php') diff --git a/plugins/digest/init.php b/plugins/digest/init.php index b06097171..aee351cd8 100644 --- a/plugins/digest/init.php +++ b/plugins/digest/init.php @@ -11,6 +11,7 @@ class Digest extends Plugin implements IHandler { } function init($host) { + $this->link = $host->get_link(); $this->host = $host; $host->add_handler("digest", "*", $this); @@ -100,5 +101,9 @@ class Digest extends Plugin implements IHandler { print json_encode($params); } + function api_version() { + return 2; + } + } ?> -- cgit v1.2.3 From d88922a5d31062196da6e69ab109079cda8867b2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 7 May 2013 10:08:34 +0400 Subject: digest and mobile (old) moved to -contrib repository --- plugins/digest/init.php | 109 ------------------------------------------------ 1 file changed, 109 deletions(-) delete mode 100644 plugins/digest/init.php (limited to 'plugins/digest/init.php') diff --git a/plugins/digest/init.php b/plugins/digest/init.php deleted file mode 100644 index aee351cd8..000000000 --- a/plugins/digest/init.php +++ /dev/null @@ -1,109 +0,0 @@ -link = $host->get_link(); - $this->host = $host; - - $host->add_handler("digest", "*", $this); - } - - function index() { - header("Content-type: text/html; charset=utf-8"); - - login_sequence(); - - require_once dirname(__FILE__) . "/digest_body.php"; - } - - /* function get_js() { - return file_get_contents(dirname(__FILE__) . "/digest.js"); - } */ - - function csrf_ignore($method) { - return in_array($method, array("index")); - } - - function before($method) { - return true; - } - - function after() { - - } - - function digestgetcontents() { - $article_id = db_escape_string($_REQUEST['article_id']); - - $result = db_query("SELECT content,title,link,marked,published - FROM ttrss_entries, ttrss_user_entries - WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']); - - $content = sanitize(db_fetch_result($result, 0, "content")); - $title = strip_tags(db_fetch_result($result, 0, "title")); - $article_url = htmlspecialchars(db_fetch_result($result, 0, "link")); - $marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked")); - $published = sql_bool_to_bool(db_fetch_result($result, 0, "published")); - - print json_encode(array("article" => - array("id" => $article_id, "url" => $article_url, - "tags" => get_article_tags($article_id), - "marked" => $marked, "published" => $published, - "title" => $title, "content" => $content))); - } - - function digestupdate() { - $feed_id = db_escape_string($_REQUEST['feed_id']); - $offset = db_escape_string($_REQUEST['offset']); - $seq = db_escape_string($_REQUEST['seq']); - - if (!$feed_id) $feed_id = -4; - if (!$offset) $offset = 0; - - $reply = array(); - - $reply['seq'] = $seq; - - $headlines = API::api_get_headlines($feed_id, 30, $offset, - '', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0); - - $reply['headlines'] = array(); - $reply['headlines']['title'] = getFeedTitle($feed_id); - $reply['headlines']['content'] = $headlines; - - print json_encode($reply); - } - - function digestinit() { - $tmp_feeds = API::api_get_feeds(-4, true, false, 0); - - $params = array(); - $feeds = array(); - - foreach ($tmp_feeds as $f) { - if ($f['id'] > 0 || $f['id'] == -4) array_push($feeds, $f); - } - - if ($_REQUEST["init"] == 1) { - $params["hotkeys"] = get_hotkeys_map(); - } - $params["feeds"] = $feeds; - - print json_encode($params); - } - - function api_version() { - return 2; - } - -} -?> -- cgit v1.2.3