Skip to content

Commit 1675d18

Browse files
author
Marius Burkard
committed
Merge branch '6199-deleting-spamfilter_users-should-delete-linked-spamfilter_wblist' into 'develop'
Resolve "deleting spamfilter_users should delete linked spamfilter_wblist" Closes #6199 See merge request ispconfig/ispconfig3!1499
2 parents 36cdb85 + 63368e9 commit 1675d18

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

interface/web/mail/mail_user_del.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ function onBeforeDelete() {
5555
global $app; $conf;
5656

5757
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", $this->dataRecord["email"]);
58+
if (is_array($tmp_user) && isset($tmp_user['id'])) {
59+
$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $tmp_user['id']);
60+
if(is_array($tmp_wblists)) {
61+
foreach($tmp_wblists as $tmp) {
62+
$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
63+
}
64+
}
65+
}
5866
$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
5967

6068
$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = ?", $this->id);
@@ -71,4 +79,3 @@ function onBeforeDelete() {
7179
$page = new page_action;
7280
$page->onDelete();
7381

74-
?>

interface/web/mail/spamfilter_users_del.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,24 @@
4545
//* Check permissions for module
4646
$app->auth->check_module_permissions('mail');
4747

48-
$app->uses("tform_actions");
49-
$app->tform_actions->onDelete();
48+
$app->uses('tform_actions');
49+
$app->load('tform_actions');
50+
51+
class page_action extends tform_actions {
52+
53+
function onBeforeDelete() {
54+
global $app; $conf;
55+
56+
$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $this->id);
57+
if(is_array($tmp_wblists)) {
58+
foreach($tmp_wblists as $tmp) {
59+
$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
60+
}
61+
}
62+
}
63+
64+
}
65+
66+
$page = new page_action;
67+
$page->onDelete();
5068

51-
?>

0 commit comments

Comments
 (0)