]> git.wh0rd.org Git - tt-rss.git/commitdiff
add catchall backend class
authorAndrew Dolgov <fox@fakecake.org>
Tue, 13 Dec 2011 06:58:30 +0000 (10:58 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Tue, 13 Dec 2011 06:58:30 +0000 (10:58 +0400)
backend.php
classes/article.php
classes/backend.php [new file with mode: 0644]
js/digest.js
js/viewfeed.js

index 8220337ac682bf258d15a3e0838f4fafee7f1bb7..0390ed761a8e1a94d81eae02b0941deb43d5ea19 100644 (file)
                        module_pref_instances($link);
                break; // pref-instances
 
                        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
                case "digestSend":
                        send_headlines_digests($link);
                break; // digestSend
index 98141d91e9affa31e5d9009946e47b933c076df0..70ecd2653398dcd026114c088dfbaa80aac30bbb 100644 (file)
@@ -1,20 +1,20 @@
 <?php\r
 class Article extends Handler {\r
 <?php\r
 class Article extends Handler {\r
-       \r
-       function index() {\r
+\r
+       function redirect() {\r
                $id = db_escape_string($_REQUEST['id']);\r
                $id = db_escape_string($_REQUEST['id']);\r
-               \r
+\r
                $result = db_query($this->link, "SELECT link FROM ttrss_entries, ttrss_user_entries\r
                                                WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'\r
                                                LIMIT 1");\r
                $result = db_query($this->link, "SELECT link FROM ttrss_entries, ttrss_user_entries\r
                                                WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'\r
                                                LIMIT 1");\r
-               \r
+\r
                if (db_num_rows($result) == 1) {\r
                        $article_url = db_fetch_result($result, 0, 'link');\r
                        $article_url = str_replace("\n", "", $article_url);\r
                if (db_num_rows($result) == 1) {\r
                        $article_url = db_fetch_result($result, 0, 'link');\r
                        $article_url = str_replace("\n", "", $article_url);\r
-               \r
+\r
                        header("Location: $article_url");\r
                        return;\r
                        header("Location: $article_url");\r
                        return;\r
-               \r
+\r
                } else {\r
                        print_error(__("Article not found."));\r
                }\r
                } else {\r
                        print_error(__("Article not found."));\r
                }\r
@@ -25,12 +25,12 @@ class Article extends Handler {
                $cids = explode(",", db_escape_string($_REQUEST["cids"]));\r
                $mode = db_escape_string($_REQUEST["mode"]);\r
                $omode = db_escape_string($_REQUEST["omode"]);\r
                $cids = explode(",", db_escape_string($_REQUEST["cids"]));\r
                $mode = db_escape_string($_REQUEST["mode"]);\r
                $omode = db_escape_string($_REQUEST["omode"]);\r
-               \r
+\r
                // in prefetch mode we only output requested cids, main article\r
                // just gets marked as read (it already exists in client cache)\r
                // in prefetch mode we only output requested cids, main article\r
                // just gets marked as read (it already exists in client cache)\r
-               \r
+\r
                $articles = array();\r
                $articles = array();\r
-               \r
+\r
                if ($mode == "") {\r
                        array_push($articles, format_article($this->link, $id, false));\r
                } else if ($mode == "zoom") {\r
                if ($mode == "") {\r
                        array_push($articles, format_article($this->link, $id, false));\r
                } else if ($mode == "zoom") {\r
@@ -40,14 +40,14 @@ class Article extends Handler {
                                header("Content-Type: text/html");\r
                                print '<link rel="stylesheet" type="text/css" href="tt-rss.css"/>';\r
                        }\r
                                header("Content-Type: text/html");\r
                                print '<link rel="stylesheet" type="text/css" href="tt-rss.css"/>';\r
                        }\r
-               \r
+\r
                        $article = format_article($this->link, $id, false);\r
                        print $article['content'];\r
                        return;\r
                }\r
                        $article = format_article($this->link, $id, false);\r
                        print $article['content'];\r
                        return;\r
                }\r
-               \r
+\r
                catchupArticleById($this->link, $id, 0);\r
                catchupArticleById($this->link, $id, 0);\r
-               \r
+\r
                if (!$_SESSION["bw_limit"]) {\r
                        foreach ($cids as $cid) {\r
                                if ($cid) {\r
                if (!$_SESSION["bw_limit"]) {\r
                        foreach ($cids as $cid) {\r
                                if ($cid) {\r
@@ -55,9 +55,9 @@ class Article extends Handler {
                                }\r
                        }\r
                }\r
                                }\r
                        }\r
                }\r
-               \r
+\r
                print json_encode($articles);\r
                print json_encode($articles);\r
-               \r
+\r
        }\r
        }\r
-       \r
-}
\ No newline at end of file
+\r
+}\r
diff --git a/classes/backend.php b/classes/backend.php
new file mode 100644 (file)
index 0000000..47fc2d8
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+class Backend extends Handler {
+
+       function loading() {
+               header("Content-type: text/html");
+               print __("Loading, please wait...") . " " .
+                       "<img src='images/indicator_tiny.gif'>";
+       }
+}
+?>
index fc0446d830b04110ca76f21cdf85d24b75a26d16..12d45e5360692ecffc1af3eb649fafb197ebb9f8 100644 (file)
@@ -805,7 +805,7 @@ function tweet_article(id) {
                var d = new Date();
       var ts = d.getTime();
 
                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", {
                        "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
 
                new Ajax.Request("backend.php", {
index b9b2a8e2b84475a52d4a2be0a0347045e91435ca..d267c7693e02ea821e30dbca7f940cbd69818db8 100644 (file)
@@ -1770,7 +1770,7 @@ function getLastVisibleHeadlineId() {
 
 function openArticleInNewWindow(id) {
        toggleUnread(id, 0, false);
 
 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() {
 }
 
 function isCdmMode() {
@@ -2003,7 +2003,7 @@ function tweetArticle(id) {
                var d = new Date();
       var ts = d.getTime();
 
                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", {
                        "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
 
                new Ajax.Request("backend.php", {