summaryrefslogtreecommitdiff
path: root/modules/pref-labels.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-01-18 11:11:55 +0100
committerAndrew Dolgov <[email protected]>2009-01-18 11:11:55 +0100
commitf6f7817d9d275c4e7fc344758c0ca0ffbf925884 (patch)
tree0f126e25da94d5eb73b05d3342fe6aac90cfc55e /modules/pref-labels.php
parent184f5092edaf45f0d8cf8a648fce790b42c4d2f8 (diff)
disable depending filters when removing label
Diffstat (limited to 'modules/pref-labels.php')
-rw-r--r--modules/pref-labels.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/modules/pref-labels.php b/modules/pref-labels.php
index 3690464e7..6f284e942 100644
--- a/modules/pref-labels.php
+++ b/modules/pref-labels.php
@@ -48,10 +48,30 @@
$ids = split(",", db_escape_string($_GET["ids"]));
- foreach ($ids as $id) {
- db_query($link, "DELETE FROM ttrss_labels2 WHERE id = '$id'
- AND owner_uid = " . $_SESSION["uid"]);
+ db_query($link, "BEGIN");
+
+ foreach ($ids as $id) {
+ $result = db_query($link, "SELECT caption FROM ttrss_labels2
+ WHERE id = '$id'");
+
+ $caption = db_fetch_result($result, 0, "caption");
+
+ $result = db_query($link, "DELETE FROM ttrss_labels2 WHERE id = '$id'
+ AND owner_uid = " . $_SESSION["uid"]);
+
+ if (db_affected_rows($link, $result) != 0 && $caption) {
+
+ /* Disable filters that reference label being removed */
+
+ db_query($link, "UPDATE ttrss_filters SET
+ enabled = false WHERE action_param = '$caption'
+ AND action_id = 7
+ AND owner_uid = " . $_SESSION["uid"]);
+ }
}
+
+ db_query($link, "COMMIT");
+
}
if ($subop == "add") {