$update_methods = array(
0 => __("Default"),
1 => __("Magpie"),
- 2 => __("SimplePie"));
+ 2 => __("SimplePie"),
+ 3 => __("Twitter OAuth"));
if (DEFAULT_UPDATE_METHOD == "1") {
$update_methods[0] .= ' (SimplePie)';
break; // rpc
case "feeds":
- $print_exec_time = true;
- $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);
+ $mode = (int) db_escape_string($_REQUEST['mode']);
+ toggle_collapse_cat($link, $cat_id, $mode);
return;
break;
+ }
- case "catsortreset":
- db_query($link, "UPDATE ttrss_feed_categories
- SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]);
- return;
- break;
+ if (!$root) {
+ print json_encode(outputFeedList($link));
+ } else {
- case "catsort":
- $corder = db_escape_string($_REQUEST["corder"]);
+ $feeds = outputFeedList($link, false);
- $cats = split(",", $corder);
+ $root = array();
+ $root['id'] = 'root';
+ $root['name'] = __('Feeds');
+ $root['items'] = $feeds['items'];
- for ($i = 0; $i < count($cats); $i++) {
- $cat_id = $cats[$i];
+ $fl = array();
+ $fl['identifier'] = 'id';
+ $fl['label'] = 'name';
+ $fl['items'] = array($root);
- if ($cat_id > 0) {
- db_query($link, "UPDATE ttrss_feed_categories
- SET order_id = '$i' WHERE id = '$cat_id' AND
- owner_uid = " . $_SESSION["uid"]);
- }
- }
+ print json_encode($fl);
+ }
- return;
- break;
+ break; // feeds
- }
+ case "la":
+ $id = db_escape_string($_REQUEST['id']);
- print json_encode(outputFeedList($link, $tags));
+ $result = db_query($link, "SELECT link FROM ttrss_entries, ttrss_user_entries
+ WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'");
- break; // feeds
+ 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."));
+ }
+ break;
case "view":