commit - 91a50b5119b24205f634c33d83ef9e2b4e94646d
commit + 826796d1612618f6edef40bf344e83e70da2a378
blob - f596135405f2ecd8c1dff449a0fff46c68d4a884
blob + 6deb5e9852bfa424c9867e7bf155b249a3433905
--- add-alias.php
+++ add-alias.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$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'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
$from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL);
if (!str_contains($goto, '@')) {
$message = $LANG['Create_alias_address_text_error1'];
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("INSERT INTO alias (address,goto,domain,created,modified) VALUES (?,?,?,NOW(),NOW())");
blob - 0cedbe468ba4d9f8f3bfec125a792d8a1db25820
blob + a435ec2e2c48ed027b2587eb6bb4ab4829d354b8
--- add-mailbox.php
+++ add-mailbox.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$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'));
-
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
$from = filter_var($username . '@' . $domain, FILTER_VALIDATE_EMAIL);
if ($list_domains[$domain_key]['mailboxes'] != 0 && $list_domains[$domain_key]['mailbox_count'] >= $list_domains[$domain_key]['mailboxes']) {
$message = $LANG['Create_mailbox_password_text_error'];
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
$hashed = bcrypt($password1);
$maildir = $from . "/";
blob - 294e56589b62367aca06c0e9f05480cbd474ba5c
blob + 85ea0fb54974b8ce8c2fc728b8fdf8a3a0d6599a
--- admin/add-alias.php
+++ admin/add-alias.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$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'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
$from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL);
if (!str_contains($goto, '@')) {
$message = $LANG['Create_alias_address_text_error1'];
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("INSERT INTO alias (address,goto,domain,created,modified) VALUES (?,?,?,NOW(),NOW())");
blob - 95bf5159986ec9155e2e01491c9a833a64ec24ca
blob + df39f7677d4de5f231e8506790400b2184c90abb
--- admin/add-mailbox.php
+++ admin/add-mailbox.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$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'));
-
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
$from = filter_var($username . '@' . $domain, FILTER_VALIDATE_EMAIL);
if ($list_domains[$domain_key]['mailboxes'] != 0 && $list_domains[$domain_key]['mailbox_count'] >= $list_domains[$domain_key]['mailboxes']) {
$message = $LANG['Create_mailbox_password_text_error'];
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
$hashed = bcrypt($password1);
$maildir = $from . "/";
blob - 3ffa13e5f71e8f480397b030e9b444d42fca2e3c
blob + 3f1097d052e174f73af2431e1f32945c64c570ed
--- admin/delete.php
+++ admin/delete.php
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($_SERVER['REQUEST_METHOD'] == "GET") {
- $table = strtolower(filter_input(INPUT_GET, 'table', FILTER_DEFAULT));
+ $table = filter_input(INPUT_GET, 'table', FILTER_DEFAULT);
$delete = filter_input(INPUT_GET, 'delete', FILTER_DEFAULT);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- if ($table == "domain") {
+ if ($domain_exist && $table == "domain") {
try {
$dbh = connect_db();
$dbh->beginTransaction();
$dbh->commit();
header("Location: list-domain.php");
- exit;
} catch (RuntimeException $e) {
$message = $e->getMessage();
$dbh->rollBack();
$dbh->commit();
header("Location: list-admin.php");
- exit;
} catch (RuntimeException $e) {
$message = $e->getMessage();
$dbh->rollBack();
}
}
- if (($table == 'alias' || $table == 'mailbox') && in_array($domain, array_column($list_domains, 'domain'))) {
+ if ($domain_exist && ($table == 'alias' || $table == 'mailbox')) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("DELETE FROM alias WHERE address=? AND domain=?");
logging($admin, $domain, "delete alias", $delete);
header("Location: list-virtual.php?domain=$domain");
- exit;
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
$sth->bindParam(1, $delete, PDO::PARAM_STR);
$sth->bindParam(2, $domain, PDO::PARAM_STR);
$sth->execute();
-
header("Location: list-virtual.php?domain=$domain");
- exit;
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
blob - 1622f6f8c57769ad5b3184689db3ae6507ea16e0
blob + 03d550c2fb0306a1ac6134d3661bc69166b43766
--- admin/edit-alias.php
+++ admin/edit-alias.php
$address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- try {
- $dbh = connect_db();
- $sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
- $sth->bindParam(1, $address, PDO::PARAM_STR);
- $sth->bindParam(2, $domain, PDO::PARAM_STR);
- $sth->execute();
- $goto = $sth->fetch(PDO::FETCH_COLUMN);
- $goto = explode(',', $goto);
- } catch(PDOException $e) {
- $message = $LANG['Edit_alias_address_error'];
+ if ($domain_exist) {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
+ $sth->bindParam(1, $address, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $goto = $sth->fetch(PDO::FETCH_COLUMN);
+ $goto = explode(',', $goto);
+ } catch(PDOException $e) {
+ $message = $LANG['Edit_alias_address_error'];
+ }
}
}
$domain = strtolower(filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN));
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if (empty($goto)) {
$goto = array();
}
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?");
blob - 350f25d1ed76be281939270fbbd3c28b6e5d33ae
blob + 01e60dbaea9985658642113aabf09ac15c1352df
--- admin/edit-mailbox.php
+++ admin/edit-mailbox.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT));
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
+ $domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- try {
- $dbh = connect_db();
- $sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?");
- $sth->bindParam(1, $username, PDO::PARAM_STR);
- $sth->bindParam(2, $domain, PDO::PARAM_STR);
- $sth->execute();
- $mailbox_details = $sth->fetch();
- $name = $mailbox_details['name'];
- } catch(PDOException $e) {
- $message = $LANG['Edit_mailbox_login_error'];
+ if ($domain_exist) {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?");
+ $sth->bindParam(1, $username, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $mailbox_details = $sth->fetch();
+ $name = $mailbox_details['name'];
+ } catch(PDOException $e) {
+ $message = $LANG['Edit_mailbox_login_error'];
+ }
}
}
$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'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if ($password1 != $password2) {
$message = $LANG['Edit_mailbox_password_text_error'];
}
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("UPDATE mailbox SET name=?,modified=NOW() WHERE username=? AND domain=?");
blob - 40d9de400f98399bacb2cc84258ca448571766a1
blob + 574bd084c23499fefe0d58a7cdd8f351e4b1667d
--- admin/viewlog.php
+++ admin/viewlog.php
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);
- $sth->execute();
- $log = $sth->fetchAll();
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
+
+ if ($domain_exist) {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10");
+ $sth->bindParam(1, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $log = $sth->fetchAll();
+ }
}
include '../templates/header.tpl';
blob - 0b3bd426c576459c8b7481eae4e11eb9415a1d4d
blob + 7d753a9dbcb72afcf1ad471d4c9b4023b1c31ded
--- delete.php
+++ delete.php
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($_SERVER['REQUEST_METHOD'] == "GET") {
- $table = strtolower(filter_input(INPUT_GET, 'table', FILTER_DEFAULT));
+ $table = filter_input(INPUT_GET, 'table', FILTER_DEFAULT);
$delete = filter_input(INPUT_GET, 'delete', FILTER_DEFAULT);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- if (($table == 'alias' || $table == 'mailbox') && in_array($domain, array_column($list_domains, 'domain'))) {
+ if ($domain_exist && ($table == 'alias' || $table == 'mailbox')) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("DELETE FROM alias WHERE address=? AND domain=?");
logging($admin, $domain, "delete alias", $delete);
header("Location: list-virtual.php?domain=$domain");
- exit;
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
$sth = $dbh->prepare("DELETE FROM mailbox WHERE username=? AND domain=?");
$sth->bindParam(1, $delete, PDO::PARAM_STR);
$sth->bindParam(2, $domain, PDO::PARAM_STR);
+
+
+ $sth = $dbh->prepare("DELETE FROM mailbox WHERE username=? AND domain=?");
+ $sth->bindParam(1, $delete, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
$sth->execute();
if ($sth->rowCount() != 1) {
throw new RuntimeException('mailbox');
$sth->execute();
header("Location: list-virtual.php?domain=$domain");
- exit;
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
blob - 5a3333a88e1bc08540b2bd23ec499451fa5852ce
blob + 7ae5c6c366610e046129f43a2958879b54fc489d
--- edit-alias.php
+++ edit-alias.php
$address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- try {
- $dbh = connect_db();
- $sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
- $sth->bindParam(1, $address, PDO::PARAM_STR);
- $sth->bindParam(2, $domain, PDO::PARAM_STR);
- $sth->execute();
- $goto = $sth->fetch(PDO::FETCH_COLUMN);
- $goto = explode(',', $goto);
- } catch(PDOException $e) {
- $message = $LANG['Edit_alias_address_error'];
+ if ($domain_exist) {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
+ $sth->bindParam(1, $address, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $goto = $sth->fetch(PDO::FETCH_COLUMN);
+ $goto = explode(',', $goto);
+ } catch(PDOException $e) {
+ $message = $LANG['Edit_alias_address_error'];
+ }
}
}
$domain = strtolower(filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN));
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if (empty($goto)) {
$goto = array();
}
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?");
}
}
include './templates/header.tpl';
-include './templates/menu.tpl';
+include './templates/admin_menu.tpl';
include './templates/edit-alias.tpl';
include './templates/footer.tpl';
?>
blob - 88ade1ff74edfa0c44d3a3dee9a705283679fa32
blob + 6bddeb312dab0dc6519917902a62b1572d82ee6a
--- edit-mailbox.php
+++ edit-mailbox.php
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT));
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
+ $domain_key = array_search($domain, array_column($list_domains, 'domain'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
- try {
- $dbh = connect_db();
- $sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?");
- $sth->bindParam(1, $username, PDO::PARAM_STR);
- $sth->bindParam(2, $domain, PDO::PARAM_STR);
- $sth->execute();
- $mailbox_details = $sth->fetch();
- $name = $mailbox_details['name'];
- } catch(PDOException $e) {
- $message = $LANG['Edit_mailbox_login_error'];
+ if ($domain_exist) {
+ try {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?");
+ $sth->bindParam(1, $username, PDO::PARAM_STR);
+ $sth->bindParam(2, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $mailbox_details = $sth->fetch();
+ $name = $mailbox_details['name'];
+ } catch(PDOException $e) {
+ $message = $LANG['Edit_mailbox_login_error'];
+ }
}
}
$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'));
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if ($password1 != $password2) {
$message = $LANG['Edit_mailbox_password_text_error'];
}
}
- if (empty($message) && isset($domain_key)) {
+ if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("UPDATE mailbox SET name=?,modified=NOW() WHERE username=? AND domain=?");
}
}
include './templates/header.tpl';
-include './templates/menu.tpl';
+include './templates/admin_menu.tpl';
include './templates/edit-mailbox.tpl';
include './templates/footer.tpl';
?>
blob - /dev/null
blob + 8ac84c406fc2599205dd1ff7f4c695168af63bfb (mode 644)
--- /dev/null
+++ list-domain.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: list-domains.php
+//
+// Template File: list-domains.tpl
+//
+// Template variables:
+//
+// list_domains
+//
+// GET / POST variables:
+//
+// -none-
+//
+require_once './functions.inc.php';
+include './languages/' . check_language() . '.lang';
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains($SESSID_USERNAME);
+
+include './templates/header.tpl';
+include './templates/menu.tpl';
+include './templates/list-domain.tpl';
+include './templates/footer.tpl';
+?>
blob - /dev/null
blob + 9c79c8f92f1c6f71e1b97a1c72ce8f626405a914 (mode 644)
--- /dev/null
+++ list-virtual.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 POST \ GET Variables:
+//
+// domain
+// offset
+//
+require_once './functions.inc.php';
+include './languages/' . check_language() . '.lang';
+
+$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);
+ }
+}
+
+include './templates/header.tpl';
+include './templates/menu.tpl';
+include './templates/list-virtual.tpl';
+include './templates/footer.tpl';
+?>
blob - 8ee12b0ca66c22f057802eff876c8c0f8a90abd2
blob + 71745f57e1fbaee3114c992257e9e0d33f58598a
--- templates/main.tpl
+++ templates/main.tpl
<div id="main_menu">
<table>
<tr>
- <td nowrap><a target="_top" href="list-domains.php"><?php echo $LANG['Menu_overview']; ?></a></td>
+ <td nowrap><a target="_top" href="list-domain.php"><?php echo $LANG['Menu_overview']; ?></a></td>
<td><?php echo $LANG['Main_overview']; ?></td>
</tr>
<tr>
blob - 7fcbd94c4299f09b725e7b0b79dd81ab66775e32
blob + 0062735f1e8bd2666ac6b21d0d2d8326ba10f1aa
--- templates/search.tpl
+++ templates/search.tpl
echo " <td>" . preg_replace("/,/", "<br>", $tAlias[$i]['goto']) . "</td>\n";
echo " <td>" . $tAlias[$i]['modified'] . "</td>\n";
echo " <td><a href=\"edit-alias.php?address=" . $tAlias[$i]['address'] . "&domain=" . $tAlias[$i]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
- echo " <td><a href=\"delete.php?delete=" . $tAlias[$i]['address'] . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
+ echo " <td><a href=\"delete.php?table=alias&delete=" . $tAlias[$i]['address'] . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
}
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_mailbox_username'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_name'] . "</td>\n";
- if ($CONF['quota'] == 'YES') echo " <td>" . $LANG['Overview_mailbox_quota'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_modified'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_active'] . "</td>\n";
echo " <td colspan=\"2\"> </td>\n";
echo " <td>" . $tMailbox[$i]['username'] . "</td>\n";
echo " <td>" . $tMailbox[$i]['name'] . "</td>\n";
echo " <td><a href=\"edit-mailbox.php?username=" . $tMailbox[$i]['username'] . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
- echo " <td><a href=\"delete.php?delete=" . $tMailbox[$i]['username'] . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
+ echo " <td><a href=\"delete.php?table=mailbox&delete=" . $tMailbox[$i]['username'] . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
}
blob - 88aaef42e8d1214661425b757f41857cd579a2ab
blob + 33a8b1ea6dffb9d70aebc966cf047580a3605e59
--- templates/viewlog.tpl
+++ templates/viewlog.tpl
</form>
</div>
<?php
-if (count($log) > 0) {
+if (count($log ?? array()) > 0) {
echo "<table id=\"log_table\">\n";
echo " <tr>\n";
echo " <td colspan=\"5\"><h3>".$LANG['Viewlog_welcome']." ".$domain."</h3></td>\n";
blob - 2c848b9cf669e07daec9107c1e2ce6b9185ac821
blob + fdae458edd429d8f39778affdbbca728b41c23ca
--- viewlog.php
+++ viewlog.php
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);
- $sth->execute();
- $log = $sth->fetchAll();
+ $domain_exist = in_array($domain, array_column($list_domains, 'domain'));
+
+ if ($domain_exist) {
+ $dbh = connect_db();
+ $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10");
+ $sth->bindParam(1, $domain, PDO::PARAM_STR);
+ $sth->execute();
+ $log = $sth->fetchAll();
+ }
}
include './templates/header.tpl';