]> git.wh0rd.org - tt-rss.git/blobdiff - classes/rpc.php
persist widescreen mode in session
[tt-rss.git] / classes / rpc.php
index 984187915e79e694fe94223a79c48af4d2654b57..33e500edfe72eb12d6e94d0ab6dd31c86b1c7622 100644 (file)
@@ -2,7 +2,7 @@
 class RPC extends Handler_Protected {
 
        function csrf_ignore($method) {
-               $csrf_ignored = array("sanitycheck", "buttonplugin", "exportget", "completelabels");
+               $csrf_ignored = array("sanitycheck", "completelabels");
 
                return array_search($method, $csrf_ignored) !== false;
        }
@@ -14,89 +14,6 @@ class RPC extends Handler_Protected {
                $_SESSION["prefs_cache"] = array();
        }
 
-       function exportget() {
-               $exportname = CACHE_DIR . "/export/" .
-                       sha1($_SESSION['uid'] . $_SESSION['login']) . ".xml";
-
-               if (file_exists($exportname)) {
-                       header("Content-type: text/xml");
-
-                       if (function_exists('gzencode')) {
-                               header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml.gz");
-                               echo gzencode(file_get_contents($exportname));
-                       } else {
-                               header("Content-Disposition: attachment; filename=TinyTinyRSS_exported.xml");
-                               echo file_get_contents($exportname);
-                       }
-               } else {
-                       echo "File not found.";
-               }
-       }
-
-       function exportrun() {
-               $offset = (int) db_escape_string($_REQUEST['offset']);
-               $exported = 0;
-               $limit = 250;
-
-               if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) {
-                       $result = db_query($this->link, "SELECT
-                                       ttrss_entries.guid,
-                                       ttrss_entries.title,
-                                       content,
-                                       marked,
-                                       published,
-                                       score,
-                                       note,
-                                       link,
-                                       tag_cache,
-                                       label_cache,
-                                       ttrss_feeds.title AS feed_title,
-                                       ttrss_feeds.feed_url AS feed_url,
-                                       ttrss_entries.updated
-                               FROM
-                                       ttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id),
-                                       ttrss_entries
-                               WHERE
-                                       (marked = true OR feed_id IS NULL) AND
-                                       ref_id = ttrss_entries.id AND
-                                       ttrss_user_entries.owner_uid = " . $_SESSION['uid'] . "
-                               ORDER BY ttrss_entries.id LIMIT $limit OFFSET $offset");
-
-                       $exportname = sha1($_SESSION['uid'] . $_SESSION['login']);
-
-                       if ($offset == 0) {
-                               $fp = fopen(CACHE_DIR . "/export/$exportname.xml", "w");
-                               fputs($fp, "<articles schema-version=\"".SCHEMA_VERSION."\">");
-                       } else {
-                               $fp = fopen(CACHE_DIR . "/export/$exportname.xml", "a");
-                       }
-
-                       if ($fp) {
-
-                               while ($line = db_fetch_assoc($result)) {
-                                       fputs($fp, "<article>");
-
-                                       foreach ($line as $k => $v) {
-                                               fputs($fp, "<$k><![CDATA[$v]]></$k>");
-                                       }
-
-                                       fputs($fp, "</article>");
-                               }
-
-                               $exported = db_num_rows($result);
-
-                               if ($exported < $limit && $exported > 0) {
-                                       fputs($fp, "</articles>");
-                               }
-
-                               fclose($fp);
-                       }
-
-               }
-
-               print json_encode(array("exported" => $exported));
-       }
-
        function remprofiles() {
                $ids = explode(",", db_escape_string(trim($_REQUEST["ids"])));
 
@@ -540,6 +457,8 @@ class RPC extends Handler_Protected {
                $limit = db_escape_string($_REQUEST["limit"]);
                $mode = (int) db_escape_string($_REQUEST["mode"]);
 
+               require_once "feedbrowser.php";
+
                print json_encode(array("content" =>
                        make_feed_browser($this->link, $search, $limit, $mode),
                                "mode" => $mode));
@@ -594,60 +513,6 @@ class RPC extends Handler_Protected {
                }
        }
 
-       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));
-       }
-
        function catchupFeed() {
                $feed_id = db_escape_string($_REQUEST['feed_id']);
                $is_cat = db_escape_string($_REQUEST['is_cat']) == "true";
@@ -706,7 +571,7 @@ class RPC extends Handler_Protected {
                print json_encode(array("status" => $status));
        }
 
-       function buttonPlugin() {
+       /* function buttonPlugin() {
                $pclass = "button_" . basename($_REQUEST['plugin']);
                $method = $_REQUEST['plugin_method'];
 
@@ -716,7 +581,7 @@ class RPC extends Handler_Protected {
                                return $plugin->$method();
                        }
                }
-       }
+       } */
 
        function genHash() {
                $hash = sha1(uniqid(rand(), true));
@@ -738,8 +603,6 @@ class RPC extends Handler_Protected {
 
                                db_query($this->link, "BEGIN");
 
-                               $update_method = 0;
-
                                if ($cat_id == "0" || !$cat_id) {
                                        $cat_qpart = "NULL";
                                } else {
@@ -755,7 +618,7 @@ class RPC extends Handler_Protected {
                                                "INSERT INTO ttrss_feeds
                                                        (owner_uid,feed_url,title,cat_id,auth_login,auth_pass,update_method)
                                                VALUES ('".$_SESSION["uid"]."', '$feed',
-                                                       '[Unknown]', $cat_qpart, '$login', '$pass', '$update_method')");
+                                                       '[Unknown]', $cat_qpart, '$login', '$pass', 0)");
                                }
 
                                db_query($this->link, "COMMIT");
@@ -774,5 +637,13 @@ class RPC extends Handler_Protected {
                        "score_pic" => theme_image($link, get_score_pic($score))));
        }
 
+       function setpanelmode() {
+               $wide = (int) $_REQUEST["wide"];
+
+               $_SESSION["widescreen"] = $wide;
+
+               print json_encode(array("wide" => $wide));
+       }
+
 }
 ?>