Skip to content

Commit 7a58805

Browse files
committed
send spamfilter_wblist_update events for change of spamfilter_users.email
1 parent d8b99a8 commit 7a58805

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

interface/web/mail/spamfilter_users_edit.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function onSubmit() {
9090
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
9191
$client = $app->db->queryOneRecord("SELECT limit_spamfilter_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
9292

93-
// Check if the user may add another mailbox.
93+
// Check if the user may add another spamfilter user.
9494
if($this->id == 0 && $client["limit_spamfilter_user"] >= 0) {
9595
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM spamfilter_users WHERE sys_groupid = ?", $client_group_id);
9696
if($tmp["number"] >= $client["limit_spamfilter_user"]) {
@@ -103,10 +103,21 @@ function onSubmit() {
103103
parent::onSubmit();
104104
}
105105

106+
107+
function onAfterUpdate() {
108+
global $app, $conf;
109+
110+
// If email changes fire spamfilter_wblist_update events so rspamd files are rewritten
111+
if(isset($this->dataRecord['email']) && $this->oldDataRecord['email'] != $this->dataRecord['email']) {
112+
$tmp_wblist = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_users WHERE rid = ?", $this->dataRecord['id']);
113+
foreach ($tmp_wblist as $tmp) {
114+
$app->db->datalogUpdate('spamfilter_wblist', array('rid' => $this->dataRecord['id']), 'wblist_id', $tmp['wblist_id']);
115+
}
116+
}
117+
}
118+
106119
}
107120

108121
$app->tform_actions = new page_action;
109122
$app->tform_actions->onLoad();
110123

111-
112-
?>

0 commit comments

Comments
 (0)