$override_order = false;
+ if (get_pref($link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
+ $date_sort_field = "updated";
+ } else {
+ $date_sort_field = "date_entered";
+ }
+
switch ($order_by) {
case "date":
if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
- $override_order = "date_entered";
+ $override_order = "$date_sort_field";
} else {
- $override_order = "date_entered DESC";
+ $override_order = "$date_sort_field DESC";
}
break;
case "title":
if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
- $override_order = "title DESC, date_entered";
+ $override_order = "title DESC, $date_sort_field";
} else {
- $override_order = "title, date_entered DESC";
+ $override_order = "title, $date_sort_field DESC";
}
break;
case "score":
if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
- $override_order = "score, date_entered";
+ $override_order = "score, $date_sort_field";
} else {
- $override_order = "score DESC, date_entered DESC";
+ $override_order = "score DESC, $date_sort_field DESC";
}
break;
}
$query_strategy_part = "id > 0"; // dumb
}
+ if (get_pref($link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
+ $date_sort_field = "updated";
+ } else {
+ $date_sort_field = "date_entered";
+ }
+
if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
- $order_by = "date_entered";
+ $order_by = "$date_sort_field";
} else {
- $order_by = "date_entered DESC";
+ $order_by = "$date_sort_field DESC";
}
if ($view_mode != "noscores") {
if (!$limit) $limit = 30;
+ if (get_pref($link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
+ $date_sort_field = "updated";
+ } else {
+ $date_sort_field = "date_entered";
+ }
+
$qfh_ret = queryFeedHeadlines($link, $feed,
$limit, $view_mode, $is_cat, $search, $search_mode,
- $match_on, "date_entered DESC", 0, $owner_uid);
+ $match_on, "$date_sort_field DESC", 0, $owner_uid);
$result = $qfh_ret[0];
$feed_title = htmlspecialchars($qfh_ret[1]);
"PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP",
"BLACKLISTED_TAGS", "ENABLE_FEED_ICONS", "ENABLE_API_ACCESS",
"UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL",
- "MARK_UNREAD_ON_UPDATE", "USER_TIMEZONE");
+ "MARK_UNREAD_ON_UPDATE", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE");
if (FORCE_ARTICLE_PURGE != 0) {
array_push($prefs_blacklist, "PURGE_OLD_DAYS");
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 19);
- define('SCHEMA_VERSION', 72);
+ define('SCHEMA_VERSION', 73);
if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy
create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
-insert into ttrss_version values (72);
+insert into ttrss_version values (73);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('USER_TIMEZONE', 2, 'UTC', 'User timezone', 1);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'true', 'Sort headlines by feed date',3,
+ 'Use feed-specified date to sort headlines instead of local import date.');
+
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (72);
+insert into ttrss_version values (73);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('USER_TIMEZONE', 2, 'UTC', 'User timezone', 1);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'true', 'Sort headlines by feed date',3,
+ 'Use feed-specified date to sort headlines instead of local import date.');
+
create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
--- /dev/null
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'true', 'Sort headlines by feed date',3,
+ 'Use feed-specified date to sort headlines instead of local import date.');
+
+update ttrss_version set schema_version = 73;
+
+commit;
--- /dev/null
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'true', 'Sort headlines by feed date',3,
+ 'Use feed-specified date to sort headlines instead of local import date.');
+
+update ttrss_version set schema_version = 73;
+
+commit;