From: Andrew Dolgov Date: Tue, 13 Dec 2011 06:58:30 +0000 (+0400) Subject: add catchall backend class X-Git-Tag: 1.5.8~21^2~12 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=611efae712769e38e232478b484779d73af263db;p=tt-rss.git add catchall backend class --- diff --git a/backend.php b/backend.php index 8220337a..0390ed76 100644 --- a/backend.php +++ b/backend.php @@ -181,10 +181,6 @@ module_pref_instances($link); break; // pref-instances - case "digestTest": - print_r(prepare_headlines_digest($link, $_SESSION["uid"])); - break; // digestTest - case "digestSend": send_headlines_digests($link); break; // digestSend diff --git a/classes/article.php b/classes/article.php index 98141d91..70ecd265 100644 --- a/classes/article.php +++ b/classes/article.php @@ -1,20 +1,20 @@ link, "SELECT link FROM ttrss_entries, ttrss_user_entries WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."' LIMIT 1"); - + if (db_num_rows($result) == 1) { $article_url = db_fetch_result($result, 0, 'link'); $article_url = str_replace("\n", "", $article_url); - + header("Location: $article_url"); return; - + } else { print_error(__("Article not found.")); } @@ -25,12 +25,12 @@ class Article extends Handler { $cids = explode(",", db_escape_string($_REQUEST["cids"])); $mode = db_escape_string($_REQUEST["mode"]); $omode = db_escape_string($_REQUEST["omode"]); - + // in prefetch mode we only output requested cids, main article // just gets marked as read (it already exists in client cache) - + $articles = array(); - + if ($mode == "") { array_push($articles, format_article($this->link, $id, false)); } else if ($mode == "zoom") { @@ -40,14 +40,14 @@ class Article extends Handler { header("Content-Type: text/html"); print ''; } - + $article = format_article($this->link, $id, false); print $article['content']; return; } - + catchupArticleById($this->link, $id, 0); - + if (!$_SESSION["bw_limit"]) { foreach ($cids as $cid) { if ($cid) { @@ -55,9 +55,9 @@ class Article extends Handler { } } } - + print json_encode($articles); - + } - -} \ No newline at end of file + +} diff --git a/classes/backend.php b/classes/backend.php new file mode 100644 index 00000000..47fc2d82 --- /dev/null +++ b/classes/backend.php @@ -0,0 +1,10 @@ +"; + } +} +?> diff --git a/js/digest.js b/js/digest.js index fc0446d8..12d45e53 100644 --- a/js/digest.js +++ b/js/digest.js @@ -805,7 +805,7 @@ function tweet_article(id) { var d = new Date(); var ts = d.getTime(); - var w = window.open('backend.php?op=loading', 'ttrss_tweet', + var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0"); new Ajax.Request("backend.php", { diff --git a/js/viewfeed.js b/js/viewfeed.js index b9b2a8e2..d267c769 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1770,7 +1770,7 @@ function getLastVisibleHeadlineId() { function openArticleInNewWindow(id) { toggleUnread(id, 0, false); - window.open("backend.php?op=article&id=" + id); + window.open("backend.php?op=article&method=redirect&id=" + id); } function isCdmMode() { @@ -2003,7 +2003,7 @@ function tweetArticle(id) { var d = new Date(); var ts = d.getTime(); - var w = window.open('backend.php?op=loading', 'ttrss_tweet', + var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0"); new Ajax.Request("backend.php", {