($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 ($SESSID_USERNAME, $fDomain, 'create_mailbox', "$fUsername");
$tDomain = $fDomain;
$tQuota = $CONF['maxquota'];
if ($fMail == "on")
{
$fTo = $fUsername;
$fFrom = $SESSID_USERNAME;
$fHeaders = "To: " . $fTo . "\n";
$fHeaders .= "From: " . $fFrom . "\n";
$fHeaders .= "Subject: " . encode_header ($PALANG['pSendmail_subject_text']) . "\n";
$fHeaders .= "MIME-Version: 1.0\n";
$fHeaders .= "Content-Type: text/plain; charset=utf-8\n";
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
$fHeaders .= $CONF['welcome_text'];
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
{
$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)));
$smarty->assign ('pCreate_mailbox_username_text', $pCreate_mailbox_username_text);
$smarty->assign ('pCreate_mailbox_password_text', $pCreate_mailbox_password_text);
$smarty->assign ('tName', $tName);
$smarty->assign ('tQuota', $tQuota);
$smarty->assign ('pCreate_mailbox_quota_text', $pCreate_mailbox_quota_text);
$smarty->assign ('tMessage', $tMessage);
$smarty->assign ('smarty_template', 'create-mailbox');
$smarty->display ('index.tpl');
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>