summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-09-03 08:34:31 +0100
committerAndrew Dolgov <[email protected]>2005-09-03 08:34:31 +0100
commitde435974523438840fbe250160523d87568f960e (patch)
treecd5d5fa88f0cc0834aac19c493bb246458322fba
parenta0d5388913ca8f9a97fa1ef257517230412bafdd (diff)
support for adding filters
-rw-r--r--backend.php20
-rw-r--r--prefs.js25
2 files changed, 32 insertions, 13 deletions
diff --git a/backend.php b/backend.php
index 9c0b5c8b0..3b07bd38d 100644
--- a/backend.php
+++ b/backend.php
@@ -613,22 +613,16 @@
if ($subop == "add") {
-/* if (!WEB_DEMO_MODE) {
+ if (!WEB_DEMO_MODE) {
- $feed_link = pg_escape_string($_GET["link"]);
+ $regexp = pg_escape_string($_GET["regexp"]);
+ $match = pg_escape_string($_GET["match"]);
$result = pg_query(
- "INSERT INTO ttrss_feeds (feed_url,title) VALUES ('$feed_link', '')");
-
- $result = pg_query(
- "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'");
-
- $feed_id = pg_fetch_result($result, 0, "id");
-
- if ($feed_id) {
- update_rss_feed($link, $feed_link, $feed_id);
- }
- } */
+ "INSERT INTO ttrss_filters (regexp,filter_type) VALUES
+ ('$regexp', (SELECT id FROM ttrss_filter_types WHERE
+ description = '$match'))");
+ }
}
$result = pg_query("SELECT description
diff --git a/prefs.js b/prefs.js
index a498bb2e3..e55f7d4f4 100644
--- a/prefs.js
+++ b/prefs.js
@@ -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() {
if (!xmlhttp_ready(xmlhttp)) {