diff --git a/TODO b/TODO index 943b1b8d..3b6f1331 100644 --- a/TODO +++ b/TODO @@ -29,7 +29,7 @@ WONTFIX 0001260 2x F5 causes bigger fonts WONTFIX 0001259 contract-changes optional with cron to the end of the interval WONTFIX 0001258 Make invoices immediately 0001120 Missing function to calculate the mail traffic - 0001236 the cron doesnt delete user directories +FIXED 0001236 the cron doesnt delete user directories 0001244 customer view too wide for 1024x768 resolutions 0001229 subdomains and Own vHost-Settings FIXED 0001254 Installation no next button @@ -67,7 +67,7 @@ FIXED 0001209 APS crashs when installing magento 0001185 Autoreponder - send mails via sendmail to set correct Return-Path header 0001211 Generated MySQL username too long 0001208 HTML Tags in Support Tickets - 0001207 FTP Passwörter mit Umlauten + 0001207 FTP Passw�rter mit Umlauten 0001201 Virtualusers conflict with local users when using libnss-mysql 0001204 php5-suhosin FIXED 0001203 Add check for PHP version and required PHP modules in install script diff --git a/admin_customers.php b/admin_customers.php index 7889f254..c4a8da6b 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -228,11 +228,18 @@ if($page == 'customers' $log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'"); inserttask('1'); inserttask('4'); + + if(isset($_POST['delete_userfiles']) + && (int)$_POST['delete_userfiles'] == 1) + { + inserttask('6', $result['loginname']); + } + redirectTo($filename, Array('page' => $page, 's' => $s)); } else { - ask_yesno('admin_customer_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']); + ask_yesno_withcheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']); } } } diff --git a/lib/functions/filedir/function.safe_exec.php b/lib/functions/filedir/function.safe_exec.php index 984c04d1..0b8e6826 100644 --- a/lib/functions/filedir/function.safe_exec.php +++ b/lib/functions/filedir/function.safe_exec.php @@ -52,7 +52,8 @@ function safe_exec($exec_string, &$return_value = false) $settings['system']['awstats_updateall_command'], 'openssl', 'unzip', - 'php' + 'php', + 'rm' ); // diff --git a/lib/functions/froxlor/function.inserttask.php b/lib/functions/froxlor/function.inserttask.php index 3cd5505e..80f6d984 100644 --- a/lib/functions/froxlor/function.inserttask.php +++ b/lib/functions/froxlor/function.inserttask.php @@ -51,6 +51,15 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '') $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("2", "' . $db->escape($data) . '")'); $doupdate = true; } + elseif($type == '6' + && $param1 != '') + { + $data = Array(); + $data['loginname'] = $param1; + $data = serialize($data); + $db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")'); + $doupdate = true; + } if($doupdate === true && (int)$settings['system']['realtime_port'] !== 0) diff --git a/lib/functions/output/function.ask_yesno.php b/lib/functions/output/function.ask_yesno.php index 8deb929e..b809000b 100644 --- a/lib/functions/output/function.ask_yesno.php +++ b/lib/functions/output/function.ask_yesno.php @@ -63,3 +63,35 @@ function ask_yesno($text, $yesfile, $params = array(), $targetname = '') eval("echo \"" . getTemplate('misc/question_yesno', '1') . "\";"); exit; } + +function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '') +{ + global $userinfo, $db, $s, $header, $footer, $lng; + + $hiddenparams = ''; + + if(is_array($params)) + { + foreach($params as $field => $value) + { + $hiddenparams.= '' . "\n"; + } + } + + if(isset($lng['question'][$text])) + { + $text = $lng['question'][$text]; + } + + if(isset($lng['question'][$chk_text])) + { + $chk_text = $lng['question'][$chk_text]; + } + + $checkbox = makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true); + + $text = strtr($text, array('%s' => $targetname)); + eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";"); + exit; +} + diff --git a/lng/english.lng.php b/lng/english.lng.php index fbedd6a7..4fe483f9 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -255,6 +255,7 @@ $lng['question']['extras_reallydelete_pathoptions'] = 'Do you really want to del $lng['question']['ftp_reallydelete'] = 'Do you really want to delete the FTP account %s?'; $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_customer_alsoremovefiles'] = 'Remove user files too?'; /** * Mails diff --git a/lng/german.lng.php b/lng/german.lng.php index 295e3f6f..f0b28299 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -255,6 +255,7 @@ $lng['question']['extras_reallydelete_pathoptions'] = 'Wollen Sie die Optionen f $lng['question']['ftp_reallydelete'] = 'Wollen Sie das FTP-Benutzerkonto %s wirklich löschen?'; $lng['question']['mysql_reallydelete'] = 'Wollen Sie die Datenbank %s wirklich löschen?
ACHTUNG! Alle Daten gehen unwiderruflich verloren!'; $lng['question']['admin_configs_reallyrebuild'] = 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?'; +$lng['question']['admin_customer_alsoremovefiles'] = 'Auch Kunden-Daten löschen?'; /** * Mails diff --git a/scripts/cron_tasks.php b/scripts/cron_tasks.php index 3f01cd00..fb8a72cc 100644 --- a/scripts/cron_tasks.php +++ b/scripts/cron_tasks.php @@ -54,18 +54,18 @@ while($row = $db->fetch_array($result_tasks)) if($row['type'] == '1') { //dhr: cleanout froxlor-generated awstats configs prior to re-creation - if ($settings[system][awstats_enabled] == '1') + if ($settings['system']['awstats_enabled'] == '1') { - $awstatsclean[header] = "## GENERATED BY FROXLOR\n"; - $awstatsclean[path] = '/etc/awstats'; - $awstatsclean[dir] = dir($awstatsclean[path]); - while($awstatsclean[entry] = $awstatsclean[dir]->read()) { - $awstatsclean[fullentry] = $awstatsclean[path].'/'.$awstatsclean[entry]; - $awstatsclean[fh] = fopen($awstatsclean[fullentry], 'r'); - $awstatsclean[headerRead] = fgets($awstatsclean[fh], strlen($awstatsclean[header])+1); - fclose($awstatsclean[fh]); - if($awstatsclean[headerRead] == $awstatsclean[header]) { - @unlink($awstatsclean[fullentry]); + $awstatsclean['header'] = "## GENERATED BY FROXLOR\n"; + $awstatsclean['path'] = '/etc/awstats'; + $awstatsclean['dir'] = dir($awstatsclean['path']); + while($awstatsclean['entry'] = $awstatsclean['dir']->read()) { + $awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry']; + $awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r'); + $awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1); + fclose($awstatsclean['fh']); + if($awstatsclean['headerRead'] == $awstatsclean['header']) { + @unlink($awstatsclean['fullentry']); } } unset($awstatsclean); @@ -199,6 +199,32 @@ while($row = $db->fetch_array($result_tasks)) mkDirWithCorrectOwnership($directory['customerroot'], $directory['homedir'], $directory['uid'], $directory['gid']); } } + + /** + * TYPE=6 MEANS THAT A CUSTOMER HAS BEEN DELETED AND THAT WE HAVE TO REMOVE ITS FILES + */ + elseif ($row['type'] == '6') + { + fwrite($debugHandler, ' cron_tasks: Task6 started - deleting customer data' . "\n"); + $cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task6 started - deleting customer data'); + + if(is_array($row['data'])) + { + if(isset($row['data']['loginname'])) + { + /* + * remove homedir + */ + $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname'])); + safe_exec('rm -rf '.escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname'])); + /* + * remove maildir + */ + $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname'])); + safe_exec('rm -rf '.escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname'])); + } + } + } } if($db->num_rows($result_tasks) != 0) diff --git a/templates/misc/question_yesno_checkbox.tpl b/templates/misc/question_yesno_checkbox.tpl new file mode 100644 index 00000000..0a1d9a2f --- /dev/null +++ b/templates/misc/question_yesno_checkbox.tpl @@ -0,0 +1,21 @@ +$header +
+ + + $hiddenparams + + + + + + + + + + + +
  {$lng['question']['question']}
$text$checkbox
 
+
+
+
+$footer \ No newline at end of file