- added possiblility for customer to get its e-mail account data deleted from the filesystem when removing an account from the panel, fixes #245

This commit is contained in:
Michael Kaufmann (d00p)
2010-06-02 05:57:44 +00:00
parent e7c9b4d402
commit de250df0cb
5 changed files with 51 additions and 3 deletions

View File

@@ -184,6 +184,12 @@ elseif($page == 'emails')
$number_forwarders = 0; $number_forwarders = 0;
} }
if(isset($_POST['delete_userfiles'])
&& (int)$_POST['delete_userfiles'] == 1)
{
inserttask('7', $result['loginname'], $result['email']);
}
$db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `emails_used`=`emails_used` - 1 , `email_forwarders_used` = `email_forwarders_used` - " . (int)$number_forwarders . " $update_users_query_addon WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `emails_used`=`emails_used` - 1 , `email_forwarders_used` = `email_forwarders_used` - " . (int)$number_forwarders . " $update_users_query_addon WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted email address '" . $result['email'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted email address '" . $result['email'] . "'");
@@ -191,7 +197,7 @@ elseif($page == 'emails')
} }
else else
{ {
ask_yesno('email_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full'])); ask_yesno_withcheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
} }
} }
} }

View File

@@ -62,6 +62,17 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")'); $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")');
$doupdate = true; $doupdate = true;
} }
elseif($type == '7'
&& $param1 != ''
&& $param2 != '')
{
$data = Array();
$data['loginname'] = $param1;
$data['email'] = $param2;
$data = serialize($data);
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("7", "' . $db->escape($data) . '")');
$doupdate = true;
}
if($doupdate === true if($doupdate === true
&& (int)$settings['system']['realtime_port'] !== 0 && (int)$settings['system']['realtime_port'] !== 0

View File

@@ -256,6 +256,7 @@ $lng['question']['ftp_reallydelete'] = 'Do you really want to delete the FTP acc
$lng['question']['mysql_reallydelete'] = 'Do you really want to delete the database %s? This cannot be undone!'; $lng['question']['mysql_reallydelete'] = 'Do you really want to delete the database %s? This cannot be undone!';
$lng['question']['admin_configs_reallyrebuild'] = 'Do you really want to rebuild all config files?'; $lng['question']['admin_configs_reallyrebuild'] = 'Do you really want to rebuild all config files?';
$lng['question']['admin_customer_alsoremovefiles'] = 'Remove user files too?'; $lng['question']['admin_customer_alsoremovefiles'] = 'Remove user files too?';
$lng['question']['admin_customer_alsoremovemail'] = 'Completely remove email data from filesystem?';
/** /**
* Mails * Mails

View File

@@ -256,6 +256,7 @@ $lng['question']['ftp_reallydelete'] = 'Wollen Sie das FTP-Benutzerkonto %s wirk
$lng['question']['mysql_reallydelete'] = 'Wollen Sie die Datenbank %s wirklich l&ouml;schen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!'; $lng['question']['mysql_reallydelete'] = 'Wollen Sie die Datenbank %s wirklich l&ouml;schen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!';
$lng['question']['admin_configs_reallyrebuild'] = 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?'; $lng['question']['admin_configs_reallyrebuild'] = 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?';
$lng['question']['admin_customer_alsoremovefiles'] = 'Auch Kunden-Daten l&ouml;schen?'; $lng['question']['admin_customer_alsoremovefiles'] = 'Auch Kunden-Daten l&ouml;schen?';
$lng['question']['admin_customer_alsoremovemail'] = 'E-Mail Daten auf dem Dateisystem l&ouml;schen?';
/** /**
* Mails * Mails

View File

@@ -213,7 +213,7 @@ $awstatsclean['headerold']) {
/* /*
* remove homedir * remove homedir
*/ */
$homedir = makeCorrectDir($settings['system']['documentroot_prefix'] . $row['data']['loginname']); $homedir = makeCorrectDir($settings['system']['documentroot_prefix'] . '/' . $row['data']['loginname']);
if($homedir != '/' if($homedir != '/'
&& $homedir != $settings['system']['documentroot_prefix'] && $homedir != $settings['system']['documentroot_prefix']
@@ -226,7 +226,7 @@ $awstatsclean['headerold']) {
/* /*
* remove maildir * remove maildir
*/ */
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] . $row['data']['loginname']); $maildir = makeCorrectDir($settings['system']['vmail_homedir'] . '/' . $row['data']['loginname']);
if($maildir != '/' if($maildir != '/'
&& $maildir != $settings['system']['vmail_homedir'] && $maildir != $settings['system']['vmail_homedir']
@@ -269,6 +269,35 @@ $awstatsclean['headerold']) {
} }
} }
} }
/**
* TYPE=7 Customer deleted an email account and wants the data to be deleted on the filesystem
*/
elseif ($row['type'] == '7')
{
fwrite($debugHandler, ' cron_tasks: Task7 started - deleting customer e-mail data' . "\n");
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task7 started - deleting customer e-mail data');
if(is_array($row['data']))
{
if(isset($row['data']['loginname'])
&& isset($row['data']['email'])
) {
/*
* remove specific maildir
*/
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $row['data']['email']);
if($maildir != '/'
&& $maildir != $settings['system']['vmail_homedir']
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir'])
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
safe_exec('rm -rf '.escapeshellarg($maildir));
}
}
}
}
} }
if($db->num_rows($result_tasks) != 0) if($db->num_rows($result_tasks) != 0)