From e938b1de117cfde17a5773fe0c6fc92185c873fe Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 30 Dec 2012 13:36:40 +0400 Subject: rename plugin main class files --- plugins/digest/digest.php | 103 ---------------------------------------------- plugins/digest/init.php | 103 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 103 deletions(-) delete mode 100644 plugins/digest/digest.php create mode 100644 plugins/digest/init.php (limited to 'plugins/digest') diff --git a/plugins/digest/digest.php b/plugins/digest/digest.php deleted file mode 100644 index 503ae5b5c..000000000 --- a/plugins/digest/digest.php +++ /dev/null @@ -1,103 +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($this->link); - - global $link; - $link = $this->link; - - 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($this->link, "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")); - $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($this->link, $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_get_headlines($this->link, $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']['content'] = $headlines; - - print json_encode($reply); - } - - function digestinit() { - $tmp_feeds = api_get_feeds($this->link, -4, true, false, 0); - - $feeds = array(); - - foreach ($tmp_feeds as $f) { - if ($f['id'] > 0 || $f['id'] == -4) array_push($feeds, $f); - } - - print json_encode(array("feeds" => $feeds)); - } - -} -?> diff --git a/plugins/digest/init.php b/plugins/digest/init.php new file mode 100644 index 000000000..503ae5b5c --- /dev/null +++ b/plugins/digest/init.php @@ -0,0 +1,103 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_handler("digest", "*", $this); + } + + function index() { + header("Content-type: text/html; charset=utf-8"); + + login_sequence($this->link); + + global $link; + $link = $this->link; + + 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($this->link, "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")); + $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($this->link, $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_get_headlines($this->link, $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']['content'] = $headlines; + + print json_encode($reply); + } + + function digestinit() { + $tmp_feeds = api_get_feeds($this->link, -4, true, false, 0); + + $feeds = array(); + + foreach ($tmp_feeds as $f) { + if ($f['id'] > 0 || $f['id'] == -4) array_push($feeds, $f); + } + + print json_encode(array("feeds" => $feeds)); + } + +} +?> -- cgit v1.2.3