- only show checkbox for e-mail file deletion if there really is some data on the filesystem
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
lib/functions/filedir/function.maildirExists.php
Normal file
40
lib/functions/filedir/function.maildirExists.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -90,7 +90,11 @@ 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 = '<input type="hidden" name="delete_userfiles" value="0" />' . "\n";;
|
||||
}
|
||||
|
||||
$text = strtr($text, array('%s' => $targetname));
|
||||
eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";");
|
||||
|
||||
Reference in New Issue
Block a user