<?php
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
/* remove ill effects of magic quotes */
if (get_magic_quotes_gpc()) {
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
+ require_once "functions.php";
require_once "sessions.php";
require_once "modules/backend-rpc.php";
-
-/* if ($_REQUEST["debug"]) {
- define('DEFAULT_ERROR_LEVEL', E_ALL);
- } else {
- define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
- }
-
- error_reporting(DEFAULT_ERROR_LEVEL); */
-
require_once "sanity_check.php";
require_once "config.php";
-
require_once "db.php";
require_once "db-prefs.php";
- require_once "functions.php";
no_cache_incantation();
if ((!$op || $op == "rpc" || $op == "rss" ||
($op == "view" && $mode != "zoom") ||
- $op == "digestSend" || $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");
- }
-
+ $print_exec_time = true;
$tags = $_REQUEST["tags"];
$subop = $_REQUEST["subop"];
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;
}
- $_SESSION["viewfeed:counters_stamp"] = time();
+ print json_encode(outputFeedList($link, $tags));
- outputFeedList($link, $tags);
break; // feeds
case "view":
$mode = db_escape_string($_REQUEST["mode"]);
$omode = db_escape_string($_REQUEST["omode"]);
- $csync = $_REQUEST["csync"];
-
- print "<reply>";
+ if ($mode != "zoom") print "<reply>";
// in prefetch mode we only output requested cids, main article
// just gets marked as read (it already exists in client cache)
}
}
-// if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) {
-
- if (time() - $_SESSION["view:counters_stamp"] > 5 && $mode == "prefetch") {
+ /* if ($mode == "prefetch") {
print "<counters><![CDATA[";
print json_encode(getAllCounters($link, $omode));
print "]]></counters>";
- $_SESSION["view:counters_stamp"] = time();
- }
+ } */
- print "</reply>";
+ if ($mode != "zoom") print "</reply>";
break; // view
case "viewfeed":
@$next_unread_feed = db_escape_string($_REQUEST["nuf"]);
@$offset = db_escape_string($_REQUEST["skip"]);
@$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);
- $csync = $_REQUEST["csync"];
$order_by = db_escape_string($_REQUEST["order_by"]);
/* Feed -5 is a special case: it is used to display auxiliary information
/* Updating a label ccache means recalculating all of the caches
* so for performance reasons we don't do that here */
-// if (time() - $_SESSION["viewfeed:ccache_update_stamp"] > 120) {
- if ($feed >= 0) {
- ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
- }
- $_SESSION["viewfeed:ccache_update_stamp"] = time();
-// }
+ if ($feed >= 0) {
+ ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
+ }
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
}
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;
+ 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;
}
+ if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);
+
$ret = outputHeadlinesList($link, $feed, $subop,
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
$vgroup_last_feed, $override_order);
$disable_cache = $ret[3];
$vgroup_last_feed = $ret[4];
- print "]]></headlines>";
+ print "</headlines>";
+
+ if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);
//print "<headlines-count value=\"$headlines_count\"/>";
//print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("20", $timing_info);
- if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop ||
- time() - $_SESSION["viewfeed:counters_stamp"] > 5) {
- if (!$offset) {
- print "<counters><![CDATA[";
- print json_encode(getAllCounters($link, $omode, $feed));
- print "]]></counters>";
- $_SESSION["viewfeed:counters_stamp"] = time();
- }
- }
+ //if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop) {
+ if ($subop) {
+ print "<counters><![CDATA[";
+ print json_encode(getAllCounters($link, $omode, $feed));
+ print "]]></counters>";
+ }
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info);
$search = db_escape_string($_REQUEST["q"]);
$match_on = db_escape_string($_REQUEST["m"]);
$search_mode = db_escape_string($_REQUEST["smode"]);
- $view_mode = db_escape_string($_REQUEST["view_mode"]);
+ $view_mode = db_escape_string($_REQUEST["view-mode"]);
if (SINGLE_USER_MODE) {
authenticate_user($link, "admin", null);