diff --git a/bureau/admin/mail_del.php b/bureau/admin/mail_del.php index 75780e73..cd404262 100755 --- a/bureau/admin/mail_del.php +++ b/bureau/admin/mail_del.php @@ -41,10 +41,27 @@ reset($d); include_once ("head.php"); if ($confirm=="y") { - $error=""; while (list($key,$val)=each($d)) { - $mail->delete($val); - $error.=$err->errstr()."
"; + // Validate that this email is owned by me... + if (!($email = $mail->is_it_my_mail($val))) { + continue; + } + + // Search for that address: + $db->query("SELECT a.id, NOT ISNULL(m.id) AS islocal FROM address a LEFT JOIN mailbox m ON m.address_id=a.id WHERE a.id= ? ;", array($val)); + + if (!$db->next_record()) { + $msg->raise('Error', "mail", _("The email %s does not exist, it can't be deleted"), $email); + continue; + } + + if ($mail->delete($val)) { + if ($db->f("islocal")) { + $msg->raise('Ok', "mail", _("The email %s has been marked for deletion"), $email); + } else { + $msg->raise('Ok', "mail", _("The email %s has been successfully deleted"), $email); + } + } } include("mail_list.php"); exit(); @@ -61,15 +78,15 @@ if ($confirm=="y") { +

" /> - "/> diff --git a/bureau/admin/mail_doadd.php b/bureau/admin/mail_doadd.php index dbafc1f2..bbc2521d 100644 --- a/bureau/admin/mail_doadd.php +++ b/bureau/admin/mail_doadd.php @@ -30,10 +30,10 @@ $fields = array ( getFields($fields); if (!($res=$mail->create($domain_id,$mail_arg))) { - $error=$err->errstr(); include("mail_list.php"); } else { $_REQUEST["mail_id"]=$res; + $new_account=true; include("mail_edit.php"); } ?> diff --git a/bureau/admin/mail_doedit.php b/bureau/admin/mail_doedit.php index 734429d2..d1f02477 100644 --- a/bureau/admin/mail_doedit.php +++ b/bureau/admin/mail_doedit.php @@ -28,6 +28,7 @@ require_once("../class/config.php"); $fields = array ( "mail_id" =>array ("post","integer",""), + "new_account" =>array ("post","integer",""), "pass" => array ("post","string",""), "passconf" => array("post","string",""), "quotamb" => array("post","integer",0), @@ -39,12 +40,10 @@ $fields = array ( getFields($fields); $isedit=true; // if we go back to edit, it will know ;) -$error=""; // We check that email first ... so that we can compare its status with our ... if (!$res=$mail->get_details($mail_id)) { - $error=$err->errstr(); - include("main.php"); + include("mail_list.php"); exit(); } else { @@ -52,21 +51,16 @@ if (!$res=$mail->get_details($mail_id)) { /* * checking the password */ - if(isset($pass) && $pass != ""){ - if($pass != $passconf){ - $error = _("Passwords do not match"); + if($pass != $passconf){ + $msg->raise("Error", "mail", _("Passwords do not match")); + include ("mail_edit.php"); + exit(); + } else { + if (!$mail->set_passwd($mail_id,$pass,($islocal == 1?false:true))) { /* SET THE PASSWORD */ include ("mail_edit.php"); exit(); - } else { - if (!$mail->set_passwd($mail_id,$pass)) { /* SET THE PASSWORD */ - $error=$err->errstr(); - include ("mail_edit.php"); - exit(); - } else { - $error.=$err->errstr()."
"; - } - } - } + } + } /* @@ -74,20 +68,14 @@ if (!$res=$mail->get_details($mail_id)) { */ if ($res["enabled"] && !$enabled) { if (!$mail->disable($mail_id)) { /* DISABLE */ - $error=$err->errstr(); include ("mail_edit.php"); exit(); - } else { - $error.=$err->errstr()."
"; } } if (!$res["enabled"] && $enabled) { if (!$mail->enable($mail_id)) { /* ENABLE */ - $error=$err->errstr(); include ("mail_edit.php"); exit(); - } else { - $error.=$err->errstr()."
"; } } @@ -96,11 +84,8 @@ if (!$res=$mail->get_details($mail_id)) { * now the islocal + quota + recipients */ if (!$mail->set_details($mail_id,$islocal,$quotamb,$recipients)) { /* SET OTHERS */ - $error=$err->errstr(); include ("mail_edit.php"); exit(); - } else { - $error.=$err->errstr()."
"; } @@ -112,15 +97,15 @@ if (!$res=$mail->get_details($mail_id)) { include ("mail_edit.php"); exit(); } else { - foreach($rh as $h) if ($h) $error.=$h."
"; + foreach($rh as $h) if ($h) $msg->raise("Error", "mail", $h); } } -if (!$error || !trim($error,"
")) { - unset($error); - $success=_("Your email has been edited successfully"); -} +if ($new_account) + $msg->raise("Ok", "mail", _("Your email has been created successfully")); // à traduire +else + $msg->raise("Ok", "mail", _("Your email has been edited successfully")); $_REQUEST["domain_id"]=$dom->get_domain_byname($res["domain"]); include("mail_list.php"); diff --git a/bureau/admin/mail_edit.php b/bureau/admin/mail_edit.php index f65f3b2e..a2ea24c4 100755 --- a/bureau/admin/mail_edit.php +++ b/bureau/admin/mail_edit.php @@ -37,8 +37,7 @@ $fields = array ( getFields($fields); if (!$res=$mail->get_details($mail_id)) { - $error=$err->errstr(); - include("main.php"); + include("mail_list.php"); exit(); } else { @@ -56,9 +55,10 @@ if (!$res=$mail->get_details($mail_id)) { $error

"; -} +$c=$admin->listPasswordPolicies(); +$passwd_classcount = $c['pop']['classcount']; + +echo $msg->msg_html_all(); ?>
@@ -68,6 +68,7 @@ if (isset($error)) { + @@ -92,20 +93,20 @@ if (isset($error)) { - + diff --git a/bureau/admin/mail_list.php b/bureau/admin/mail_list.php index e93ffbde..03499bc3 100755 --- a/bureau/admin/mail_list.php +++ b/bureau/admin/mail_list.php @@ -44,28 +44,10 @@ if(!$domain_id ) { exit(); } -$fatal=false; - if ($domain=$dom->get_domain_byid($domain_id)) { - if(!($mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,$show_systemmails)) && $search) { - $error=$err->errstr(); - } + $mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,$show_systemmails); $allmails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,'true'); -} else { - $error=$err->errstr(); - $fatal=true; } - -if ($fatal) { - echo "
$error
"; -} else { - - if (isset($error) && !empty($error)) { - echo "

$error

"; - } else if (isset($success)) { - echo "

$success

"; -} - ?>

- onclick="popoff()" /> - onclick="popon();" /> + onclick="popoff()" /> + onclick="popon();" />

- +
@@ -75,7 +57,10 @@ if ($fatal) { echo '

'._("Create a new mail account")."

"; } else { echo '

'._("Manage Catch-all")."

"; -} ?> +} + +echo $msg->msg_html_all(); +?> @@ -188,7 +173,7 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
@@ -303,7 +288,6 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"] -