support for adding filters

master
Andrew Dolgov 20 years ago
parent a0d5388913
commit de43597452

@ -613,22 +613,16 @@
if ($subop == "add") { if ($subop == "add") {
/* if (!WEB_DEMO_MODE) { if (!WEB_DEMO_MODE) {
$feed_link = pg_escape_string($_GET["link"]);
$result = pg_query( $regexp = pg_escape_string($_GET["regexp"]);
"INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')"); $match = pg_escape_string($_GET["match"]);
$result = pg_query( $result = pg_query(
"SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'"); "INSERT INTO ttrss_filters (regexp,filter_type) VALUES
('$regexp', (SELECT id FROM ttrss_filter_types WHERE
$feed_id = pg_fetch_result($result, 0, "id"); description = '$match'))");
if ($feed_id) {
update_rss_feed($link, $feed_link, $feed_id);
} }
} */
} }
$result = pg_query("SELECT description $result = pg_query("SELECT description

@ -106,6 +106,31 @@ function toggleSelectRow(sender) {
} }
} }
function addFilter() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
var regexp = document.getElementById("fadd_regexp");
var match = document.getElementById("fadd_match");
if (regexp.value.length == 0) {
notify("Missing filter expression.");
} else {
notify("Adding filter...");
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add&regexp=" +
param_escape(regexp.value) + "&match=" + match.value, true);
xmlhttp.onreadystatechange=filterlist_callback;
xmlhttp.send(null);
regexp.value = "";
}
}
function addFeed() { function addFeed() {
if (!xmlhttp_ready(xmlhttp)) { if (!xmlhttp_ready(xmlhttp)) {

Loading…
Cancel
Save