if ((!$op || $op == "rpc" || $op == "rss" ||
($op == "view" && $mode != "zoom") ||
- $op == "digestSend" || $op == "dlg" || $op == "viewfeed" || $op == "publish" ||
+ $op == "digestSend" || $op == "dlg" ||
+ $op == "viewfeed" || $op == "publish" ||
$op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) {
header("Content-Type: application/xml; charset=utf-8");
break; // rpc
case "feeds":
- if (ENABLE_GZIP_OUTPUT) {
- ob_start("ob_gzhandler");
- }
-
- $tags = $_REQUEST["tags"];
-
$subop = $_REQUEST["subop"];
+ $root = (bool)$_REQUEST["root"];
switch($subop) {
case "catchupAll":
case "collapse":
$cat_id = db_escape_string($_REQUEST["cid"]);
- toggle_collapse_cat($link, $cat_id);
- return;
- break;
-
- case "catsortreset":
- db_query($link, "UPDATE ttrss_feed_categories
- SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
+ $mode = (int) db_escape_string($_REQUEST['mode']);
+ toggle_collapse_cat($link, $cat_id, $mode);
return;
break;
+ }
- case "catsort":
- $corder = db_escape_string($_REQUEST["corder"]);
+ if (!$root) {
+ print json_encode(outputFeedList($link));
+ } else {
- $cats = split(",", $corder);
+ $feeds = outputFeedList($link, false);
- for ($i = 0; $i < count($cats); $i++) {
- $cat_id = $cats[$i];
+ $root = array();
+ $root['id'] = 'root';
+ $root['name'] = __('Feeds');
+ $root['items'] = $feeds['items'];
- if ($cat_id > 0) {
- db_query($link, "UPDATE ttrss_feed_categories
- SET order_id = '$i' WHERE id = '$cat_id' AND
- owner_uid = " . $_SESSION["uid"]);
- }
- }
-
- return;
- break;
+ $fl = array();
+ $fl['identifier'] = 'id';
+ $fl['label'] = 'name';
+ $fl['items'] = array($root);
+ print json_encode($fl);
}
- outputFeedList($link, $tags);
break; // feeds
+ case "la":
+ $id = db_escape_string($_REQUEST['id']);
+
+ $result = db_query($link, "SELECT link FROM ttrss_entries, ttrss_user_entries
+ WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'");
+
+ if (db_num_rows($result) == 1) {
+ $article_url = db_fetch_result($result, 0, 'link');
+
+ header("Location: $article_url");
+ return;
+
+ } else {
+ print_error(__("Article not found."));
+ }
+ break;
+
case "view":
$id = db_escape_string($_REQUEST["id"]);
}
if (!$next_unread_feed) {
- print "<headlines id=\"$feed\" is_cat=\"$cat_view\"><![CDATA[";
+ print "<headlines id=\"$feed\" is_cat=\"$cat_view\">";
} else {
- print "<headlines id=\"$next_unread_feed\" is_cat=\"$cat_view\"><![CDATA[";
+ print "<headlines id=\"$next_unread_feed\" is_cat=\"$cat_view\">";
}
$override_order = false;
$disable_cache = $ret[3];
$vgroup_last_feed = $ret[4];
- print "]]></headlines>";
+ print "</headlines>";
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);