diff --git a/customer_email.php b/customer_email.php index 7a00eb4e..723db5da 100644 --- a/customer_email.php +++ b/customer_email.php @@ -197,7 +197,12 @@ elseif($page == 'emails') } else { - ask_yesno_withcheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full'])); + if(maildirExists($result)) { + $show_checkbox = true; + } else { + $show_checkbox = false; + } + ask_yesno_withcheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']), $show_checkbox); } } } diff --git a/lib/functions/filedir/function.maildirExists.php b/lib/functions/filedir/function.maildirExists.php new file mode 100644 index 00000000..c5446c5a --- /dev/null +++ b/lib/functions/filedir/function.maildirExists.php @@ -0,0 +1,40 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * @version $Id$ + */ + +/** + * check whether a maildir exists on the filesystem + * + * @param array $result all mail-info of customer + * + * @return boolean + */ +function maildirExists($result = null) +{ + global $settings; + + if(is_array($result)) + { + $loginname = getCustomerDetail($result['customerid'], 'loginname'); + if($loginname !== false) { + $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $loginname .'/'. $result['email']); + if(@file_exists($maildir)) { + return true; + } + } + } + return false; +} diff --git a/lib/functions/output/function.ask_yesno.php b/lib/functions/output/function.ask_yesno.php index 35c3bbaf..e11319d3 100644 --- a/lib/functions/output/function.ask_yesno.php +++ b/lib/functions/output/function.ask_yesno.php @@ -66,7 +66,7 @@ function ask_yesno($text, $yesfile, $params = array(), $targetname = '') exit; } -function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '') +function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true) { global $userinfo, $db, $s, $header, $footer, $lng; @@ -89,8 +89,12 @@ function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $ { $chk_text = $lng['question'][$chk_text]; } - - $checkbox = makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true); + + if ($show_checkbox) { + $checkbox = makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true); + } else { + $checkbox = '' . "\n";; + } $text = strtr($text, array('%s' => $targetname)); eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";");