0 && strlen($fPassword) < $min_length) { $mailbox_password_text_error = sprintf($PALANG['pPasswordTooShort'], $CONF['min_password_length']); $error = 1; } $formvars['password'] = pacrypt($fPassword); } } else { $mailbox_password_text_error = $PALANG['pEdit_mailbox_password_text_error']; $error = 1; } } if ($CONF['quota'] == "YES") { if (!check_quota ($fQuota, $fDomain, $fUsername)) { $error = 1; $tName = $fName; $tQuota = $fQuota; $tActive = $fActive; $pEdit_mailbox_quota_text_error = $PALANG['pEdit_mailbox_quota_text_error']; } } if ($error != 1) { if (!empty ($fQuota)) { $quota = multiply_quota ($fQuota); } else { $quota = 0; } if ($fActive == "on") { $sqlActive = db_get_boolean(True); $fActive = 1; } else { $sqlActive = db_get_boolean(False); $fActive = 0; } $formvars['name'] = $fName; $formvars['quota'] =$quota; $formvars['active']=$sqlActive; if(preg_match('/^(.*)@/', $fUsername, $matches)) { $formvars['local_part'] = $matches[1]; } $result = db_update_q('mailbox', "username='$fUsername' AND domain='$fDomain'", $formvars); # TODO: check if we need the AND domain=... clause, if not, switch to db_update() $maildir = $user_details['maildir']; if ($result != 1 || !mailbox_postedit($fUsername,$fDomain,$maildir, $quota)) { flash_error($PALANG['pEdit_mailbox_result_error']); } else { db_log ($fDomain, 'edit_mailbox', $fUsername); header ("Location: list-virtual.php?domain=$fDomain"); exit(0); } } else { # error detected. Put the values the user entered in the form again. $tName = $fName; $tQuota = $fQuota; $tActive = $fActive; } } $smarty->assign ('fUsername', $fUsername); $smarty->assign ('tName', $tName, false); $smarty->assign ('tMaxquota', $tMaxquota); $smarty->assign ('tQuota', $tQuota); $smarty->assign ('mailbox_quota_text_error', $pEdit_mailbox_quota_text_error); $smarty->assign ('mailbox_password_text_error', $mailbox_password_text_error); if ($tActive) $smarty->assign ('tActive', ' checked="checked"'); $smarty->assign ('smarty_template', 'edit-mailbox'); $smarty->display ('index.tpl'); /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ ?>