Skip to content

Commit fe11e42

Browse files
committed
Bugfix: Custom rules field not emptied when a custom mail filter is deleted.
1 parent c30ad79 commit fe11e42

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

interface/web/mail/mail_user_filter_del.php

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

48-
$app->uses("tform_actions");
49-
$app->tform_actions->onDelete();
48+
// Loading classes
49+
$app->uses('tpl,tform,tform_actions');
50+
$app->load('tform_actions');
51+
52+
class page_action extends tform_actions {
53+
54+
function onAfterDelete() {
55+
global $app, $conf;
56+
57+
$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
58+
$skip = false;
59+
$lines = explode("\n",$mailuser['custom_mailfilter']);
60+
$out = '';
61+
62+
foreach($lines as $line) {
63+
$line = trim($line);
64+
if($line == '### BEGIN FILTER_ID:'.$this->id) {
65+
$skip = true;
66+
}
67+
if($skip == false && $line != '') $out .= $line ."\n";
68+
if($line == '### END FILTER_ID:'.$this->id) {
69+
$skip = false;
70+
}
71+
}
72+
73+
$out = addslashes($out);
74+
$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
75+
76+
}
77+
78+
}
79+
80+
$page = new page_action;
81+
$page->onDelete();
5082

5183
?>

0 commit comments

Comments
 (0)