merge admin + superadmin

This commit is contained in:
mischa 2022-09-05 18:29:41 +00:00
parent 525cdfa64e
commit ff6266ff1d
48 changed files with 380 additions and 1362 deletions

View File

@ -16,7 +16,7 @@
// domain
// goto
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// address
// domain
@ -26,9 +26,16 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));

View File

@ -16,7 +16,7 @@
// name
// domain
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// username
// password1
@ -28,9 +28,16 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));

View File

@ -1,8 +0,0 @@
AuthUserFile /usr/local/www/mailadmin.high5.net/admin/.htpasswd
AuthGroupFile /dev/null
AuthName "Postfix Admin"
AuthType Basic
<limit GET POST>
require valid-user
</limit>

View File

@ -1,79 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: add-alias.php
//
// Template File: add-alias.tpl
//
// Template Variables:
//
// message
// address
// domain
// goto
//
// Form POST / GET Variables:
//
// address
// domain
// goto
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
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") {
$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'));
$domain_exist = in_array($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]['aliases'] != 0 && $list_domains[$domain_key]['alias_count'] >= $list_domains[$domain_key]['aliases']) {
$message = $LANG['Add_alias_address_text_error2'];
}
if (empty($address) || empty($goto)) {
$message = $LANG['Add_alias_address_text_error1'];
}
if ($domain_exist && empty($message)) {
try {
$dbh = pdo_connect();
$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, $domain, $LANG['Logging_alias_add'], "$from -> $goto");
$message = $LANG['Add_alias_result_succes'] . "<br />($from -> $goto)</br />";
$address = '';
$goto = '';
} catch(PDOException $e) {
$message = $LANG['Add_alias_result_error'] . "<br />($from -> $goto)<br />";
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/add-alias.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,98 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: add-mailbox.php
//
// Template File: add-mailbox.tpl
//
// Template Variables:
//
// message
// username
// name
// domain
//
// Form POST / GET Variables:
//
// username
// password1
// password2
// name
// domain
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
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") {
$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'));
$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['Add_mailbox_username_text_error3'];
}
if (empty($username)) {
$message = $LANG['Add_mailbox_username_text_error1'];
}
if (empty($password1) or ($password1 != $password2)) {
$message = $LANG['Add_mailbox_password_text_error'];
}
if ($domain_exist && empty($message)) {
$hashed = bcrypt($password1);
$maildir = $from . "/";
try {
$dbh = pdo_connect();
$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 = $LANG['Add_alias_result_error'] . "<br />($from) - $e<br />";
}
try {
$dbh = pdo_connect();
$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, $domain, $LANG['Logging_mailbox_add'], "$from");
$message = $LANG['Add_mailbox_result_succes'] . "<br />($from)";
$username = '';
$name = '';
} catch(PDOException $e) {
$message = $LANG['Add_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';
?>

View File

@ -1,135 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: admin.php
//
// Template File: admin_admin.tpl
//
//
// Template Variables:
//
// action
// message
// username
// domains
//
// Form POST / GET Variables:
//
// username
// password1
// password2
// domains
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$list_admins = list_admins();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT) ?? 'add';
if ($action == 'edit') {
$username = filter_input(INPUT_GET, 'username', FILTER_VALIDATE_EMAIL);
$domains['domains'] = array_column(list_domains($username), 'domain');
}
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT) ?? 'add';
$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 ($action == 'add') {
if (empty($username) || in_array($username, array_column($list_admins, 'username'))) {
$message = $LANG['AdminAdd_admin_username_error'];
}
if (empty($password1) || $password1 != $password2) {
$message = $LANG['AdminAdd_admin_password_error'];
}
if (empty($domains['domains'])) {
$message = $LANG['AdminAdd_admin_domain_error'];
}
if (empty($message)) {
$hashed = bcrypt($password1);
try {
$dbh = pdo_connect();
$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 = $LANG['AdminAdd_admin_result_succes'] . "<br />($username)</br />";
} catch(PDOException $e) {
$message = $LANG['AdminAdd_admin_result_error'] . "<br />($username)<br />";
}
}
}
if (in_array($username, array_column($list_admins, 'username')) && $action == 'edit') {
if ($password1 != $password2) {
$message = $LANG['AdminAdd_admin_password_error'];
}
if (empty($message) && !empty($password1)) {
$hashed = bcrypt($password1);
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("UPDATE admin SET password=?,modified=NOW() WHERE username=?");
$sth->bindParam(1, $hashed, PDO::PARAM_STR);
$sth->bindParam(2, $username, PDO::PARAM_STR);
$sth->execute();
} catch(PDOException $e) {
$message = $LANG['AdminEdit_admin_result_error'] . "<br />($username)<br />";
}
}
if (empty($domains['domains'])) {
$message = $LANG['AdminAdd_admin_domain_error'];
}
if (empty($message)) {
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("SELECT COUNT(*) FROM domain_admins WHERE username=?");
$sth->execute(array($username));
$count_domain_admins = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM domain_admins WHERE username=?");
$sth->execute(array($username));
if ($sth->rowCount() != $count_domain_admins) {
throw new RuntimeException('Unable to delete entries from the domain_admins table.');
}
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();
}
header("Location: list-admin.php");
} catch (RuntimeException $e) {
$message = $LANG['AdminEdit_admin_result_error'];
} catch (PDOException $e) {
$message = $LANG['AdminEdit_admin_result_error'];
}
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/admin_admin.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,68 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: backup.php
//
// Template File: -none-
//
// Template Variables:
//
// -none-
//
// Form POST / GET Variables:
//
// -none-
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
date_default_timezone_set('Europe/Amsterdam');
if ($_SERVER['REQUEST_METHOD'] == "GET") {
umask(077);
$filename = "opensmtpadmin-" . date("Ymd") . "-" . getmypid() . ".sql";
$backup = "/tmp" . $filename;
$header = "#\n# OpenSMTPD Admin " . VERSION . "\n# Date: " . date("D M j G:i:s T Y") . "\n#\n";
$tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation');
if (!$fh = fopen($backup, 'w')) {
$message = "<div class=\"error_msg\">Cannot open file ($backup)</div>";
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/message.tpl';
include '../templates/footer.tpl';
} else {
fwrite($fh, $header);
$dbh = pdo_connect();
foreach ($tables as $table) {
$sth = $dbh->query("SHOW CREATE TABLE $table");
$row = $sth->fetch(PDO::FETCH_ASSOC);
fwrite ($fh, $row['Create Table']. "\n\n");
}
foreach ($tables as $table) {
$sth = $dbh->query("SELECT * FROM $table");
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
foreach ($row as $k => $v) {
$keys[] = $k;
$values[] = $v;
}
fwrite($fh, "INSERT INTO ". $table . " (". implode (',',$keys) . ") VALUES ('" . implode ('\',\'',$values) . "')\n");
$keys = array();
$values = array();
}
}
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize("$backup"));
header("Content-Description: OpenSMTPD Admin");
$download_backup = fopen("$backup", "r");
unlink("$backup");
fpassthru($download_backup);
}
?>

View File

@ -1,193 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: delete.php
//
// Template File: message.tpl
//
// Template Variables:
//
// message
//
// Form POST / GET Variables:
//
// table
// where
// delete
// domain
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$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 ($domain_exist && $table == "domain") {
try {
$dbh = pdo_connect();
$dbh->beginTransaction();
$sth = $dbh->prepare("SELECT COUNT(*) FROM log WHERE domain=?");
$sth->execute(array($domain));
$count_log = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM log WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_log) {
throw new RuntimeException('Unable to delete entries from the logs table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM vacation WHERE domain=?");
$sth->execute(array($domain));
$count_vacation = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM vacation WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_vacation) {
throw new RuntimeException('Unable to delete entries from the vacation table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM alias WHERE domain=?");
$sth->execute(array($domain));
$count_alias = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM alias WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_alias) {
throw new RuntimeException('Unable to delete entries from the alias table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM mailbox WHERE domain=?");
$sth->execute(array($domain));
$count_mailbox = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM mailbox WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_mailbox) {
throw new RuntimeException('Unable to delete entries from the mailbox table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM domain_admins WHERE domain=?");
$sth->execute(array($domain));
$count_domain_admins = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM domain_admins WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_domain_admins) {
throw new RuntimeException('Unable to delete entries from the domain_admins table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM domain WHERE domain=?");
$sth->execute(array($domain));
$count_domain = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM domain WHERE domain=?");
$sth->execute(array($domain));
if ($sth->rowCount() != $count_domain) {
throw new RuntimeException('Unable to delete entry from the domain table.');
}
$dbh->commit();
header("Location: list-domain.php");
} catch (RuntimeException $e) {
$message = $e->getMessage();
$dbh->rollBack();
} catch (PDOException $e) {
$message = $e->getMessage();
}
}
if ($table == "admin") {
try {
$dbh = pdo_connect();
$dbh->beginTransaction();
$sth = $dbh->prepare("SELECT COUNT(*) FROM admin WHERE username=?");
$sth->execute(array($delete));
$count_admin = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM admin WHERE username=?");
$sth->execute(array($delete));
if ($sth->rowCount() != $count_admin) {
throw new RuntimeException('Unable to delete entry from the admin table.');
}
$sth = $dbh->prepare("SELECT COUNT(*) FROM domain_admins WHERE username=?");
$sth->execute(array($delete));
$count_domain_admins = $sth->fetchColumn();
$sth = $dbh->prepare("DELETE FROM domain_admins WHERE username=?");
$sth->execute(array($delete));
if ($sth->rowCount() != $count_domain_admins) {
throw new RuntimeException('Unable to delete entries from the domain_admins table.');
}
$dbh->commit();
header("Location: list-admin.php");
} catch (RuntimeException $e) {
$message = $e->getMessage();
$dbh->rollBack();
} catch (PDOException $e) {
$message = $e->getMessage();
$dbh->rollBack();
}
}
if ($domain_exist && ($table == 'alias' || $table == 'mailbox')) {
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("DELETE FROM alias WHERE address=? 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('alias');
}
logging($admin, $domain, $LANG['Logging_alias_delete'], $delete);
header("Location: list-virtual.php?domain=$domain");
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (alias)!</span> " . $e-getMessage();
}
try {
$dbh = pdo_connect();
$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');
}
logging($admin, $domain, $LANG['Logging_mailbox_delete'], $delete);
$sth = $dbh->prepare("DELETE FROM vacation WHERE email=? AND domain=?");
$sth->bindParam(1, $delete, PDO::PARAM_STR);
$sth->bindParam(2, $domain, PDO::PARAM_STR);
$sth->execute();
header("Location: list-virtual.php?domain=$domain");
} catch (RuntimeException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (" . $e->getMessage() . ")!</span>";
} catch (PDOException $e) {
$message = $LANG['Delete_delete_error'] . "<b>$delete</b> (mailbox)!</span>";
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/message.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,88 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: domain.php
//
// Template File: admin_domain.tpl
//
// Template Variables:
//
// action
// message
// domain
// description
// aliases
// mailboxes
//
// Form POST / GET Variables:
//
// domain
// description
// aliases
// mailboxes
//
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) ?? 'add';
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) ?? 'add';
$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 = pdo_connect();
$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 = $LANG['AdminAdd_domain_result_succes'] . "<br />($domain)</br />";
} catch(PDOException $e) {
$message = $LANG['AdminAdd_domain_result_error'] . "<br />($domain)<br />";
}
} else {
$message = $LANG['AdminAdd_domain_domain_text_error'];
}
if (in_array($domain, array_column($list_domains, 'domain')) && $action == 'edit') {
try {
$dbh = pdo_connect();
$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 = $LANG['AdminEdit_domain_result_error'];
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/admin_domain.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,93 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: edit-alias.php
//
// Template File: edit-alias.tpl
//
// Template Variables:
//
// message
// goto
//
// Form POST / GET Variables:
//
// address
// domain
// goto
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$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'));
if ($domain_exist) {
try {
$dbh = pdo_connect();
$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 ($_SERVER['REQUEST_METHOD'] == "POST") {
$address = strtolower(filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL));
$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();
$message = $LANG['Edit_alias_goto_text_error1'];
} else {
$goto = preg_replace('/\\\r\\\n/', ',', $goto);
$goto = preg_replace('/\r\n/', ',', $goto);
$goto = preg_replace('/[\s]+/i', '', $goto);
$goto = preg_replace('/\,*$/', '', $goto);
$validate_goto = explode(',', $goto);
foreach ($validate_goto as $row) {
if (!filter_var($row, FILTER_VALIDATE_EMAIL)) {
$goto = explode(',', $goto);
$message = $LANG['Edit_alias_goto_text_error2'] . "$row</div>";
}
}
}
if ($domain_exist && empty($message)) {
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?");
$sth->bindParam(1, $goto, PDO::PARAM_STR);
$sth->bindParam(2, $address, PDO::PARAM_STR);
$sth->bindParam(3, $domain, PDO::PARAM_STR);
$sth->execute();
logging($admin, $domain, $LANG['Logging_alias_edit'], "$address -> $goto");
header("Location: list-virtual.php?domain=$domain");
} catch(PDOException $e) {
$message = $LANG['Edit_alias_result_error'];
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/edit-alias.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,99 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: edit-mailbox.php
//
// Template File: edit-mailbox.tpl
//
// Template Variables:
//
// message
// name
//
// Form POST / GET Variables:
//
// username
// domain
// password1
// password2
// name
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
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'));
if ($domain_exist) {
try {
$dbh = pdo_connect();
$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 ($_SERVER['REQUEST_METHOD'] == "POST") {
$username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT));
$domain = filter_input(INPUT_GET, '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'));
$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) && !empty($password1)) {
$hashed = bcrypt($password1);
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("UPDATE mailbox SET password=?,name=?,modified=NOW() WHERE username=? AND domain=?");
$sth->bindParam(1, $hashed, PDO::PARAM_STR);
$sth->bindParam(2, $name, PDO::PARAM_STR);
$sth->bindParam(3, $username, PDO::PARAM_STR);
$sth->bindParam(4, $domain, PDO::PARAM_STR);
$sth->execute();
} catch(PDOException $e) {
$message = $LANG['Edit_mailbox_result_error'];
}
}
if ($domain_exist && empty($message)) {
try {
$dbh = pdo_connect();
$sth = $dbh->prepare("UPDATE mailbox SET name=?,modified=NOW() WHERE username=? AND domain=?");
$sth->bindParam(1, $name, PDO::PARAM_STR);
$sth->bindParam(2, $username, PDO::PARAM_STR);
$sth->bindParam(3, $domain, PDO::PARAM_STR);
$sth->execute();
logging($admin, $domain, $LANG['Logging_mailbox_edit'], $username);
header("Location: list-virtual.php?domain=$domain");
} catch(PDOException $e) {
$message = $LANG['Edit_mailbox_result_error'];
}
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/edit-mailbox.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,22 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: index.php
//
// Template File: -none-
//
// Template Variables:
//
// -none-
//
// Form POST / GET Variables:
//
// -none-
//
header ("Location: list-domain.php");
exit;
?>

View File

@ -1,29 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: list-admin.php
//
// Template File: list-admin.tpl
//
// Template Variables:
//
// list_admins
//
// Form POST / GET Variables:
//
// -none-
//
require '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_admins = list_admins();
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/admin_list-admin.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,36 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: list-domain.php
//
// Template File: admin_list-domain.tpl
//
// Template Variables:
//
// list_domains
//
// Form POST / GET Variables:
//
// username
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_admins = list_admins();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$username = filter_input(INPUT_GET, 'username', FILTER_VALIDATE_EMAIL);
$list_domains = list_domains($username);
} else {
$list_domains = list_domains();
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/admin_list-domain.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,42 +0,0 @@
<?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 POST / GET Variables:
//
// domain
// offset
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
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'];
$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/admin_menu.tpl';
include '../templates/admin_list-virtual.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,59 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: search.php
//
// Template File: search.tpl
//
// Template Variables:
//
// list_alias
// list_mailbox
//
// Form POST / GET Variables:
//
// search
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$search = filter_input(INPUT_POST, 'search', FILTER_DEFAULT);
if (isset($search)) {
$dbh = pdo_connect();
$sth = $dbh->prepare("SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE ? AND mailbox.maildir IS NULL ORDER BY alias.address");
$sth->bindValue(1, '%'.$search.'%', PDO::PARAM_STR);
$sth->execute();
$list_alias = $sth->fetchAll();
foreach ($list_alias as $key => $value) {
if (!in_array($value['domain'], array_column($list_domains, 'domain'))) {
unset($list_alias[$key]);
}
}
$sth = $dbh->prepare("SELECT * FROM mailbox WHERE username LIKE ? ORDER BY username");
$sth->bindValue(1, '%'.$search.'%', PDO::PARAM_STR);
$sth->execute();
$list_mailbox = $sth->fetchAll();
foreach ($list_mailbox as $key => $value) {
if (!in_array($value['domain'], array_column($list_domains, 'domain'))) {
unset($list_mailbox[$key]);
}
}
} else {
$list_alias = array();
$list_mailbox = array();
}
}
include '../templates/header.tpl';
include '../templates/admin_menu.tpl';
include '../templates/search.tpl';
include '../templates/footer.tpl';
?>

View File

@ -1,43 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: viewlog.php
//
// Template File: viewlog.tpl
//
// Template Variables:
//
// log
//
// Form POST / GET Variables:
//
// domain
//
require_once '../functions.inc.php';
include '../languages/' . check_language() . '.lang';
$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'));
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if ($domain_exist) {
$dbh = pdo_connect();
$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';
include '../templates/admin_menu.tpl';
include '../templates/viewlog.tpl';
include '../templates/footer.tpl';
?>

View File

@ -13,7 +13,7 @@
//
// message
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// table
// where

View File

@ -14,7 +14,7 @@
// message
// goto
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// address
// domain
@ -24,9 +24,16 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
@ -88,7 +95,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
}
}
include './templates/header.tpl';
include './templates/admin_menu.tpl';
include './templates/menu.tpl';
include './templates/edit-alias.tpl';
include './templates/footer.tpl';
?>

View File

@ -14,7 +14,7 @@
// message
// name
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// username
// domain
@ -26,9 +26,16 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT));
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
@ -94,7 +101,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
}
}
include './templates/header.tpl';
include './templates/admin_menu.tpl';
include './templates/menu.tpl';
include './templates/edit-mailbox.tpl';
include './templates/footer.tpl';
?>

View File

@ -43,6 +43,12 @@ function check_session($session = "sessid") {
return $_SESSION[$session]['username'];
}
function check_permissions($session = "sessid") {
if (!empty($_SESSION[$session]['rights'])) {
return $_SESSION[$session]['rights'];
}
}
//
// check_language
// Action: checks what language the browser uses

View File

@ -13,7 +13,7 @@
//
// -none-
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// -none-
//

View File

@ -11,49 +11,46 @@ $LANG['confirm'] = 'Are you sure you want to delete this?\n';
$LANG['confirm_domain'] = 'Do you really want to delete all records for this domain?\nThis can not be undone! ';
$LANG['check_update'] = 'Check for update';
$LANG['Login_welcome'] = 'Mail admins login here to administer your domain.';
$LANG['Login_welcome'] = 'Mail admins login here to administer your domain';
$LANG['Login_username'] = 'Login (email)';
$LANG['Login_password'] = 'Password';
$LANG['Login_button'] = 'Login';
$LANG['Login_incorrect'] = '<span class="error_msg">Your login or password is not correct.</span>';
$LANG['Login_login_users'] = 'Users click here to login to the user section.';
$LANG['Menu_overview'] = 'List Domains';
$LANG['Menu_create_alias'] = 'Add Alias';
$LANG['Menu_create_mailbox'] = 'Add Mailbox';
$LANG['Menu_list_domain'] = 'List Domains';
$LANG['Menu_list_virtual'] = 'List Virtuals';
$LANG['Menu_add_alias'] = 'Add Alias';
$LANG['Menu_add_mailbox'] = 'Add Mailbox';
$LANG['Menu_sendmail'] = 'Send Email';
$LANG['Menu_password'] = 'Password';
$LANG['Menu_viewlog'] = 'View Log';
$LANG['Menu_logout'] = 'Logout';
$LANG['Overview_disabled'] = 'Disabled';
$LANG['Overview_unlimited'] = 'Unlimited';
$LANG['Overview_title'] = ':: Defined Domains';
$LANG['Overview_up_arrow'] = 'Go Top';
$LANG['Overview_right_arrow'] = 'Next Page';
$LANG['Overview_left_arrow'] = 'Previus Page';
$LANG['Overview_alias_title'] = ':: Alias';
$LANG['Overview_mailbox_title'] = ':: Mailboxes';
$LANG['Overview_button'] = 'Go';
$LANG['Overview_welcome'] = 'Overview for ';
$LANG['Overview_alias_alias_count'] = 'Aliases';
$LANG['Overview_alias_mailbox_count'] = 'Mailboxes';
$LANG['Overview_alias_address'] = 'From';
$LANG['Overview_alias_goto'] = 'To';
$LANG['Overview_alias_modified'] = 'Last Modified';
$LANG['Overview_mailbox_username'] = 'Email';
$LANG['Overview_mailbox_name'] = 'Name';
$LANG['Overview_mailbox_modified'] = 'Last Modified';
$LANG['List_modified'] = 'Last Modified';
$LANG['List_button'] = 'Go';
$LANG['List_up_arrow'] = 'Top';
$LANG['List_right_arrow'] = 'Next Page';
$LANG['List_left_arrow'] = 'Previous Page';
$LANG['Overview_get_domain'] = 'Domain';
$LANG['Overview_get_aliases'] = 'Aliases';
$LANG['Overview_get_mailboxes'] = 'Mailboxes';
$LANG['Overview_get_modified'] = 'Last Modified';
$LANG['List_domain_domain'] = 'Domain';
$LANG['List_domain_description'] = 'Description';
$LANG['List_domain_aliases'] = 'Aliases';
$LANG['List_domain_mailboxes'] = 'Mailboxes';
$LANG['List_domain_unlimited'] = 'unlimited';
$LANG['List_virtual_welcome'] = 'Overview for ';
$LANG['List_virtual_alias_title'] = ':: Alias';
$LANG['List_virtual_alias_address'] = 'From';
$LANG['List_virtual_alias_goto'] = 'To';
$LANG['List_virtual_mailbox_title'] = ':: Mailboxes';
$LANG['List_virtual_mailbox_username'] = 'Email';
$LANG['List_virtual_mailbox_name'] = 'Name';
$LANG['Delete_delete_error'] = '<span class="error_msg">Unable to delete the entry ';
$LANG['Delete_domain_error'] = '<span class="error_msg">This domain is not yours ';
$LANG['Add_alias_welcome'] = 'Create a new alias for your domain.';
$LANG['Add_alias_welcome'] = 'Create a new alias for your domain';
$LANG['Add_alias_address'] = 'Alias';
$LANG['Add_alias_address_text_error1'] = '<span class="error_msg">The ALIAS or TO is not valid.</span>';
$LANG['Add_alias_address_text_error2'] = '<span class="error_msg">You have reached your limit to create aliases.</span>';
@ -64,7 +61,7 @@ $LANG['Add_alias_result_error'] = '<span class="error_msg">This email address al
$LANG['Add_alias_result_succes'] = 'The alias has been added to the alias table.';
$LANG['Add_alias_catchall_text'] = 'To create a catch-all use an "*" as alias.<br />For domain to domain forwarding use "*@domain.tld" as to.';
$LANG['Edit_alias_welcome'] = 'Edit an alias for your domain.<br />One entry per line.';
$LANG['Edit_alias_welcome'] = 'Edit an alias for your domain<br />one entry per line';
$LANG['Edit_alias_address'] = 'Alias';
$LANG['Edit_alias_address_error'] = '<span class="error_msg">Unable to locate alias.</span>';
$LANG['Edit_alias_goto'] = 'To';
@ -74,7 +71,7 @@ $LANG['Edit_alias_domain_error'] = '<span class="error_msg">This domain is not y
$LANG['Edit_alias_button'] = 'Edit Alias';
$LANG['Edit_alias_result_error'] = '<span class="error_msg">Unable to modify the alias.</span>';
$LANG['Add_mailbox_welcome'] = 'Create a new mailbox for your domain.';
$LANG['Add_mailbox_welcome'] = 'Create a new mailbox for your domain';
$LANG['Add_mailbox_username'] = 'Username';
$LANG['Add_mailbox_username_text_error1'] = '<span class="error_msg">The USERNAME is not valid.</span>';
$LANG['Add_mailbox_username_text_error2'] = '<span class="error_msg">This email address already exists, please choose a different one.</span>';
@ -90,7 +87,7 @@ $LANG['Add_mailbox_button'] = 'Add Mailbox';
$LANG['Add_mailbox_result_error'] = '<span class="error_msg">Unable to add the mailbox to the mailbox table.</span>';
$LANG['Add_mailbox_result_succes'] = 'The mailbox has been added to the mailbox table.';
$LANG['Edit_mailbox_welcome'] = 'Edit a mailbox for your domain.';
$LANG['Edit_mailbox_welcome'] = 'Edit a mailbox for your domain';
$LANG['Edit_mailbox_username'] = 'Username';
$LANG['Edit_mailbox_username_error'] = '<span class="error_msg">Unable to locate mailbox.</span>';
$LANG['Edit_mailbox_password'] = 'New Password';
@ -101,7 +98,7 @@ $LANG['Edit_mailbox_domain_error'] = '<span class="error_msg">This domain is not
$LANG['Edit_mailbox_button'] = 'Edit Mailbox';
$LANG['Edit_mailbox_result_error'] = '<span class="error_msg">Unable to modify the mailbox.</span>';
$LANG['Password_welcome'] = 'Change your login password.';
$LANG['Password_welcome'] = 'Change your login password';
$LANG['Password_admin'] = 'Login';
$LANG['Password_admin_text_error'] = '<span class="error_msg">The LOGIN that you supplied doesn\'t match a mailbox.</span>';
$LANG['Password_password_current'] = 'Current Password';
@ -122,7 +119,7 @@ $LANG['Viewlog_data'] = 'Data';
$LANG['Viewlog_button'] = 'Go';
$LANG['Viewlog_result_error'] = '<span class="error_msg">Unable to find the logs.</span>';
$LANG['Sendmail_welcome'] = 'Send an email.';
$LANG['Sendmail_welcome'] = 'Send an email';
$LANG['Sendmail_admin'] = 'From';
$LANG['Sendmail_to'] = 'To';
$LANG['Sendmail_to_text_error'] = '<span class="error_msg">TO is empty or is not a valid email address.</span>';
@ -136,7 +133,6 @@ $LANG['Sendmail_result_succes'] = 'The mailbox has been created.';
$LANG['AdminMenu_list_domain'] = 'List Domains';
$LANG['AdminMenu_list_admin'] = 'List Admins';
$LANG['AdminMenu_list_virtual'] = 'List Virtuals';
$LANG['AdminMenu_viewlog'] = 'View Log';
$LANG['AdminMenu_backup'] = 'Backup';
$LANG['AdminMenu_create_domain_admins'] = 'Domain Admins';
@ -210,7 +206,7 @@ $LANG['AdminEdit_admin_button'] = 'Edit Admin';
$LANG['AdminEdit_admin_result_error'] = '<span class="error_msg">Unable to modify admin.</span>';
$LANG['AdminEdit_admin_result_succes'] = 'Admin has been modified.';
$LANG['UsersLogin_welcome'] = 'Mailbox users login to change your password and aliases.';
$LANG['UsersLogin_welcome'] = 'Mailbox users login to change your password and aliases';
$LANG['UsersLogin_username'] = 'Login (email)';
$LANG['UsersLogin_password'] = 'Password';
$LANG['UsersLogin_button'] = 'Login';
@ -221,7 +217,7 @@ $LANG['UsersMenu_vacation'] = 'Auto Response';
$LANG['UsersMenu_edit_alias'] = 'Change your forward';
$LANG['UsersMenu_password'] = 'Change Password';
$LANG['UsersVacation_welcome'] = 'Auto Response.';
$LANG['UsersVacation_welcome'] = 'Auto Response';
$LANG['UsersVacation_welcome_text'] = 'You already have an auto response configured.';
$LANG['UsersVacation_subject'] = 'Subject';
$LANG['UsersVacation_subject_text'] = 'Out of Office';

View File

@ -21,8 +21,21 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$username = filter_input(INPUT_GET, 'username', FILTER_VALIDATE_EMAIL);
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_admins = list_admins();
if (empty($username)) {
$list_domains = list_domains();
} else {
$list_domains = list_domains($username);
}
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
}
include './templates/header.tpl';
include './templates/menu.tpl';
include './templates/list-domain.tpl';

View File

@ -14,7 +14,7 @@
// list_alias
// list_mailbox
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// domain
// offset
@ -23,12 +23,18 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
} else {
$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);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['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);

View File

@ -28,24 +28,24 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (!empty($username) && !empty($password)) {
$dbh = pdo_connect();
$sth = $dbh->prepare("SELECT password FROM admin WHERE username=?");
$sth = $dbh->prepare("SELECT password,rights FROM admin WHERE username=?");
$sth->bindParam(1, $username, PDO::PARAM_STR);
$sth->execute();
$row = $sth->fetch(PDO::FETCH_COLUMN);
$row = $sth->fetch(PDO::FETCH_ASSOC);
}
if (!empty($row)) {
if (!password_verify($password, $row)) {
if (!empty($row['password'])) {
if (!password_verify($password, $row['password'])) {
$message = $LANG['Login_incorrect'];
}
} else {
$message = $LANG['Login_incorrect'];
}
if (empty($message)) {
session_start();
$_SESSION['sessid']['username'] = $username;
$_SESSION['sessid']['rights'] = $row['rights'];
header("Location: list-domain.php");
exit;
}

View File

@ -13,7 +13,7 @@
//
// -none-
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// -none-
//

View File

@ -13,7 +13,7 @@
//
// message
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// password_current
// password1
@ -23,6 +23,15 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $SESSID_USERNAME;

View File

@ -14,7 +14,7 @@
// list_alias
// list_mailbox
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// search
//
@ -22,7 +22,13 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$search = filter_input(INPUT_POST, 'search', FILTER_DEFAULT);

View File

@ -16,7 +16,7 @@
// subject
// body
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// to
// subject
@ -26,6 +26,15 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$to = strtolower(filter_input(INPUT_POST, 'to', FILTER_VALIDATE_EMAIL));

View File

@ -163,7 +163,7 @@ a:visited, a:active {
border-left: 4px solid #40B33C;
}
#overview, #admin_domains, #admin_virtual {
#overview {
width: 1024px;
margin: 0 auto;
background: #AFE1A6; /*#9ACD32;*/

View File

@ -13,7 +13,7 @@
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
?>
</select>

View File

@ -13,7 +13,7 @@
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
?>
</select>

View File

@ -32,7 +32,7 @@
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domains['domains']) && in_array($row['domain'], $domains['domains'])) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
?>
</select>

View File

@ -1,24 +1,24 @@
<?php
if (count($list_admins) > 0) {
echo "<table id=\"admin_table\">\n";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['AdminList_admin_username'] . "</td>\n";
echo " <td>" . $LANG['AdminList_admin_count'] . "</td>\n";
echo " <td>" . $LANG['AdminList_admin_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo "<table id=\"admin_table\">";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['AdminList_admin_username'] . "</td>";
echo " <td>" . $LANG['AdminList_admin_count'] . "</td>";
echo " <td>" . $LANG['AdminList_admin_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
foreach ($list_admins as $row) {
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td><a href=\"list-domain.php?username=" . $row['username'] . "\">" . $row['username'] . "</a></td>";
echo " <td>" . $row['domain_count'] . "</td>";
echo " <td>" . $row['modified'] . "</td>";
echo " <td><a href=\"admin.php?action=edit&username=" . $row['username'] . "\">" . $LANG['edit'] . "</a></td>";
echo " <td><a href=\"delete.php?table=admin&where=username&delete=" . $row['username'] . "\" onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['AdminList_admin_username'] . ": " . $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>\n";
echo " </tr>";
}
echo "</table>\n";
echo "</table>";
}
?>

View File

@ -1,12 +1,12 @@
<div id="overview">
<form name="list_domain" method="get">
<select name=username onChange="this.form.submit()";>
<select name="username" onChange="this.form.submit()";>
<?php
if (count($list_admins) > 0) {
foreach ($list_admins as $row) {
echo '<option value="' . $row['username'] . '"';
if (isset($username) && $username == $row['username']) echo ' selected';
echo ">" . $row['username'] . "</option>\n";
echo ">" . $row['username'] . "</option>";
}
}
?>
@ -19,17 +19,17 @@ if (count($list_admins) > 0) {
</div>
<?php
if (count($list_domains) > 0) {
echo "<table id=\"admin_table\">\n";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['AdminList_domain_domain'] . "</td>\n";
echo " <td>" . $LANG['AdminList_domain_description'] . "</td>\n";
echo " <td>" . $LANG['AdminList_domain_aliases'] . "</td>\n";
echo " <td>" . $LANG['AdminList_domain_mailboxes'] . "</td>\n";
echo " <td>" . $LANG['AdminList_domain_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo "<table id=\"admin_table\">";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['AdminList_domain_domain'] . "</td>";
echo " <td>" . $LANG['AdminList_domain_description'] . "</td>";
echo " <td>" . $LANG['AdminList_domain_aliases'] . "</td>";
echo " <td>" . $LANG['AdminList_domain_mailboxes'] . "</td>";
echo " <td>" . $LANG['AdminList_domain_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
foreach ($list_domains as $row) {
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo "<td><a href=\"list-virtual.php?domain=" . $row['domain'] . "\">" . $row['domain'] . "</a></td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['alias_count'] . " / " . $row['aliases'] . "</td>";
@ -37,9 +37,8 @@ if (count($list_domains) > 0) {
echo "<td>" . $row['modified'] . "</td>";
echo "<td><a href=\"domain.php?action=edit&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo "<td><a href=\"delete.php?table=domain&domain=" . $row['domain'] . "\" onclick=\"return confirm ('" . $LANG['confirm_domain'] . $LANG['AdminList_admin_domain'] . ": " . $row['domain'] . "')\">" . $LANG['del'] . "</a></td>";
echo "</tr>\n";
echo "</tr>";
}
echo "</table>\n";
echo "</table>";
}
?>

View File

@ -6,7 +6,7 @@ if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
}
?>
@ -26,65 +26,65 @@ if (count($list_domains) > 0) {
<?php
if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) {
echo "<div id=\"nav_bar\">\n";
echo "<div id=\"nav_bar\">";
if ($offset >= $limit) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"../images/arrow-l.png\" title=\"" . $LANG['Overview_left_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"../images/arrow-l.png\" title=\"" . $LANG['Overview_left_arrow'] . "\"></a>";
}
if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=0\"><img border=\"0\" src=\"../images/arrow-u.png\" title=\"" . $LANG['Overview_up_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=0\"><img border=\"0\" src=\"../images/arrow-u.png\" title=\"" . $LANG['Overview_up_arrow'] . "\"></a>";
}
if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"../images/arrow-r.png\" title=\"" . $LANG['Overview_right_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"../images/arrow-r.png\" title=\"" . $LANG['Overview_right_arrow'] . "\"></a>";
}
echo "</div>\n";
echo "</div>";
}
if (count($list_alias) > 0) {
echo "<table id=\"alias_table\">\n";
echo " <tr>\n";
echo "<table id=\"alias_table\">";
echo " <tr>";
echo " <td colspan=\"5\"><h3>" . $LANG['Overview_alias_title'] . "</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['AdminList_virtual_alias_address'] . "</td>\n";
echo " <td>" . $LANG['AdminList_virtual_alias_goto'] . "</td>\n";
echo " <td>" . $LANG['AdminList_virtual_alias_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['AdminList_virtual_alias_address'] . "</td>";
echo " <td>" . $LANG['AdminList_virtual_alias_goto'] . "</td>";
echo " <td>" . $LANG['AdminList_virtual_alias_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
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";
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=alias" . "&delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td>" . $row['address'] . "</td>";
echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>";
echo " <td>" . $row['modified'] . "</td>";
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo " <td><a href=\"delete.php?table=alias" . "&delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>";
}
echo "</table>\n";
echo "</table>";
}
if (count($list_mailbox) > 0) {
echo "<table id=\"mailbox_table\">\n";
echo " <tr>\n";
echo "<table id=\"mailbox_table\">";
echo " <tr>";
echo " <td colspan=\"7\"><h3>" . $LANG['Overview_mailbox_title'] . "</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['AdminList_virtual_mailbox_username'] . "</td>\n";
echo " <td>" . $LANG['AdminList_virtual_mailbox_name'] . "</td>\n";
echo " <td>" . $LANG['AdminList_virtual_mailbox_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['AdminList_virtual_mailbox_username'] . "</td>";
echo " <td>" . $LANG['AdminList_virtual_mailbox_name'] . "</td>";
echo " <td>" . $LANG['AdminList_virtual_mailbox_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
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";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=mailbox" . "&delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td>" . $row['username'] . "</td>";
echo " <td>" . $row['name'] . "</td>";
echo " <td>" . $row['modified'] . "</td>";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo " <td><a href=\"delete.php?table=mailbox" . "&delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>";
}
echo "</table>\n";
echo "</table>";
}
?>

View File

@ -3,10 +3,13 @@
<li><a target="_top" href="list-domain.php"><?php echo $LANG['AdminMenu_list_domain']; ?></a></li>
<li><a target="_top" href="list-admin.php"><?php echo $LANG['AdminMenu_list_admin']; ?></a></li>
<li><a target="_top" href="list-virtual.php"><?php echo $LANG['AdminMenu_list_virtual']; ?></a></li>
<li><a target="_top" href="viewlog.php"><?php echo $LANG['AdminMenu_viewlog']; ?></a></li>
<li><a target="_top" href="backup.php"><?php echo $LANG['AdminMenu_backup']; ?></a></li>
<li><a target="_top" href="domain.php"><?php echo $LANG['AdminMenu_create_domain']; ?></a></li>
<li><a target="_top" href="admin.php"><?php echo $LANG['AdminMenu_create_admin']; ?></a></li>
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['AdminMenu_create_alias']; ?></a></li>
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['AdminMenu_create_mailbox']; ?></a></li>
</ul>

View File

@ -14,7 +14,7 @@
<textarea class="flat" rows="10" cols="60" name="goto">
<?php
foreach ($goto as $row) {
echo "$row\n";
echo "$row";
}
?>
</textarea>

View File

@ -3,7 +3,7 @@
<?php
if (SHOW_FOOTER == "YES" && FOOTER_LINK) {
echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
echo "<a href=\"" . FOOTER_LINK . "\">" . FOOTER_TEXT . "</a>\n";
echo "<a href=\"" . FOOTER_LINK . "\">" . FOOTER_TEXT . "</a>";
}
?>
</div>

View File

@ -11,8 +11,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo isset($LANG['charset']) ? $LANG['charset'] : 'iso-8859-1' ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
if (file_exists(realpath("./stylesheet.css"))) echo "<link rel=\"stylesheet\" href=\"stylesheet.css\">\n";
if (file_exists(realpath("../stylesheet.css"))) echo "<link rel=\"stylesheet\" href=\"../stylesheet.css\">\n";
if (file_exists(realpath("./stylesheet.css"))) echo "<link rel=\"stylesheet\" href=\"stylesheet.css\">";
if (file_exists(realpath("../stylesheet.css"))) echo "<link rel=\"stylesheet\" href=\"../stylesheet.css\">";
?>
<title>OpenSMTPD Admin - <?php echo $_SERVER['HTTP_HOST']; ?></title>
</head>
@ -20,15 +20,15 @@ if (file_exists(realpath("../stylesheet.css"))) echo "<link rel=\"stylesheet\" h
<div id="login_header">
<?php
if (file_exists(realpath("./stylesheet.css"))) {
echo "<img id=\"login_header_logo\" src=\"images/postbox.png\" />\n";
echo "<img id=\"login_header_logo\" height=\"30px\" src=\"images/opensmtpdadmin.png\" />\n";
echo "<img id=\"login_header_logo\" src=\"images/postbox.png\" />";
echo "<img id=\"login_header_logo\" height=\"30px\" src=\"images/opensmtpdadmin.png\" />";
}
if (file_exists(realpath("../stylesheet.css"))) {
echo "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n";
echo "<img id=\"login_header_logo\" height=\"30px\"% src=\"../images/opensmtpdadmin.png\" />\n";
echo "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />";
echo "<img id=\"login_header_logo\" height=\"30px\"% src=\"../images/opensmtpdadmin.png\" />";
}
if (SHOW_HEADER == "YES" && HEADER_TEXT) {
echo "<h2>" . HEADER_TEXT . "</h2>\n";
echo "<h2>" . HEADER_TEXT . "</h2>";
}
?>
</div>

View File

@ -1,28 +1,47 @@
<div id="overview">
<?php if ($PERMISSIONS == ADMIN_RIGHTS) { ?>
<form name="list_domain" method="get">
<select name="username" onChange="this.form.submit()";>
<?php
if (count($list_admins) > 0) {
foreach ($list_admins as $row) {
echo '<option value="' . $row['username'] . '"';
if (isset($username) && $username == $row['username']) echo ' selected';
echo ">" . $row['username'] . "</option>";
}
}
?>
</select>
<input class="button" type="submit" name="go" value="<?php echo $LANG['List_button']; ?>" />
<?php } ?>
<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>".$LANG['Overview_title']."</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_get_domain'] . "</td>\n";
echo " <td>" . $LANG['Overview_get_aliases'] . "</td>\n";
echo " <td>" . $LANG['Overview_get_mailboxes'] . "</td>\n";
echo " </tr>\n";
foreach ($list_domains as $row) {
if ($row['aliases'] == 0) $row['aliases'] = $LANG['Overview_unlimited'];
if ($row['mailboxes'] == 0) $row['mailboxes'] = $LANG['Overview_unlimited'];
if ($row['aliases'] < 0) $row['aliases'] = $LANG['Overview_disabled'];
if ($row['mailboxes'] < 0) $row['mailboxes'] = $LANG['Overview_disabled'];
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
echo " <td><a href=\"list-virtual.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";
if (count($list_domains) > 0) {
echo "<table id=\"admin_table\">";
echo "<tr class=\"header\">";
echo "<td>" . $LANG['List_domain_domain'] . "</td>";
echo "<td>" . $LANG['List_domain_description'] . "</td>";
echo "<td>" . $LANG['List_domain_aliases'] . "</td>";
echo "<td>" . $LANG['List_domain_mailboxes'] . "</td>";
echo "<td>" . $LANG['List_modified'] . "</td>";
if ($PERMISSIONS == ADMIN_RIGHTS) echo "<td colspan=\"2\">&nbsp;</td>";
echo "</tr>";
foreach ($list_domains as $row) {
if ($row['aliases'] == 0) $row['aliases'] = $LANG['List_domain_unlimited'];
if ($row['mailboxes'] == 0) $row['mailboxes'] = $LANG['List_domain_unlimited'];
echo "<tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo "<td><a href=\"list-virtual.php?domain=" . $row['domain'] . "\">" . $row['domain'] . "</a></td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['alias_count'] . " / " . $row['aliases'] . "</td>";
echo "<td>" . $row['mailbox_count'] . " / " . $row['mailboxes'] . "</td>";
echo "<td>" . $row['modified'] . "</td>";
if ($PERMISSIONS == ADMIN_RIGHTS) echo "<td><a href=\"domain.php?action=edit&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
if ($PERMISSIONS == ADMIN_RIGHTS) echo "<td><a href=\"delete.php?table=domain&domain=" . $row['domain'] . "\" onclick=\"return confirm ('" . $LANG['confirm_domain'] . $LANG['List_domain_domain'] . ": " . $row['domain'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>";
}
echo "</table>";
}
echo "</table>\n";
?>

View File

@ -6,22 +6,20 @@ if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
}
if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['aliases'] = $LANG['Overview_unlimited'];
if ($list_domains[$domain_key]['aliases'] < 0) $list_domains[$domain_key]['aliases'] = $LANG['Overview_disabled'];
if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $LANG['Overview_unlimited'];
if ($list_domains[$domain_key]['mailboxes'] < 0) $list_domains[$domain_key]['mailboxes'] = $LANG['Overview_disabled'];
if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['aliases'] = $LANG['List_domain_unlimited'];
if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $LANG['List_domain_unlimited'];
?>
</select>
<input type="hidden" name="offset" value="0">
<input class="button" type="submit" name="go" value="<?php echo $LANG['Overview_button']; ?>" />
<input class="button" type="submit" name="go" value="<?php echo $LANG['List_button']; ?>" />
</form>
<h4><?php echo $LANG['Overview_welcome'] . $domain; ?></h4>
<p><?php echo $LANG['Overview_alias_alias_count'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases']; ?></p>
<p><?php echo $LANG['Overview_alias_mailbox_count'] . ": " . $list_domains[$domain_key]['mailbox_count'] . " / " . $list_domains[$domain_key]['mailboxes']; ?></p>
<h4><?php echo $LANG['List_virtual_welcome'] . $domain; ?></h4>
<p><?php echo $LANG['List_domain_aliases'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases']; ?></p>
<p><?php echo $LANG['List_domain_mailboxes'] . ": " . $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">
@ -29,66 +27,66 @@ if ($list_domains[$domain_key]['mailboxes'] < 0) $list_domains[$domain_key]['mai
</div>
<?php
if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) {
echo "<div id=\"nav_bar\">\n";
echo "<div id=\"nav_bar\">";
if ($offset >= $limit) {
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $LANG['Overview_left_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $LANG['List_left_arrow'] . "\"></a>";
}
if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) {
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $LANG['Overview_up_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $LANG['List_up_arrow'] . "\"></a>";
}
if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) {
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $LANG['Overview_right_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $_GET['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $LANG['List_right_arrow'] . "\"></a>";
}
echo "</div>\n";
echo "</div>";
}
if (count($list_alias) > 0) {
echo "<table id=\"alias_table\">\n";
echo " <tr>\n";
echo " <td colspan=\"5\"><h3>".$LANG['Overview_alias_title']."</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_alias_address'] . "</td>\n";
echo " <td>" . $LANG['Overview_alias_goto'] . "</td>\n";
echo " <td>" . $LANG['Overview_alias_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo "<table id=\"alias_table\">";
echo "<tr>";
echo "<td colspan=\"5\"><h3>" . $LANG['List_virtual_alias_title'] . "</h3></td>";
echo "</tr>";
echo "<tr class=\"header\">";
echo "<td>" . $LANG['List_virtual_alias_address'] . "</td>";
echo "<td>" . $LANG['List_virtual_alias_goto'] . "</td>";
echo "<td>" . $LANG['List_modified'] . "</td>";
echo "<td colspan=\"2\">&nbsp;</td>";
echo "</tr>";
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";
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo "<tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>";
echo "<td>" . $row['modified'] . "</td>";
echo "<td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo "<td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>";
echo "</tr>";
}
echo "</table>\n";
echo "</table>";
}
if (count($list_mailbox) > 0) {
echo "<table id=\"mailbox_table\">\n";
echo " <tr>\n";
echo " <td colspan=\"7\"><h3>".$LANG['Overview_mailbox_title']."</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_mailbox_username'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_name'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
echo "<table id=\"mailbox_table\">";
echo "<tr>";
echo "<td colspan=\"7\"><h3>" . $LANG['List_virtual_mailbox_title'] . "</h3></td>";
echo "</tr>";
echo "<tr class=\"header\">";
echo "<td>" . $LANG['List_virtual_mailbox_username'] . "</td>";
echo "<td>" . $LANG['List_virtual_mailbox_name'] . "</td>";
echo "<td>" . $LANG['List_modified'] . "</td>";
echo "<td colspan=\"2\">&nbsp;</td>";
echo "</tr>";
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";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo "<tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['modified'] . "</td>";
echo "<td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo "<td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
echo "</tr>";
}
echo "</table>\n";
echo "</table>";
}
?>

View File

@ -1,17 +1,27 @@
<div id="menu">
<ul>
<li><a target="_top" href="list-domain.php"><?php echo $LANG['Menu_overview']; ?></a></li>
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_alias']; ?></a></li>
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_mailbox']; ?></a></li>
<li><a target="_top" href="list-domain.php"><?php echo $LANG['Menu_list_domain']; ?></a></li>
<li><a target="_top" href="list-virtual.php"><?php echo $LANG['Menu_list_virtual']; ?></a></li>
<?php if ($PERMISSIONS == ADMIN_RIGHTS) { ?>
<li><a target="_top" href="list-admin.php"><?php echo $LANG['AdminMenu_list_admin']; ?></a></li>
<li><a target="_top" href="backup.php"><?php echo $LANG['AdminMenu_backup']; ?></a></li>
<li><a target="_top" href="domain.php"><?php echo $LANG['AdminMenu_create_domain']; ?></a></li>
<li><a target="_top" href="admin.php"><?php echo $LANG['AdminMenu_create_admin']; ?></a></li>
<?php } else {?>
<li><a target="_top" href="sendmail.php"><?php echo $LANG['Menu_sendmail']; ?></a></li>
<li><a target="_top" href="password.php"><?php echo $LANG['Menu_password']; ?></a></li>
<?php } ?>
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_alias']; ?></a></li>
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_add_mailbox']; ?></a></li>
<li><a target="_top" href="viewlog.php"><?php echo $LANG['Menu_viewlog']; ?></a></li>
<li><a target="_top" href="logout.php"><?php echo $LANG['Menu_logout']; ?></a></li>
</ul>
</div>
<?php
if (file_exists(realpath("motd.txt"))) {
echo "<div id=\"motd\">\n";
echo "<div id=\"motd\">";
include("motd.txt");
echo "</div>";
}

View File

@ -6,50 +6,50 @@
</div>
<?php
if (count($list_alias) > 0) {
echo "<table id=\"alias_table\">\n";
echo " <tr>\n";
echo " <td colspan=\"5\"><h3>".$LANG['Overview_alias_title']."</h3></td>";
echo "<table id=\"alias_table\">";
echo " <tr>";
echo " <td colspan=\"5\"><h3>" . $LANG['List_virtual_alias_title'] . "</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['List_virtual_alias_address'] . "</td>";
echo " <td>" . $LANG['List_virtual_alias_goto'] . "</td>";
echo " <td>" . $LANG['List_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_alias_address'] . "</td>\n";
echo " <td>" . $LANG['Overview_alias_goto'] . "</td>\n";
echo " <td>" . $LANG['Overview_alias_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</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";
echo " <td><a href=\"edit-alias.php?action=edit&address=" . $row['address'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td>" . $row['address'] . "</td>";
echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>";
echo " <td>" . $row['modified'] . "</td>";
echo " <td><a href=\"edit-alias.php?action=edit&address=" . $row['address'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo " <td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>";
}
echo "</table>\n";
echo "</table>";
}
if (count($list_mailbox) > 0) {
echo "<table id=\"mailbox_table\">\n";
echo " <tr>\n";
echo " <td colspan=\"7\"><h3>".$LANG['Overview_mailbox_title']."</h3></td>";
echo "<table id=\"mailbox_table\">";
echo " <tr>";
echo " <td colspan=\"7\"><h3>" . $LANG['List_virtual_mailbox_title'] . "</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['List_virtual_mailbox_username'] . "</td>";
echo " <td>" . $LANG['List_virtual_mailbox_name'] . "</td>";
echo " <td>" . $LANG['List_modified'] . "</td>";
echo " <td colspan=\"2\">&nbsp;</td>";
echo " </tr>";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Overview_mailbox_username'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_name'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_modified'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</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";
echo " <td><a href=\"edit-mailbox.php?action=edit&username=" . $row['username'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td>" . $row['username'] . "</td>";
echo " <td>" . $row['name'] . "</td>";
echo " <td>" . $row['modified'] . "</td>";
echo " <td><a href=\"edit-mailbox.php?action=edit&username=" . $row['username'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
echo " <td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
echo " </tr>";
}
echo "</table>\n";
echo "</table>";
}
?>

View File

@ -10,7 +10,7 @@
<?php
if (file_exists(realpath("../motd-users.txt"))) {
echo "<div id=\"motd\">\n";
echo "<div id=\"motd\">";
include("../motd-users.txt");
echo "</div>";
}

View File

@ -6,7 +6,7 @@ if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
echo ">" . $row['domain'] . "</option>";
}
}
?>
@ -16,29 +16,29 @@ if (count($list_domains) > 0) {
</div>
<?php
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";
echo " </tr>\n";
echo " <tr class=\"header\">\n";
echo " <td>" . $LANG['Viewlog_timestamp'] . "</td>\n";
echo " <td>" . $LANG['Viewlog_username'] . "</td>\n";
echo " <td>" . $LANG['Viewlog_domain'] . "</td>\n";
echo " <td>" . $LANG['Viewlog_action'] . "</td>\n";
echo " <td>" . $LANG['Viewlog_data'] . "</td>\n";
echo " </tr>\n";
echo "<table id=\"log_table\">";
echo " <tr>";
echo " <td colspan=\"5\"><h3>".$LANG['Viewlog_welcome']." ".$domain."</h3></td>";
echo " </tr>";
echo " <tr class=\"header\">";
echo " <td>" . $LANG['Viewlog_timestamp'] . "</td>";
echo " <td>" . $LANG['Viewlog_username'] . "</td>";
echo " <td>" . $LANG['Viewlog_domain'] . "</td>";
echo " <td>" . $LANG['Viewlog_action'] . "</td>";
echo " <td>" . $LANG['Viewlog_data'] . "</td>";
echo " </tr>";
foreach ($log as $row) {
if (strlen($row['data']) > 35) $row['data'] = substr($row['data'], 0, 35) . " ...";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
echo " <td nowrap>" . $row['timestamp'] . "</td>\n";
echo " <td nowrap>" . $row['username'] . "</td>\n";
echo " <td nowrap>" . $row['domain'] . "</td>\n";
echo " <td nowrap>" . $row['action'] . "</td>\n";
echo " <td nowrap>" . $row['data'] . "</td>\n";
echo " </tr>\n";
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
echo " <td nowrap>" . $row['timestamp'] . "</td>";
echo " <td nowrap>" . $row['username'] . "</td>";
echo " <td nowrap>" . $row['domain'] . "</td>";
echo " <td nowrap>" . $row['action'] . "</td>";
echo " <td nowrap>" . $row['data'] . "</td>";
echo " </tr>";
}
echo "</table>\n";
echo "<p />\n";
echo "</table>";
echo "<p />";
}
?>

View File

@ -13,7 +13,7 @@
//
// log
//
// Form POST / GET Variables:
// POST / GET Variables:
//
// domain
//
@ -21,7 +21,15 @@ require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$PERMISSIONS = check_permissions();
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($PERMISSIONS == ADMIN_RIGHTS) {
$list_domains = list_domains();
$list_admins = list_admins();
} else {
$list_domains = list_domains($SESSID_USERNAME);
}
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain'];