pg_query("set client_encoding = 'utf-8'");
}
+ if (get_pref($link, "HIDE_READ_FEEDS") == "true") {
+ setcookie("ttrss_vf_hreadf", 1);
+ } else {
+ setcookie("ttrss_vf_hreadf", 0);
+ }
+
$fetch = $_GET["fetch"];
setcookie("ttrss_icons_url", ICONS_URL);
$subop = $_GET["subop"];
+ if ($subop == "setpref") {
+ if (WEB_DEMO_MODE) {
+ return;
+ }
+
+ print "<rpc-reply>";
+
+ $key = db_escape_string($_GET["key"]);
+ $value = db_escape_string($_GET["value"]);
+
+ set_pref($link, $key, $value);
+
+ print "<param-set key=\"$key\" value=\"$value\"/>";
+
+ print "</rpc-reply>";
+
+ }
+
if ($subop == "getLabelCounters") {
$aid = $_GET["aid"];
print "<rpc-reply>";
return $value;
}
}
+
+ // doesn't peform any type checking, be vigilant
+
+ function set_pref($link, $key, $value) {
+ $key = db_escape_string($key);
+ $value = db_escape_string($value);
+
+ db_query($link, "UPDATE ttrss_user_prefs SET
+ value = '$value' WHERE pref_name = '$key'
+ AND owner_uid = " . $_SESSION["uid"]);
+
+ $_SESSION["prefs_cache"] = array();
+
+ }
?>
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+
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,
alter table ttrss_feeds change private private bool not null;
alter table ttrss_feeds alter column private set default 0;
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+
update ttrss_version set schema_version = 4;
commit;
alter table ttrss_feeds alter column private set not null;
alter table ttrss_feeds alter column private set default false;
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+
update ttrss_version set schema_version = 4;
commit;
}
}
+function hide_unread_callback() {
+ if (xmlhttp.readyState == 4) {
+
+ try {
+
+ var reply = xmlhttp.responseXML.firstChild.firstChild;
+ var value = reply.getAttribute("value");
+ var hide_read_feeds = (value != "false")
+ var feeds_doc = window.frames["feeds-frame"].document;
+
+ hideOrShowFeeds(feeds_doc, hide_read_feeds);
+
+ if (hide_read_feeds) {
+ setCookie("ttrss_vf_hreadf", 1);
+ } else {
+ setCookie("ttrss_vf_hreadf", 0);
+ }
+
+ } catch (e) {
+ exception_error("hide_unread_callback", e);
+ }
+
+ }
+}
+
function refetch_callback() {
if (xmlhttp.readyState == 4) {
try {
function displayDlg(id, param) {
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
notify("");
xmlhttp.open("GET", "backend.php?op=dlg&id=" +
notify("Removing feed...");
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
// var feeds_doc = window.frames["feeds-frame"].document;
// feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
}
function toggleDispRead() {
- var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
+ try {
- hide_read_feeds = !hide_read_feeds;
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
- var feeds_doc = window.frames["feeds-frame"].document;
+ var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
- hideOrShowFeeds(feeds_doc, hide_read_feeds);
+ hide_read_feeds = !hide_read_feeds;
+
+ var query = "backend.php?op=rpc&subop=setpref" +
+ "&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds);
- if (hide_read_feeds) {
- setCookie("ttrss_vf_hreadf", 1);
- } else {
- setCookie("ttrss_vf_hreadf", 0);
+ xmlhttp.open("GET", query);
+ xmlhttp.onreadystatechange=hide_unread_callback;
+ xmlhttp.send(null);
+
+ } catch (e) {
+ exception_error("toggleDispRead", e);
}
-
}