Commit 63368e9e authored by Jesse Norell's avatar Jesse Norell
Browse files

remove spamfilter_wblist entries when removing spamfilter_users

parent 36cdb858
Pipeline #9062 passed with stage
in 8 minutes and 16 seconds
......@@ -55,6 +55,14 @@ class page_action extends tform_actions {
global $app; $conf;
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", $this->dataRecord["email"]);
if (is_array($tmp_user) && isset($tmp_user['id'])) {
$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $tmp_user['id']);
if(is_array($tmp_wblists)) {
foreach($tmp_wblists as $tmp) {
$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
}
}
}
$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = ?", $this->id);
......@@ -71,4 +79,3 @@ class page_action extends tform_actions {
$page = new page_action;
$page->onDelete();
?>
......@@ -45,7 +45,24 @@ require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
$app->uses('tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onBeforeDelete() {
global $app; $conf;
$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $this->id);
if(is_array($tmp_wblists)) {
foreach($tmp_wblists as $tmp) {
$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
}
}
}
}
$page = new page_action;
$page->onDelete();
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment