From e0b946dd8b114ac17fb1ceb84acc1dd8236cadf7 Mon Sep 17 00:00:00 2001 From: mischa Date: Sun, 4 Sep 2022 11:10:23 +0000 Subject: [PATCH] create -> add --- create-alias.php => add-alias.php | 6 +-- create-mailbox.php => add-mailbox.php | 6 +-- admin/add-alias.php | 6 +++ admin/add-mailbox.php | 6 ++- admin/list-virtual.php | 2 +- admin/viewlog.php | 1 + list-virtuals.php | 10 ++--- password.php | 2 - sendmail.php | 2 - templates/add-alias.tpl | 2 +- templates/add-mailbox.tpl | 2 +- templates/admin_list-domain.tpl | 2 +- templates/admin_list-virtual.tpl | 26 +++++------ templates/create-alias.tpl | 35 --------------- templates/create-mailbox.tpl | 65 --------------------------- templates/list-virtuals.tpl | 23 +++------- templates/menu.tpl | 4 +- templates/viewlog.tpl | 2 +- viewlog.php | 60 +++++++------------------ 19 files changed, 62 insertions(+), 200 deletions(-) rename create-alias.php => add-alias.php (95%) rename create-mailbox.php => add-mailbox.php (97%) delete mode 100644 templates/create-alias.tpl delete mode 100644 templates/create-mailbox.tpl diff --git a/create-alias.php b/add-alias.php similarity index 95% rename from create-alias.php rename to add-alias.php index 7a1895d..d3f7356 100644 --- a/create-alias.php +++ b/add-alias.php @@ -22,13 +22,11 @@ // fGoto // fDomain // -require("./variables.inc.php"); -require("./config.inc.php"); require("./functions.inc.php"); include("./languages/" . check_language() . ".lang"); $SESSID_USERNAME = check_session(); -$list_domains = list_domains_for_admin($SESSID_USERNAME); +$list_domains = list_domains($SESSID_USERNAME); if ($_SERVER['REQUEST_METHOD'] == "GET") { $pCreate_alias_goto_text = $LANG['Create_alias_goto_text']; @@ -109,6 +107,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { } include("./templates/header.tpl"); include("./templates/menu.tpl"); -include("./templates/create-alias.tpl"); +include("./templates/add-alias.tpl"); include("./templates/footer.tpl"); ?> diff --git a/create-mailbox.php b/add-mailbox.php similarity index 97% rename from create-mailbox.php rename to add-mailbox.php index 3c3b829..2369879 100644 --- a/create-mailbox.php +++ b/add-mailbox.php @@ -28,13 +28,11 @@ // fActive // fMail // -require("./variables.inc.php"); -require("./config.inc.php"); require("./functions.inc.php"); include("./languages/" . check_language() . ".lang"); $SESSID_USERNAME = check_session(); -$list_domains = list_domains_for_admin($SESSID_USERNAME); +$list_domains = list_domains($SESSID_USERNAME); if ($_SERVER['REQUEST_METHOD'] == "GET") { $tQuota = $CONF['maxquota']; @@ -188,6 +186,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { } include("./templates/header.tpl"); include("./templates/menu.tpl"); -include("./templates/create-mailbox.tpl"); +include("./templates/add-mailbox.tpl"); include("./templates/footer.tpl"); ?> diff --git a/admin/add-alias.php b/admin/add-alias.php index 8d1c032..ac2bcff 100644 --- a/admin/add-alias.php +++ b/admin/add-alias.php @@ -27,12 +27,18 @@ include '../languages/' . check_language() . '.lang'; $list_domains = list_domains(); +if ($_SERVER['REQUEST_METHOD'] == "GET") { + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN); + $domain_key = array_search($domain, array_column($list_domains, 'domain')); +} + 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')); + print "$domain_key"; $from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL); if (!str_contains($goto, '@')) { diff --git a/admin/add-mailbox.php b/admin/add-mailbox.php index 76e84c0..d6f2fe7 100644 --- a/admin/add-mailbox.php +++ b/admin/add-mailbox.php @@ -29,8 +29,12 @@ include '../languages/' . check_language() . '.lang'; $list_domains = list_domains(); -if ($_SERVER['REQUEST_METHOD'] == "POST") { +if ($_SERVER['REQUEST_METHOD'] == "GET") { + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN); + $domain_key = array_search($domain, array_column($list_domains, 'domain')); +} +if ($_SERVER['REQUEST_METHOD'] == "POST") { $username = strtolower(filter_input(INPUT_POST, 'username', FILTER_DEFAULT)); $domain = filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN); $password1 = filter_input(INPUT_POST, 'password1', FILTER_DEFAULT); diff --git a/admin/list-virtual.php b/admin/list-virtual.php index c9e4606..76e1928 100644 --- a/admin/list-virtual.php +++ b/admin/list-virtual.php @@ -29,7 +29,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { $limit = PAGE_SIZE; if (count($list_domains) > 0) { $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain']; - $selected_domain = array_search($domain, array_column($list_domains, 'domain')); + $domain_key = array_search($domain, array_column($list_domains, 'domain')); $list_alias = list_aliases($domain, $offset, $limit); $list_mailbox = list_mailboxes($domain, $offset, $limit); } diff --git a/admin/viewlog.php b/admin/viewlog.php index 43fdcad..40d9de4 100644 --- a/admin/viewlog.php +++ b/admin/viewlog.php @@ -24,6 +24,7 @@ $list_domains = list_domains(); if ($_SERVER['REQUEST_METHOD'] == "GET") { $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain']; + $domain_key = array_search($domain, array_column($list_domains, 'domain')); $dbh = connect_db(); $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10"); $sth->bindParam(1, $domain, PDO::PARAM_STR); diff --git a/list-virtuals.php b/list-virtuals.php index b10de07..6683e3c 100644 --- a/list-virtuals.php +++ b/list-virtuals.php @@ -14,14 +14,13 @@ // list_alias // list_mailbox // -// Form GET Variables: +// Form POST \ GET Variables: // // domain // offset // require_once './functions.inc.php'; include './languages/' . check_language() . '.lang'; -include './templates/header.tpl'; $SESSID_USERNAME = check_session(); $list_domains = list_domains($SESSID_USERNAME); @@ -34,10 +33,11 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { $domain_key = array_search($domain, array_column($list_domains, 'domain')); $list_alias = list_aliases($domain, $offset, $limit); $list_mailbox = list_mailboxes($domain, $offset, $limit); - $template = "list-virtual.tpl"; - include './templates/menu.tpl'; - include './templates/list-virtuals.tpl'; } } + +include './templates/header.tpl'; +include './templates/menu.tpl'; +include './templates/list-virtuals.tpl'; include './templates/footer.tpl'; ?> diff --git a/password.php b/password.php index 4284426..d03a0e0 100644 --- a/password.php +++ b/password.php @@ -19,8 +19,6 @@ // fPassword // fPassword2 // -require("./variables.inc.php"); -require("./config.inc.php"); require("./functions.inc.php"); include("./languages/" . check_language() . ".lang"); diff --git a/sendmail.php b/sendmail.php index f89cf76..b683444 100644 --- a/sendmail.php +++ b/sendmail.php @@ -22,8 +22,6 @@ // fSubject // fBody // -require("./variables.inc.php"); -require("./config.inc.php"); require("./functions.inc.php"); include("./languages/" . check_language() . ".lang"); diff --git a/templates/add-alias.tpl b/templates/add-alias.tpl index 28b655d..bca4f98 100644 --- a/templates/add-alias.tpl +++ b/templates/add-alias.tpl @@ -12,7 +12,7 @@ " . $row['domain'] . "\n"; } ?> diff --git a/templates/add-mailbox.tpl b/templates/add-mailbox.tpl index 35306c5..96286bf 100644 --- a/templates/add-mailbox.tpl +++ b/templates/add-mailbox.tpl @@ -12,7 +12,7 @@ " . $row['domain'] . "\n"; } ?> diff --git a/templates/admin_list-domain.tpl b/templates/admin_list-domain.tpl index 2338630..366f82f 100644 --- a/templates/admin_list-domain.tpl +++ b/templates/admin_list-domain.tpl @@ -5,7 +5,7 @@ if (count($list_admins) > 0) { foreach ($list_admins as $row) { echo '\n"; } } diff --git a/templates/admin_list-virtual.tpl b/templates/admin_list-virtual.tpl index 0bce685..6688e7d 100644 --- a/templates/admin_list-virtual.tpl +++ b/templates/admin_list-virtual.tpl @@ -5,7 +5,7 @@ if (count($list_domains) > 0) { foreach ($list_domains as $row) { echo '\n"; } } @@ -16,8 +16,8 @@ if (count($list_domains) > 0) {

-

-

+

+

@@ -25,18 +25,18 @@ if (count($list_domains) > 0) { $limit || $list_domains[$selected_domain]['mailbox_count'] > $limit) { +if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) { echo "
\n"; if ($offset >= $limit) { - echo "\n"; + echo "\n"; } - if (($list_domains[$selected_domain]['alias_count'] > $limit) || ($list_domains[$selected_domain]['mailbox_count'] > $limit)) { + if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) { - echo "\n"; + echo "\n"; } - if ((($offset + $limit) < $list_domains[$selected_domain]['alias_count']) || (($offset + $limit) < $list_domains[$selected_domain]['mailbox_count'])) { - echo "\n"; + if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) { + echo "\n"; } echo "
\n"; } @@ -57,8 +57,8 @@ if (count($list_alias) > 0) { echo " " . $row['address'] . "\n"; echo " " . preg_replace("/,/", "
", $row['goto']) . "\n"; echo " " . $row['modified'] . "\n"; - echo " " . $LANG['edit'] . "\n"; - echo " " . $LANG['del'] . "\n"; + echo " " . $LANG['edit'] . "\n"; + echo " " . $LANG['del'] . "\n"; echo " \n"; } echo "\n"; @@ -81,8 +81,8 @@ if (count($list_mailbox) > 0) { echo " " . $row['username'] . "\n"; echo " " . $row['name'] . "\n"; echo " " . $row['modified'] . "\n"; - echo " " . $LANG['edit'] . "\n"; - echo " " . $LANG['del'] . "\n"; + echo " " . $LANG['edit'] . "\n"; + echo " " . $LANG['del'] . "\n"; echo " \n"; } echo "\n"; diff --git a/templates/create-alias.tpl b/templates/create-alias.tpl deleted file mode 100644 index bf573c0..0000000 --- a/templates/create-alias.tpl +++ /dev/null @@ -1,35 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - -

- -
-
diff --git a/templates/create-mailbox.tpl b/templates/create-mailbox.tpl deleted file mode 100644 index 2c69af0..0000000 --- a/templates/create-mailbox.tpl +++ /dev/null @@ -1,65 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - -
 
 
 
- -
diff --git a/templates/list-virtuals.tpl b/templates/list-virtuals.tpl index 4c3327e..839685c 100644 --- a/templates/list-virtuals.tpl +++ b/templates/list-virtuals.tpl @@ -5,7 +5,7 @@ if (count($list_domains) > 0) { foreach ($list_domains as $row) { echo '\n"; } } @@ -63,22 +63,10 @@ if (count($list_alias) > 0) { echo " " . $row['address'] . "\n"; echo " " . preg_replace("/,/", "
", $row['goto']) . "\n"; echo " " . $row['modified'] . "\n"; - - if ($CONF['special_alias_control'] == 'YES') { - echo " " . $LANG['edit'] . "\n"; - echo " " . $LANG['del'] . "\n"; - } else { - if (!in_array($row['goto'], $CONF['default_aliases'])) { - echo " " . $LANG['edit'] . "\n"; - echo " " . $LANG['del'] . "\n"; - } else { - echo "  \n"; - echo "  \n"; - } - } + echo " " . $LANG['edit'] . "\n"; + echo " " . $LANG['del'] . "\n"; echo " \n"; } - echo "\n"; } @@ -91,7 +79,6 @@ if (count($list_mailbox) > 0) { echo " " . $LANG['Overview_mailbox_username'] . "\n"; echo " " . $LANG['Overview_mailbox_name'] . "\n"; echo " " . $LANG['Overview_mailbox_modified'] . "\n"; - echo " " . $LANG['Overview_mailbox_active'] . "\n"; echo "  \n"; echo " \n"; @@ -100,8 +87,8 @@ if (count($list_mailbox) > 0) { echo " " . $row['username'] . "\n"; echo " " . $row['name'] . "\n"; echo " " . $row['modified'] . "\n"; - echo " " . $LANG['edit'] . "\n"; - echo " " . $LANG['del'] . "\n"; + echo " " . $LANG['edit'] . "\n"; + echo " " . $LANG['del'] . "\n"; echo " \n"; } echo "\n"; diff --git a/templates/menu.tpl b/templates/menu.tpl index cc43a3a..8e65d72 100644 --- a/templates/menu.tpl +++ b/templates/menu.tpl @@ -1,8 +1,8 @@