split backend rpc, various interface improvements
This commit is contained in:
parent
9d87df8f60
commit
01b3e1919a
9 changed files with 278 additions and 345 deletions
202
backend-rpc.php
Normal file
202
backend-rpc.php
Normal file
|
@ -0,0 +1,202 @@
|
|||
<?
|
||||
function handle_rpc_request($link) {
|
||||
|
||||
$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>";
|
||||
getLabelCounters($link);
|
||||
if ($aid) {
|
||||
getFeedCounter($link, $aid);
|
||||
}
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "getFeedCounters") {
|
||||
print "<rpc-reply>";
|
||||
getFeedCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "getAllCounters") {
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "mark") {
|
||||
$mark = $_GET["mark"];
|
||||
$id = db_escape_string($_GET["id"]);
|
||||
|
||||
if ($mark == "1") {
|
||||
$mark = "true";
|
||||
} else {
|
||||
$mark = "false";
|
||||
}
|
||||
|
||||
// FIXME this needs collision testing
|
||||
|
||||
$result = db_query($link, "UPDATE ttrss_user_entries SET marked = $mark
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
|
||||
if ($subop == "updateFeed") {
|
||||
$feed_id = db_escape_string($_GET["feed"]);
|
||||
|
||||
$result = db_query($link,
|
||||
"SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'
|
||||
AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
if (db_num_rows($result) > 0) {
|
||||
$feed_url = db_fetch_result($result, 0, "feed_url");
|
||||
update_rss_feed($link, $feed_url, $feed_id);
|
||||
}
|
||||
|
||||
print "<rpc-reply>";
|
||||
getFeedCounter($link, $feed_id);
|
||||
print "</rpc-reply>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
|
||||
|
||||
if (ENABLE_UPDATE_DAEMON) {
|
||||
|
||||
if ($subop == "forceUpdateAllFeeds") {
|
||||
|
||||
$result = db_query($link, "SELECT count(id) AS cid FROM
|
||||
ttrss_scheduled_updates WHERE feed_id IS NULL AND
|
||||
owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$cid = db_fetch_result($result, 0, "cid");
|
||||
|
||||
if ($cid == 0) {
|
||||
|
||||
db_query($link, "INSERT INTO ttrss_scheduled_updates
|
||||
(owner_uid, feed_id, entered) VALUES
|
||||
(".$_SESSION["uid"].", NULL, NOW())");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
update_all_feeds($link, $subop == "forceUpdateAllFeeds");
|
||||
}
|
||||
|
||||
$global_unread_caller = sprintf("%d", $_GET["uctr"]);
|
||||
$global_unread = getGlobalUnread($link);
|
||||
|
||||
print "<rpc-reply>";
|
||||
|
||||
if ($global_unread_caller != $global_unread) {
|
||||
|
||||
$omode = $_GET["omode"];
|
||||
|
||||
if (!$omode) $omode = "tflc";
|
||||
|
||||
if (strchr($omode, "l")) getLabelCounters($link);
|
||||
if (strchr($omode, "f")) getFeedCounters($link);
|
||||
if (strchr($omode, "t")) getTagCounters($link);
|
||||
if (strchr($omode, "c")) {
|
||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||
getCategoryCounters($link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getGlobalCounters($link, $global_unread);
|
||||
|
||||
print "</rpc-reply>";
|
||||
|
||||
}
|
||||
|
||||
/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
|
||||
if ($subop == "catchupSelected") {
|
||||
|
||||
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||
|
||||
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
|
||||
if ($cmode == 0) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = false,last_read = NOW()
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else if ($cmode == 1) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = true
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = NOT unread,last_read = NOW()
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
}
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "markSelected") {
|
||||
|
||||
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||
|
||||
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
|
||||
if ($cmode == 0) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = false
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else if ($cmode == 1) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = true
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = NOT marked
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
}
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "sanityCheck") {
|
||||
if (sanity_check($link)) {
|
||||
print "<error error-code=\"0\"/>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($subop == "globalPurge") {
|
||||
|
||||
print "<rpc-reply>";
|
||||
global_purge_old_posts($link, true);
|
||||
print "</rpc-reply>";
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
274
backend.php
274
backend.php
|
@ -1,5 +1,6 @@
|
|||
<?
|
||||
require_once "sessions.php";
|
||||
require_once "backend-rpc.php";
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
|
@ -459,213 +460,7 @@
|
|||
|
||||
|
||||
if ($op == "rpc") {
|
||||
|
||||
$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>";
|
||||
getLabelCounters($link);
|
||||
if ($aid) {
|
||||
getFeedCounter($link, $aid);
|
||||
}
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "getFeedCounters") {
|
||||
print "<rpc-reply>";
|
||||
getFeedCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "getAllCounters") {
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "mark") {
|
||||
$mark = $_GET["mark"];
|
||||
$id = db_escape_string($_GET["id"]);
|
||||
|
||||
if ($mark == "1") {
|
||||
$mark = "true";
|
||||
} else {
|
||||
$mark = "false";
|
||||
}
|
||||
|
||||
// FIXME this needs collision testing
|
||||
|
||||
$result = db_query($link, "UPDATE ttrss_user_entries SET marked = $mark
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
|
||||
if ($subop == "updateFeed") {
|
||||
$feed_id = db_escape_string($_GET["feed"]);
|
||||
|
||||
$result = db_query($link,
|
||||
"SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'
|
||||
AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
if (db_num_rows($result) > 0) {
|
||||
$feed_url = db_fetch_result($result, 0, "feed_url");
|
||||
update_rss_feed($link, $feed_url, $feed_id);
|
||||
}
|
||||
|
||||
print "<rpc-reply>";
|
||||
getFeedCounter($link, $feed_id);
|
||||
print "</rpc-reply>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
|
||||
|
||||
if (ENABLE_UPDATE_DAEMON) {
|
||||
|
||||
if ($subop == "forceUpdateAllFeeds") {
|
||||
|
||||
$result = db_query($link, "SELECT count(id) AS cid FROM
|
||||
ttrss_scheduled_updates WHERE feed_id IS NULL AND
|
||||
owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$cid = db_fetch_result($result, 0, "cid");
|
||||
|
||||
# print "<rpc-reply>";
|
||||
|
||||
if ($cid == 0) {
|
||||
|
||||
db_query($link, "INSERT INTO ttrss_scheduled_updates
|
||||
(owner_uid, feed_id, entered) VALUES
|
||||
(".$_SESSION["uid"].", NULL, NOW())");
|
||||
|
||||
// print "<!-- ScheduledOK -->";
|
||||
|
||||
} else {
|
||||
// print "<!-- RequestAlreadyInQueue -->";
|
||||
}
|
||||
|
||||
# print "</rpc-reply>";
|
||||
}
|
||||
|
||||
} else {
|
||||
update_all_feeds($link, $subop == "forceUpdateAllFeeds");
|
||||
}
|
||||
|
||||
$global_unread_caller = sprintf("%d", $_GET["uctr"]);
|
||||
$global_unread = getGlobalUnread($link);
|
||||
|
||||
print "<rpc-reply>";
|
||||
|
||||
if ($global_unread_caller != $global_unread) {
|
||||
|
||||
$omode = $_GET["omode"];
|
||||
|
||||
if (!$omode) $omode = "tflc";
|
||||
|
||||
if (strchr($omode, "l")) getLabelCounters($link);
|
||||
if (strchr($omode, "f")) getFeedCounters($link);
|
||||
if (strchr($omode, "t")) getTagCounters($link);
|
||||
if (strchr($omode, "c")) {
|
||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||
getCategoryCounters($link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getGlobalCounters($link, $global_unread);
|
||||
|
||||
print "</rpc-reply>";
|
||||
|
||||
}
|
||||
|
||||
/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
|
||||
if ($subop == "catchupSelected") {
|
||||
|
||||
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||
|
||||
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
|
||||
if ($cmode == 0) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = false,last_read = NOW()
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else if ($cmode == 1) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = true
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
unread = NOT unread,last_read = NOW()
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
}
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "markSelected") {
|
||||
|
||||
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||
|
||||
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||
|
||||
foreach ($ids as $id) {
|
||||
|
||||
if ($cmode == 0) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = false
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else if ($cmode == 1) {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = true
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
} else {
|
||||
db_query($link, "UPDATE ttrss_user_entries SET
|
||||
marked = NOT marked
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
}
|
||||
print "<rpc-reply>";
|
||||
getAllCounters($link);
|
||||
print "</rpc-reply>";
|
||||
}
|
||||
|
||||
if ($subop == "sanityCheck") {
|
||||
if (sanity_check($link)) {
|
||||
print "<error error-code=\"0\"/>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($subop == "globalPurge") {
|
||||
|
||||
print "<rpc-reply>";
|
||||
global_purge_old_posts($link, true);
|
||||
print "</rpc-reply>";
|
||||
|
||||
}
|
||||
|
||||
handle_rpc_request($link);
|
||||
}
|
||||
|
||||
if ($op == "feeds") {
|
||||
|
@ -2093,10 +1888,9 @@
|
|||
if (!get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||
print "<tr class=\"title\">
|
||||
<td width='5%' align='center'> </td>
|
||||
<td width='30%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
|
||||
<td width='30%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
|
||||
<td width='15%'><a href=\"javascript:updateFeedList('update_interval')\">Update Interval</a></td>
|
||||
<td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Interval</a></td></tr>";
|
||||
<td width='40%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
|
||||
<td width='45%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
|
||||
<td width='15%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">Updated</a></td>";
|
||||
}
|
||||
|
||||
$lnum = 0;
|
||||
|
@ -2111,14 +1905,18 @@
|
|||
$edit_title = htmlspecialchars(db_unescape_string($line["title"]));
|
||||
$edit_link = htmlspecialchars(db_unescape_string($line["feed_url"]));
|
||||
$edit_cat = htmlspecialchars(db_unescape_string($line["category"]));
|
||||
|
||||
// if ($line["update_interval"] == "0") $line["update_interval"] = "Default";
|
||||
// if ($line["update_interval"] == "-1") $line["update_interval"] = "Disabled";
|
||||
// if ($line["purge_interval"] == "0") $line["purge_interval"] = "Default";
|
||||
// if ($line["purge_interval"] < 0) $line["purge_interval"] = "Disabled";
|
||||
|
||||
if (!$edit_cat) $edit_cat = "Uncategorized";
|
||||
|
||||
$last_updated = $line["last_updated"];
|
||||
|
||||
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
|
||||
$last_updated = smart_date_time(strtotime($last_updated));
|
||||
} else {
|
||||
$short_date = get_pref($link, 'SHORT_DATE_FORMAT');
|
||||
$last_updated = date($short_date, strtotime($last_updated));
|
||||
}
|
||||
|
||||
if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) {
|
||||
$lnum = 0;
|
||||
|
||||
|
@ -2126,10 +1924,9 @@
|
|||
|
||||
print "<tr class=\"title\">
|
||||
<td width='5%' align='center'> </td>
|
||||
<td width='30%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
|
||||
<td width='30%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
|
||||
<td width='15%'><a href=\"javascript:updateFeedList('update_interval')\">Update Interval</a></td>
|
||||
<td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Interval</a></td></tr>";
|
||||
<td width='40%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
|
||||
<td width='45%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
|
||||
<td width='15%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">Updated</a></td>";
|
||||
|
||||
$cur_cat_id = $cat_id;
|
||||
}
|
||||
|
@ -2171,12 +1968,15 @@
|
|||
$edit_cat . "</a></td>";
|
||||
} */
|
||||
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
/* print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$update_intervals[$line["update_interval"]] . "</a></td>";
|
||||
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$purge_intervals[$line["purge_interval"]] . "</a></td>";
|
||||
|
||||
$purge_intervals[$line["purge_interval"]] . "</a></td>"; */
|
||||
|
||||
print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
"$last_updated</a></td>";
|
||||
|
||||
print "</tr>";
|
||||
|
||||
++$lnum;
|
||||
|
@ -2230,15 +2030,6 @@
|
|||
onclick=\"javascript:categorizeSelectedFeeds()\" value=\"Set category\">";
|
||||
|
||||
}
|
||||
|
||||
if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) {
|
||||
print "
|
||||
<input type=\"submit\" class=\"button\"
|
||||
onclick=\"javascript:readSelectedFeeds(true)\" value=\"Mark as read\">
|
||||
<input type=\"submit\" class=\"button\"
|
||||
onclick=\"javascript:readSelectedFeeds(false)\"
|
||||
value=\"Mark as unread\"> ";
|
||||
}
|
||||
|
||||
print "
|
||||
All feeds: <input type=\"submit\"
|
||||
|
@ -2378,7 +2169,6 @@
|
|||
if ($subop == "editSave") {
|
||||
|
||||
$regexp = db_escape_string($_GET["r"]);
|
||||
$descr = db_escape_string($_GET["d"]);
|
||||
$match = db_escape_string($_GET["m"]);
|
||||
$filter_id = db_escape_string($_GET["id"]);
|
||||
$feed_id = db_escape_string($_GET["fid"]);
|
||||
|
@ -2392,7 +2182,6 @@
|
|||
|
||||
$result = db_query($link, "UPDATE ttrss_filters SET
|
||||
reg_exp = '$regexp',
|
||||
description = '$descr',
|
||||
feed_id = $feed_id,
|
||||
action_id = '$action_id',
|
||||
filter_type = (SELECT id FROM ttrss_filter_types WHERE
|
||||
|
@ -2496,7 +2285,6 @@
|
|||
|
||||
$result = db_query($link, "SELECT
|
||||
ttrss_filters.id AS id,reg_exp,
|
||||
ttrss_filters.description AS description,
|
||||
ttrss_filter_types.name AS filter_type_name,
|
||||
ttrss_filter_types.description AS filter_type_descr,
|
||||
feed_id,
|
||||
|
@ -2529,9 +2317,8 @@
|
|||
<td width=\"20%\">Filter expression</td>
|
||||
<td width=\"20%\">Feed</td>
|
||||
<td width=\"15%\">Match</td>
|
||||
<td width=\"15%\">Action</td>
|
||||
<td width=\"30%\">Description</td></tr>";
|
||||
|
||||
<td width=\"15%\">Action</td>";
|
||||
|
||||
$lnum = 0;
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
|
@ -2551,14 +2338,11 @@
|
|||
print "<tr class=\"$class\" $this_row_id>";
|
||||
|
||||
$line["regexp"] = htmlspecialchars($line["reg_exp"]);
|
||||
$line["description"] = htmlspecialchars($line["description"]);
|
||||
|
||||
if (!$line["feed_title"]) $line["feed_title"] = "All feeds";
|
||||
|
||||
if (!$edit_filter_id || $subop != "edit") {
|
||||
|
||||
if (!$line["description"]) $line["description"] = "[No description]";
|
||||
|
||||
print "<td align='center'><input onclick='toggleSelectRow(this);'
|
||||
type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>";
|
||||
|
||||
|
@ -2573,9 +2357,6 @@
|
|||
|
||||
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
|
||||
$line["action_description"] . "</td>";
|
||||
|
||||
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
|
||||
$line["description"] . "</td>";
|
||||
|
||||
} else if ($filter_id != $edit_filter_id) {
|
||||
|
||||
|
@ -2588,7 +2369,6 @@
|
|||
print "<td>".$line["feed_title"]."</td>";
|
||||
print "<td>".$line["filter_type_descr"]."</td>";
|
||||
print "<td>".$line["action_description"]."</td>";
|
||||
print "<td>".$line["description"]."</td>";
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -2642,10 +2422,6 @@
|
|||
|
||||
print "</select></td>";
|
||||
|
||||
|
||||
print "<td><input id=\"iedit_descr\" value=\"".$line["description"].
|
||||
"\"></td>";
|
||||
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
|
74
prefs.js
74
prefs.js
|
@ -239,7 +239,7 @@ function addLabel() {
|
|||
var sqlexp = document.getElementById("ladd_expr");
|
||||
|
||||
if (sqlexp.value.length == 0) {
|
||||
notify("Missing SQL expression.");
|
||||
alert("Can't add label: missing SQL expression.");
|
||||
} else {
|
||||
notify("Adding label...");
|
||||
|
||||
|
@ -267,7 +267,7 @@ function addFilter() {
|
|||
var action = document.getElementById("fadd_action");
|
||||
|
||||
if (regexp.value.length == 0) {
|
||||
notify("Missing filter expression.");
|
||||
alert("Can't add filter: missing filter expression.");
|
||||
} else {
|
||||
notify("Adding filter...");
|
||||
|
||||
|
@ -297,7 +297,7 @@ function addFeed() {
|
|||
var link = document.getElementById("fadd_link");
|
||||
|
||||
if (link.value.length == 0) {
|
||||
notify("Missing feed URL.");
|
||||
alert("Can't add feed: missing feed URL.");
|
||||
} else {
|
||||
notify("Adding feed...");
|
||||
|
||||
|
@ -322,7 +322,7 @@ function addFeedCat() {
|
|||
var cat = document.getElementById("fadd_cat");
|
||||
|
||||
if (cat.value.length == 0) {
|
||||
notify("Missing feed category.");
|
||||
alert("Can't add category: no name specified.");
|
||||
} else {
|
||||
notify("Adding feed category...");
|
||||
|
||||
|
@ -346,7 +346,7 @@ function addUser() {
|
|||
var sqlexp = document.getElementById("uadd_box");
|
||||
|
||||
if (sqlexp.value.length == 0) {
|
||||
notify("Missing user login.");
|
||||
alert("Can't add user: no login specified.");
|
||||
} else {
|
||||
notify("Adding user...");
|
||||
|
||||
|
@ -476,7 +476,7 @@ function getSelectedFeedCats() {
|
|||
}
|
||||
|
||||
|
||||
function readSelectedFeeds(read) {
|
||||
/*function readSelectedFeeds(read) {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
printLockingError();
|
||||
|
@ -502,10 +502,10 @@ function readSelectedFeeds(read) {
|
|||
|
||||
} else {
|
||||
|
||||
notify("Please select some feeds first.");
|
||||
alert("No feeds are selected.");
|
||||
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
function removeSelectedLabels() {
|
||||
|
||||
|
@ -529,7 +529,7 @@ function removeSelectedLabels() {
|
|||
xmlhttp.send(null);
|
||||
}
|
||||
} else {
|
||||
notify("Please select some labels first.");
|
||||
alert("No labels are selected.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ function removeSelectedUsers() {
|
|||
}
|
||||
|
||||
} else {
|
||||
notify("Please select some labels first.");
|
||||
alert("No users are selected.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ function removeSelectedFilters() {
|
|||
xmlhttp.send(null);
|
||||
}
|
||||
} else {
|
||||
notify("Please select some filters first.");
|
||||
alert("No filters are selected.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ function removeSelectedFeeds() {
|
|||
|
||||
} else {
|
||||
|
||||
notify("Please select some feeds first.");
|
||||
alert("No feeds are selected.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ function removeSelectedFeedCats() {
|
|||
|
||||
} else {
|
||||
|
||||
notify("Please select some feeds first.");
|
||||
alert("No categories are selected.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -944,7 +944,6 @@ function filterEditSave() {
|
|||
}
|
||||
|
||||
var regexp = document.getElementById("iedit_regexp").value;
|
||||
var descr = document.getElementById("iedit_descr").value;
|
||||
var match = document.getElementById("iedit_match");
|
||||
|
||||
var v_match = match[match.selectedIndex].text;
|
||||
|
@ -955,19 +954,16 @@ function filterEditSave() {
|
|||
var action = document.getElementById("iedit_filter_action");
|
||||
var action_id = action[action.selectedIndex].id;
|
||||
|
||||
// notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
|
||||
|
||||
if (regexp.length == 0) {
|
||||
notify("Filter expression cannot be blank.");
|
||||
alert("Can't save filter: match expression is blank.");
|
||||
return;
|
||||
}
|
||||
|
||||
active_filter = false;
|
||||
|
||||
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
|
||||
filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) +
|
||||
"&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id) +
|
||||
"&aid=" + param_escape(action_id), true);
|
||||
filter + "&r=" + param_escape(regexp) + "&m=" + param_escape(v_match) +
|
||||
"&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
|
||||
|
||||
notify("Saving filter...");
|
||||
|
||||
|
@ -980,12 +976,12 @@ function editSelectedLabel() {
|
|||
var rows = getSelectedLabels();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No labels are selected.");
|
||||
alert("No labels are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one label.");
|
||||
alert("Please select only one label.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -999,12 +995,12 @@ function editSelectedUser() {
|
|||
var rows = getSelectedUsers();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No users are selected.");
|
||||
alert("No users are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one user.");
|
||||
alert("Please select only one user.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1017,12 +1013,12 @@ function resetSelectedUserPass() {
|
|||
var rows = getSelectedUsers();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No users are selected.");
|
||||
alert("No users are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one user.");
|
||||
alert("Please select only one user.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1050,12 +1046,12 @@ function selectedUserDetails() {
|
|||
var rows = getSelectedUsers();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No users are selected.");
|
||||
alert("No users are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one user.");
|
||||
alert("Please select only one user.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1079,14 +1075,14 @@ function selectedFeedDetails() {
|
|||
var rows = getSelectedFeeds();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No feeds are selected.");
|
||||
alert("No feeds are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (rows.length > 1) {
|
||||
// notify("Please select one feed.");
|
||||
// return;
|
||||
// }
|
||||
if (rows.length > 1) {
|
||||
notify("Please select only one feed.");
|
||||
return;
|
||||
}
|
||||
|
||||
// var id = rows[0];
|
||||
|
||||
|
@ -1103,12 +1099,12 @@ function editSelectedFilter() {
|
|||
var rows = getSelectedFilters();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No filters are selected.");
|
||||
alert("No filters are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one filter.");
|
||||
alert("Please select only one filter.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1142,12 +1138,12 @@ function editSelectedFeedCat() {
|
|||
var rows = getSelectedFeedCats();
|
||||
|
||||
if (rows.length == 0) {
|
||||
notify("No categories are selected.");
|
||||
alert("No categories are selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length > 1) {
|
||||
notify("Please select one category.");
|
||||
alert("Please select only one category.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1221,7 +1217,7 @@ function validateOpmlImport() {
|
|||
var opml_file = document.getElementById("opml_file");
|
||||
|
||||
if (opml_file.value.length == 0) {
|
||||
notify("Please select OPML file to upload.");
|
||||
alert("No OPML file to upload.");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -1384,7 +1380,7 @@ function categorizeSelectedFeeds() {
|
|||
|
||||
} else {
|
||||
|
||||
notify("Please select some feeds first.");
|
||||
alert("No feeds are selected.");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ create table ttrss_filters (id integer not null primary key auto_increment,
|
|||
feed_id integer default null,
|
||||
filter_type integer not null,
|
||||
reg_exp varchar(250) not null,
|
||||
description varchar(250) not null default '',
|
||||
action_id integer not null default 1,
|
||||
index (filter_type),
|
||||
foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE,
|
||||
|
@ -205,7 +204,6 @@ create table ttrss_prefs (pref_name varchar(250) not null primary key,
|
|||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable icons in feedlist',2);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_OLD_DAYS', 3, '60', 'Purge old posts after this number of days (0 - disables)',1);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('UPDATE_POST_ON_CHECKSUM_CHANGE', 1, 'true', 'Update post on checksum change',1);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_PREFS_CATCHUP_UNCATCHUP', 1, 'false', 'Enable catchup/uncatchup buttons in feed editor',2);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_LABELS', 1, 'false', 'Enable labels',3,
|
||||
'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
|
||||
|
||||
|
@ -216,9 +214,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
|
|||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
|
||||
'Default limit for articles to display, any custom number you like (0 - disables).');
|
||||
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DISPLAY_FEEDLIST_ACTIONS', 1, 'false', 'Display feedlist actions',2,
|
||||
'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
|
||||
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1,
|
||||
'This option is useful when you are reading several planet-type aggregators with partially colliding userbase.
|
||||
When disabled, it forces same posts from different feeds to appear only once.');
|
||||
|
|
|
@ -134,7 +134,6 @@ create table ttrss_filters (id serial not null primary key,
|
|||
feed_id integer references ttrss_feeds(id) on delete cascade default null,
|
||||
filter_type integer not null references ttrss_filter_types(id),
|
||||
reg_exp varchar(250) not null,
|
||||
description varchar(250) not null default '',
|
||||
action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade);
|
||||
|
||||
create table ttrss_labels (id serial not null primary key,
|
||||
|
@ -185,7 +184,6 @@ create table ttrss_prefs (pref_name varchar(250) not null primary key,
|
|||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable icons in feedlist',2);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_OLD_DAYS', 3, '60', 'Purge old posts after this number of days (0 - disables)',1);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('UPDATE_POST_ON_CHECKSUM_CHANGE', 1, 'true', 'Update post on checksum change',1);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_PREFS_CATCHUP_UNCATCHUP', 1, 'false', 'Enable catchup/uncatchup buttons in feed editor',2);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_LABELS', 1, 'false', 'Enable labels',3,
|
||||
'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
|
||||
|
||||
|
@ -195,9 +193,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
|
|||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('USE_COMPACT_STYLESHEET', 1, 'false', 'Use compact stylesheet by default',2);
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
|
||||
'Default limit for articles to display, any custom number you like (0 - disables).');
|
||||
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DISPLAY_FEEDLIST_ACTIONS', 1, 'false', 'Display feedlist actions',2,
|
||||
'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
|
||||
|
||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1,
|
||||
'This option is useful when you are reading several planet-type aggregators with partially colliding userbase.
|
||||
|
|
|
@ -5,7 +5,15 @@ update ttrss_feeds set rtl_content = false;
|
|||
alter table ttrss_feeds change rtl_content rtl_content bool not null;
|
||||
alter table ttrss_feeds alter column rtl_content set default false;
|
||||
|
||||
delete from ttrss_user_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||
delete from ttrss_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||
|
||||
delete from ttrss_user_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||
delete from ttrss_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||
|
||||
alter table ttrss_sessions drop column ip_address;
|
||||
|
||||
alter table ttrss_filters drop column description;
|
||||
|
||||
update ttrss_version set schema_version = 7;
|
||||
|
||||
|
|
|
@ -9,6 +9,14 @@ alter table ttrss_feeds alter column rtl_content set default false;
|
|||
|
||||
alter table ttrss_sessions drop column ip_address;
|
||||
|
||||
delete from ttrss_user_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||
delete from ttrss_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||
|
||||
delete from ttrss_user_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||
delete from ttrss_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||
|
||||
alter table ttrss_filters drop column description;
|
||||
|
||||
update ttrss_version set schema_version = 7;
|
||||
|
||||
commit;
|
||||
|
|
24
tt-rss.js
24
tt-rss.js
|
@ -653,30 +653,6 @@ function qfdDelete(feed_id) {
|
|||
}
|
||||
|
||||
|
||||
function allFeedsMenuChange() {
|
||||
var chooser = document.getElementById("allFeedsChooser");
|
||||
|
||||
var opname = chooser[chooser.selectedIndex].text;
|
||||
|
||||
chooser.selectedIndex = 0;
|
||||
|
||||
if (opname == "Update") {
|
||||
scheduleFeedUpdate(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (opname == "Mark as read") {
|
||||
catchupAllFeeds();
|
||||
return;
|
||||
}
|
||||
|
||||
if (opname == "Show only unread") {
|
||||
toggleDispRead();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateFeedTitle(t) {
|
||||
active_title_text = t;
|
||||
updateTitle();
|
||||
|
|
23
tt-rss.php
23
tt-rss.php
|
@ -127,34 +127,11 @@ window.onload = init;
|
|||
</div>
|
||||
</td></tr>
|
||||
<tr><td height="100%" width="100%" valign="top">
|
||||
|
||||
<? if (get_pref($link, 'DISPLAY_FEEDLIST_ACTIONS')) { ?>
|
||||
|
||||
<iframe frameborder="0"
|
||||
src="backend.php?op=error&msg=Loading,%20please wait..."
|
||||
id="feeds-frame" name="feeds-frame" class="feedsFrameWithActions"> </iframe>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<select id="allFeedsChooser" onchange="allFeedsMenuChange()">
|
||||
<option selected>All feeds...</option>
|
||||
<? if (!ENABLE_UPDATE_DAEMON) { ?>
|
||||
<option>Update</option>
|
||||
<? } ?>
|
||||
<option>Mark as read</option>
|
||||
<option>Show only unread</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<? } else { ?>
|
||||
|
||||
<iframe frameborder="0"
|
||||
src="backend.php?op=error&msg=Loading,%20please wait..."
|
||||
id="feeds-frame" name="feeds-frame" class="feedsFrame"> </iframe>
|
||||
|
||||
<? } ?>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue