support custom order in generated feeds (closes #709)

master
Andrew Dolgov 12 years ago
parent 838b374431
commit 25051fb84b

@ -3,7 +3,7 @@ class Handler_Public extends Handler {
private function generate_syndicated_feed($owner_uid, $feed, $is_cat, private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
$limit, $offset, $search, $search_mode, $limit, $offset, $search, $search_mode,
$view_mode = false, $format = 'atom') { $view_mode = false, $format = 'atom', $order = false) {
require_once "lib/MiniTemplator.class.php"; require_once "lib/MiniTemplator.class.php";
@ -21,6 +21,18 @@ class Handler_Public extends Handler {
else if ($feed == -1) else if ($feed == -1)
$date_sort_field = "last_marked DESC"; $date_sort_field = "last_marked DESC";
switch ($order) {
case "title":
$date_sort_field = "ttrss_entries.title";
break;
case "date_reverse":
$date_sort_field = "date_entered, updated";
break;
case "feed_dates":
$date_sort_field = "updated DESC";
break;
}
$qfh_ret = queryFeedHeadlines($feed, $qfh_ret = queryFeedHeadlines($feed,
1, $view_mode, $is_cat, $search, $search_mode, 1, $view_mode, $is_cat, $search, $search_mode,
$date_sort_field, $offset, $owner_uid, $date_sort_field, $offset, $owner_uid,
@ -337,6 +349,7 @@ class Handler_Public extends Handler {
$search = $this->dbh->escape_string($_REQUEST["q"]); $search = $this->dbh->escape_string($_REQUEST["q"]);
$search_mode = $this->dbh->escape_string($_REQUEST["smode"]); $search_mode = $this->dbh->escape_string($_REQUEST["smode"]);
$view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]); $view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
$order = $this->dbh->escape_string($_REQUEST["order"]);
$format = $this->dbh->escape_string($_REQUEST['format']); $format = $this->dbh->escape_string($_REQUEST['format']);
@ -358,7 +371,7 @@ class Handler_Public extends Handler {
if ($owner_id) { if ($owner_id) {
$this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit, $this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit,
$offset, $search, $search_mode, $view_mode, $format); $offset, $search, $search_mode, $view_mode, $format, $order);
} else { } else {
header('HTTP/1.1 403 Forbidden'); header('HTTP/1.1 403 Forbidden');
} }

Loading…
Cancel
Save