commit - 461ed9a53b7c9de7dff3b543bb45460bee4cb085
commit + cd5bb241228d4ed5f649ce32d88edaca1d8c6845
blob - /dev/null
blob + 031d7f3f77f0a683f9e972c92275303d3700533f (mode 644)
--- /dev/null
+++ admin/add-alias.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// 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'] . "<br />($from -> $goto)</br />";
+ $address = '';
+ $goto = '';
+ } catch(PDOException $e) {
+ $message = $PALANG['pCreate_alias_result_error'] . "<br />($from -> $goto) - $e<br />";
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/add-alias.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + f8561449f63eb83ab47b0a06ef2e7d138451af73 (mode 644)
--- /dev/null
+++ admin/add-domain.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-domain.php
+//
+// Template File: admin_create-domain.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tDomain
+// tDescription
+// tAliases
+// tMailboxes
+// tMaxquota
+// tDefaultaliases
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+// fDescription
+// fAliases
+// fMailboxes
+// fMaxquota
+// fDefaultaliases
+//
+require_once '../functions.inc.php';
+include '../languages/' . check_language() . '.lang';
+
+$list_domains = list_domains();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT) ?? 'new';
+ if ($action == 'edit') {
+ $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
+ $domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $description = $list_domains[$domain_key]['description'];
+ $aliases = $list_domains[$domain_key]['aliases'];
+ $mailboxes = $list_domains[$domain_key]['mailboxes'];
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT) ?? 'new';
+ $domain = strtolower(filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN));
+ $description = filter_input(INPUT_POST, 'description', FILTER_CALLBACK, array('options' => 'htmlspecialchars'));
+ $aliases = filter_input(INPUT_POST, 'aliases', FILTER_VALIDATE_INT);
+ $mailboxes = filter_input(INPUT_POST, 'mailboxes', FILTER_VALIDATE_INT);
+
+ if (!in_array($domain, array_column($list_domains, 'domain'))) {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("INSERT INTO domain (domain,description,aliases,mailboxes,created,modified) VALUES (?,?,?,?,NOW(),NOW())");
+ $sth->bindParam(1, $domain, PDO::PARAM_STR);
+ $sth->bindParam(2, $description, PDO::PARAM_STR);
+ $sth->bindParam(3, $aliases, PDO::PARAM_INT);
+ $sth->bindParam(4, $mailboxes, PDO::PARAM_INT);
+ $sth->execute();
+ $message = $PALANG['pAdminCreate_domain_result_succes'] . "<br />($domain)</br />";
+ } catch(PDOException $e) {
+ $message = $PALANG['pAdminCreate_domain_result_error'] . "<br />($domain)<br />";
+ }
+ } else {
+ $message = $PALANG['pAdminCreate_domain_domain_text_error'];
+ }
+
+ if (in_array($domain, array_column($list_domains, 'domain')) && $action == 'edit') {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("UPDATE domain SET description=?,aliases=?,mailboxes=?,modified=NOW() WHERE domain=?");
+ $sth->bindParam(1, $description, PDO::PARAM_STR);
+ $sth->bindParam(2, $aliases, PDO::PARAM_INT);
+ $sth->bindParam(3, $mailboxes, PDO::PARAM_INT);
+ $sth->bindParam(4, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ header("Location: list-domain.php");
+ } catch(PDOException $e) {
+ $message = $PALANG['pAdminEdit_domain_result_error'];
+ }
+ }
+}
+
+include '../templates/header.tpl';
+include '../templates/admin_menu.tpl';
+include '../templates/admin_add-domain.tpl';
+include '../templates/footer.tpl';
+?>
blob - /dev/null
blob + 1de342c7ec278152528ff3e1781203a60a5f4d67 (mode 644)
--- /dev/null
+++ admin/add-mailbox.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// 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:
+//
+// username
+// fPassword
+// fPassword2
+// fName
+// fQuota
+// domain
+// fActive
+// fMail
+//
+require_once("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+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);
+ $password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT);
+ $name = filter_input(INPUT_POST, 'name', FILTER_DEFAULT);
+
+ $domain_key = array_search($domain, array_column($list_domains, 'domain'));
+
+ $from = filter_var($username . '@' . $domain, FILTER_VALIDATE_EMAIL);
+
+ if ($list_domains[$domain_key]['mailbox_count'] < 0 || $list_domains[$domain_key]['mailbox_count'] >= $list_domains[$domain_key]['mailboxes']) {
+ $message = $PALANG['pCreate_mailbox_username_text_error3'];
+ }
+
+ if (empty($username)) {
+ $message = $PALANG['pCreate_mailbox_username_text_error1'];
+ }
+
+ if (empty($password1) or ($password1 != $password2)) {
+ $message = $PALANG['pCreate_mailbox_password_text_error'];
+ }
+
+ if (empty($message)) {
+ $hashed = bcrypt($password1);
+ $maildir = $from . "/";
+
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("INSERT INTO alias (address,goto,domain,created,modified) VALUES (?,'vmail',?,NOW(),NOW())");
+ $sth->bindParam(1, $from, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $username = '';
+ } catch(PDOException $e) {
+ $message = $PALANG['pCreate_alias_result_error'] . "<br />($from) - $e<br />";
+ }
+
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("INSERT INTO mailbox (username,password,name,maildir,domain,created,modified) VALUES (?,?,?,?,?,NOW(),NOW())");
+ $sth->bindParam(1, $from, PDO::PARAM_STR);
+ $sth->bindParam(2, $hashed, PDO::PARAM_STR);
+ $sth->bindParam(3, $name, PDO::PARAM_STR);
+ $sth->bindParam(4, $maildir, PDO::PARAM_STR);
+ $sth->bindParam(5, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ logging(ADMIN_EMAIL, $domain, "create mailbox", "$from");
+ $message = $PALANG['pCreate_mailbox_result_succes'] . "<br />($from)";
+ $username = '';
+ $name = '';
+ } catch(PDOException $e) {
+ $message = $PALANG['pCreate_alias_result_error'] . "<br />($from) - $e<br />";
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/add-mailbox.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 4896fadb2f7372db81f0559c18a63e0f0e8e6270 (mode 644)
--- /dev/null
+++ admin/list-virtual.php-orig
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: list-virtual.php
+//
+// Template File: admin_list-virtual.tpl
+//
+// Template Variables:
+//
+// list_alias
+// list_mailbox
+//
+// Form GET Variables:
+//
+// domain
+// offset
+//
+require_once '../functions.inc.php';
+include '../languages/' . check_language() . '.lang';
+
+$list_domains = list_domains();
+
+$dbh = new PDO(DB_TYPE . ':host='. DB_HOST . ';dbname='. DB_NAME , DB_USER, DB_PASS);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $offset = filter_input(INPUT_GET, 'offset', FILTER_VALIDATE_INT) ?? '0';
+ $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'));
+
+ if ($CONF['alias_control'] == "NO") {
+ $sth = $dbh->prepare("SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain=? AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT ?, ?");
+ } else {
+ $sth = $dbh->prepare("SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain=? ORDER BY alias.address LIMIT ?, ?");
+ }
+
+ $sth->bindParam(1, $domain, PDO::PARAM_STR);
+ $sth->bindParam(2, $offset, PDO::PARAM_INT);
+ $sth->bindParam(3, $limit, PDO::PARAM_INT);
+ $sth->execute();
+ $list_alias = $sth->fetchAll();
+
+ $sth = $dbh->prepare("SELECT * FROM mailbox WHERE domain=? ORDER BY username LIMIT ?, ?");
+ $sth->bindParam(1, $domain, PDO::PARAM_STR);
+ $sth->bindParam(2, $offset, PDO::PARAM_INT);
+ $sth->bindParam(3, $limit, PDO::PARAM_INT);
+ $sth->execute();
+ $list_mailbox = $sth->fetchAll();
+ }
+}
+include '../templates/header.tpl';
+include '../templates/admin_menu.tpl';
+include '../templates/admin_list-virtual.tpl';
+include '../templates/footer.tpl';
+?>
blob - /dev/null
blob + c30f2e5bf70d48db4ca99d41632bcc2b788a5d28 (mode 644)
--- /dev/null
+++ conf.php-sample
+<?php
+define('DEBUG', 'true');
+define('PAGE_SIZE', '10');
+
+define('DB_TYPE', 'mysql');
+define('DB_HOST', '');
+define('DB_USER', '');
+define('DB_PASS', '');
+define('DB_NAME', '');
+
+define('ADMIN_EMAIL', 'postmaster@example.tld');
+
+define('LOGGING', 'YES');
+define('ALIASES', '10');
+define('MAILBOXES', '10');
+define('ALIAS_CONTROL', 'NO');
+?>
blob - /dev/null
blob + 04bfc12e9fe74e52db8e56903980de0e45a15200 (mode 644)
--- /dev/null
+++ list-domains.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: overview.php
+//
+// Template File: overview.tpl
+//
+// Template variables:
+//
+// list_domains
+//
+// GET / POST variables:
+//
+// -none-
+//
+require_once './functions.inc.php';
+include './languages/' . check_language() . '.lang';
+include './templates/header.tpl';
+include './templates/menu.tpl';
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains($SESSID_USERNAME);
+
+include './templates/list-domains.tpl';
+include './templates/footer.tpl';
+?>
blob - /dev/null
blob + b10de07cab0b29113833827477611ba24c3fe7f0 (mode 644)
--- /dev/null
+++ list-virtuals.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: list-virtual.php
+//
+// Template File: list-virtual.tpl
+//
+// Template Variables:
+//
+// list_alias
+// list_mailbox
+//
+// Form 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);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $offset = filter_input(INPUT_GET, 'offset', FILTER_VALIDATE_INT) ?? '0';
+ $limit = PAGE_SIZE;
+ $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
+ if (in_array($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);
+ $template = "list-virtual.tpl";
+ include './templates/menu.tpl';
+ include './templates/list-virtuals.tpl';
+ }
+}
+include './templates/footer.tpl';
+?>
blob - /dev/null
blob + afa5760edb5221eddb9e353cafea209823bf27ca (mode 644)
--- /dev/null
+++ templates/add-alias.tpl
+<div id="edit_form">
+<form name="create_alias" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php echo $PALANG['pCreate_alias_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pCreate_alias_address']; ?></td>
+ <td><input class="flat" type="text" name="address" value="<?php echo $address ?? ''; ?>" /></td>
+ <td>
+ <select name="domain">
+ <?php
+ foreach ($list_domains as $row) {
+ echo '<option value="' . $row['domain'] . '"';
+ if (isset($domain) && $domain == $row['domain']) echo ' selected';
+ echo ">" . $row['domain'] . "</option>\n";
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pCreate_alias_goto'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="goto" value="<?php echo $goto ?? ''; ?>" /></td>
+ <td><?php echo $PALANG['pCreate_alias_goto_text']; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $PALANG['pCreate_alias_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php echo $message ?? ' '; ?></td>
+ </tr>
+</table>
+</div>
blob - /dev/null
blob + 93bdcd0f6f15817c77c549d4eeeeafaafa9eda8c (mode 644)
--- /dev/null
+++ templates/add-mailbox.tpl
+<div id="edit_form">
+<form name="create_mailbox" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pCreate_mailbox_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_username'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="username" value="<?php print $username ?? ''; ?>" /></td>
+ <td>
+ <select name="domain">
+ <?php
+ foreach ($list_domains as $row) {
+ echo '<option value="' . $row['domain'] . '"';
+ if (isset($domain) && $domain == $row['domain']) echo ' selected';
+ echo ">" . $row['domain'] . "</option>\n";
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="password1" /></td>
+ <td><?php print $PALANG['pCreate_mailbox_password_text']; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="password2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_name'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="name" value="<?php print $name ?? ''; ?>" /></td>
+ <td><?php print $PALANG['pCreate_mailbox_name_text']; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pCreate_mailbox_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $message ?? ' '; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 2071a1deb21236a255047a0ac732f7d12d84692d (mode 644)
--- /dev/null
+++ templates/admin_add-domain.tpl
+<div id="edit_form">
+<form name="create_domain" method="post">
+<table>
+ <tr>
+ <?php if ($action == 'edit') { ?>
+ <td colspan="3"><h3><?php print $PALANG['pAdminEdit_domain_welcome']; ?></h3></td>
+ <?php } else { ?>
+ <td colspan="3"><h3><?php echo $PALANG['pAdminCreate_domain_welcome']; ?></h3></td>
+ <?php } ?>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_domain'] . ":"; ?></td>
+ <?php if ($action == 'edit') { ?>
+ <td><input class="flat" type="hidden" name="domain" value="<?php echo $domain ?? ''; ?>" /><?php print $domain; ?></td>
+ <?php } else { ?>
+ <td><input class="flat" type="text" name="domain" value="<?php echo $domain ?? ''; ?>" /></td>
+ <td> </td>
+ <?php } ?>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_description'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="description" value="<?php echo $description ?? ''; ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_aliases'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="aliases" value="<?php echo $aliases ?? ALIASES; ?>" /></td>
+ <td><?php echo $PALANG['pAdminCreate_domain_aliases_text']; ?></td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_mailboxes'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="mailboxes" value="<?php echo $mailboxes ?? MAILBOXES; ?>" /></td>
+ <td><?php echo $PALANG['pAdminCreate_domain_mailboxes_text']; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $PALANG['pAdminCreate_domain_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php echo $message ?? ' '; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 2071a1deb21236a255047a0ac732f7d12d84692d (mode 644)
--- /dev/null
+++ templates/admin_domain.tpl
+<div id="edit_form">
+<form name="create_domain" method="post">
+<table>
+ <tr>
+ <?php if ($action == 'edit') { ?>
+ <td colspan="3"><h3><?php print $PALANG['pAdminEdit_domain_welcome']; ?></h3></td>
+ <?php } else { ?>
+ <td colspan="3"><h3><?php echo $PALANG['pAdminCreate_domain_welcome']; ?></h3></td>
+ <?php } ?>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_domain'] . ":"; ?></td>
+ <?php if ($action == 'edit') { ?>
+ <td><input class="flat" type="hidden" name="domain" value="<?php echo $domain ?? ''; ?>" /><?php print $domain; ?></td>
+ <?php } else { ?>
+ <td><input class="flat" type="text" name="domain" value="<?php echo $domain ?? ''; ?>" /></td>
+ <td> </td>
+ <?php } ?>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_description'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="description" value="<?php echo $description ?? ''; ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_aliases'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="aliases" value="<?php echo $aliases ?? ALIASES; ?>" /></td>
+ <td><?php echo $PALANG['pAdminCreate_domain_aliases_text']; ?></td>
+ </tr>
+ <tr>
+ <td><?php echo $PALANG['pAdminCreate_domain_mailboxes'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="mailboxes" value="<?php echo $mailboxes ?? MAILBOXES; ?>" /></td>
+ <td><?php echo $PALANG['pAdminCreate_domain_mailboxes_text']; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $PALANG['pAdminCreate_domain_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php echo $message ?? ' '; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + a91dc97f799e6e8205bea764cf3046860352e1f8 (mode 644)
--- /dev/null
+++ templates/list-domains.tpl
+<div id="overview">
+<form name="search" method="post" action="search.php">
+Search: <input type="textbox" name="search" size="25">
+</form>
+</div>
+<?php
+echo "<table id=\"overview_table\">\n";
+echo " <tr>\n";
+echo " <td colspan=\"5\"><h3>".$PALANG['pOverview_title']."</h3></td>";
+echo " </tr>";
+echo " <tr class=\"header\">\n";
+echo " <td>" . $PALANG['pOverview_get_domain'] . "</td>\n";
+echo " <td>" . $PALANG['pOverview_get_aliases'] . "</td>\n";
+echo " <td>" . $PALANG['pOverview_get_mailboxes'] . "</td>\n";
+echo " </tr>\n";
+foreach ($list_domains as $row) {
+ if ($row['aliases'] == 0) $row['aliases'] = $PALANG['pOverview_unlimited'];
+ if ($row['mailboxes'] == 0) $row['mailboxes'] = $PALANG['pOverview_unlimited'];
+ if ($row['aliases'] < 0) $row['aliases'] = $PALANG['pOverview_disabled'];
+ if ($row['mailboxes'] < 0) $row['mailboxes'] = $PALANG['pOverview_disabled'];
+ echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ echo " <td><a href=\"list-virtuals.php?domain=" . $row['domain'] . "\">" . $row['domain'] . "</a></td>\n";
+ echo " <td>" . $row['alias_count'] . " / " . $row['aliases'] . "</td>\n";
+ echo " <td>" . $row['mailbox_count'] . " / " . $row['mailboxes'] . "</td>\n";
+ echo " </tr>\n";
+}
+echo "</table>\n";
+?>
blob - /dev/null
blob + 54fc7f6c8c2b96307b10aa3acc504f8e64cd8bb9 (mode 644)
--- /dev/null
+++ templates/list-virtuals.tpl
+<div id="overview">
+<form name="select_domain" method="get">
+<select name="domain" onChange="this.form.submit()";>
+<?php
+if (count($list_domains) > 0) {
+ foreach ($list_domains as $row) {
+ echo '<option value="' . $row['domain'] . '"';
+ if (isset($domain) && $domain == $row['domain']) echo ' selected';
+ echo ">" . $row['domain'] . "</option>\n";
+ }
+}
+if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['aliases'] = $PALANG['pOverview_unlimited'];
+if ($list_domains[$domain_key]['aliases'] < 0) $list_domains[$domain_key]['aliases'] = $PALANG['pOverview_disabled'];
+if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $PALANG['pOverview_unlimited'];
+if ($list_domains[$domain_key]['mailboxes'] < 0) $list_domains[$domain_key]['mailboxes'] = $PALANG['pOverview_disabled'];
+if ($list_domains[$domain_key]['maxquota'] == 0) $list_domains[$domain_key]['maxquota'] = $PALANG['pOverview_unlimited'];
+if ($list_domains[$domain_key]['maxquota'] < 0) $list_domains[$domain_key]['maxquota'] = $PALANG['pOverview_disabled'];
+?>
+</select>
+<input type="hidden" name="offset" value="0">
+<input class="button" type="submit" name="go" value="<?php echo $PALANG['pOverview_button']; ?>" />
+</form>
+
+<h4><?php echo $PALANG['pOverview_welcome'] . $domain; ?></h4>
+<p><?php echo $PALANG['pOverview_alias_alias_count'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases']; ?></p>
+<p><?php echo $PALANG['pOverview_alias_mailbox_count'] . ": " . $list_domains[$domain_key]['mailbox_count'] . " / " . $list_domains[$domain_key]['mailboxes']; ?></p>
+
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search" size="25">
+</form>
+</div>
+<?php
+if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) {
+ echo "<div id=\"nav_bar\">\n";
+ if ($offset >= $limit) {
+
+ echo "<a href=\"overview.php?domain=" . $_GET['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\"></a>\n";
+ }
+ if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) {
+
+ echo "<a href=\"overview.php?domain=" . $_GET['domain'] . "&offset=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\"></a>\n";
+ }
+ if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) {
+ echo "<a href=\"overview.php?domain=" . $_GET['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\"></a>\n";
+ }
+ echo "</div>\n";
+}
+
+if (count($list_alias) > 0) {
+ echo "<table id=\"alias_table\">\n";
+ echo " <tr>\n";
+ echo " <td colspan=\"5\"><h3>".$PALANG['pOverview_alias_title']."</h3></td>";
+ echo " </tr>";
+ echo " <tr class=\"header\">\n";
+ echo " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
+ echo " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
+ echo " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
+ echo " <td colspan=\"2\"> </td>\n";
+ echo " </tr>\n";
+
+ foreach ($list_alias as $row) {
+ echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ echo " <td>" . $row['address'] . "</td>\n";
+ echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>\n";
+ echo " <td>" . $row['modified'] . "</td>\n";
+
+ if ($CONF['special_alias_control'] == 'YES') {
+ echo " <td><a href=\"edit-alias.php?address=" . urlencode($row['address']) . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ echo " <td><a href=\"delete.php?delete=" . urlencode($row['address']) . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $row['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ } else {
+ if (!in_array($row['goto'], $CONF['default_aliases'])) {
+ echo " <td><a href=\"edit-alias.php?address=" . urlencode($row['address']) . "&domain=" . $row['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ echo " <td><a href=\"delete.php?delete=" . urlencode($row['address']) . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $row['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ } else {
+ echo " <td> </td>\n";
+ echo " <td> </td>\n";
+ }
+ }
+ echo " </tr>\n";
+ }
+
+ echo "</table>\n";
+}
+
+if (count($list_mailbox) > 0) {
+ echo "<table id=\"mailbox_table\">\n";
+ echo " <tr>\n";
+ echo " <td colspan=\"7\"><h3>".$PALANG['pOverview_mailbox_title']."</h3></td>";
+ echo " </tr>";
+ echo " <tr class=\"header\">\n";
+ echo " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
+ echo " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
+ echo " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
+ echo " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
+ echo " <td colspan=\"2\"> </td>\n";
+ echo " </tr>\n";
+
+ foreach ($list_mailbox as $row) {
+ echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ echo " <td>" . $row['username'] . "</td>\n";
+ echo " <td>" . $row['name'] . "</td>\n";
+ echo " <td>" . $row['modified'] . "</td>\n";
+ $active = ($row['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ echo " <td><a href=\"edit-active.php?username=" . urlencode($row['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+ echo " <td><a href=\"edit-mailbox.php?username=" . urlencode($row['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ echo " <td><a href=\"delete.php?delete=" . urlencode($row['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ echo " </tr>\n";
+ }
+ echo "</table>\n";
+}
+?>