($fUsername -> $fUsername)";
}
// apparently uppercase usernames really confuse some IMAP clients.
$fUsername = strtolower($fUsername);
$local_part = '';
if(preg_match('/^(.*)@/', $fUsername, $matches)) {
$local_part = $matches[1];
}
$result = db_query ("INSERT INTO $table_mailbox (username,password,name,maildir,local_part,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$local_part','$quota','$fDomain',NOW(),NOW(),'$sqlActive')");
if ($result['rows'] != 1 || !mailbox_postcreation($fUsername,$fDomain,$maildir, $quota))
{
$tDomain = $fDomain;
$tMessage .= $PALANG['pCreate_mailbox_result_error'] . "
($fUsername)
";
db_query('ROLLBACK');
}
else
{
db_query('COMMIT');
db_log ($fDomain, 'create_mailbox', "$fUsername");
$tDomain = $fDomain;
$tQuota = $CONF['maxquota'];
if ($fMail == "on")
{
$fTo = $fUsername;
$fFrom = $SESSID_USERNAME;
$fSubject = $PALANG['pSendmail_subject_text'];
$fBody = $CONF['welcome_text'];
if (!smtp_mail ($fTo, $fFrom, $fSubject, $fBody))
{
$tMessage .= "
" . $PALANG['pSendmail_result_error'] . "
";
}
else
{
$tMessage .= "
" . $PALANG['pSendmail_result_success'] . "
";
}
}
$tShowpass = "";
if ( $tPassGenerated == 1 || $CONF['show_password'] == "YES") $tShowpass = " / $fPassword";
if (create_mailbox_subfolders($fUsername,$fPassword))
{
$tMessage .= $PALANG['pCreate_mailbox_result_success'] . "
($fUsername$tShowpass)";
} else {
$tMessage .= $PALANG['pCreate_mailbox_result_succes_nosubfolders'] . "
($fUsername$tShowpass)";
}
}
}
}
$smarty->assign ('tUsername', $tUsername);
$smarty->assign ('select_options', select_options ($list_domains, array ($tDomain)), false);
$smarty->assign ('pCreate_mailbox_username_text', $pCreate_mailbox_username_text, false);
$smarty->assign ('pCreate_mailbox_password_text', $pCreate_mailbox_password_text, false);
$smarty->assign ('tName', $tName, false);
$smarty->assign ('tQuota', $tQuota);
$smarty->assign ('pCreate_mailbox_quota_text', $pCreate_mailbox_quota_text, false);
$smarty->assign ('tMessage', $tMessage, false);
$smarty->assign ('smarty_template', 'create-mailbox');
$smarty->display ('index.tpl');
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>