diff --git a/admin/create-admin.php b/admin/create-admin.php deleted file mode 100644 index 292d8ff..0000000 --- a/admin/create-admin.php +++ /dev/null @@ -1,77 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: create-admin.php -// -// Template File: admin_create-admin.tpl -// -// -// Template Variables: -// -// tMessage -// tUsername -// tDomains -// -// Form POST \ GET Variables: -// -// fUsername -// fPassword -// fPassword2 -// fDomains -// -require("../variables.inc.php"); -require("../config.inc.php"); -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); - -$list_domains = list_domains(); -$list_admins = list_admins(); - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $username = filter_input(INPUT_POST, 'username', FILTER_VALIDATE_EMAIL); - $password1 = filter_input(INPUT_POST, 'password1', FILTER_DEFAULT); - $password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT); - $domains = filter_input_array(INPUT_POST, array('domains' => array('filter' => FILTER_VALIDATE_DOMAIN, 'flags' => FILTER_REQUIRE_ARRAY))); - - if (empty($username) || in_array($username, array_column($list_admins, 'username'))) { - $message = $PALANG['pAdminCreate_admin_username_error']; - } - - if (empty($password1) or ($password1 != $password2)) { - $message = $PALANG['pAdminCreate_admin_password_error']; - } - - if (empty($domains['domains'])) { - $message = $PALANG['pAdminCreate_admin_domain_error']; - } - - if (empty($message)) { - $hashed = bcrypt($password1); - try { - $dbh = connect_db(); - $sth = $dbh->prepare("INSERT INTO admin (username,password,created,modified) VALUES (?,?,NOW(),NOW())"); - $sth->bindParam(1, $username, PDO::PARAM_STR); - $sth->bindParam(2, $hashed, PDO::PARAM_STR); - $sth->execute(); - foreach ($domains['domains'] as $row) { - $sth = $dbh->prepare("INSERT INTO domain_admins (username,domain,created) VALUES (?,?,NOW())"); - $sth->bindParam(1, $username, PDO::PARAM_STR); - $sth->bindParam(2, $row, PDO::PARAM_STR); - $sth->execute(); - } - $message = $PALANG['pAdminCreate_admin_result_succes'] . "
($username)
"; - } catch(PDOException $e) { - $message = $PALANG['pAdminCreate_admin_result_error'] . "
($username)
"; - } - } - -} -include("../templates/header.tpl"); -include("../templates/admin_menu.tpl"); -include("../templates/admin_create-admin.tpl"); -include("../templates/footer.tpl"); -?> diff --git a/admin/create-alias.php b/admin/create-alias.php deleted file mode 100644 index d66b1a5..0000000 --- a/admin/create-alias.php +++ /dev/null @@ -1,73 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: create-alias.php -// -// Template File: create-alias.tpl -// -// Template Variables: -// -// tMessage -// tAddress -// tGoto -// domain -// -// Form POST \ GET Variables: -// -// address -// fGoto -// domain -// -require("../variables.inc.php"); -require("../config.inc.php"); -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); - -$list_domains = list_domains(); - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $address = strtolower(filter_input(INPUT_POST, 'address', FILTER_DEFAULT)); - $domain = filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN); - $goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT)); - $domain_key = array_search($domain, array_column($list_domains, 'domain')); - - $from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL); - if (!str_contains($goto, '@')) { - $goto = $goto . "@" . $domain; - } - $goto = filter_var($goto, FILTER_VALIDATE_EMAIL); - - if ($list_domains[$domain_key]['alias_count'] < 0 || $list_domains[$domain_key]['alias_count'] >= $list_domains[$domain_key]['aliases']) { - $message = $PALANG['pCreate_alias_address_text_error2']; - } - - if (empty($address) || empty($goto)) { - $message = $PALANG['pCreate_alias_address_text_error1']; - } - - if (empty($message)) { - try { - $dbh = connect_db(); - $sth = $dbh->prepare("INSERT INTO alias (address,goto,domain,created,modified) VALUES (?,?,?,NOW(),NOW())"); - $sth->bindParam(1, $from, PDO::PARAM_STR); - $sth->bindParam(2, $goto, PDO::PARAM_STR); - $sth->bindParam(3, $domain, PDO::PARAM_STR); - $sth->execute(); - logging(ADMIN_EMAIL, $domain, "create alias", "$from -> $goto"); - $message = $PALANG['pCreate_alias_result_succes'] . "
($from -> $goto)
"; - $address = ''; - $goto = ''; - } catch(PDOException $e) { - $message = $PALANG['pCreate_alias_result_error'] . "
($from -> $goto) - $e
"; - } - } -} -include("../templates/header.tpl"); -include("../templates/admin_menu.tpl"); -include("../templates/create-alias.tpl"); -include("../templates/footer.tpl"); -?> diff --git a/admin/create-mailbox.php b/admin/create-mailbox.php deleted file mode 100644 index 2281526..0000000 --- a/admin/create-mailbox.php +++ /dev/null @@ -1,191 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: create-mailbox.php -// -// Template File: create-mailbox.tpl -// -// Template Variables: -// -// tMessage -// tUsername -// tName -// tQuota -// tDomain -// -// Form POST \ GET Variables: -// -// fUsername -// fPassword -// fPassword2 -// fName -// fQuota -// fDomain -// fActive -// fMail -// -require("../variables.inc.php"); -require("../config.inc.php"); -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); - -$list_domains = list_domains(); - -if ($_SERVER['REQUEST_METHOD'] == "GET") { - $tQuota = $CONF['maxquota']; - - $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text']; - $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text']; - $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text']; - - if (isset($_GET['domain'])) $tDomain = escape_string($_GET['domain']); - - include("../templates/header.tpl"); - include("../templates/admin_menu.tpl"); - include("../templates/create-mailbox.tpl"); - include("../templates/footer.tpl"); -} - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text']; - $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text']; - $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text']; - - $fUsername = escape_string($_POST['fUsername']) . "@" . escape_string($_POST['fDomain']); - $fUsername = strtolower($fUsername); - $fPassword = escape_string($_POST['fPassword']); - $fPassword2 = escape_string($_POST['fPassword2']); - isset($_POST['fName']) ? $fName = escape_string($_POST['fName']) : $fName = "No Name"; - $fDomain = escape_string($_POST['fDomain']); - isset($_POST['fQuota']) ? $fQuota = escape_string($_POST['fQuota']) : $fQuota = "0"; - isset($_POST['fActive']) ? $fActive = escape_string($_POST['fActive']) : $fActive = "1"; - if(isset($_POST['fMail'])) $fMail = escape_string($_POST['fMail']); - - if (!check_mailbox($fDomain)) { - $error = 1; - $tUsername = escape_string($_POST['fUsername']); - $tName = $fName; - $tQuota = $fQuota; - $tDomain = $fDomain; - $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3']; - } - - if (empty($fUsername) or !check_email($fUsername)) { - $error = 1; - $tUsername = escape_string($_POST['fUsername']); - $tName = $fName; - $tQuota = $fQuota; - $tDomain = $fDomain; - $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1']; - } - - if (empty($fPassword) or ($fPassword != $fPassword2)) { - if ($CONF['generate_password'] == "YES") { - $fPassword = generate_password(); - } else { - $error = 1; - $tUsername = escape_string($_POST['fUsername']); - $tName = $fName; - $tQuota = $fQuota; - $tDomain = $fDomain; - $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error']; - } - } - - if ($CONF['quota'] == "YES") { - if (!check_quota($fQuota, $fDomain)) { - $error = 1; - $tUsername = escape_string($_POST['fUsername']); - $tName = $fName; - $tQuota = $fQuota; - $tDomain = $fDomain; - $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error']; - } - } - - $result = db_query("SELECT * FROM alias WHERE address='$fUsername'"); - if ($result['rows'] == 1) { - $error = 1; - $tUsername = escape_string($_POST['fUsername']); - $tName = $fName; - $tQuota = $fQuota; - $tDomain = $fDomain; - $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2']; - } - - if ($error != 1) { - $password = pacrypt($fPassword); - - if ($CONF['domain_path'] == "YES") { - if ($CONF['domain_in_mailbox'] == "YES") { - $maildir = $fDomain . "/" . $fUsername . "/"; - } else { - $maildir = $fDomain . "/" . escape_string($_POST['fUsername']) . "/"; - } - } else { - $maildir = $fUsername . "/"; - } - - if (!empty($fQuota)) { - $quota = $fQuota * $CONF['quota_multiplier']; - } else { - $quota = 0; - } - - if ($fActive == "on") { - $fActive = 1; - } else { - $fActive = 0; - } - - $result = db_query("INSERT INTO alias (address,goto,domain,created,modified,active) VALUES ('$fUsername','vmail','$fDomain',NOW(),NOW(),'$fActive')"); - if ($result['rows'] != 1) { - $tDomain = $fDomain; - $tMessage = $PALANG['pAlias_result_error'] . "
($fUsername -> $fUsername)
"; - } - - $result = db_query("INSERT INTO mailbox (username,password,name,maildir,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$quota','$fDomain',NOW(),NOW(),'$fActive')"); - if ($result['rows'] != 1) { - $tDomain = $fDomain; - $tMessage .= $PALANG['pCreate_mailbox_result_error'] . "
($fUsername)
"; - } else { - - db_log($CONF['admin_email'], $fDomain, "create mailbox", $fUsername); - - $tDomain = $fDomain; - $tMessage = $PALANG['pCreate_mailbox_result_succes'] . "
($fUsername"; - if ($CONF['generate_password'] == "YES") { - $tMessage .= " / $fPassword)
"; - } else { - $tMessage .= ")
"; - } - - - $tQuota = $CONF['maxquota']; - - if ($fMail == "on") { - $fTo = $fUsername; - $fSubject = $PALANG['pSendmail_subject_text']; - $fHeaders = "From: " . $CONF['admin_email'] . "\r\n"; - $fHeaders .= "Content-Type: text/plain; charset=utf-8\r\n"; - $fBody = $CONF['welcome_text']; - - if (!mail($fTo, $fSubject, $fBody, $fHeaders)) { - $tMessage .= "
" . $PALANG['pSendmail_result_error'] . "
"; - } else { - $tMessage .= "
" . $PALANG['pSendmail_result_succes'] . "
"; - } - } - } - } - - include("../templates/header.tpl"); - include("../templates/admin_menu.tpl"); - include("../templates/create-mailbox.tpl"); - include("../templates/footer.tpl"); -} -?> diff --git a/templates/admin_create-admin.tpl b/templates/admin_create-admin.tpl deleted file mode 100644 index 25b8a7c..0000000 --- a/templates/admin_create-admin.tpl +++ /dev/null @@ -1,41 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- -
-
-
diff --git a/templates/admin_list-virtual.tpl b/templates/admin_list-virtual.tpl index 3e35140..c1ae8e2 100644 --- a/templates/admin_list-virtual.tpl +++ b/templates/admin_list-virtual.tpl @@ -73,9 +73,7 @@ if (count($list_mailbox) > 0) { print " \n"; print " " . $PALANG['pAdminList_virtual_mailbox_username'] . "\n"; print " " . $PALANG['pAdminList_virtual_mailbox_name'] . "\n"; - if ($CONF['quota'] == 'YES') print " " . $PALANG['pAdminList_virtual_mailbox_quota'] . "\n"; print " " . $PALANG['pAdminList_virtual_mailbox_modified'] . "\n"; - print " " . $PALANG['pAdminList_virtual_mailbox_active'] . "\n"; print "  \n"; print " \n"; @@ -84,8 +82,6 @@ if (count($list_mailbox) > 0) { print " " . $row['username'] . "\n"; print " " . $row['name'] . "\n"; print " " . $row['modified'] . "\n"; - $active = ($row['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " " . $active . "\n"; print " " . $PALANG['edit'] . "\n"; print " " . $PALANG['del'] . "\n"; print " \n";