commit - /dev/null
commit + 386bf42a35e2603fdac0b26723a4d0e4e6bda7b8
blob - /dev/null
blob + 8e49dc8c193673617a760778a40a5ab010c6065e (mode 644)
--- /dev/null
+++ .gitignore
+config.inc.php
+/admin/.htpasswd
blob - /dev/null
blob + f708343d81fee1acdfff35834591488ab2c97f24 (mode 644)
--- /dev/null
+++ LICENSE.TXT
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
blob - /dev/null
blob + c42e60093ad87a269b4d5b9bb25488d03be41435 (mode 644)
--- /dev/null
+++ README.md
+## OpenSMTPD Admin
+
+Fork of Postfix Admin 2.1.0 (released in 2007)
+
blob - /dev/null
blob + c50ed759c7e7dae5266f497af3a9146d87fbc59b (mode 755)
--- /dev/null
+++ VIRTUAL_VACATION/vacation.pl
+#!/usr/bin/env perl
+#
+# Copyright (c) 2022 Mischa Peters <mischa @ high5.nl>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+use 5.024;
+use strict;
+use warnings;
+use autodie;
+use Getopt::Std;
+use DBI;
+
+my $db_type = 'MariaDB';
+my $db_host = '';
+my $db_user = '';
+my $db_pass = '';
+my $db_name = '';
+
+getopts('dv');
+our($opt_d, $opt_v);
+
+my $email = "";
+my $from = "";
+my %ooo;
+my $dbh = DBI->connect("DBI:$db_type:$db_name:$db_host", "$db_user", "$db_pass", {RaiseError => 1});
+sub do_query {
+ my ($query) = @_;
+ my $sth = $dbh->prepare($query);
+ $sth->execute;
+ return $sth;
+}
+
+open (my $fh, '>', "/tmp/virtualvacation.log") if ($opt_d);
+select(STDOUT);
+$|++;
+select($fh);
+$|++;
+print STDOUT "register|filter|smtp-in|rcpt-to\n";
+print STDOUT "register|filter|smtp-in|mail-from\n";
+print STDOUT "register|filter|smtp-in|data-line\n";
+print STDOUT "register|ready\n";
+
+while (my $line = <>) {
+ next if ($line =~ m/^config/);
+ chomp $line;
+ print $fh "$line\n" if ($opt_v);
+ if ($line =~ m/filter/) {
+ my ($stream, $version, $timestamp, $subsystem, $event, $sid, $token, $data) = split /\|/, $line;
+ if ($line =~ m/mail-from/) {
+ $from = $data;
+ print STDOUT "filter-result|$sid|$token|proceed\n";
+ }
+ if ($line =~ m/rcpt-to/) {
+ $email = $data;
+ $ooo{$sid} = 1;
+ print $fh "Virtual Vacation: created session $sid\n";
+ print STDOUT "filter-result|$sid|$token|proceed\n";
+ }
+ if ($line =~ m/data-line/) {
+ if (!$data) { $data = ""; }
+ if ($data =~ m/^precedence:\s+(bulk|list|junk)/i) { $ooo{$sid} = 0; }
+ if ($data =~ m/^x-loop:\s+opensmtpd\ admin\ virtual\ vacation/i) { $ooo{$sid} = 0; }
+ print STDOUT "filter-dataline|$sid|$token|$data\n";
+ }
+ if ($line =~ m/data-line/ && $data eq '.' && $ooo{$sid} == 1) {
+ print $fh "Virtual Vacation: To: $email, From: $from\n" if ($opt_d);
+ my $query = qq{SELECT subject,body FROM vacation WHERE email='$email' and active=1};
+ my $sth = do_query($query);
+ my $rv = $sth->rows;
+ if ($rv == 1) {
+ my @row = $sth->fetchrow_array;
+ print $fh "Virtual Vacation: Found OOO for $email\n" if ($opt_d);
+ $query = qq{SELECT cache FROM vacation WHERE email='$email' AND FIND_IN_SET('$from',cache)};
+ $sth = do_query ($query);
+ $rv = $sth->rows;
+ if ($rv == 0) {
+ $query = qq{UPDATE vacation SET cache=CONCAT(cache,',','$from') WHERE email='$email'};
+ $sth = do_query($query);
+ print $fh "Virtual Vacation: Sending OOO to $from\n" if ($opt_d);
+ open my $fh_email, "|-", "/usr/sbin/sendmail -t";
+ print $fh_email "From: $email\n";
+ print $fh_email "To: $from\n";;
+ print $fh_email "Subject: $row[0]\n";
+ print $fh_email "X-Loop: OpenSMTPD Admin Virtual Vacation\n";
+ print $fh_email "Content-Type: text/plain; charset=utf-8\n\n";
+ print $fh_email "$row[1]\n";
+ close $fh_email;
+ }
+ delete $ooo{$sid};
+ print $fh "Virtual Vacation: removed session $sid\n" if ($opt_d);
+ }
+ } elsif ($line =~ m/data-line/ && $data eq '.' && $ooo{$sid} == 0) {
+ delete $ooo{$sid};
+ print $fh "Virtual Vacation: removed session $sid\n" if ($opt_d);
+ }
+ }
+}
+close $fh;
+0;
blob - /dev/null
blob + 4dc0a29c1dab8aec43a9dd43eee77cb1eecbec15 (mode 644)
--- /dev/null
+++ admin/.htaccess
+AuthUserFile /usr/local/www/mailadmin.high5.net/admin/.htpasswd
+AuthGroupFile /dev/null
+AuthName "Postfix Admin"
+AuthType Basic
+
+<limit GET POST>
+require valid-user
+</limit>
blob - /dev/null
blob + 2996e681a5ec8179d671394838e08e4d828ea4dd (mode 644)
--- /dev/null
+++ admin/backup.php
+<?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("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+date_default_timezone_set('Europe/Amsterdam');
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ umask(077);
+ $path = "/tmp/";
+ $filename = "opensmtpadmin-" . date("Ymd") . "-" . getmypid() . ".sql";
+ $backup = $path . $filename;
+
+ $header = "#\n# OpenSMTPD Admin $version\n# Date: " . date("D M j G:i:s T Y") . "\n#\n";
+
+ if (!$fh = fopen($backup, 'w')) {
+ $tMessage = "<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);
+
+ $tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation');
+
+ for ($i = 0 ; $i < count($tables) ; ++$i) {
+ $result = db_query("SHOW CREATE TABLE $tables[$i]");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ fwrite ($fh, "$row[1]\n\n");
+ }
+ }
+ }
+
+ for ($i = 0 ; $i < count($tables) ; ++$i) {
+ $result = db_query("SELECT * FROM $tables[$i]");
+ if ($result['rows'] > 0) {
+ while ($row = db_assoc($result['result'])) {
+ foreach ($row as $key => $val) {
+ $fields[] = $key;
+ $values[] = $val;
+ }
+
+ fwrite($fh, "INSERT INTO ". $tables[$i] . " (". implode (',',$fields) . ") VALUES ('" . implode ('\',\'',$values) . "')\n");
+ $fields = 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);
+}
+?>
blob - /dev/null
blob + fa28d2fca200acdc3a03579bd6d78d6d5b382085 (mode 644)
--- /dev/null
+++ admin/create-admin.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-admin.php
+//
+// Template File: admin_create-admin.tpl
+//
+//
+// Template Variables:
+//
+// tMessage
+// tUsername
+// tDomains
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fPassword
+// fPassword2
+// fDomains
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
+ $tDomains = array();
+
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/admin_create-admin.tpl");
+ include("../templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fUsername = escape_string($_POST['fUsername']);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ if (isset($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+
+ if (!check_email($fUsername)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ if (isset($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text_error1'];
+ }
+
+ if (empty($fUsername) or admin_exist($fUsername)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ if (isset($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text_error2'];
+ }
+
+ if (empty($fPassword) or ($fPassword != $fPassword2)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ if (isset($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
+ $pAdminCreate_admin_password_text = $PALANG['pAdminCreate_admin_password_text_error'];
+ }
+
+ if ($error != 1) {
+ $password = pacrypt("$fPassword");
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
+
+
+ $result = db_query("INSERT INTO admin (username,password,created,modified) VALUES ('$fUsername','$password',NOW(),NOW())");
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pAdminCreate_admin_result_error'] . "<br />($fUsername)<br />";
+ } else {
+ if (!empty($tDomains[0])) {
+ for ($i = 0; $i < count($tDomains); $i++) {
+ $domain = $tDomains[$i];
+ $result = db_query("INSERT INTO domain_admins (username,domain,created) VALUES ('$fUsername','$domain',NOW())");
+ }
+ }
+ $tMessage = $PALANG['pAdminCreate_admin_result_succes'] . "<br />($fUsername)</br />";
+ }
+ }
+
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/admin_create-admin.tpl");
+ include("../templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + 6c54a20be4d06984f5e0b38ba4a22742bee208f2 (mode 644)
--- /dev/null
+++ admin/create-alias.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-alias.php
+//
+// Template File: create-alias.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tAddress
+// tGoto
+// tDomain
+//
+// Form POST \ GET Variables:
+//
+// fAddress
+// fGoto
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text'];
+
+ if (isset($_GET['domain'])) $tDomain = escape_string($_GET['domain']);
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text'];
+
+ $fAddress = escape_string($_POST['fAddress']) . "@" . escape_string($_POST['fDomain']);
+ $fAddress = strtolower($fAddress);
+ $fGoto = escape_string($_POST['fGoto']);
+ $fGoto = strtolower($fGoto);
+ $fDomain = escape_string($_POST['fDomain']);
+
+ if (!preg_match('/@/',$fGoto)) {
+ $fGoto = $fGoto . "@" . escape_string($_POST['fDomain']);
+ }
+
+ if (!check_alias($fDomain)) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error3'];
+ }
+
+ if (empty($fAddress) or !check_email($fAddress))
+ {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
+ }
+
+ if (empty($fGoto) or !check_email($fGoto))
+ {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text_error'];
+ }
+
+ if (escape_string($_POST['fAddress']) == "*") $fAddress = "@" . escape_string($_POST['fDomain']);
+
+ $result = db_query("SELECT * FROM alias WHERE address='$fAddress'");
+ if ($result['rows'] == 1) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error2'];
+ }
+
+ if ($error != 1) {
+ if (preg_match('/^\*@(.*)$/', $fGoto, $match)) $fGoto = "@" . $match[1];
+
+ $result = db_query("INSERT INTO alias (address,goto,domain,created,modified) VALUES ('$fAddress','$fGoto','$fDomain',NOW(),NOW())");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />";
+ } else {
+ db_log($CONF['admin_email'], $fDomain, "create alias", "$fAddress -> $fGoto");
+
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_alias_result_succes'] . "<br />($fAddress -> $fGoto)</br />";
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/create-alias.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + cd5ed76efe610f1286d548fd3e5542f7f0c9fb26 (mode 644)
--- /dev/null
+++ admin/create-domain.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-domain.php
+//
+// Template File: admin_create-domain.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tDomain
+// tDescription
+// tAliases
+// tMailboxes
+// tMaxquota
+// tDefaultaliases
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+// fDescription
+// fAliases
+// fMailboxes
+// fMaxquota
+// fDefaultaliases
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $tAliases = $CONF['aliases'];
+ $tMailboxes = $CONF['mailboxes'];
+ $tMaxquota = $CONF['maxquota'];
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fDomain = escape_string($_POST['fDomain']);
+ !empty($_POST['fDescription']) ? $fDescription = escape_string($_POST['fDescription']) : $fDescription = "No Description";
+ $fAliases = escape_string($_POST['fAliases']);
+ $fMailboxes = escape_string($_POST['fMailboxes']);
+ !empty($_POST['fMaxquota']) ? $fMaxquota = escape_string($_POST['fMaxquota']) : $fMaxquota = "0";
+ !empty($_POST['fTransport']) ? $fTransport = escape_string($_POST['fTransport']) : $fTransport = "virtual";
+ if (isset($_POST['fDefaultaliases'])) $fDefaultaliases = escape_string($_POST['fDefaultaliases']);
+ isset($_POST['fBackupmx']) ? $fBackupmx = escape_string($_POST['fBackupmx']) : $fBackupmx = "0";
+
+ if (empty($fDomain) or domain_exist($fDomain)) {
+ $error = 1;
+ $tDomain = escape_string($_POST['fDomain']);
+ $tDescription = escape_string($_POST['fDescription']);
+ $tAliases = escape_string($_POST['fAliases']);
+ $tMailboxes = escape_string($_POST['fMailboxes']);
+ if (isset($_POST['fMaxquota'])) $tMaxquota = escape_string($_POST['fMaxquota']);
+ if (isset($_POST['fTransport'])) $tTransport = escape_string($_POST['fTransport']);
+ if (isset($_POST['fDefaultaliases'])) $tDefaultaliases = escape_string($_POST['fDefaultaliases']);
+ if (isset($_POST['fBackupmx'])) $tBackupmx = escape_string($_POST['fBackupmx']);
+ $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error'];
+ }
+
+ if ($error != 1) {
+ $tAliases = $CONF['aliases'];
+ $tMailboxes = $CONF['mailboxes'];
+ $tMaxquota = $CONF['maxquota'];
+
+ if ($fBackupmx == "on") {
+ $fAliases = -1;
+ $fMailboxes = -1;
+ $fMaxquota = -1;
+ $fBackupmx = 1;
+ } else {
+ $fBackupmx = 0;
+ }
+
+ $result = db_query("INSERT INTO domain (domain,description,aliases,mailboxes,maxquota,transport,backupmx,created,modified) VALUES ('$fDomain','$fDescription',$fAliases,$fMailboxes,$fMaxquota,'$fTransport',$fBackupmx,NOW(),NOW())");
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pAdminCreate_domain_result_error'] . "<br />($fDomain)<br />";
+ } else {
+ if ($fDefaultaliases == "on") {
+ foreach ($CONF['default_aliases'] as $address=>$goto) {
+ $address = $address . "@" . $fDomain;
+ $result = db_query("INSERT INTO alias (address,goto,domain,created,modified) VALUES ('$address','$goto','$fDomain',NOW(),NOW())");
+ }
+ }
+ $tMessage = $PALANG['pAdminCreate_domain_result_succes'] . "<br />($fDomain)</br />";
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_create-domain.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 22815262041f5c5956f691a060e43f77d2c2dfb1 (mode 644)
--- /dev/null
+++ admin/create-mailbox.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-mailbox.php
+//
+// Template File: create-mailbox.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tUsername
+// tName
+// tQuota
+// tDomain
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fPassword
+// fPassword2
+// fName
+// fQuota
+// fDomain
+// fActive
+// fMail
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $tQuota = $CONF['maxquota'];
+
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
+ $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
+
+ if (isset($_GET['domain'])) $tDomain = escape_string($_GET['domain']);
+
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/create-mailbox.tpl");
+ include("../templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
+ $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
+
+ $fUsername = escape_string($_POST['fUsername']) . "@" . escape_string($_POST['fDomain']);
+ $fUsername = strtolower($fUsername);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ isset($_POST['fName']) ? $fName = escape_string($_POST['fName']) : $fName = "No Name";
+ $fDomain = escape_string($_POST['fDomain']);
+ isset($_POST['fQuota']) ? $fQuota = escape_string($_POST['fQuota']) : $fQuota = "0";
+ isset($_POST['fActive']) ? $fActive = escape_string($_POST['fActive']) : $fActive = "1";
+ if(isset($_POST['fMail'])) $fMail = escape_string($_POST['fMail']);
+
+ if (!check_mailbox($fDomain)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3'];
+ }
+
+ if (empty($fUsername) or !check_email($fUsername)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
+ }
+
+ if (empty($fPassword) or ($fPassword != $fPassword2)) {
+ if ($CONF['generate_password'] == "YES") {
+ $fPassword = generate_password();
+ } else {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error'];
+ }
+ }
+
+ if ($CONF['quota'] == "YES") {
+ if (!check_quota($fQuota, $fDomain)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error'];
+ }
+ }
+
+ $result = db_query("SELECT * FROM alias WHERE address='$fUsername'");
+ if ($result['rows'] == 1) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2'];
+ }
+
+ if ($error != 1) {
+ $password = pacrypt($fPassword);
+
+ if ($CONF['domain_path'] == "YES") {
+ if ($CONF['domain_in_mailbox'] == "YES") {
+ $maildir = $fDomain . "/" . $fUsername . "/";
+ } else {
+ $maildir = $fDomain . "/" . escape_string($_POST['fUsername']) . "/";
+ }
+ } else {
+ $maildir = $fUsername . "/";
+ }
+
+ if (!empty($fQuota)) {
+ $quota = $fQuota * $CONF['quota_multiplier'];
+ } else {
+ $quota = 0;
+ }
+
+ if ($fActive == "on") {
+ $fActive = 1;
+ } else {
+ $fActive = 0;
+ }
+
+ $result = db_query("INSERT INTO alias (address,goto,domain,created,modified,active) VALUES ('$fUsername','vmail','$fDomain',NOW(),NOW(),'$fActive')");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pAlias_result_error'] . "<br />($fUsername -> $fUsername)</br />";
+ }
+
+ $result = db_query("INSERT INTO mailbox (username,password,name,maildir,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$quota','$fDomain',NOW(),NOW(),'$fActive')");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage .= $PALANG['pCreate_mailbox_result_error'] . "<br />($fUsername)<br />";
+ } else {
+
+ db_log($CONF['admin_email'], $fDomain, "create mailbox", $fUsername);
+
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_mailbox_result_succes'] . "<br />($fUsername";
+ if ($CONF['generate_password'] == "YES") {
+ $tMessage .= " / $fPassword)</br />";
+ } else {
+ $tMessage .= ")</br />";
+ }
+
+
+ $tQuota = $CONF['maxquota'];
+
+ if ($fMail == "on") {
+ $fTo = $fUsername;
+ $fSubject = $PALANG['pSendmail_subject_text'];
+ $fHeaders = "From: " . $CONF['admin_email'] . "\r\n";
+ $fHeaders .= "Content-Type: text/plain; charset=utf-8\r\n";
+ $fBody = $CONF['welcome_text'];
+
+ if (!mail($fTo, $fSubject, $fBody, $fHeaders)) {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
+ } else {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_succes'] . "<br />";
+ }
+ }
+ }
+ }
+
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/create-mailbox.tpl");
+ include("../templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + a36a41f0d9a0ddd9445c89ed8d9d20bc65a658f3 (mode 644)
--- /dev/null
+++ admin/delete.php
+<?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:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fTable
+// fWhere
+// fDelete
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['table'])) $fTable = escape_string($_GET['table']);
+ if (isset($_GET['where'])) $fWhere = escape_string($_GET['where']);
+ if (isset($_GET['delete'])) $fDelete = escape_string($_GET['delete']);
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+
+ if (empty($fTable)) {
+ $error = 1;
+ }
+
+ if ($fTable == "domain") {
+ $result_domain = db_delete("domain",$fWhere,$fDelete);
+ $result_domain_admins = db_delete("domain_admins",$fWhere,$fDelete);
+ $result_alias = db_delete("alias",$fWhere,$fDelete);
+ $result_mailbox = db_delete("mailbox",$fWhere,$fDelete);
+ $result_log = db_delete("log",$fWhere,$fDelete);
+ if ($CONF['vacation'] == "YES") {
+ $result_vacation = db_delete("vacation",$fWhere,$fDelete);
+ }
+
+ if (!($result_domain == 1) and ($result_domain_admins >= 0) and ($result_alias >= 0) and ($result_mailbox >= 0) and ($result_vacation >= 0)) {
+ $error = 1;
+ $tMessage = $PALANG['pAdminDelete_domain_error'];
+ } else {
+ $url = "list-domain.php";
+ }
+ }
+
+ if ($fTable == "admin") {
+ $result_admin = db_delete("admin",$fWhere,$fDelete);
+ $result_domain_admins = db_delete("domain_admins",$fWhere,$fDelete);
+
+ if (!($result_admin == 1) and ($result_domain_admins >= 0)) {
+ $error = 1;
+ $tMessage = $PALANG['pAdminDelete_admin_error'];
+ } else {
+ $url = "list-admin.php";
+ }
+ }
+
+ if ($fTable == "alias" or $fTable == "mailbox") {
+ $result = db_query("DELETE FROM alias WHERE address='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (alias)!</div>";
+ } else {
+ $url = "list-virtual.php?domain=$fDomain";
+ db_log($CONF['admin_email'], $fDomain, "delete alias", $fDelete);
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $result = db_query("DELETE FROM mailbox WHERE username='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (mailbox)!</div>";
+ } else {
+ $url = "list-virtual.php?domain=$fDomain";
+ db_query("DELETE FROM vacation WHERE email='$fDelete' AND domain='$fDomain'");
+ db_log($CONF['admin_email'], $fDomain, "delete mailbox", $fDelete);
+ }
+ }
+ }
+
+ if ($error != 1) {
+ header("Location: $url");
+ exit;
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/message.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + dce19d10cfeff328b8c4925f51a3033b66149cbb (mode 644)
--- /dev/null
+++ admin/edit-active-admin.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-active.php
+//
+// Template File: message.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['username'])) $fUsername = escape_string($_GET['username']);
+
+ $result = db_query("UPDATE admin SET active=1-active WHERE username='$fUsername'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pAdminEdit_admin_result_error'];
+ }
+
+ if ($error != 1) {
+ header("Location: list-admin.php");
+ exit;
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/message.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 88dca998d5e5dab9b8bf07fbf48f5e57a2f5b3f7 (mode 644)
--- /dev/null
+++ admin/edit-active-domain.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-active.php
+//
+// Template File: message.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+
+ $result = db_query("UPDATE domain SET active=1-active WHERE domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pAdminEdit_domain_result_error'];
+ }
+
+ if ($error != 1) {
+ header("Location: list-domain.php");
+ exit;
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/message.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 63c1c6fce9ade700d2b1690e714e15e43e90e87f (mode 644)
--- /dev/null
+++ admin/edit-active.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-active.php
+//
+// Template File: message.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['username'])) $fUsername = escape_string($_GET['username']);
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+
+ $result = db_query("UPDATE mailbox SET active=1-active WHERE username='$fUsername' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pEdit_mailbox_result_error'];
+ } else {
+ db_log($CONF['admin_email'], $fDomain, "edit active", $fUsername);
+ }
+
+ if ($error != 1) {
+ header("Location: list-virtual.php?domain=$fDomain");
+ exit;
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/message.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 97388aad49373b07d48fe7eb116761bca47ab20e (mode 644)
--- /dev/null
+++ admin/edit-admin.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-admin.php
+//
+// Template File: admin_edit-admin.tpl
+//
+// Template Variables:
+//
+// tDescription
+// tAliases
+// tMailboxes
+// tMaxquota
+// tActive
+//
+// Form POST \ GET Variables:
+//
+// fDescription
+// fAliases
+// fMailboxes
+// fMaxquota
+// fActive
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $username = escape_string($_GET['username']);
+
+ $list_domains = list_domains();
+ $tDomains = list_domains_for_admin($username);
+
+ $result = db_query("SELECT * FROM admin WHERE username='$username'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tActive = $row['active'];
+ }
+
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/admin_edit-admin.tpl");
+ include("../templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $username = escape_string($_GET['username']);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ $fActive = escape_string($_POST['fActive']);
+ if (isset($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+
+ $list_domains = list_domains();
+
+ if ($fPassword != $fPassword2) {
+ $error = 1;
+ $tActive = escape_string($_POST['fActive']);
+ $tDomains = escape_string($_POST['fDomains']);
+ $pAdminEdit_admin_password_text = $PALANG['pAdminEdit_admin_password_text_error'];
+ }
+
+ if ($error != 1) {
+ if (empty($fPassword) and empty($fPassword2)) {
+ if ($fActive == "on") $fActive = 1;
+ $result = db_query("UPDATE admin SET modified=NOW(),active='$fActive' WHERE username='$username'");
+ } else {
+ $password = pacrypt($fPassword);
+ if ($fActive == "on") $fActive = 1;
+ $result = db_query("UPDATE admin SET password='$password',modified=NOW(),active='$fActive' WHERE username='$username'");
+ }
+
+ if (count($tDomains) > 0) {
+ for ($i = 0; $i < count($tDomains); $i++) {
+ $domain = $tDomains[$i];
+ $result_domains = db_query("INSERT INTO domain_admins (username,domain,created) VALUES ('$username','$domain',NOW())");
+ }
+ }
+
+ if ($result['rows'] == 1) {
+ if (isset($tDomains[0])) {
+ $result = db_query("DELETE FROM domain_admins WHERE username='$username'");
+ for ($i = 0; $i < count($tDomains); $i++) {
+ $domain = $tDomains[$i];
+ $result = db_query("INSERT INTO domain_admins (username,domain,created) VALUES ('$username','$domain',NOW())");
+ }
+ }
+ header("Location: list-admin.php");
+ } else {
+ $tMessage = $PALANG['pAdminEdit_admin_result_error'];
+ }
+ }
+ include("../templates/header.tpl");
+ include("../templates/admin_menu.tpl");
+ include("../templates/admin_edit-admin.tpl");
+ include("../templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + 79452236ce2d50f2094fb6085d2385fbeda9db6f (mode 644)
--- /dev/null
+++ admin/edit-alias.php
+<?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:
+//
+// tMessage
+// tGoto
+//
+// Form POST \ GET Variables:
+//
+// fAddress
+// fDomain
+// fGoto
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fAddress = escape_string($_GET['address']);
+ $fDomain = escape_string($_GET['domain']);
+
+ $result = db_query("SELECT * FROM alias WHERE address='$fAddress' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tGoto = $row['goto'];
+ } else {
+ $tMessage = $PALANG['pEdit_alias_address_error'];
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pEdit_alias_goto = $PALANG['pEdit_alias_goto'];
+
+ $fAddress = escape_string($_GET['address']);
+ $fAddress = strtolower($fAddress);
+ $fDomain = escape_string($_GET['domain']);
+ $fGoto = escape_string($_POST['fGoto']);
+ $fGoto = strtolower($fGoto);
+
+ if (empty($fGoto)) {
+ $error = 1;
+ $tGoto = $fGoto;
+ $tMessage = $PALANG['pEdit_alias_goto_text_error1'];
+ }
+
+ $goto = preg_replace('/\\\r\\\n/', ',', $fGoto);
+ $goto = preg_replace('/\r\n/', ',', $goto);
+ $goto = preg_replace('/[\s]+/i', '', $goto);
+ $goto = preg_replace('/\,*$/', '', $goto);
+ $array = preg_split('/,/', $goto);
+
+ for ($i = 0; $i < count($array); $i++) {
+ if (in_array("$array[$i]", $CONF['default_aliases'])) continue;
+ if (empty($array[$i])) continue;
+ if (!check_email($array[$i]))
+ {
+ $error = 1;
+ $tGoto = $goto;
+ $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . "$array[$i]</div>";
+ }
+ }
+
+ if ($error != 1) {
+ $result = db_query("UPDATE alias SET goto='$goto',modified=NOW() WHERE address='$fAddress' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pEdit_alias_result_error'];
+ } else {
+ db_log($CONF['admin_email'], $fDomain, "edit alias", "$fAddress -> $goto");
+
+ header("Location: list-virtual.php?domain=$fDomain");
+ exit;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/edit-alias.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 351ba00448d694c074ed164916d34b939d8de54d (mode 644)
--- /dev/null
+++ admin/edit-domain.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-domain.php
+//
+// Template File: admin_edit-domain.tpl
+//
+// Template Variables:
+//
+// tDescription
+// tAliases
+// tMailboxes
+// tMaxquota
+// tActive
+//
+// Form POST \ GET Variables:
+//
+// fDescription
+// fAliases
+// fMailboxes
+// fMaxquota
+// fActive
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $domain = escape_string($_GET['domain']);
+ $domain_properties = get_domain_properties($domain);
+
+ $tDescription = $domain_properties['description'];
+ $tAliases = $domain_properties['aliases'];
+ $tMailboxes = $domain_properties['mailboxes'];
+ $tMaxquota = $domain_properties['maxquota'];
+ $tTransport = $domain_properties['transport'];
+ $tBackupmx = $domain_properties['backupmx'];
+ $tActive = $domain_properties['active'];
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $domain = escape_string($_GET['domain']);
+
+ $fDescription = escape_string($_POST['fDescription']);
+ $fAliases = escape_string($_POST['fAliases']);
+ $fMailboxes = escape_string($_POST['fMailboxes']);
+ if (isset($_POST['fMaxquote']) ? $fMaxquota = escape_string($_POST['fMaxquota']) : $fMaxquota = "0");
+ if (isset($_POST['fTransport'])) $fTransport = escape_string($_POST['fTransport']);
+ if (isset($_POST['fBackupmx'])) $fBackupmx = escape_string($_POST['fBackupmx']);
+ if (isset($_POST['fActive'])) $fActive = escape_string($_POST['fActive']);
+
+ if ($fBackupmx == "on") {
+ $fAliases = -1;
+ $fMailboxes = -1;
+ $fMaxquota = -1;
+ $fBackupmx = 1;
+ } else {
+ $fBackupmx = 0;
+ }
+
+ $fActive = ($fActive == "on" ? 1 : 0);
+
+ $result = db_query("UPDATE domain SET description='$fDescription',aliases='$fAliases',mailboxes='$fMailboxes',maxquota='$fMaxquota',transport='$fTransport',backupmx='$fBackupmx',active='$fActive',modified=NOW() WHERE domain='$domain'");
+ if ($result['rows'] == 1) {
+ header("Location: list-domain.php");
+ } else {
+ $tMessage = $PALANG['pAdminEdit_domain_result_error'];
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_edit-domain.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 0d4baccbdb01eb4594639174302beea3cdcab84c (mode 644)
--- /dev/null
+++ admin/edit-mailbox.php
+<?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:
+//
+// tMessage
+// tName
+// tQuota
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fDomain
+// fPassword
+// fPassword2
+// fName
+// fQuota
+// fActive
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fUsername = escape_string($_GET['username']);
+ $fDomain = escape_string($_GET['domain']);
+
+ $result = db_query("SELECT * FROM mailbox WHERE username='$fUsername' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tName = $row['name'];
+ $tQuota = $row['quota'] / $CONF['quota_multiplier'];
+ $tActive = $row['active'];
+ } else {
+ $tMessage = $PALANG['pEdit_mailbox_login_error'];
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pEdit_mailbox_password_text = $PALANG['pEdit_mailbox_password_text_error'];
+ $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text'];
+
+ $fUsername = escape_string($_GET['username']);
+ $fUsername = strtolower($fUsername);
+ $fDomain = escape_string($_GET['domain']);
+
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ $fName = escape_string($_POST['fName']);
+ if (isset($_POST['fQuota'])) $fQuota = escape_string($_POST['fQuota']);
+ if (isset($_POST['fActive'])) $fActive = escape_string($_POST['fActive']);
+
+ if ($fPassword != $fPassword2)
+ {
+ $error = 1;
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tActive = $fActive;
+ $pEdit_mailbox_password_text = $PALANG['pEdit_mailbox_password_text_error'];
+ }
+
+ if ($CONF['quota'] == "YES") {
+ if (!check_quota($fQuota, $fDomain)) {
+ $error = 1;
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tActive = $fActive;
+ $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text_error'];
+ }
+ }
+
+ if ($error != 1) {
+ if (!empty($fQuota)) {
+ $quota = $fQuota * $CONF['quota_multiplier'];
+ } else {
+ $quota = 0;
+ }
+
+ if ($fActive == "on") {
+ $fActive = 1;
+ } else {
+ $fActive = 0;
+ }
+
+ if (empty($fPassword) and empty($fPassword2)) {
+ $result = db_query("UPDATE mailbox SET name='$fName',quota='$quota',modified=NOW(),active='$fActive' WHERE username='$fUsername' AND domain='$fDomain'");
+ } else {
+ $password = pacrypt($fPassword);
+ $result = db_query("UPDATE mailbox SET password='$password',name='$fName',quota='$quota',modified=NOW(),active='$fActive',scheme='' WHERE username='$fUsername' AND domain='$fDomain'");
+ }
+
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pEdit_mailbox_result_error'];
+ } else {
+ db_log($CONF['admin_email'], $fDomain, "edit mailbox", $fUsername);
+ header("Location: list-virtual.php?domain=$fDomain");
+ exit;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/edit-mailbox.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + a11416a6d209dd64a130a20096f1d54a5af5472f (mode 644)
--- /dev/null
+++ admin/index.php
+<?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;
+?>
blob - /dev/null
blob + e2f96c721e7581314c2a0f4c3c45c8d5063a1466 (mode 644)
--- /dev/null
+++ admin/list-admin.php
+<?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:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_admins = list_admins();
+
+if (!empty($list_admins)) {
+ $list_admins_count = count($list_admins);
+ if ((is_array($list_admins) and $list_admins_count > 0)) {
+ for ($i = 0; $i < $list_admins_count; $i++) {
+ $admin_properties[$i] = get_admin_properties($list_admins[$i]);
+ }
+ }
+}
+
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_list-admin.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 185ba574954c51c7ca64f93005e8e3f41feb8bc4 (mode 644)
--- /dev/null
+++ admin/list-domain.php
+<?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:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_admins = list_admins();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['username'])) {
+ $fUsername = escape_string($_GET['username']);
+
+ $list_domains = list_domains_for_admin($fUsername);
+ if ($list_domains != 0) {
+ for ($i = 0; $i < count($list_domains); $i++) {
+ $domain_properties[$i] = get_domain_properties($list_domains[$i]);
+ }
+ }
+ } else {
+ $list_domains = list_domains();
+ if ((is_array($list_domains) and count($list_domains) > 0)) {
+ for ($i = 0; $i < count($list_domains); $i++) {
+ $domain_properties[$i] = get_domain_properties($list_domains[$i]);
+ }
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fUsername = escape_string($_POST['fUsername']);
+
+ $list_domains = list_domains_for_admin($fUsername);
+ if (!empty($list_domains)) {
+ for ($i = 0; $i < count($list_domains); $i++) {
+ $domain_properties[$i] = get_domain_properties($list_domains[$i]);
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_list-domain.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 3f86a84ff7d40303e6544819f5f6c491b31d126c (mode 644)
--- /dev/null
+++ admin/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: admin_list-virtual.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tAlias
+// tMailbox
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+$tAlias = array();
+$tMailbox = array();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fDisplay = 0;
+ $page_size = $CONF['page_size'];
+
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+ if (isset($_GET['limit'])) $fDisplay = escape_string($_GET['limit']);
+
+ if ((is_array($list_domains) and count($list_domains) > 0)) if (empty($fDomain)) $fDomain = $list_domains[0];
+
+ $limit = get_domain_properties($fDomain);
+
+ if ((is_array($list_domains) and count($list_domains) > 0)) if (empty($fDomain)) $fDomain = $list_domains[1];
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain='$fDomain' ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain='$fDomain' AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ }
+
+ $result = db_query("$query");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+
+ if (isset($limit)) {
+ if ($fDisplay >= $page_size) {
+ $tDisplay_back_show = 1;
+ $tDisplay_back = $fDisplay - $page_size;
+ }
+ if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) {
+ $tDisplay_up_show = 1;
+ }
+ if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) {
+ $tDisplay_next_show = 1;
+ $tDisplay_next = $fDisplay + $page_size;
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fDisplay = 0;
+ $page_size = $CONF['page_size'];
+
+ $fDomain = escape_string($_POST['fDomain']);
+ if (isset($_POST['limit'])) $fDisplay = escape_string($_POST['limit']);
+
+ $limit = get_domain_properties($fDomain);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain='$fDomain' ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain='$fDomain' AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ }
+
+ $result = db_query("$query");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+
+ if (isset($limit)) {
+ if ($fDisplay >= $page_size) {
+ $tDisplay_back_show = 1;
+ $tDisplay_back = $fDisplay - $page_size;
+ }
+ if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) {
+ $tDisplay_up_show = 1;
+ }
+ if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) {
+ $tDisplay_next_show = 1;
+ $tDisplay_next = $fDisplay + $page_size;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_list-virtual.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + a600b2e9a1a5611d931232595747bb6906404ce4 (mode 644)
--- /dev/null
+++ admin/search.php
+<?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:
+//
+// tAlias
+// tMailbox
+//
+// Form POST \ GET Variables:
+//
+// fSearch
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$tAlias = array();
+$tMailbox = array();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['search'])) $fSearch = escape_string($_GET['search']);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias WHERE alias.address LIKE '%$fSearch%' OR alias.goto LIKE '%$fSearch%' ORDER BY alias.address";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE '%$fSearch%' AND mailbox.maildir IS NULL ORDER BY alias.address";
+ }
+
+ $result = db_query("$query");
+
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username LIKE '%$fSearch%' ORDER BY username");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ if (isset($_POST['search'])) $fSearch = escape_string($_POST['search']);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias WHERE alias.address LIKE '%$fSearch%' OR alias.goto LIKE '%$fSearch%' ORDER BY alias.address";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE '%$fSearch%' AND mailbox.maildir IS NULL ORDER BY alias.address";
+ }
+
+ $result = db_query("$query");
+
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username LIKE '%$fSearch%' ORDER BY username");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/admin_search.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 4f60f29896f962357b72773c63714cae32944c12 (mode 644)
--- /dev/null
+++ admin/viewlog.php
+<?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:
+//
+// tMessage
+// tLog
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$list_domains = list_domains();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+
+ if ((is_array($list_domains) and count($list_domains) > 0)) $fDomain = $list_domains[0];
+
+ $result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tLog[] = $row;
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fDomain = escape_string($_POST['fDomain']);
+
+ $result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tLog[] = $row;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/admin_menu.tpl");
+include("../templates/viewlog.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + c9c83978f5f0bb1d8df10e507e3cbb0317ba10a3 (mode 644)
--- /dev/null
+++ config.inc.php.sample
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: config.inc.php
+//
+if (preg_match("/config.inc.php/", $_SERVER['SCRIPT_NAME'])) {
+ header("Location: login.php");
+ exit;
+}
+
+// Language config
+// Language files are located in './languages'.
+$CONF['default_language'] = 'en';
+
+// Database Config
+// mysqli = MySQL 4.1
+// pgsql = PostgreSQL
+$CONF['database_type'] = 'mysqli';
+$CONF['database_host'] = 'localhost';
+$CONF['database_user'] = 'opensmtpdadmin';
+$CONF['database_password'] = 'RandomStringOfChars';
+$CONF['database_name'] = 'opensmtpd';
+$CONF['database_prefix'] = '';
+
+// Site Admin
+// Define the Site Admins email address below.
+// This will be used to send emails from to create mailboxes.
+$CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld';
+
+// Encrypt
+$CONF['encrypt'] = 'bcrypt';
+
+// Generate Password
+// Generate a random password for a mailbox and display it.
+// If you want to automagically generate paswords set this to 'YES'.
+$CONF['generate_password'] = 'NO';
+
+// Page Size
+// Set the number of entries that you would like to see
+// in one page.
+$CONF['page_size'] = '25';
+
+// Default Aliases
+// The default aliases that need to be created for all domains.
+$CONF['default_aliases'] = array (
+ 'abuse' => 'abuse@change-this-to-your.domain.tld',
+ 'hostmaster' => 'hostmaster@change-this-to-your.domain.tld',
+ 'postmaster' => 'postmaster@change-this-to-your.domain.tld',
+ 'webmaster' => 'webmaster@change-this-to-your.domain.tld'
+);
+
+// Mailboxes
+// If you want to store the mailboxes per domain set this to 'YES'.
+// Example: /usr/local/virtual/domain.tld/username@domain.tld
+$CONF['domain_path'] = 'NO';
+// If you don't want to have the domain in your mailbox set this to 'NO'.
+// Example: /usr/local/virtual/domain.tld/username
+$CONF['domain_in_mailbox'] = 'YES';
+
+// Default Domain Values
+// Specify your default values below. Quota in MB.
+$CONF['aliases'] = '10';
+$CONF['mailboxes'] = '10';
+$CONF['maxquota'] = '0';
+
+// Quota
+// When you want to enforce quota for your mailbox users set this to 'YES'.
+$CONF['quota'] = 'NO';
+// You can either use '1024000' or '1048576'
+$CONF['quota_multiplier'] = '1024000';
+
+// Transport
+// If you want to define additional transport options for a domain set this to 'YES'.
+// Read the transport file of the OpenSMTPD documentation.
+$CONF['transport'] = 'NO';
+
+// Virtual Vacation
+// If you want to use virtual vacation for you mailbox users set this to 'YES'.
+$CONF['vacation'] = 'NO';
+
+// Alias Control
+// OpenSMTPD Admin inserts an alias in the alias table for every mailbox it creates.
+// The reason for this is that when you want catch-all and normal mailboxes
+// to work you need to have the mailbox replicated in the alias table.
+// If you want to take control of these aliases as well set this to 'YES'.
+$CONF['alias_control'] = 'NO';
+
+// Special Alias Control
+// Set to 'NO' if you don't want your domain admins to change the default aliases.
+$CONF['special_alias_control'] = 'YES';
+
+// Logging
+// If you don't want logging set this to 'NO';
+$CONF['logging'] = 'YES';
+
+// Header
+$CONF['show_header_text'] = 'NO';
+$CONF['header_text'] = ':: OpenSMTPD Admin ::';
+
+// Footer
+// Below information will be on all pages.
+// If you don't want the footer information to appear set this to 'NO'.
+$CONF['show_footer_text'] = 'YES';
+$CONF['footer_text'] = 'Return to change-this-to-your.domain.tld!';
+$CONF['footer_link'] = 'http://change-this-to-your.domain.tld/';
+
+// Welcome Message
+// This message is send to every newly created mailbox.
+// Change the text between EOM.
+$CONF['welcome_text'] = <<<EOM
+Hi,
+
+Welcome to your new account.
+EOM;
+
+//
+// END OF CONFIG FILE
+//
+?>
blob - /dev/null
blob + 0dd2b61aa1e5685835172742b822614f9e94a5b6 (mode 644)
--- /dev/null
+++ create-alias.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-alias.php
+//
+// Template File: create-alias.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tAddress
+// tGoto
+// tDomain
+//
+// Form POST \ GET Variables:
+//
+// fAddress
+// fGoto
+// fDomain
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains_for_admin($SESSID_USERNAME);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text'];
+
+ if (isset($_GET['domain'])) $tDomain = escape_string($_GET['domain']);
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text'];
+
+ $fAddress = escape_string($_POST['fAddress']) . "@" . escape_string($_POST['fDomain']);
+ $fAddress = strtolower($fAddress);
+ $fGoto = escape_string($_POST['fGoto']);
+ $fGoto = strtolower($fGoto);
+ $fDomain = escape_string($_POST['fDomain']);
+
+ if (!preg_match('/@/',$fGoto)) {
+ $fGoto = $fGoto . "@" . escape_string($_POST['fDomain']);
+ }
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
+ }
+
+ if (!check_alias($fDomain)) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error3'];
+ }
+
+ if (empty($fAddress) or !check_email($fAddress)) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
+ }
+
+ if (empty($fGoto) or !check_email($fGoto)) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_goto_text = $PALANG['pCreate_alias_goto_text_error'];
+ }
+
+ if (escape_string($_POST['fAddress']) == "*") $fAddress = "@" . escape_string($_POST['fDomain']);
+
+ $result = db_query("SELECT * FROM alias WHERE address='$fAddress'");
+ if ($result['rows'] == 1) {
+ $error = 1;
+ $tAddress = escape_string($_POST['fAddress']);
+ $tGoto = $fGoto;
+ $tDomain = $fDomain;
+ $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error2'];
+ }
+
+ if ($error != 1) {
+ if (preg_match('/^\*@(.*)$/', $fGoto, $match)) $fGoto = "@" . $match[1];
+
+ $result = db_query("INSERT INTO alias (address,goto,domain,created,modified) VALUES ('$fAddress','$fGoto','$fDomain',NOW(),NOW())");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n";
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "create alias", "$fAddress -> $fGoto");
+
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_alias_result_succes'] . "<br />($fAddress -> $fGoto)<br />\n";
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/create-alias.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 29de1d6eea9d9c4c828767591acba0786163df58 (mode 644)
--- /dev/null
+++ create-mailbox.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: create-mailbox.php
+//
+// Template File: create-mailbox.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tUsername
+// tName
+// tQuota
+// tDomain
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fPassword
+// fPassword2
+// fName
+// fQuota
+// fDomain
+// fActive
+// fMail
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains_for_admin($SESSID_USERNAME);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $tQuota = $CONF['maxquota'];
+
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
+ $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
+
+ if (isset($_GET['domain'])) $tDomain = escape_string($_GET['domain']);
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
+ $pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
+
+ $fUsername = escape_string($_POST['fUsername']) . "@" . escape_string($_POST['fDomain']);
+ $fUsername = strtolower($fUsername);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ $fName = escape_string($_POST['fName']);
+ $fDomain = escape_string($_POST['fDomain']);
+ if (isset($_POST['fQuota'])) $fQuota = escape_string($_POST['fQuota']);
+ if (isset($_POST['fActive'])) $fActive = escape_string($_POST['fActive']);
+ if (isset($_POST['fMail'])) $fMail = escape_string($_POST['fMail']);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
+ }
+
+ if (!check_mailbox($fDomain)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error3'];
+ }
+
+ if (empty($fUsername) or !check_email($fUsername)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error1'];
+ }
+
+ if (empty($fPassword) or ($fPassword != $fPassword2)) {
+ if ($CONF['generate_password'] == "YES") {
+ $fPassword = generate_password();
+ } else {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text_error'];
+ }
+ }
+
+ if ($CONF['quota'] == "YES") {
+ if (!check_quota($fQuota, $fDomain)) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text_error'];
+ }
+ }
+
+ $result = db_query("SELECT * FROM alias WHERE address='$fUsername'");
+ if ($result['rows'] == 1) {
+ $error = 1;
+ $tUsername = escape_string($_POST['fUsername']);
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tDomain = $fDomain;
+ $pCreate_mailbox_username_text = $PALANG['pCreate_mailbox_username_text_error2'];
+ }
+
+ if ($error != 1) {
+ $password = pacrypt($fPassword);
+
+ if ($CONF['domain_path'] == "YES") {
+ if ($CONF['domain_in_mailbox'] == "YES") {
+ $maildir = $fDomain . "/" . $fUsername . "/";
+ } else {
+ $maildir = $fDomain . "/" . escape_string($_POST['fUsername']) . "/";
+ }
+ } else {
+ $maildir = $fUsername . "/";
+ }
+
+ if (!empty($fQuota)) {
+ $quota = $fQuota * $CONF['quota_multiplier'];
+ } else {
+ $quota = 0;
+ }
+
+ if ($fActive == "on") {
+ $fActive = 1;
+ } else {
+ $fActive = 0;
+ }
+
+ $result = db_query("INSERT INTO alias (address,goto,domain,created,modified,active) VALUES ('$fUsername','vmail','$fDomain',NOW(),NOW(),'$fActive')");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pAlias_result_error'] . "<br />($fUsername -> $fUsername)</br />";
+ }
+
+ $result = db_query("INSERT INTO mailbox (username,password,name,maildir,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$quota','$fDomain',NOW(),NOW(),'$fActive')");
+ if ($result['rows'] != 1) {
+ $tDomain = $fDomain;
+ $tMessage .= $PALANG['pCreate_mailbox_result_error'] . "<br />($fUsername)<br />";
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "create mailbox", "$fUsername");
+
+ $tDomain = $fDomain;
+ $tMessage = $PALANG['pCreate_mailbox_result_succes'] . "<br />($fUsername";
+ if ($CONF['generate_password'] == "YES") {
+ $tMessage .= " / $fPassword)</br />";
+ } else {
+ $tMessage .= ")</br />";
+ }
+
+ $tQuota = $CONF['maxquota'];
+
+ if ($fMail == "on") {
+ $fTo = $fUsername;
+ $fSubject = $PALANG['pSendmail_subject_text'];
+ $fHeaders = "From: " . $SESSID_USERNAME . "\r\n";
+ $fHeaders .= "Content-Type: text/plain; charset=utf-8\r\n";
+ $fBody = $CONF['welcome_text'];
+
+ if (!mail($fTo, $fSubject, $fBody, $fHeaders)) {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
+ } else {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_succes'] . "<br />";
+ }
+ }
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/create-mailbox.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 6fddc13292e78fa25154677d9f25b0303f89eb70 (mode 644)
--- /dev/null
+++ delete.php
+<?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:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fDelete
+// fDomain
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['delete'])) $fDelete = escape_string($_GET['delete']);
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tMessage = $PALANG['pDelete_domain_error'] . "<b>$fDomain</b>!</div>";
+ } else {
+
+ $result = db_query("DELETE FROM alias WHERE address='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (alias)!</div>";
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "delete alias", $fDelete);
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $result = db_query("DELETE FROM mailbox WHERE username='$fDelete' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (mailbox)!</div>";
+ } else {
+ db_query("DELETE FROM vacation WHERE email='$fDelete' AND domain='$fDomain'");
+ db_log($SESSID_USERNAME, $fDomain, "delete mailbox", $fDelete);
+ }
+ }
+ }
+
+ if ($error != 1) {
+ header("Location: overview.php?domain=$fDomain");
+ exit;
+ }
+
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/message.tpl");
+ include("./templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/message.tpl");
+ include("./templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + 1eba32a7e3a58ddd9b3fd0b8eb5ec03c0c377624 (mode 644)
--- /dev/null
+++ edit-active.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: edit-active.php
+//
+// Template File: message.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fDomain
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['username'])) $fUsername = escape_string($_GET['username']);
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tMessage = $PALANG['pEdit_mailbox_domain_error'] . "<b>$fDomain</b>!</font>";
+ } else {
+ $result = db_query("UPDATE mailbox SET active=1-active WHERE username='$fUsername' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pEdit_mailbox_result_error'];
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "edit active", $fUsername);
+ }
+ }
+
+ if ($error != 1) {
+ header("Location: overview.php?domain=$fDomain");
+ exit;
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/message.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 0c129c7cfea43b9431e9544e870a529b2c23ef32 (mode 644)
--- /dev/null
+++ edit-alias.php
+<?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:
+//
+// tMessage
+// tGoto
+//
+// Form POST \ GET Variables:
+//
+// fAddress
+// fDomain
+// fGoto
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fAddress = escape_string($_GET['address']);
+ $fDomain = escape_string($_GET['domain']);
+
+ if (check_owner($SESSID_USERNAME, $fDomain)) {
+ $result = db_query("SELECT * FROM alias WHERE address='$fAddress' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tGoto = $row['goto'];
+ }
+ } else {
+ $tMessage = $PALANG['pEdit_alias_address_error'];
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pEdit_alias_goto = $PALANG['pEdit_alias_goto'];
+
+ $fAddress = escape_string($_GET['address']);
+ $fAddress = strtolower($fAddress);
+ $fDomain = escape_string($_GET['domain']);
+ $fGoto = escape_string($_POST['fGoto']);
+ $fGoto = strtolower($fGoto);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tGoto = $fGoto;
+ $tMessage = $PALANG['pEdit_alias_domain_error'] . "$fDomain</font>";
+ }
+
+ if (empty($fGoto)) {
+ $error = 1;
+ $tGoto = $fGoto;
+ $tMessage = $PALANG['pEdit_alias_goto_text_error1'];
+ }
+
+ $goto = preg_replace('/\\\r\\\n/', ',', $fGoto);
+ $goto = preg_replace('/\r\n/', ',', $fGoto);
+ $goto = preg_replace('/[\s]+/i', '', $goto);
+ $goto = preg_replace('/\,*$/', '', $goto);
+ $array = preg_split('/,/', $goto);
+
+ if (!empty($array)) { $array_count = count($array); }
+
+ for($i = 0; $i < $array_count; $i++) {
+ if (in_array("$array[$i]", $CONF['default_aliases'])) continue;
+ if (empty($array[$i])) continue;
+ if (!check_email($array[$i]))
+ {
+ $error = 1;
+ $tGoto = $goto;
+ $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . "$array[$i]</div>";
+ }
+ }
+
+ if ($error != 1) {
+ $result = db_query("UPDATE alias SET goto='$goto',modified=NOW() WHERE address='$fAddress' AND domain='$fDomain'");
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pEdit_alias_result_error'];
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "edit alias", "$fAddress -> $goto");
+
+ header("Location: overview.php?domain=$fDomain");
+ exit;
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/edit-alias.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 11eb4b0a0716b2005472fa5fa0ff255978534f7a (mode 644)
--- /dev/null
+++ edit-mailbox.php
+<?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:
+//
+// tMessage
+// tName
+// tQuota
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fDomain
+// fPassword
+// fPassword2
+// fName
+// fQuota
+// fActive
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fUsername = escape_string($_GET['username']);
+ $fDomain = escape_string($_GET['domain']);
+
+ if (check_owner($SESSID_USERNAME, $fDomain)) {
+ $result = db_query("SELECT * FROM mailbox WHERE username='$fUsername' AND domain='$fDomain'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tName = $row['name'];
+ $tQuota = $row['quota'] / $CONF['quota_multiplier'];
+ $tActive = $row['active'];
+ }
+ } else {
+ $tMessage = $PALANG['pEdit_mailbox_login_error'];
+ }
+
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/edit-mailbox.tpl");
+ include("./templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pEdit_mailbox_password_text = $PALANG['pEdit_mailbox_password_text_error'];
+ $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text'];
+
+ $fUsername = escape_string($_GET['username']);
+ $fUsername = strtolower($fUsername);
+ $fDomain = escape_string($_GET['domain']);
+
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+ $fName = escape_string($_POST['fName']);
+ if (isset($_POST['fQuota'])) $fQuota = escape_string($_POST['fQuota']);
+ if (isset($_POST['fActive'])) $fActive = escape_string($_POST['fActive']);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tActive = $fActive;
+ $tMessage = $PALANG['pEdit_mailbox_domain_error'] . "$fDomain</font>";
+ }
+
+ if ($fPassword != $fPassword2) {
+ $error = 1;
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tActive = $fActive;
+ $pEdit_mailbox_password_text = $PALANG['pEdit_mailbox_password_text_error'];
+ }
+
+ if ($CONF['quota'] == "YES") {
+ if (!check_quota($fQuota, $fDomain)) {
+ $error = 1;
+ $tName = $fName;
+ $tQuota = $fQuota;
+ $tActive = $fActive;
+ $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text_error'];
+ }
+ }
+
+ if ($error != 1) {
+ if (!empty($fQuota)) {
+ $quota = $fQuota * $CONF['quota_multiplier'];
+ } else {
+ $quota = 0;
+ }
+
+ if ($fActive == "on") {
+ $fActive = 1;
+ } else {
+ $fActive = 0;
+ }
+
+ if (empty($fPassword) and empty($fPassword2)) {
+ $result = db_query("UPDATE mailbox SET name='$fName',quota='$quota',modified=NOW(),active='$fActive' WHERE username='$fUsername' AND domain='$fDomain'");
+ } else {
+ $password = pacrypt($fPassword);
+ $result = db_query("UPDATE mailbox SET password='$password',name='$fName',quota='$quota',modified=NOW(),active='$fActive',scheme='' WHERE username='$fUsername' AND domain='$fDomain'");
+ }
+
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pEdit_mailbox_result_error'];
+ } else {
+ db_log($SESSID_USERNAME, $fDomain, "edit mailbox", $fUsername);
+
+ header("Location: overview.php?domain=$fDomain");
+ exit;
+ }
+ }
+
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/edit-mailbox.tpl");
+ include("./templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + 24c6ce2e0323cbcd98cf008f884f4ba30e6ba752 (mode 644)
--- /dev/null
+++ functions.inc.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: functions.inc.php
+//
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);
+mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
+
+if(preg_match("/functions.inc.php/", $_SERVER['SCRIPT_NAME'])) {
+ header("Location: login.php");
+ exit;
+}
+
+$version = "1.0.0";
+
+//
+// check_session
+// Action: Check if a session already exists, if not redirect to login.php
+// Call: check_session() -or- check_user_session()
+//
+function check_session() {
+ session_start();
+ if (!isset($_SESSION['sessid']['username'])) {
+ header("Location: login.php");
+ exit;
+ }
+ $SESSID_USERNAME = $_SESSION['sessid']['username'];
+ return $SESSID_USERNAME;
+}
+
+function check_user_session() {
+ session_start();
+ if (!isset($_SESSION['userid']['username'])) {
+ header("Location: login.php");
+ exit;
+ }
+ $USERID_USERNAME = $_SESSION['userid']['username'];
+ return $USERID_USERNAME;
+}
+
+//
+// check_language
+// Action: checks what language the browser uses
+// Call: check_language
+//
+function check_language() {
+ global $CONF;
+ // Currently only English is supported, no need to run through the check now.
+ return $CONF['default_language'];
+}
+
+//
+// check_string
+// Action: checks if a string is valid and returns TRUE is this is the case.
+// Call: check_string(string var)
+//
+function check_string($var) {
+ if (preg_match('/^([A-Za-z0-9 ]+)+$/', $var)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+//
+// check_email
+// Action: Checks if email is valid and returns TRUE if this is the case.
+// Call: check_email(string email)
+//
+function check_email($email) {
+ if (preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,10}$/i', trim($email))) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+//
+// escape_string
+// Action: Escape a string
+// Call: escape_string(string string)
+//
+function escape_string($string) {
+ global $CONF;
+ $escaped_string = $string;
+ return $escaped_string;
+}
+
+//
+// get_domain_properties
+// Action: Get all the properties of a domain.
+// Call: get_domain_properties(string domain)
+//
+function get_domain_properties($domain) {
+ global $CONF;
+ $list = array();
+
+ $result = db_query("SELECT COUNT(*) FROM alias WHERE domain='$domain'");
+ $row = db_row($result['result']);
+ $list['alias_count'] = $row[0];
+
+ $result = db_query("SELECT COUNT(*) FROM mailbox WHERE domain='$domain'");
+ $row = db_row($result['result']);
+ $list['mailbox_count'] = $row[0];
+ if ($CONF['alias_control'] == "NO") {
+ $list['alias_count'] = $list['alias_count'] - $list['mailbox_count'];
+ } else {
+ $list['alias_count'] = $list['alias_count'];
+ }
+
+ $result = db_query("SELECT * FROM domain WHERE domain='$domain'");
+ $row = db_array($result['result']);
+ $list['description'] = $row['description'];
+ $list['aliases'] = $row['aliases'];
+ $list['mailboxes'] = $row['mailboxes'];
+ $list['maxquota'] = $row['maxquota'];
+ $list['transport'] = $row['transport'];
+ $list['backupmx'] = $row['backupmx'];
+ $list['created'] = $row['created'];
+ $list['modified'] = $row['modified'];
+ $list['active'] = $row['active'];
+
+ if ($CONF['database_type'] == "pgsql") {
+ if ($row['active'] == "t")
+ {
+ $list['active'] = 1;
+ } else {
+ $list['active'] = 0;
+ }
+
+ if ($row['backupmx'] == "t") {
+ $list['backupmx'] = 1;
+ } else {
+ $list['backupmx'] = 0;
+ }
+ } else {
+ $list['active'] = $row['active'];
+ $list['backupmx'] = $row['backupmx'];
+ }
+ return $list;
+}
+
+//
+// check_alias
+// Action: Checks if the domain is still able to create aliases.
+// Call: check_alias(string domain)
+//
+function check_alias($domain) {
+ $limit = get_domain_properties($domain);
+ if ($limit['aliases'] == 0) {
+ return true;
+ }
+ if ($limit['aliases'] < 0) {
+ return false;
+ }
+ if ($limit['alias_count'] >= $limit['aliases']) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// check_mailbox
+// Action: Checks if the domain is still able to create mailboxes.
+// Call: ceck_mailbox(string domain)
+//
+function check_mailbox($domain) {
+ $limit = get_domain_properties($domain);
+ if ($limit['mailboxes'] == 0) {
+ return true;
+ }
+ if ($limit['mailboxes'] < 0) {
+ return false;
+ }
+ if ($limit['mailbox_count'] >= $limit['mailboxes']) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// check_quota
+// Action: Checks if the user is creating a mailbox with the correct quota
+// Call: check_quota(string domain)
+//
+function check_quota($quota, $domain) {
+ $limit = get_domain_properties($domain);
+ if ($limit['maxquota'] == 0) {
+ return true;
+ }
+ if (($limit['maxquota'] < 0) and ($quota < 0)) {
+ return true;
+ }
+ if (($limit['maxquota'] > 0) and ($quota == 0)) {
+ return false;
+ }
+ if ($quota > $limit['maxquota']) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// check_owner
+// Action: Checks if the admin is the owner of the domain.
+// Call: check_owner(string admin, string domain)
+//
+function check_owner($username, $domain) {
+ $result = db_query("SELECT * FROM domain_admins WHERE username='$username' AND domain='$domain' AND active='1'");
+ if ($result['rows'] != 1) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// list_domains_for_admin
+// Action: Lists all the domains for an admin.
+// Call: list_domains_for_admin(string admin)
+//
+function list_domains_for_admin($username) {
+ $list = array();
+
+ $result = db_query("SELECT * FROM domain LEFT JOIN domain_admins ON domain.domain=domain_admins.domain WHERE domain_admins.username='$username' AND domain.active='1' AND domain.backupmx='0' ORDER BY domain_admins.domain");
+ if ($result['rows'] > 0) {
+ $i = 0;
+ while ($row = db_array($result['result'])) {
+ $list[$i] = $row['domain'];
+ $i++;
+ }
+ }
+ return $list;
+}
+
+//
+// list_domains
+// Action: List all available domains.
+// Call: list_domains()
+//
+function list_domains() {
+ $list = array();
+
+ $result = db_query("SELECT * FROM domain ORDER BY domain");
+ if ($result['rows'] > 0) {
+ $i = 0;
+ while ($row = db_array($result['result'])) {
+ $list[$i] = $row['domain'];
+ $i++;
+ }
+ }
+ return $list;
+}
+
+//
+// admin_exist
+// Action: Checks if the admin already exists.
+// Call: admin_exist(string admin)
+//
+// was check_admin
+//
+function admin_exist($username) {
+ $result = db_query("SELECT * FROM admin WHERE username='$username'");
+ if ($result['rows'] != 1) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// domain_exist
+// Action: Checks if the domain already exists.
+// Call: domain_exist(string domain)
+//
+function domain_exist($domain) {
+ $result = db_query("SELECT * FROM domain WHERE domain='$domain'");
+ if ($result['rows'] != 1) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+//
+// list_admins
+// Action: Lists all the admins
+// Call: list_admins()
+//
+// was admin_list_admins
+//
+function list_admins() {
+ $list = array();
+
+ $result = db_query("SELECT * FROM admin ORDER BY username");
+ if ($result['rows'] > 0) {
+ $i = 0;
+ while ($row = db_array($result['result'])) {
+ $list[$i] = $row['username'];
+ $i++;
+ }
+ }
+ return $list;
+}
+
+//
+// get_admin_properties
+// Action: Get all the admin properties.
+// Call: get_admin_properties(string admin)
+function get_admin_properties($username) {
+ $list = array();
+
+ $result = db_query("SELECT COUNT(*) FROM domain_admins WHERE username='$username'");
+ $row = db_row($result['result']);
+ $list['domain_count'] = $row[0];
+
+ $result = db_query("SELECT * FROM admin WHERE username='$username'");
+ $row = db_array($result['result']);
+ $list['created'] = $row['created'];
+ $list['modified'] = $row['modified'];
+ $list['active'] = $row['active'];
+ return $list;
+}
+
+//
+// generate_password
+// Action: Generates a random password
+// Call: generate_password()
+//
+function generate_password() {
+ $password = substr(md5(mt_rand()), 0, 8);
+ return $password;
+}
+
+//
+// pacrypt
+// Action: Encrypts password based on config settings
+// Call: pacrypt(string cleartextpassword)
+//
+function pacrypt($pw, $pw_db="") {
+ global $CONF;
+ $password = "";
+
+ if ($CONF['encrypt'] == 'bcrypt') {
+ $options = ['cost' => 8];
+ $password = password_hash($pw, PASSWORD_BCRYPT, $options);
+ $password = preg_replace('/\$2y\$/', '\$2b\$', $password);
+ }
+ return $password;
+}
+
+//
+// db_connect
+// Action: Makes a connection to the database if it doesn't exist
+// Call: db_connect()
+//
+$DEBUG_TEXT = "\n
+<p />\n
+Please check the documentation and website for more information.\n
+<p />\n
+";
+
+function db_connect() {
+ global $CONF;
+ global $DEBUG_TEXT;
+ $link = "";
+
+ if ($CONF['database_type'] == "mysqli") {
+ if(function_exists("mysqli_connect")) {
+ $link = @mysqli_connect($CONF['database_host'], $CONF['database_user'], $CONF['database_password']) or die("<p />DEBUG INFORMATION:<br />Connect: " . mysqli_connect_error() . "$DEBUG_TEXT");
+ $succes = @mysqli_select_db($link, $CONF['database_name']) or die("<p />DEBUG INFORMATION:<br />MySQLi Select Database: " . mysqli_error() . "$DEBUG_TEXT");
+ } else {
+ print "<p />DEBUG INFORMATION:<br />MySQL 4.1 functions not available!<br />database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT";
+ die;
+ }
+ }
+
+ if ($CONF['database_type'] == "pgsql") {
+ if(function_exists("pg_connect")) {
+ $connect_string = "host=" . $CONF['database_host'] . " dbname=" . $CONF['database_name'] . " user=" . $CONF['database_user'] . " password=" . $CONF['database_password'];
+ $link = @pg_connect($connect_string) or die("<p />DEBUG INFORMATION:<br />Connect: " . pg_last_error() . "$DEBUG_TEXT");
+ } else {
+ print "<p />DEBUG INFORMATION:<br />PostgreSQL functions not available!<br />database_type = 'pgsql' in config.inc.php, are you using a different database? $DEBUG_TEXT";
+ die;
+ }
+ }
+
+ if ($link) {
+ return $link;
+ } else {
+ print "DEBUG INFORMATION:<br />\n";
+ print "Connect: Unable to connect to database<br />\n";
+ print "<br />\n";
+ print "Make sure that you have set the correct database type in the config.inc.php file<br />\n";
+ print $DEBUG_TEXT;
+ die;
+ }
+}
+
+//
+// db_query
+// Action: Sends a query to the database and returns query result and number of rows
+// Call: db_query(string query)
+//
+function db_query($query) {
+ global $CONF;
+ global $DEBUG_TEXT;
+ $result = "";
+ $number_rows = "";
+
+ $link = db_connect();
+
+ // database prefix workaround
+ if (!empty($CONF['database_prefix'])) {
+ if (preg_match("/^SELECT/i", $query)) {
+ $query = substr($query, 0, 14) . $CONF['database_prefix'] . substr($query, 14);
+ } else {
+ $query = substr($query, 0, 6) . $CONF['database_prefix'] . substr($query, 7);
+ }
+ }
+
+ if ($CONF['database_type'] == "mysqli") $result = @mysqli_query($link, $query) or die("<p />DEBUG INFORMATION:<br />Invalid query: " . mysqli_error($link) . "$DEBUG_TEXT");
+ if ($CONF['database_type'] == "pgsql") {
+ if (preg_match("/LIMIT/i", $query)) {
+ $search = "/LIMIT(\w+), (\w+)/";
+ $replace = "LIMIT \$2 OFFSET \$1";
+ $query = preg_replace($search, $replace, $query);
+ }
+ $result = @pg_query($link, $query) or die("<p />DEBUG INFORMATION:<br />Invalid query: " . pg_last_error() . "$DEBUG_TEXT");
+ }
+
+ if (preg_match("/^SELECT/i", $query)) {
+ // if $query was a SELECT statement check the number of rows with [database_type]_num_rows().
+ if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_num_rows($result);
+ if ($CONF['database_type'] == "pgsql") $number_rows = pg_num_rows($result);
+ } else {
+ // if $query was something else, UPDATE, DELETE or INSERT check the number of rows with
+ // [database_type]_affected_rows().
+ if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_affected_rows($link);
+ if ($CONF['database_type'] == "pgsql") $number_rows = pg_affected_rows($result);
+ }
+
+ if ($CONF['database_type'] == "mysqli") mysqli_close($link);
+ if ($CONF['database_type'] == "pgsql") pg_close($link);
+
+ $return = array(
+ "result" => $result,
+ "rows" => $number_rows
+ );
+ return $return;
+}
+
+// db_row
+// Action: Returns a row from a table
+// Call: db_row(int result)
+//
+function db_row($result) {
+ global $CONF;
+ $row = "";
+ if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_row($result);
+ if ($CONF['database_type'] == "pgsql") $row = pg_fetch_row($result);
+ return $row;
+}
+
+// db_array
+// Action: Returns a row from a table
+// Call: db_array(int result)
+//
+function db_array($result) {
+ global $CONF;
+ $row = "";
+ if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_array($result);
+ if ($CONF['database_type'] == "pgsql") $row = pg_fetch_array($result);
+ return $row;
+}
+
+// db_assoc
+// Action: Returns a row from a table
+// Call: db_assoc(int result)
+//
+function db_assoc($result) {
+ global $CONF;
+ $row = "";
+ if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_assoc($result);
+ if ($CONF['database_type'] == "pgsql") $row = pg_fetch_assoc($result);
+ return $row;
+}
+
+//
+// db_delete
+// Action: Deletes a row from a specified table
+// Call: db_delete(string table, string where, string delete)
+//
+function db_delete($table,$where,$delete) {
+ $result = db_query("DELETE FROM $table WHERE $where='$delete'");
+ if ($result['rows'] >= 1) {
+ return $result['rows'];
+ } else {
+ return true;
+ }
+}
+
+//
+// db_log
+// Action: Logs actions from admin
+// Call: db_log(string username, string domain, string action, string data)
+//
+function db_log($username, $domain, $action, $data) {
+ global $CONF;
+ if (!empty($_SERVER['HTTP_X_CLIENTIP'])) {
+ $REMOTE_ADDR = $_SERVER['HTTP_X_CLIENTIP'];
+ } else {
+ $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
+ }
+
+ if ($CONF['logging'] == 'YES') {
+ $result = db_query("INSERT INTO log (timestamp, username, domain, action, data) VALUES (NOW(), '$username ($REMOTE_ADDR)', '$domain', '$action', '$data')");
+ if ($result['rows'] != 1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+}
+?>
blob - /dev/null
blob + 739ec212f73d7050cbab1d05763be2e351962ef9 (mode 644)
Binary files /dev/null and images/arrow-l.png differ
blob - /dev/null
blob + 8d85a9132c8e13b50b20ff8403399f2b8bbdeff6 (mode 644)
Binary files /dev/null and images/arrow-r.png differ
blob - /dev/null
blob + 63c33cedc83d6ca1de1ba5e42e750344cd4d61c5 (mode 644)
Binary files /dev/null and images/arrow-u.png differ
blob - /dev/null
blob + 032abd6ff5dc8cffb91c1920e48bc1dd26368668 (mode 644)
--- /dev/null
+++ images/index.php
+<?php
+//
+// File: index.php
+//
+// Template File: -none-
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+header ("Location: ../login.php");
+exit;
+?>
blob - /dev/null
blob + 2e45b0c82aad45454eb80d94bd819d5373f3cf51 (mode 644)
Binary files /dev/null and images/opensmtpdadmin.png differ
blob - /dev/null
blob + ea830bfb898e21400042d20ac7db62d10fb1a83f (mode 644)
Binary files /dev/null and images/postbox.png differ
blob - /dev/null
blob + b60c4942d1fec3a7769246c8b40a977373764efa (mode 644)
--- /dev/null
+++ index.php
+<?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-
+//
+if (!file_exists(realpath("./setup.php"))) {
+ header ("Location: login.php");
+ exit;
+} else {
+ print <<< EOF
+<html>
+<head>
+<title>Welcome to OpenSMTPD Admin</title>
+</head>
+<body>
+<img id="login_header_logo" src="images/postbox.png" />
+<img id="login_header_logo" src="images/opensmtpdadmin.png" />
+<h1>Welcome to OpenSMTPD Admin</h1>
+It seems that you are running this version of OpenSMTPD Admin for the first time.<br />
+<p />
+You can now run <a href="setup.php">setup</a> to make sure that all the functions are available for OpenSMTPD Admin to run.<br />
+<p />
+If you still encounter any problems please check the documentation and website for more information.
+<p />
+</body>
+</html>
+EOF;
+}
+?>
blob - /dev/null
blob + f7692b819f249b36ee4c354fa686920dc755c3a9 (mode 644)
--- /dev/null
+++ languages/en.lang
+<?php
+//
+// Language file English
+// by Mischa <mischa at high5 dot nl>
+//
+$PALANG['YES'] = 'YES';
+$PALANG['NO'] = 'NO';
+$PALANG['edit'] = 'edit';
+$PALANG['del'] = 'del';
+$PALANG['confirm'] = 'Are you sure you want to delete this?\n';
+$PALANG['confirm_domain'] = 'Do you really want to delete all records for this domain? This can not be undone!\n';
+$PALANG['check_update'] = 'Check for update';
+
+$PALANG['pLogin_welcome'] = 'Mail admins login here to administer your domain.';
+$PALANG['pLogin_username'] = 'Login (email)';
+$PALANG['pLogin_password'] = 'Password';
+$PALANG['pLogin_button'] = 'Login';
+$PALANG['pLogin_username_incorrect'] = '<span class="error_msg">Your login is not correct. Make sure that you login with your email address.</span>';
+$PALANG['pLogin_password_incorrect'] = '<span class="error_msg">Your password is not correct.</span>';
+$PALANG['pLogin_login_users'] = 'Users click here to login to the user section.';
+
+$PALANG['pMenu_overview'] = 'Overview';
+$PALANG['pMenu_create_alias'] = 'Add Alias';
+$PALANG['pMenu_create_mailbox'] = 'Add Mailbox';
+$PALANG['pMenu_sendmail'] = 'Send Email';
+$PALANG['pMenu_password'] = 'Password';
+$PALANG['pMenu_viewlog'] = 'View Log';
+$PALANG['pMenu_logout'] = 'Logout';
+
+$PALANG['pMain_welcome'] = 'Welcome to OpenSMTPD Admin!';
+$PALANG['pMain_overview'] = 'List your aliases and mailboxes. You can edit / delete them from here.';
+$PALANG['pMain_create_alias'] = 'Create a new alias for your domain.';
+$PALANG['pMain_create_mailbox'] = 'Create a new mailbox for your domain.';
+$PALANG['pMain_sendmail'] = 'Send an email to one of your newly created mailboxes.';
+$PALANG['pMain_password'] = 'Change the password for your admin account.';
+$PALANG['pMain_viewlog'] = 'View the log files.';
+$PALANG['pMain_logout'] = 'Logout from the system';
+
+$PALANG['pOverview_disabled'] = 'Disabled';
+$PALANG['pOverview_unlimited'] = 'Unlimited';
+$PALANG['pOverview_title'] = ':: Defined Domains';
+$PALANG['pOverview_up_arrow'] = 'Go Top';
+$PALANG['pOverview_right_arrow'] = 'Next Page';
+$PALANG['pOverview_left_arrow'] = 'Previus Page';
+$PALANG['pOverview_alias_title'] = ':: Alias';
+$PALANG['pOverview_mailbox_title'] = ':: Mailboxes';
+$PALANG['pOverview_button'] = 'Go';
+$PALANG['pOverview_welcome'] = 'Overview for ';
+$PALANG['pOverview_alias_alias_count'] = 'Aliases';
+$PALANG['pOverview_alias_mailbox_count'] = 'Mailboxes';
+$PALANG['pOverview_alias_address'] = 'From';
+$PALANG['pOverview_alias_goto'] = 'To';
+$PALANG['pOverview_alias_modified'] = 'Last Modified';
+$PALANG['pOverview_mailbox_username'] = 'Email';
+$PALANG['pOverview_mailbox_name'] = 'Name';
+$PALANG['pOverview_mailbox_quota'] = 'Quota (MB)';
+$PALANG['pOverview_mailbox_modified'] = 'Last Modified';
+$PALANG['pOverview_mailbox_active'] = 'Active';
+
+$PALANG['pOverview_get_domain'] = 'Domain';
+$PALANG['pOverview_get_aliases'] = 'Aliases';
+$PALANG['pOverview_get_mailboxes'] = 'Mailboxes';
+$PALANG['pOverview_get_quota'] = 'Mailbox Quota (MB)';
+$PALANG['pOverview_get_modified'] = 'Last Modified';
+
+$PALANG['pDelete_delete_error'] = '<span class="error_msg">Unable to delete the entry ';
+$PALANG['pDelete_domain_error'] = '<span class="error_msg">This domain is not yours ';
+
+$PALANG['pCreate_alias_welcome'] = 'Create a new alias for your domain.';
+$PALANG['pCreate_alias_address'] = 'Alias';
+$PALANG['pCreate_alias_address_text_error1'] = '<br /><span class="error_msg">The ALIAS is not valid.</span>';
+$PALANG['pCreate_alias_address_text_error2'] = '<br /><span class="error_msg">This email address already exists, please choose a different one.</span>';
+$PALANG['pCreate_alias_address_text_error3'] = '<br /><span class="error_msg">You have reached your limit to create aliases.</span>';
+$PALANG['pCreate_alias_goto'] = 'To';
+$PALANG['pCreate_alias_button'] = 'Add Alias';
+$PALANG['pCreate_alias_goto_text'] = 'Where the mail needs to be send to.';
+$PALANG['pCreate_alias_goto_text_error'] = 'Where the email needs to go.<br /><span class="error_msg">The TO is not valid.</span>';
+$PALANG['pCreate_alias_result_error'] = '<span class="error_msg">Unable to add the alias to the alias table.</span>';
+$PALANG['pCreate_alias_result_succes'] = 'The alias has been added to the alias table.';
+$PALANG['pCreate_alias_catchall_text'] = 'To create a catch-all use an "*" as alias.<br />For domain to domain forwarding use "*@domain.tld" as to.';
+
+$PALANG['pEdit_alias_welcome'] = 'Edit an alias for your domain.<br />One entry per line.';
+$PALANG['pEdit_alias_address'] = 'Alias';
+$PALANG['pEdit_alias_address_error'] = '<span class="error_msg">Unable to locate alias.</span>';
+$PALANG['pEdit_alias_goto'] = 'To';
+$PALANG['pEdit_alias_goto_text_error1'] = '<span class="error_msg">You didn\'t enter anything at To</span>';
+$PALANG['pEdit_alias_goto_text_error2'] = '<span class="error_msg">The email address that you have entered is not valid: ';
+$PALANG['pEdit_alias_domain_error'] = '<span class="error_msg">This domain is not yours: ';
+$PALANG['pEdit_alias_button'] = 'Edit Alias';
+$PALANG['pEdit_alias_result_error'] = '<span class="error_msg">Unable to modify the alias.</span>';
+
+$PALANG['pCreate_mailbox_welcome'] = 'Create a new mailbox for your domain.';
+$PALANG['pCreate_mailbox_username'] = 'Username';
+$PALANG['pCreate_mailbox_username_text_error1'] = '<br /><span class="error_msg">The EMAIL is not valid.</span>';
+$PALANG['pCreate_mailbox_username_text_error2'] = '<br /><span class="error_msg">This email address already exists, please choose a different one.</span>';
+$PALANG['pCreate_mailbox_username_text_error3'] = '<br /><span class="error_msg">You have reached your limit to create mailboxes.</span>';
+$PALANG['pCreate_mailbox_password'] = 'Password';
+$PALANG['pCreate_mailbox_password2'] = 'Password (again)';
+$PALANG['pCreate_mailbox_password_text'] = 'Password for POP3/IMAP';
+$PALANG['pCreate_mailbox_password_text_error'] = 'Password for POP3/IMAP<br /><span class="error_msg">The passwords that you supplied don\'t match, or are empty.</span>';
+$PALANG['pCreate_mailbox_name'] = 'Name';
+$PALANG['pCreate_mailbox_name_text'] = 'Full name';
+$PALANG['pCreate_mailbox_quota'] = 'Quota';
+$PALANG['pCreate_mailbox_quota_text'] = 'MB';
+$PALANG['pCreate_mailbox_quota_text_error'] = 'MB<br /><span class="error_msg">The quota that you specified is to high.</span>';
+$PALANG['pCreate_mailbox_active'] = 'Active';
+$PALANG['pCreate_mailbox_mail'] = 'Create mailbox';
+$PALANG['pCreate_mailbox_button'] = 'Add Mailbox';
+$PALANG['pCreate_mailbox_result_error'] = '<span class="error_msg">Unable to add the mailbox to the mailbox table.</span>';
+$PALANG['pCreate_mailbox_result_succes'] = 'The mailbox has been added to the mailbox table.';
+
+$PALANG['pEdit_mailbox_welcome'] = 'Edit a mailbox for your domain.';
+$PALANG['pEdit_mailbox_username'] = 'Username';
+$PALANG['pEdit_mailbox_username_error'] = '<span class="error_msg">Unable to locate mailbox.</span>';
+$PALANG['pEdit_mailbox_password'] = 'New Password';
+$PALANG['pEdit_mailbox_password2'] = 'New Password (again)';
+$PALANG['pEdit_mailbox_password_text_error'] = '<span class="error_msg">The passwords that you supplied don\'t match.</span>';
+$PALANG['pEdit_mailbox_name'] = 'Name';
+$PALANG['pEdit_mailbox_quota'] = 'Quota';
+$PALANG['pEdit_mailbox_quota_text'] = 'MB';
+$PALANG['pEdit_mailbox_quota_text_error'] = 'MB<br /><span class="error_msg">The quota that you specified is to high.</span>';
+$PALANG['pEdit_mailbox_domain_error'] = '<span class="error_msg">This domain is not yours: ';
+$PALANG['pEdit_mailbox_button'] = 'Edit Mailbox';
+$PALANG['pEdit_mailbox_result_error'] = '<span class="error_msg">Unable to modify the mailbox.</span>';
+
+$PALANG['pPassword_welcome'] = 'Change your login password.';
+$PALANG['pPassword_admin'] = 'Login';
+$PALANG['pPassword_admin_text_error'] = '<span class="error_msg">The LOGIN that you supplied doesn\'t match a mailbox.</span>';
+$PALANG['pPassword_password_current'] = 'Current Password';
+$PALANG['pPassword_password_current_text_error'] = '<span class="error_msg">You didn\'t supply your current password.</span>';
+$PALANG['pPassword_password'] = 'New Password';
+$PALANG['pPassword_password2'] = 'New Password (again)';
+$PALANG['pPassword_password_text_error'] = '<span class="error_msg">The passwords that you supplied don\'t match, or are empty.</span>';
+$PALANG['pPassword_button'] = 'Change Password';
+$PALANG['pPassword_result_error'] = '<span class="error_msg">Unable to change your password.</span>';
+$PALANG['pPassword_result_succes'] = 'Your password has been changed.';
+
+$PALANG['pViewlog_welcome'] = 'View the last 10 actions for ';
+$PALANG['pViewlog_timestamp'] = 'Timestamp';
+$PALANG['pViewlog_username'] = 'Admin';
+$PALANG['pViewlog_domain'] = 'Domain';
+$PALANG['pViewlog_action'] = 'Action';
+$PALANG['pViewlog_data'] = 'Data';
+
+$PALANG['pViewlog_button'] = 'Go';
+$PALANG['pViewlog_result_error'] = '<span class="error_msg">Unable to find the logs.</span>';
+
+$PALANG['pSendmail_welcome'] = 'Send an email.';
+$PALANG['pSendmail_admin'] = 'From';
+$PALANG['pSendmail_to'] = 'To';
+$PALANG['pSendmail_to_text_error'] = '<span class="error_msg">To is empty or is not a valid email address.</span>';
+$PALANG['pSendmail_subject'] = 'Subject';
+$PALANG['pSendmail_subject_text'] = 'Welcome';
+$PALANG['pSendmail_body'] = 'Body';
+$PALANG['pSendmail_button'] = 'Send Message';
+$PALANG['pSendmail_result_error'] = '<span class="error_msg">Unable to create mailbox.</span>';
+$PALANG['pSendmail_result_succes'] = 'The mailbox has been created.';
+
+$PALANG['pAdminMenu_list_admin'] = 'Admin List';
+$PALANG['pAdminMenu_list_domain'] = 'Domain List';
+$PALANG['pAdminMenu_list_virtual'] = 'Virtual List';
+$PALANG['pAdminMenu_viewlog'] = 'View Log';
+$PALANG['pAdminMenu_backup'] = 'Backup';
+$PALANG['pAdminMenu_create_domain_admins'] = 'Domain Admins';
+$PALANG['pAdminMenu_create_admin'] = 'New Admin';
+$PALANG['pAdminMenu_create_domain'] = 'New Domain';
+$PALANG['pAdminMenu_create_alias'] = 'Add Alias';
+$PALANG['pAdminMenu_create_mailbox'] = 'Add Mailbox';
+
+$PALANG['pAdminList_admin_domain'] = 'Domain';
+$PALANG['pAdminList_admin_username'] = 'Admin';
+$PALANG['pAdminList_admin_count'] = 'Domains';
+$PALANG['pAdminList_admin_modified'] = 'Last Modified';
+$PALANG['pAdminList_admin_active'] = 'Active';
+
+$PALANG['pAdminList_domain_domain'] = 'Domain';
+$PALANG['pAdminList_domain_description'] = 'Description';
+$PALANG['pAdminList_domain_aliases'] = 'Aliases';
+$PALANG['pAdminList_domain_mailboxes'] = 'Mailboxes';
+$PALANG['pAdminList_domain_maxquota'] = 'Quota (MB)';
+$PALANG['pAdminList_domain_transport'] = 'Transport';
+$PALANG['pAdminList_domain_backupmx'] = 'Backup MX';
+$PALANG['pAdminList_domain_modified'] = 'Last Modified';
+$PALANG['pAdminList_domain_active'] = 'Active';
+
+$PALANG['pAdminList_virtual_button'] = 'Go';
+$PALANG['pAdminList_virtual_welcome'] = 'Overview for ';
+$PALANG['pAdminList_virtual_alias_alias_count'] = 'Aliases';
+$PALANG['pAdminList_virtual_alias_mailbox_count'] = 'Mailboxes';
+$PALANG['pAdminList_virtual_alias_address'] = 'From';
+$PALANG['pAdminList_virtual_alias_goto'] = 'To';
+$PALANG['pAdminList_virtual_alias_modified'] = 'Last Modified';
+$PALANG['pAdminList_virtual_mailbox_username'] = 'Email';
+$PALANG['pAdminList_virtual_mailbox_name'] = 'Name';
+$PALANG['pAdminList_virtual_mailbox_quota'] = 'Quota (MB)';
+$PALANG['pAdminList_virtual_mailbox_modified'] = 'Last Modified';
+$PALANG['pAdminList_virtual_mailbox_active'] = 'Active';
+
+$PALANG['pAdminCreate_domain_welcome'] = 'Add a new domain';
+$PALANG['pAdminCreate_domain_domain'] = 'Domain';
+$PALANG['pAdminCreate_domain_domain_text_error'] = '<span class="error_msg">The domain already exists.</span>';
+$PALANG['pAdminCreate_domain_description'] = 'Description';
+$PALANG['pAdminCreate_domain_aliases'] = 'Aliases';
+$PALANG['pAdminCreate_domain_aliases_text'] = '-1 = disable | 0 = unlimited';
+$PALANG['pAdminCreate_domain_mailboxes'] = 'Mailboxes';
+$PALANG['pAdminCreate_domain_mailboxes_text'] = '-1 = disable | 0 = unlimited';
+$PALANG['pAdminCreate_domain_maxquota'] = 'Max Quota';
+$PALANG['pAdminCreate_domain_maxquota_text'] = 'MB<br /> -1 = disable | 0 = unlimited';
+$PALANG['pAdminCreate_domain_transport'] = 'Transport';
+$PALANG['pAdminCreate_domain_transport_text'] = 'Define transport';
+$PALANG['pAdminCreate_domain_defaultaliases'] = 'Add default mail aliases';
+$PALANG['pAdminCreate_domain_backupmx'] = 'Mail server is backup MX';
+$PALANG['pAdminCreate_domain_button'] = 'Add Domain';
+$PALANG['pAdminCreate_domain_result_error'] = '<span class="error_msg">Unable to add domain.</span>';
+$PALANG['pAdminCreate_domain_result_succes'] = 'Domain has been added.';
+
+$PALANG['pAdminEdit_domain_welcome'] = 'Edit a domain';
+$PALANG['pAdminEdit_domain_domain'] = 'Domain';
+$PALANG['pAdminEdit_domain_description'] = 'Description';
+$PALANG['pAdminEdit_domain_aliases'] = 'Aliases';
+$PALANG['pAdminEdit_domain_aliases_text'] = '-1 = disable | 0 = unlimited';
+$PALANG['pAdminEdit_domain_mailboxes'] = 'Mailboxes';
+$PALANG['pAdminEdit_domain_mailboxes_text'] = '-1 = disable | 0 = unlimited';
+$PALANG['pAdminEdit_domain_maxquota'] = 'Max Quota';
+$PALANG['pAdminEdit_domain_maxquota_text'] = 'MB<br /> -1 = disable | 0 = unlimited';
+$PALANG['pAdminEdit_domain_transport'] = 'Transport';
+$PALANG['pAdminEdit_domain_transport_text'] = 'Define transport';
+$PALANG['pAdminEdit_domain_backupmx'] = 'Mail server is backup MX';
+$PALANG['pAdminEdit_domain_active'] = 'Active';
+$PALANG['pAdminEdit_domain_button'] = 'Edit Domain';
+$PALANG['pAdminEdit_domain_result_error'] = '<span class="error_msg">Unable to modify domain.</span>';
+
+$PALANG['pAdminCreate_admin_welcome'] = 'Add a new domain admin';
+$PALANG['pAdminCreate_admin_username'] = 'Admin';
+$PALANG['pAdminCreate_admin_username_text'] = 'email address';
+$PALANG['pAdminCreate_admin_username_text_error1'] = 'Email address<br /><span class="error_msg">Admin is not a valid email address.</span>';
+$PALANG['pAdminCreate_admin_username_text_error2'] = 'Email address<br /><span class="error_msg">The admin already exists or is not valid</span>';
+$PALANG['pAdminCreate_admin_password'] = 'Password';
+$PALANG['pAdminCreate_admin_password2'] = 'Password (again)';
+$PALANG['pAdminCreate_admin_password_text_error'] = '<span class="error_msg">The passwords that you supplied don\'t match, or are empty.</span>';
+$PALANG['pAdminCreate_admin_button'] = 'Add Admin';
+$PALANG['pAdminCreate_admin_result_error'] = '<span class="error_msg">Unable to add admin.</span>';
+$PALANG['pAdminCreate_admin_result_succes'] = 'Admin has been added.';
+$PALANG['pAdminCreate_admin_address'] = 'Domain';
+
+$PALANG['pAdminEdit_admin_welcome'] = 'Edit a domain admin';
+$PALANG['pAdminEdit_admin_username'] = 'Admin';
+$PALANG['pAdminEdit_admin_password'] = 'Password';
+$PALANG['pAdminEdit_admin_password2'] = 'Password (again)';
+$PALANG['pAdminEdit_admin_password_text_error'] = '<span class="error_msg">The passwords that you supplied don\'t match, or are empty.</span>';
+$PALANG['pAdminEdit_admin_active'] = 'Active';
+$PALANG['pAdminEdit_admin_button'] = 'Edit Admin';
+$PALANG['pAdminEdit_admin_result_error'] = '<span class="error_msg">Unable to modify admin.</span>';
+$PALANG['pAdminEdit_admin_result_succes'] = 'Admin has been modified.';
+
+$PALANG['pUsersLogin_welcome'] = 'Mailbox users login to change your password and aliases.';
+$PALANG['pUsersLogin_username'] = 'Login (email)';
+$PALANG['pUsersLogin_password'] = 'Password';
+$PALANG['pUsersLogin_button'] = 'Login';
+$PALANG['pUsersLogin_username_incorrect'] = 'Your login is not correct. Make sure that you login with your email address.';
+$PALANG['pUsersLogin_password_incorrect'] = 'Your password is not correct.';
+
+$PALANG['pUsersMenu_vacation'] = 'Auto Response';
+$PALANG['pUsersMenu_edit_alias'] = 'Change your forward';
+$PALANG['pUsersMenu_password'] = 'Change Password';
+
+$PALANG['pUsersMain_vacation'] = 'Set an "out of office" message or auto responder for your mail.';
+$PALANG['pUsersMain_edit_alias'] = 'Change your email forwarding.';
+$PALANG['pUsersMain_password'] = 'Change your current password.';
+
+$PALANG['pUsersVacation_welcome'] = 'Auto Response.';
+$PALANG['pUsersVacation_welcome_text'] = 'You already have an auto response configured.';
+$PALANG['pUsersVacation_subject'] = 'Subject';
+$PALANG['pUsersVacation_subject_text'] = 'Out of Office';
+$PALANG['pUsersVacation_body'] = 'Body';
+$PALANG['pUsersVacation_body_text'] = <<<EOM
+I will be away from <date> until <date>.
+For urgent matters you can contact <contact person>.
+EOM;
+$PALANG['pUsersVacation_button_away'] = 'Going Away';
+$PALANG['pUsersVacation_button_back'] = 'Coming Back';
+$PALANG['pUsersVacation_result_error'] = '<span class="error_msg">Unable to update your auto response settings.</span>';
+$PALANG['pUsersVacation_result_succes'] = 'Your auto response has been removed.';
+
+$PALANG['pCreate_dbLog_createmailbox'] = 'create mailbox';
+$PALANG['pCreate_dbLog_createalias'] = 'create alias';
+$PALANG['pDelete_dbLog_deletealias'] = 'delete alias';
+$PALANG['pDelete_dbLog_deletemailbox'] = 'delete mailbox';
+
+$PALANG['pEdit_dbLog_editactive'] = 'change active state';
+$PALANG['pEdit_dbLog_editalias'] = 'edit alias';
+$PALANG['pEdit_dbLog_editmailbox'] = 'edit mailbox';
+
+$PALANG['pSearch_welcome'] = 'Searching for: ';
+?>
blob - /dev/null
blob + a8b62bd60cf949801863d1e910f26965a1aed4fc (mode 644)
--- /dev/null
+++ languages/index.php
+<?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: ../login.php");
+exit;
+?>
blob - /dev/null
blob + 412495dc5381afaa6b006b9a7a3c692ba6532ed2 (mode 644)
--- /dev/null
+++ login.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: login.php
+//
+// Template File: login.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tUsername
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fPassword
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language () . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fUsername = escape_string ($_POST['fUsername']);
+ $fPassword = escape_string ($_POST['fPassword']);
+
+ $result = db_query("SELECT password FROM admin WHERE username='$fUsername' AND active='1'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ if (!password_verify($fPassword, $row['password'])) {
+ $error = 1;
+ $tMessage = $PALANG['pLogin_password_incorrect'];
+ $tUsername = $fUsername;
+ }
+ } else {
+ $error = 1;
+ $tMessage = $PALANG['pLogin_username_incorrect'];
+ }
+
+ if ($error != 1) {
+ session_start();
+ $_SESSION['sessid']['username'] = $fUsername;
+ header("Location: main.php");
+ exit;
+ }
+}
+include("./templates/header.tpl");
+include("./templates/login.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 550fccf1c997f6cdad8f81523503fbb0d05be909 (mode 644)
--- /dev/null
+++ logout.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: logout.php
+//
+// Template File: -none-
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+require("./config.inc.php");
+require("./functions.inc.php");
+
+$SESSID_USERNAME = check_session();
+
+session_unset();
+session_destroy();
+
+header("Location: login.php");
+exit;
+?>
blob - /dev/null
blob + e92daaf53493bf97e523c1803b3aff8af2a24eb9 (mode 644)
--- /dev/null
+++ main.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: main.php
+//
+// Template File: main.tpl
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/main.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 16df579ccc8af9e7ba0b6fb1ce4e8cd82314275f (mode 644)
--- /dev/null
+++ overview.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: overview.php
+//
+// Template File: overview.tpl
+//
+// Template Variables:
+//
+// tAlias
+// tDomain
+// tMailbox
+// tDisplay_back
+// tDisplay_next
+//
+// Form POST \ GET Variables:
+//
+// domain
+// fDomain
+// limit
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains_for_admin($SESSID_USERNAME);
+
+$tAlias = array();
+$tMailbox = array();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $fDisplay = 0;
+ $page_size = $CONF['page_size'];
+
+ if (isset($_GET['domain'])) $fDomain = escape_string($_GET['domain']);
+ if (isset($_GET['limit'])) $fDisplay = escape_string($_GET['limit']);
+
+ if (check_owner($SESSID_USERNAME, $fDomain)) {
+ $limit = get_domain_properties($fDomain);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain='$fDomain' ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain='$fDomain' AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ }
+
+ $result = db_query("$query");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+ $template = "overview.tpl";
+ } else {
+ $template = "overview-get.tpl";
+ }
+
+ $tDomain = $fDomain;
+
+ if (isset($limit)) {
+ if ($fDisplay >= $page_size) {
+ $tDisplay_back_show = 1;
+ $tDisplay_back = $fDisplay - $page_size;
+ }
+ if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) {
+ $tDisplay_up_show = 1;
+ }
+ if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) {
+ $tDisplay_next_show = 1;
+ $tDisplay_next = $fDisplay + $page_size;
+ }
+ }
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/$template");
+ include("./templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fDisplay = 0;
+ $page_size = $CONF['page_size'];
+
+ if (isset($_POST['limit'])) $fDisplay = escape_string($_POST['limit']);
+
+ if (check_owner($SESSID_USERNAME, escape_string($_POST['fDomain']))) {
+ $fDomain = escape_string($_POST['fDomain']);
+
+ $limit = get_domain_properties($fDomain);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain='$fDomain' ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain='$fDomain' AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT $fDisplay, $page_size";
+ }
+
+ $result = db_query("$query");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tAlias[] = $row;
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tMailbox[] = $row;
+ }
+ }
+ }
+
+ if (isset($limit)) {
+ if ($fDisplay >= $page_size) {
+ $tDisplay_back_show = 1;
+ $tDisplay_back = $fDisplay - $page_size;
+ }
+ if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) {
+ $tDisplay_up_show = 1;
+ }
+ if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) {
+ $tDisplay_next_show = 1;
+ $tDisplay_next = $fDisplay + $page_size;
+ }
+ }
+ include("./templates/header.tpl");
+ include("./templates/menu.tpl");
+ include("./templates/overview.tpl");
+ include("./templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + 0ca3d13fa91f10ea31125e0cf2f20f1a2bafe9d7 (mode 644)
--- /dev/null
+++ password.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: password.php
+//
+// Template File: password.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fPassword_current
+// fPassword
+// fPassword2
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fPassword_current = escape_string($_POST['fPassword_current']);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+
+ $username = $SESSID_USERNAME;
+
+ $result = db_query("SELECT * FROM admin WHERE username='$username'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ if (!password_verify($fPassword_current, $row['password'])) {
+ $error = 1;
+ $pPassword_password_current_text = $PALANG['pPassword_password_current_text_error'];
+ }
+ } else {
+ $error = 1;
+ $pPassword_email_text = $PALANG['pPassword_email_text_error'];
+ }
+
+ if (empty($fPassword) or ($fPassword != $fPassword2))
+ {
+ $error = 1;
+ $pPassword_password_text = $PALANG['pPassword_password_text_error'];
+ }
+
+ if ($error != 1) {
+ $password = pacrypt($fPassword);
+ $result = db_query("UPDATE admin SET password='$password',modified=NOW() WHERE username='$username'");
+ if ($result['rows'] == 1) {
+ $tMessage = $PALANG['pPassword_result_succes'];
+ } else {
+ $tMessage = $PALANG['pPassword_result_error'];
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/password.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + f69a9861891f9e9cf38ea584afa3905e10779a10 (mode 644)
--- /dev/null
+++ search.php
+<?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:
+//
+// tAlias
+// tMailbox
+//
+// Form POST \ GET Variables:
+//
+// fSearch
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+$tAlias = array();
+$tMailbox = array();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if (isset($_GET['search'])) $fSearch = escape_string($_GET['search']);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias WHERE alias.address LIKE '%$fSearch%' OR alias.goto LIKE '%$fSearch%' ORDER BY alias.address";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE '%$fSearch%' AND mailbox.maildir IS NULL ORDER BY alias.address";
+ }
+
+ $result = db_query("$query");
+
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ if (check_owner($SESSID_USERNAME, $row['domain'])) {
+ $tAlias[] = $row;
+ }
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username LIKE '%$fSearch%' ORDER BY username");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ if (check_owner($SESSID_USERNAME, $row['domain'])) {
+ $tMailbox[] = $row;
+ }
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ if (isset($_POST['search'])) $fSearch = escape_string($_POST['search']);
+
+ if ($CONF['alias_control'] == "YES") {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias WHERE alias.address LIKE '%$fSearch%' OR alias.goto LIKE '%$fSearch%' ORDER BY alias.address";
+ } else {
+ $query = "SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE '%$fSearch%' AND mailbox.maildir IS NULL ORDER BY alias.address";
+ }
+
+ $result = db_query("$query");
+
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ if (check_owner($SESSID_USERNAME, $row['domain'])) {
+ $tAlias[] = $row;
+ }
+ }
+ }
+
+ $result = db_query("SELECT * FROM mailbox WHERE username LIKE '%$fSearch%' ORDER BY username");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ if (check_owner($SESSID_USERNAME, $row['domain'])) {
+ $tMailbox[] = $row;
+ }
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/search.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 779b05e89646745cb93b296641d0751dcda86444 (mode 644)
--- /dev/null
+++ sendmail.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: sendmail.php
+//
+// Template File: sendmail.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tFrom
+// tSubject
+// tBody
+//
+// Form POST \ GET Variables:
+//
+// fTo
+// fSubject
+// fBody
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fTo = escape_string($_POST['fTo']);
+ $fSubject = escape_string($_POST['fSubject']);
+ $fHeaders = "From: " . $SESSID_USERNAME . "\r\n";
+ $fHeaders .= "Content-Type: text/plain; charset=utf-8\r\n";
+ $fBody = escape_string($_POST['fBody']);
+
+ if (empty($fTo) or !check_email($fTo)) {
+ $error = 1;
+ $tTo = escape_string($_POST['fTo']);
+ $tSubject = escape_string($_POST['fSubject']);
+ $tBody = escape_string($_POST['fBody']);
+ $tMessage = $PALANG['pSendmail_to_text_error'];
+ }
+
+ if ($error != 1) {
+ if (!mail($fTo, $fSubject, $fBody, $fHeaders)) {
+ $tMessage .= $PALANG['pSendmail_result_error'];
+ } else {
+ $tMessage .= $PALANG['pSendmail_result_succes'];
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/sendmail.tpl");
+include("./templates/footer.tpl");
+?>
blob - /dev/null
blob + 81eae7fd60e51870e917af89de4587d81e73cdf0 (mode 644)
--- /dev/null
+++ setup.php
+<?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-
+//
+?>
+<html>
+<head>
+<title>OpenSMTPD Admin Setup Checker</title>
+</head>
+<body>
+<img id="login_header_logo" src="images/postbox.png" />
+<img id="login_header_logo" height="30px" src="images/opensmtpdadmin.png" />
+<h2>OpenSMTPD Admin Setup Checker 1.0</h2>
+Running software:<br />
+<p />
+<?php
+//
+// Check for availablilty functions
+//
+$f_phpversion = function_exists("phpversion");
+$f_apache_get_version = function_exists("apache_get_version");
+$f_get_magic_quotes_gpc = function_exists("get_magic_quotes_gpc");
+$f_mysql_connect = function_exists("mysql_connect");
+$f_mysqli_connect = function_exists("mysqli_connect");
+$f_pg_connect = function_exists("pg_connect");
+$f_session_start = function_exists("session_start");
+$f_preg_match = function_exists("preg_match");
+
+$file_config = file_exists(realpath("./config.inc.php"));
+
+$error = 0;
+
+//
+// Check for PHP version
+//
+if ($f_phpversion == 1) {
+ if (phpversion() < 8) $phpversion = 7;
+ if (phpversion() >= 8) $phpversion = 8;
+ print "- PHP version " . phpversion() . "<br />\n";
+} else {
+ print "<li><b>Unable to check for PHP version. (missing function: phpversion())</b><br />\n";
+}
+print "<p />\n";
+print "Checking for dependencies:<br />\n";
+print "<p />\n";
+
+//
+// Check for config.inc.php
+//
+if ($file_config == 1) {
+ print "- Depends on: presence config.inc.php - OK<br />\n";
+} else {
+ print "<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br />\n";
+ print "Create the file.<br />";
+ print "For example:<br />\n";
+ print "<pre>% cp config.inc.php.sample config.inc.php</pre>\n";
+ $error =+ 1;
+}
+print "<p />\n";
+
+//
+// Check if there is support for at least 1 database
+//
+if (($f_mysql_connect == 0) and ($f_mysqli_connect == 0) and ($f_pg_connect == 0)) {
+ print "<li><b>Error: There is no database support in your PHP setup</b><br />\n";
+ print "To install MariaDB 10 support on OpenBSD:<br />\n";
+ print "% pkg_add php-mysqli</pre>\n";
+ print "To install PostgreSQL support on OpenBSD:<br />\n";
+ print "% pkg_add php-pgsql</pre>\n";
+ $error =+ 1;
+}
+//
+// MariaDB functions
+//
+if ($f_mysqli_connect == 1) {
+ print "- Depends on: MariaDB - OK<br />\n";
+}
+print "<p />\n";
+
+//
+// PostgreSQL functions
+//
+if ($f_pg_connect == 1) {
+ print "- Depends on: PostgreSQL - OK (change the database_type in config.inc.php!!)<br />\n";
+}
+print "<p />\n";
+
+//
+// Session functions
+//
+if ($f_session_start == 1) {
+ print "- Depends on: session - OK<br />\n";
+} else {
+ print "<li><b>Error: Depends on: session - NOT FOUND</b><br />\n";
+ print "To install session support on FreeBSD:<br />\n";
+ print "<pre>% cd /usr/ports/www/php$phpversion-session/\n";
+ print "% make clean install\n";
+ print " - or with portupgrade -\n";
+ print "% portinstall php$phpversion-session</pre>\n";
+ $error =+ 1;
+}
+print "<p />\n";
+
+//
+// PCRE functions
+//
+if ($f_preg_match == 1) {
+ print "- Depends on: pcre - OK<br />\n";
+} else {
+ print "<li><b>Error: Depends on: pcre - NOT FOUND</b><br />\n";
+ print "To install pcre support on FreeBSD:<br />\n";
+ print "<pre>% cd /usr/ports/devel/php$phpversion-pcre/\n";
+ print "% make clean install\n";
+ print " - or with portupgrade -\n";
+ print "% portinstall php$phpversion-pcre</pre>\n";
+ $error =+ 1;
+}
+print "<p />\n";
+
+if ($error == 0) {
+ print "Everything seems fine... you are ready to rock & roll!</br>\n";
+ print "<b>Make sure you delete this setup.php file!</b><br />\n";
+ print "Also check the config.inc.php file for any settings that you might need to change!<br />\n";
+ print "Click here to go to the <a href=\"admin/index.php\">admin section</a> (make sure that your .htaccess is setup properly)\n";
+}
+?>
+</body>
+</html>
blob - /dev/null
blob + 779666dd033ecc149584a759fa59de1a120da0d9 (mode 644)
--- /dev/null
+++ stylesheet.css
+body {
+ background: #ffffff;
+ color: #000000;
+ font-family: BitStream Vera Sans, Verdana, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ font-weight: normal;
+ text-align: center;
+}
+
+a {
+ text-decoration: none;
+ color: #888888;
+}
+
+a:hover {
+ text-decoration: underline;
+ color: #888888;
+}
+
+a:visited, a:active {
+ color: #888888;
+}
+
+.button {
+ border: 1px solid #aaaaaa;
+ color: #777777;
+ background: #dddddd;
+ padding: 3px 3px 3px 3px;
+ font-size: 12px;
+}
+
+.button:hover {
+ background: #BCFF36;
+ color: #888888;
+}
+
+.flat {
+ border: 1px solid #888888;
+}
+
+.error_msg {
+ color: #d01313;
+}
+
+.standout {
+ color: maroon;
+ padding: 3px 3px 3px 3px;
+ text-align: center;
+}
+
+#login_header {
+ width: 800px;
+ margin: 0 auto;
+ padding-bottom: 10px;
+ text-align: left;
+}
+
+
+#login {
+ width: 750px;
+ margin: 0 auto;
+}
+
+#login_table {
+ border-left: 8px solid gray;
+ border-right: 8px solid gray;
+ background: #eeeeee;
+ width: 350px;
+ margin: 0 auto;
+}
+
+#login_table h4 {
+ font-size: 13px;
+}
+
+#menu {
+ width: 800px;
+ margin: 0 auto;
+ padding-top: 10px;
+}
+
+#menu ul li {
+ display: inline;
+ background: #efefef;
+ padding: 20px 5px 5px 5px;
+ margin-right: 3px;
+ border-top: 4px solid #aaaaaa;
+}
+
+#menu ul li:hover {
+ background: #BFFF00; /* #F32121; */
+ color: white;
+}
+
+#menu ul li a {
+ color: #888888;
+}
+
+#menu ul li a:hover {
+ color: #888888;
+}
+
+
+#main_menu, #edit_form {
+ width: 800px;
+ margin: 0 auto;
+}
+
+#edit_form table {
+ margin: 0 auto;
+ padding-top: 10px;
+ text-align: left;
+ width: 500px;
+ border: 1px solid #efefef;
+}
+
+#edit_form h3 {
+ text-align: center;
+ font-size: 12px;
+ margin: 0;
+ background: #AFE1A6; /*#b4004a;*/
+ border: 1px solid #bbb;
+ line-height: 25px;
+ color: #555555;
+}
+
+/* Helper class to center some attribs */
+.hlp_center {
+ text-align: center;
+}
+
+.help_text{
+ background: #efefef;
+ border-left: 1px solid #bbbbbb;
+ border-right: 1px solid #bbbbbb;
+ text-align: center;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+#main_menu table {
+ margin: 0 auto;
+ text-align: left;
+ padding-top: 20px;
+ padding-bottom: 20px;
+}
+
+#main_menu table td {
+ padding-left: 30px;
+ padding-bottom: 5px;
+}
+
+#main_menu a {
+ color: #888888;
+ padding-left: 8px;
+}
+
+#main_menu a:hover {
+ color: #40B33C; /*#CD6A6A;*/
+ text-decoration: none;
+ padding-left: 4px;
+ border-bottom: 1px solid #40B33C;
+ border-left: 4px solid #40B33C;
+}
+
+#overview, #admin_domains, #admin_virtual {
+ width: 800px;
+ margin: 0 auto;
+ background: #AFE1A6; /*#9ACD32;*/
+ border: 1px solid #bbb;
+}
+
+#overview h4, #overview P, #overview FORM, #admin_virtual h4, #admin_virtual P, #admin_virtual FORM {
+ display: inline;
+ padding-right: 20px;
+ line-height: 30px;
+}
+
+#nav_bar {
+ text-align: right;
+ width: 800px;
+ margin: 0 auto;
+}
+
+#alias_table, #mailbox_table, #overview_table, #log_table, #admin_table {
+ width: 800px;
+ margin: 0px auto;
+ border: 1px solid #efefef;
+}
+
+#alias_table .header, #mailbox_table .header, #overview_table .header, #log_table .header, #admin_table .header {
+ line-height: 20px;
+ background: #efefef;
+ color: black;
+}
+
+#alias_table .hilightoff, #mailbox_table .hilightoff, #overview_table .hilightoff, #log_table .hilightoff, #admin_table .hilighoff {
+ background: white;
+}
+
+#alias_table .hilighton, #mailbox_table .hilighton, #overview_table .hilighton, #log_table .hilighton, #admin_table .hilighton {
+ background: #D9FF43; /*#D6FF85;*/ /*#ffdddd;*/
+}
+
+#alias_table h3, #mailbox_table h3, #overview_table h3, #log_table h3, #admin_table h3 {
+ background: silver;
+ text-align: left;
+ font-size: 12px;
+ font-weight: bold;
+ padding-left: 20px;
+ line-height: 25px;
+ margin: 0;
+}
+
+#footer {
+ width: 800px;
+ margin: 20px auto;
+ border-top: 1px solid #bbbbbb;
+ background: #efefef;
+ color: #999999;
+ line-height: 20px;
+ text-align: left;
+ padding-left: 15px;
+ font-size: 11px;
+}
+
+#footer a {
+ text-decoration: none;
+ color: #999999;
+}
+
+#footer a:hover {
+ text-decoration: underline;
+ color: #777777;
+}
+
blob - /dev/null
blob + 3bdc8e206e7fa7c7f9900ebaf710bb26c8e15793 (mode 644)
--- /dev/null
+++ templates/admin_create-admin.tpl
+<div id="edit_form">
+<form name="create_admin" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pAdminCreate_admin_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_admin_username'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fUsername" value="<?php print $tUsername; ?>" /></td>
+ <td><?php print $pAdminCreate_admin_username_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_admin_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ <td><?php print $pAdminCreate_admin_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_admin_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_admin_address'] . ":"; ?></td>
+ <td>
+ <select name="fDomains[]" size="10" multiple="multiple">
+ <?php
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if (in_array($list_domains[$i], $tDomains)) {
+ print "<option value=\"" . $list_domains[$i] . "\" selected=\"selected\">" . $list_domains[$i] . "</option>\n";
+ } else {
+ print "<option value=\"" . $list_domains[$i] . "\">" . $list_domains[$i] . "</option>\n";
+ }
+ }
+ ?>
+ </select>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pAdminCreate_admin_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 9e0efb87e4410a01eec2a1123ce75979f93a2d77 (mode 644)
--- /dev/null
+++ templates/admin_create-domain.tpl
+<div id="edit_form">
+<form name="create_domain" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pAdminCreate_domain_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_domain'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fDomain" value="<?php print $tDomain; ?>" /></td>
+ <td><?php print $pAdminCreate_domain_domain_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_description'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fDescription" value="<?php print $tDescription; ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_aliases'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fAliases" value="<?php print $tAliases; ?>" /></td>
+ <td><?php print $PALANG['pAdminCreate_domain_aliases_text']; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_mailboxes'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fMailboxes" value="<?php print $tMailboxes; ?>" /></td>
+ <td><?php print $PALANG['pAdminCreate_domain_mailboxes_text']; ?></td>
+ </tr>
+ <?php if ($CONF['quota'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_maxquota'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fMaxquota" value="<?php print $tMaxquota; ?>" /></td>
+ <td><?php print $PALANG['pAdminCreate_domain_maxquota_text']; ?></td>
+ </tr>
+ <?php } if ($CONF['transport'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_transport'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fTransport" value="<?php print $tTransport; ?>" /></td>
+ <td><?php print $PALANG['pAdminCreate_domain_transport_text']; ?></td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_defaultaliases'] . ":"; ?></td>
+ <td><?php $checked = (!empty($tDefaultaliases)) ? 'checked' : ''; ?>
+ <input class="flat" type="checkbox" name="fDefaultaliases" <?php print $checked; ?> />
+ </td>
+ <td><?php print $pAdminCreate_domain_defaultaliases_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminCreate_domain_backupmx'] . ":"; ?></td>
+ <td><?php $checked = (!empty($tBackupmx)) ? 'checked' : ''; ?>
+ <input class="flat" type="checkbox" name="fBackupmx" <?php print $checked; ?> />
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pAdminCreate_domain_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + e679e2793bdfe075de0aa6a8cabe0b37e741b2cf (mode 644)
--- /dev/null
+++ templates/admin_edit-admin.tpl
+<div id="edit_form">
+<form name="edit_admin" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pAdminEdit_admin_welcome']; ?></h3></td></tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_admin_username'] . ":"; ?></td>
+ <td><?php print $username; ?></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_admin_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" ></td>
+ <td><?php print $pAdminEdit_admin_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_admin_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword2" ></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_admin_active'] . ":"; ?></td>
+ <td><input class="flat" type="checkbox" name="fActive" <?php print (!empty($tActive)) ? 'checked' : ''; ?> ></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan=3 align=center>
+ <select name="fDomains[]" size="10" multiple="multiple">
+ <?php
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if (in_array($list_domains[$i], $tDomains)) {
+ print "<option value=\"" . $list_domains[$i] . "\" selected=\"selected\">" . $list_domains[$i] . "</option>\n";
+ } else {
+ print "<option value=\"" . $list_domains[$i] . "\">" . $list_domains[$i] . "</option>\n";
+ }
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pAdminEdit_admin_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 8c640173b4ef1eb60b2d847ecc2da1a39480b332 (mode 644)
--- /dev/null
+++ templates/admin_edit-domain.tpl
+<div id="edit_form">
+<form name="edit_domain" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pAdminEdit_domain_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_domain'] . ":"; ?></td>
+ <td><?php print $domain; ?></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_description'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fDescription" value="<?php print htmlspecialchars($tDescription, ENT_QUOTES); ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_aliases'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fAliases" value="<?php print $tAliases; ?>" /></td>
+ <td><?php print $PALANG['pAdminEdit_domain_aliases_text']; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_mailboxes'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fMailboxes" value="<?php print $tMailboxes; ?>" /></td>
+ <td><?php print $PALANG['pAdminEdit_domain_mailboxes_text']; ?></td>
+ </tr>
+ <?php if ($CONF['quota'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_maxquota'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fMaxquota" value="<?php print $tMaxquota; ?>" /></td>
+ <td><?php print $PALANG['pAdminEdit_domain_maxquota_text']; ?></td>
+ </tr>
+ <?php } if ($CONF['transport'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_transport'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fTransport" value="<?php print $tTransport; ?>" /></td>
+ <td><?php $PALANG['pAdminEdit_domain_transport_text']; ?></td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_backupmx'] . ":"; ?></td>
+ <td><?php $checked = (!empty($tBackupmx)) ? 'checked' : ''; ?>
+ <input class="flat" type="checkbox" name="fBackupmx" <?php print $checked; ?> /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pAdminEdit_domain_active'] . ":"; ?></td>
+ <td><?php $checked = (!empty($tActive)) ? 'checked' : ''; ?>
+ <input class="flat" type="checkbox" name="fActive" <?php print $checked; ?> /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input type="submit" class="button" name="submit" value="<?php print $PALANG['pAdminEdit_domain_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 9d031a2aca1d65b42edeeceab5837987d5e15177 (mode 644)
--- /dev/null
+++ templates/admin_list-admin.tpl
+<?php
+if (!empty($list_admins)) {
+ $list_admins_count = count($list_admins);
+
+ if (is_array($list_admins) && $list_admins_count > 0) {
+ print "<table id=\"admin_table\">\n";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pAdminList_admin_username'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_admin_count'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_admin_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_admin_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < $list_admins_count; $i++) {
+ if ((is_array($list_admins) and $list_admins_count > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td><a href=\"list-domain.php?username=" . $list_admins[$i] . "\">" . $list_admins[$i] . "</a></td>";
+ print " <td>" . $admin_properties[$i]['domain_count'] . "</td>";
+ print " <td>" . $admin_properties[$i]['modified'] . "</td>";
+ $active = ($admin_properties[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active-admin.php?username=" . $list_admins[$i] . "\">" . $active . "</a></td>";
+ print " <td><a href=\"edit-admin.php?username=" . $list_admins[$i] . "\">" . $PALANG['edit'] . "</a></td>";
+ print " <td><a href=\"delete.php?table=admin&where=username&delete=" . $list_admins[$i] . "\" onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pAdminList_admin_username'] . ": " . $list_admins[$i] . "')\">" . $PALANG['del'] . "</a></td>";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+ }
+}
+?>
blob - /dev/null
blob + a19af99a3c05e24856837dd3177db8a7eb1446c7 (mode 644)
--- /dev/null
+++ templates/admin_list-domain.tpl
+<div id="overview">
+<form name="list_domain" method="post">
+<select name="fUsername" onChange="this.form.submit()";>
+<?php
+if (!empty($list_admins)) {
+ for ($i = 0; $i < count($list_admins); $i++) {
+ if ($fUsername == $list_admins[$i]) {
+ print "<option value=\"" . $list_admins[$i] . "\" selected>" . $list_admins[$i] . "</option>\n";
+ } else {
+ print "<option value=\"" . $list_admins[$i] . "\">" . $list_admins[$i] . "</option>\n";
+ }
+ }
+}
+?>
+</select>
+<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" />
+</form>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search" size="10">
+</form>
+</div>
+
+<?php
+if (count($list_domains) > 0) {
+ print "<table id=\"admin_table\">\n";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pAdminList_domain_domain'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_description'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_aliases'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_mailboxes'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pAdminList_domain_maxquota'] . "</td>\n";
+ if ($CONF['transport'] == 'YES') print " <td>" . $PALANG['pAdminList_domain_transport'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_backupmx'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_domain_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if ((is_array($list_domains) and count($list_domains) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print "<td><a href=\"list-virtual.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>";
+ print "<td>" . $domain_properties[$i]['description'] . "</td>";
+ print "<td>" . $domain_properties[$i]['alias_count'] . " / " . $domain_properties[$i]['aliases'] . "</td>";
+ print "<td>" . $domain_properties[$i]['mailbox_count'] . " / " . $domain_properties[$i]['mailboxes'] . "</td>";
+ if ($CONF['quota'] == 'YES') print "<td>" . $domain_properties[$i]['maxquota'] . "</td>";
+ if ($CONF['transport'] == 'YES') print "<td>" . $domain_properties[$i]['transport'] . "</td>";
+ $backupmx = ($domain_properties[$i]['backupmx'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print "<td>$backupmx</td>";
+ print "<td>" . $domain_properties[$i]['modified'] . "</td>";
+ $active = ($domain_properties[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print "<td><a href=\"edit-active-domain.php?domain=" . $list_domains[$i] . "\">" . $active . "</a></td>";
+ print "<td><a href=\"edit-domain.php?domain=" . $list_domains[$i] . "\">" . $PALANG['edit'] . "</a></td>";
+ print "<td><a href=\"delete.php?table=domain&where=domain&delete=" . $list_domains[$i] . "\" onclick=\"return confirm ('" . $PALANG['confirm_domain'] . $PALANG['pAdminList_admin_domain'] . ": " . $list_domains[$i] . "')\">" . $PALANG['del'] . "</a></td>";
+ print "</tr>\n";
+ }
+ }
+
+ print "</table>\n";
+}
+?>
blob - /dev/null
blob + a2c391c1df0c2358ef87a177ba02c6080b6c6407 (mode 644)
--- /dev/null
+++ templates/admin_list-virtual.tpl
+<div id="admin_virtual">
+<form name="list_virtual" method="post">
+<select name="fDomain" onChange="this.form.submit()";>
+<?php
+for ($i = 0; $i < count($list_domains); $i++) {
+ if ($fDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+}
+?>
+</select>
+<input type="hidden" name="limit" value="0">
+<input type="submit" name="go" value="<?php print $PALANG['pAdminList_virtual_button']; ?>" />
+</form>
+<h4><?php print $PALANG['pAdminList_virtual_welcome'] . $fDomain; ?></h4>
+<p><?php print $PALANG['pAdminList_virtual_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p>
+<p><?php print $PALANG['pAdminList_virtual_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search" size="10">
+</form>
+</div>
+
+<?php
+print "<div id=\"nav_bar\">\n";
+if ($tDisplay_back_show == 1) {
+ print "<a href=\"list-virtual.php?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"../images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\"></a>\n";
+}
+if ($tDisplay_up_show == 1) {
+ print "<a href=\"list-virtual.php?domain=$fDomain&limit=0\"><img border=\"0\" src=\"../images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\"></a>\n";
+}
+if ($tDisplay_next_show == 1) {
+ print "<a href=\"list-virtual.php?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"../images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\"></a>\n";
+}
+print "</div>\n";
+
+if (count($tAlias) > 0) {
+ print "<table id=\"alias_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pAdminList_virtual_alias_address'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_virtual_alias_goto'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_virtual_alias_modified'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tAlias); $i++) {
+ if ((is_array($tAlias) and count($tAlias) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tAlias[$i]['address'] . "</td>\n";
+ print " <td>" . preg_replace("/,/", "<br>", $tAlias[$i]['goto']) . "</td>\n";
+ print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+
+if (count($tMailbox) > 0) {
+ print "<table id=\"mailbox_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pAdminList_virtual_mailbox_username'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_virtual_mailbox_name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pAdminList_virtual_mailbox_quota'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_virtual_mailbox_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pAdminList_virtual_mailbox_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tMailbox); $i++) {
+ if ((is_array($tMailbox) and count($tMailbox) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $tMailbox[$i]['quota'] / $CONF['quota_multiplier'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
+ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-mailbox.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=mailbox" . "&delete=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+?>
blob - /dev/null
blob + 9437ae62732372dd406441030766a276aeae1678 (mode 644)
--- /dev/null
+++ templates/admin_menu.tpl
+<div id="menu">
+<ul>
+ <li><a target="_top" href="list-admin.php"><?php print $PALANG['pAdminMenu_list_admin']; ?></a></li>
+ <li><a target="_top" href="list-domain.php"><?php print $PALANG['pAdminMenu_list_domain']; ?></a></li>
+ <li><a target="_top" href="list-virtual.php"><?php print $PALANG['pAdminMenu_list_virtual']; ?></a></li>
+ <li><a target="_top" href="viewlog.php"><?php print $PALANG['pAdminMenu_viewlog']; ?></a></li>
+ <li><a target="_top" href="backup.php"><?php print $PALANG['pAdminMenu_backup']; ?></a></li>
+ <li><a target="_top" href="create-domain.php"><?php print $PALANG['pAdminMenu_create_domain']; ?></a></li>
+ <li><a target="_top" href="create-admin.php"><?php print $PALANG['pAdminMenu_create_admin']; ?></a></li>
+ <?php $url = "create-alias.php"; if (isset($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+ <li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pAdminMenu_create_alias']; ?></a></li>
+ <?php $url = "create-mailbox.php"; if (isset($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+ <li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pAdminMenu_create_mailbox']; ?></a></li>
+</ul>
+</div>
+<?php
+if (file_exists(realpath("../motd-admin.txt"))) {
+ print "<div id=\"motd\">\n";
+ include("../motd-admin.txt");
+ print "</div>";
+}
+?>
blob - /dev/null
blob + 4d0cc583860d053d7540f7bed569d164f2944fd5 (mode 644)
--- /dev/null
+++ templates/admin_search.tpl
+<div id="overview">
+<h4><?php print $PALANG['pSearch_welcome'] . $fSearch; ?></h4>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search">
+</form>
+</div>
+<?php
+if (count($tAlias) > 0) {
+ print "<table id=\"alias_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>".$PALANG['pOverview_alias_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tAlias); $i++) {
+ if ((is_array($tAlias) and count($tAlias) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tAlias[$i]['address'] . "</td>\n";
+ print " <td>" . preg_replace("/,/", "<br>", $tAlias[$i]['goto']) . "</td>\n";
+ print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=alias&delete=" . urlencode($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+
+if (count($tMailbox) > 0) {
+ print "<table id=\"mailbox_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"7\"><h3>".$PALANG['pOverview_mailbox_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tMailbox); $i++) {
+ if ((is_array($tMailbox) and count($tMailbox) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $tMailbox[$i]['quota'] / $CONF['quota_multiplier'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
+ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-mailbox.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=mailbox&delete=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+?>
blob - /dev/null
blob + 384b8b2f191de0fbca2fcd72b4a9f069b442a999 (mode 644)
--- /dev/null
+++ templates/create-alias.tpl
+<div id="edit_form">
+<form name="create_alias" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pCreate_alias_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_alias_address']; ?></td>
+ <td><input class="flat" type="text" name="fAddress" value="<?php print $tAddress; ?>" /></td>
+ <td>
+ <select class="flat" name="fDomain">
+ <?php
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if ($tDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+ }
+ ?>
+ </select>
+ <?php print $pCreate_alias_address_text; ?>
+ </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_alias_goto'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fGoto" value="<?php print $tGoto; ?>" /></td>
+ <td><?php print $pCreate_alias_goto_text; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pCreate_alias_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="help_text"><?php print $PALANG['pCreate_alias_catchall_text']; ?></td>
+ </tr>
+</table>
+</div>
blob - /dev/null
blob + b6c680f1567f366eeed3cd60430986ec53ac2801 (mode 644)
--- /dev/null
+++ templates/create-mailbox.tpl
+<div id="edit_form">
+<form name="create_mailbox" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pCreate_mailbox_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_username'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fUsername" value="<?php print $tUsername; ?>" /></td>
+ <td>
+ <select name="fDomain">
+ <?php
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if ($tDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+ }
+ ?>
+ </select>
+ <?php print $pCreate_mailbox_username_text; ?>
+ </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ <td><?php print $pCreate_mailbox_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_name'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fName" value="<?php print $tName; ?>" /></td>
+ <td><?php print $pCreate_mailbox_name_text; ?></td>
+ </tr>
+ <?php if ($CONF['quota'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_quota'] . ":"; ?></td>
+ <td><input type="text" name="fQuota" value="<?php print $tQuota; ?>" /></td>
+ <td><?php print $pCreate_mailbox_quota_text; ?></td>
+ <tr>
+ <?php } ?>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_active'] . ":"; ?></td>
+ <td><input class="flat" type="checkbox" name="fActive" checked /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_mail'] . ":"; ?></td>
+ <td><input class="flat" type="checkbox" name="fMail" checked /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pCreate_mailbox_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 69c21a9c3328d972c4be2a215f9beb8754d0a4ee (mode 644)
--- /dev/null
+++ templates/edit-alias.tpl
+<div id="edit_form">
+<form name="edit_alias" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pEdit_alias_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_alias_address'] . ":"; ?></td>
+ <td><?php print $fAddress; ?></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_alias_goto'] . ":"; ?></td>
+ <td>
+<textarea class="flat" rows="10" cols="60" name="fGoto">
+<?php
+$array = preg_split('/,/', $tGoto);
+for ($i = 0 ; $i < count($array) ; $i++) {
+ if (empty($array[$i])) continue;
+ print "$array[$i]\n";
+}
+?>
+</textarea>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pEdit_alias_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 929d046b1916ec525e4e0dd6d1811282d0ffa9a0 (mode 644)
--- /dev/null
+++ templates/edit-mailbox.tpl
+<div id="edit_form">
+<form name="edit_mailbox" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pEdit_mailbox_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_mailbox_username']; ?></td>
+ <td><?php print $fUsername; ?></td>
+ <td><?php print $pEdit_mailbox_username_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_mailbox_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ <td><?php print $pEdit_mailbox_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_mailbox_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_mailbox_name'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fName" value="<?php print htmlspecialchars($tName,ENT_QUOTES); ?>" /></td>
+ <td> </td>
+ </tr>
+ <?php if ($CONF['quota'] == 'YES') { ?>
+ <tr>
+ <td><?php print $PALANG['pEdit_mailbox_quota'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fQuota" value="<?php print $tQuota; ?>" /></td>
+ <td><?php print $pEdit_mailbox_quota_text; ?></td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <td><?php print $PALANG['pCreate_mailbox_active'] . ":"; ?></td>
+ <td><input class="flat" type="checkbox" name="fActive" <?php print (!empty($tActive)) ? 'checked' : '' ?> ></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="flat" type="submit" name="submit" value="<?php print $PALANG['pEdit_mailbox_button']; ?>" ></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 47328c811a27fd4fd8dc93decb8445763c1b16d0 (mode 644)
--- /dev/null
+++ templates/footer.tpl
+<div id="footer">
+<a href="https://git.high5.nl/opensmtpdadmin/">OpenSMTPD Admin <?php print $version; ?></a>
+<?php
+if (($CONF['show_footer_text'] == "YES") and ($CONF['footer_link'])) {
+ print " | ";
+ print "<a href=\"" . $CONF['footer_link'] . "\">" . $CONF['footer_text'] . "</a>\n";
+}
+?>
+</div>
+</body>
+</html>
blob - /dev/null
blob + aaff17bea3f69dff9984a52be0bdc91d1c184f46 (mode 644)
--- /dev/null
+++ templates/header.tpl
+<?php
+@header("Expires: Wed, 29 Feb 1984 00:00:00 GMT");
+@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+@header("Cache-Control: no-store, no-cache, must-revalidate");
+@header("Cache-Control: post-check=0, pre-check=0", false);
+@header("Pragma: no-cache");
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php print isset($PALANG['charset']) ? $PALANG['charset'] : 'iso-8859-1' ?>" />
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<?php
+if (file_exists(realpath("./stylesheet.css"))) print "<link rel=\"stylesheet\" href=\"stylesheet.css\">\n";
+if (file_exists(realpath("../stylesheet.css"))) print "<link rel=\"stylesheet\" href=\"../stylesheet.css\">\n";
+?>
+<title>OpenSMTPD Admin - <?php print $_SERVER['HTTP_HOST']; ?></title>
+</head>
+<body>
+<div id="login_header">
+<?php
+if (file_exists(realpath("./stylesheet.css"))) {
+ print "<img id=\"login_header_logo\" src=\"images/postbox.png\" />\n";
+ print "<img id=\"login_header_logo\" height=\"30px\" src=\"images/opensmtpdadmin.png\" />\n";
+}
+if (file_exists(realpath("../stylesheet.css"))) {
+ print "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n";
+ print "<img id=\"login_header_logo\" height=\"30px\"% src=\"../images/opensmtpdadmin.png\" />\n";
+}
+if (($CONF['show_header_text'] == "YES") and ($CONF['header_text'])) {
+ print "<h2>" . $CONF['header_text'] . "</h2>\n";
+}
+?>
+</div>
blob - /dev/null
blob + 1bbc9657ec974d1fae4f577ad21fd0e95e96d55c (mode 644)
--- /dev/null
+++ templates/index.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot net>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: index.php
+//
+// Template File: -none-
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+header ("Location: ../login.php");
+exit;
+>
blob - /dev/null
blob + 9b5a0f0f010ababfebb2687c93c2132c4db1d3d5 (mode 644)
--- /dev/null
+++ templates/login.tpl
+<div id="login">
+<form name="login" method="post">
+<table id="login_table" cellspacing="10">
+ <tr>
+ <td colspan="2"><h4><?php print $PALANG['pLogin_welcome']; ?></h4></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pLogin_username'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fUsername" value="<?php print $tUsername; ?>" /></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pLogin_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pLogin_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+ <tr>
+ <td colspan="2"><a href="users/"><?php print $PALANG['pLogin_login_users']; ?></a></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 51b9c0100973d6201eab4e10a6cb601823b3644c (mode 644)
--- /dev/null
+++ templates/main.tpl
+<div id="main_menu">
+<table>
+ <tr>
+ <td nowrap><a target="_top" href="overview.php"><?php print $PALANG['pMenu_overview']; ?></a></td>
+ <td><?php print $PALANG['pMain_overview']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="create-alias.php"><?php print $PALANG['pMenu_create_alias']; ?></a></td>
+ <td><?php print $PALANG['pMain_create_alias']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="create-mailbox.php"><?php print $PALANG['pMenu_create_mailbox']; ?></a></td>
+ <td><?php print $PALANG['pMain_create_mailbox']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="sendmail.php"><?php print $PALANG['pMenu_sendmail']; ?></a></td>
+ <td><?php print $PALANG['pMain_sendmail']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="password.php"><?php print $PALANG['pMenu_password']; ?></a></td>
+ <td><?php print $PALANG['pMain_password']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="viewlog.php"><?php print $PALANG['pMenu_viewlog']; ?></a></td>
+ <td><?php print $PALANG['pMain_viewlog']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></td>
+ <td><?php print $PALANG['pMain_logout']; ?></td>
+ </tr>
+</table>
+</div>
blob - /dev/null
blob + a38efffcbeb15d611687dd1a5b114b6cef093844 (mode 644)
--- /dev/null
+++ templates/menu.tpl
+<div id="menu">
+<ul>
+ <li><a target="_top" href="overview.php"><?php print $PALANG['pMenu_overview']; ?></a></li>
+ <?php $url = "create-alias.php"; if (isset($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+ <li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_alias']; ?></a></li>
+ <?php $url = "create-mailbox.php"; if (isset($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+ <li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_mailbox']; ?></a></li>
+ <li><a target="_top" href="sendmail.php"><?php print $PALANG['pMenu_sendmail']; ?></a></li>
+ <li><a target="_top" href="password.php"><?php print $PALANG['pMenu_password']; ?></a></li>
+ <li><a target="_top" href="viewlog.php"><?php print $PALANG['pMenu_viewlog']; ?></a></li>
+ <li><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></li>
+</ul>
+</div>
+<?php
+if (file_exists(realpath("motd.txt"))) {
+ print "<div id=\"motd\">\n";
+ include("motd.txt");
+ print "</div>";
+}
+?>
blob - /dev/null
blob + cab095f747a7ac5bc035271c68580cfe8344574d (mode 644)
--- /dev/null
+++ templates/menu.tpl.orig
+<div id="submenu">
+<a target="_top" href="<?php print $_SERVER['PHP_SELF']; ?>"><?php print date("Y/m/d - H:i"); ?></a>·
+<?php
+if (($CONF['show_footer_text'] == "YES") and ($CONF['footer_link']))
+{
+ print "<a target=\"_top\" href=\"" . $CONF['footer_link'] . "\">" . $CONF['footer_text'] . "</a>·\n";
+}
+?>
+<a target="_blank" href="http://postfixadmin.com/?version=<?php print $version; ?>"><?php print $PALANG['check_update']; ?></a>·
+<a target="_blank" href="http://postfixadmin.com/">Postfix Admin <?php print $version; ?></a>
+</div>
+<div id="menu">
+<a target="_top" href="overview.php"><?php print $PALANG['pMenu_overview']; ?></a>·
+<?php $url = "create-alias.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+<a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_alias']; ?></a>·
+<?php $url = "create-mailbox.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
+<a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_mailbox']; ?></a>·
+<a target="_top" href="sendmail.php"><?php print $PALANG['pMenu_sendmail']; ?></a>·
+<a target="_top" href="password.php"><?php print $PALANG['pMenu_password']; ?></a>·
+<a target="_top" href="viewlog.php"><?php print $PALANG['pMenu_viewlog']; ?></a>·
+<a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a>
+</div>
+<?php if (file_exists (realpath ("motd.txt"))) include ("motd.txt"); ?>
+<p>
blob - /dev/null
blob + be874e8d2180be9f49f98ef4d290d391efe5ce90 (mode 644)
--- /dev/null
+++ templates/message.tpl
+<?php print $tMessage; ?>
blob - /dev/null
blob + ac41c3d497a7385b7e13a3c450597286899ae6a6 (mode 644)
--- /dev/null
+++ templates/overview-get.tpl
+<div id="overview">
+<form name="overview" method="post">
+<select class="flat" name="fDomain" onChange="this.form.submit()";>
+<?php
+for ($i = 0; $i < count($list_domains); $i++) {
+ if ($fDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+}
+?>
+</select>
+<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" />
+</form>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search" size="10">
+</form>
+</div>
+<?php
+ print "<table id=\"overview_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>".$PALANG['pOverview_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_get_domain'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_get_aliases'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_get_mailboxes'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_get_quota'] . "</td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($list_domains); $i++) {
+ if ((is_array($list_domains) and count($list_domains) > 0)) {
+ $limit = get_domain_properties($list_domains[$i]);
+
+ if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited'];
+ if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited'];
+ if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited'];
+ if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled'];
+ if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled'];
+ if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled'];
+
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td><a href=\"overview.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>\n";
+ print " <td>" . $limit['alias_count'] . " / " . $limit['aliases'] . "</td>\n";
+ print " <td>" . $limit['mailbox_count'] . " / " . $limit['mailboxes'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $limit['maxquota'] . "</td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+?>
blob - /dev/null
blob + f1008d8ab91792a4506cb966e3615e9c7de3ac04 (mode 644)
--- /dev/null
+++ templates/overview.tpl
+<div id="overview">
+<form name="overview" method="post">
+<select name="fDomain" onChange="this.form.submit()";>
+<?php
+if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited'];
+if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited'];
+if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited'];
+if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled'];
+if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled'];
+if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled'];
+
+for ($i = 0; $i < count($list_domains); $i++) {
+ if ($fDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+}
+?>
+</select>
+<input type="hidden" name="limit" value="0">
+<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" />
+</form>
+<h4><?php print $PALANG['pOverview_welcome'] . $fDomain; ?></h4>
+<p><?php print $PALANG['pOverview_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p>
+<p><?php print $PALANG['pOverview_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search" size="10">
+</form>
+</div>
+
+<?php
+print "<div id=\"nav_bar\">\n";
+if ($tDisplay_back_show == 1) print "<a href=\"overview.php?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\"></a>\n";
+if ($tDisplay_up_show == 1) print "<a href=\"overview.php?domain=$fDomain&limit=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow']."\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\"></a>\n";
+if ($tDisplay_next_show == 1) print "<a href=\"overview.php?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\"></a>\n";
+print "</div>\n";
+
+if (count($tAlias) > 0) {
+ print "<table id=\"alias_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>".$PALANG['pOverview_alias_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tAlias); $i++) {
+ if ((is_array($tAlias) and count($tAlias) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tAlias[$i]['address'] . "</td>\n";
+ print " <td>" . preg_replace("/,/", "<br>", $tAlias[$i]['goto']) . "</td>\n";
+ print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
+
+ if ($CONF['special_alias_control'] == 'YES') {
+ print " <td><a href=\"edit-alias.php?address=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?delete=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ } else {
+ if (!in_array($tAlias[$i]['goto'], $CONF['default_aliases'])) {
+ print " <td><a href=\"edit-alias.php?address=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?delete=" . urlencode($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ } else {
+ print " <td> </td>\n";
+ print " <td> </td>\n";
+ }
+ }
+ print " </tr>\n";
+ }
+ }
+
+ print "</table>\n";
+}
+
+if (count($tMailbox) > 0) {
+ print "<table id=\"mailbox_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"7\"><h3>".$PALANG['pOverview_mailbox_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tMailbox); $i++) {
+ if ((is_array($tMailbox) and count($tMailbox) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') {
+ print " <td>";
+ if ($tMailbox[$i]['quota'] == 0) {
+ print $PALANG['pOverview_unlimited'];
+ } elseif ($tMailbox[$i]['quota'] < 0) {
+ print $PALANG['pOverview_disabled'];
+ } else {
+ print $tMailbox[$i]['quota'] / $CONF['quota_multiplier'];
+ }
+ print "</td>\n";
+ }
+ print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
+ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-mailbox.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?delete=" . urlencode($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+?>
blob - /dev/null
blob + cefcf5c905c7b7c4a548eb040a6cd3359eedc4a1 (mode 644)
--- /dev/null
+++ templates/password.tpl
+<div id="edit_form">
+<form name="password" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pPassword_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_admin'] . ":"; ?></td>
+ <td><?php print $SESSID_USERNAME; ?></td>
+ <td><?php print $pPassword_admin_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password_current']; ?></td>
+ <td><input class="flat" type="password" name="fPassword_current" /></td>
+ <td><?php print $pPassword_password_current_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ <td><?php print $pPassword_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password2'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pPassword_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 58386c3f0c07cdf073428a4240ed267f7a9e7c3d (mode 644)
--- /dev/null
+++ templates/search.tpl
+<div id="overview">
+<h4><?php print $PALANG['pSearch_welcome'] . $fSearch; ?></h4>
+<form name="search" method="post" action="search.php">
+<input type="textbox" name="search">
+</form>
+</div>
+<?php
+if (count($tAlias) > 0) {
+ print "<table id=\"alias_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>".$PALANG['pOverview_alias_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tAlias); $i++) {
+ if ((is_array($tAlias) and count($tAlias) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tAlias[$i]['address'] . "</td>\n";
+ print " <td>" . preg_replace("/,/", "<br>", $tAlias[$i]['goto']) . "</td>\n";
+ print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?delete=" . urlencode($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+
+ print "</table>\n";
+}
+
+if (count($tMailbox) > 0) {
+ print "<table id=\"mailbox_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"7\"><h3>".$PALANG['pOverview_mailbox_title']."</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < count($tMailbox); $i++) {
+ if ((is_array($tMailbox) and count($tMailbox) > 0)) {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $tMailbox[$i]['quota'] / $CONF['quota_multiplier'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
+ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-mailbox.php?username=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?delete=" . urlencode($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+?>
blob - /dev/null
blob + f244ad650fb3a3daa0d533ff6788c21a4e528a22 (mode 644)
--- /dev/null
+++ templates/sendmail.tpl
+<div id="edit_form">
+<form name="sendmail" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pSendmail_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pSendmail_admin'] . ":"; ?></td>
+ <td><?php print $SESSID_USERNAME; ?></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pSendmail_to'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fTo" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pSendmail_subject'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fSubject" value="<?php print $PALANG['pSendmail_subject_text']; ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pSendmail_body'] . ":" ?></td>
+ <td>
+ <textarea class="flat" rows="10" cols="60" name="fBody"><?php print $CONF['welcome_text']; ?></textarea>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pSendmail_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 8111c3bd4cfd1a694af71cb637ced8980258b179 (mode 644)
--- /dev/null
+++ templates/users_edit-alias.tpl
+<div id="edit_form">
+<form name="edit_alias" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pEdit_alias_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_alias_address'] . ":"; ?></td>
+ <td><?php print $USERID_USERNAME; ?></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pEdit_alias_goto'] . ":"; ?></td>
+<td><textarea class="flat" rows="4" cols="30" name="fGoto">
+<?php
+$array = preg_split('/,/', $tGoto);
+
+for ($i = 0 ; $i < count($array) ; $i++) {
+ if (empty($array[$i])) continue;
+ if ($array[$i] == $USERID_USERNAME) continue;
+ print "$array[$i]\n";
+}
+?>
+</textarea>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pEdit_alias_button']; ?>"></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 93a4aa9ac8152d44c97ce3bab3991bd4917630e4 (mode 644)
--- /dev/null
+++ templates/users_login.tpl
+<div id="login">
+<form name="login" method="post">
+<table id="login_table" cellspacing="10">
+ <tr>
+ <td colspan="2"><h4><?php print $PALANG['pUsersLogin_welcome']; ?></h4></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pUsersLogin_username'] . ":"; ?></td>
+ <td><input class="flat" type="text" name="fUsername" value="<?php print $tUsername; ?>" /></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pUsersLogin_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pUsersLogin_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 555b8d8c8688559724d1c1ccddb3dd1b12c82e00 (mode 644)
--- /dev/null
+++ templates/users_main.tpl
+<div id="main_menu">
+<table>
+ <tr>
+ <td> </td>
+ <td><?php print $_SESSION['userid']['username']; ?></td>
+ </tr>
+ <?php if ($CONF['vacation'] == 'YES') { ?>
+ <tr>
+ <td nowrap><a target="_top" href="vacation.php"><?php print $PALANG['pUsersMenu_vacation']; ?></a></td>
+ <td><?php print $PALANG['pUsersMain_vacation']; ?></td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <td nowrap><a target="_top" href="edit-alias.php"><?php print $PALANG['pUsersMenu_edit_alias']; ?></a></td>
+ <td><?php print $PALANG['pUsersMain_edit_alias']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="password.php"><?php print $PALANG['pUsersMenu_password']; ?></a></td>
+ <td><?php print $PALANG['pUsersMain_password']; ?></td>
+ </tr>
+ <tr>
+ <td nowrap><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></td>
+ <td><?php print $PALANG['pMain_logout']; ?></td>
+ </tr>
+</table>
+</div>
blob - /dev/null
blob + 804fdf41ff7c84948919e0c5ecad595648c8f3ae (mode 644)
--- /dev/null
+++ templates/users_menu.tpl
+<div id="menu">
+<ul>
+ <?php if ($CONF['vacation'] == "YES") { ?>
+ <li><a target="_top" href="vacation.php"><?php print $PALANG['pUsersMenu_vacation']; ?></a></li>
+ <?php } ?>
+ <li><a target="_top" href="edit-alias.php"><?php print $PALANG['pUsersMenu_edit_alias']; ?></a></li>
+ <li><a target="_top" href="password.php"><?php print $PALANG['pUsersMenu_password']; ?></a></li>
+ <li><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></li>
+</ul>
+</div>
+
+<?php
+if (file_exists(realpath("../motd-users.txt"))) {
+ print "<div id=\"motd\">\n";
+ include("../motd-users.txt");
+ print "</div>";
+}
+?>
blob - /dev/null
blob + 4e7c8c5f16fdeaa2ad257b223dbc262184b329fa (mode 644)
--- /dev/null
+++ templates/users_password.tpl
+<div id="edit_form">
+<form name="password" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pPassword_welcome']; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_admin'] . ":"; ?></td>
+ <td><?php print $USERID_USERNAME; ?></td>
+ <td><?php print $pPassword_admin_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password_current'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword_current" ></td>
+ <td><?php print $pPassword_password_current_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password'] . ":"; ?></td>
+ <td><input class="flat" type="password" name="fPassword" ></td>
+ <td><?php print $pPassword_password_text; ?></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pPassword_password2'].":" ?></td>
+ <td><input class="flat" type="password" name="fPassword2" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input type="submit" name="submit" value="<?php print $PALANG['pPassword_button']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 2b6b42fce704c8098f61af28deeeef07c5dd8c15 (mode 644)
--- /dev/null
+++ templates/users_vacation-get.tpl
+<div id="edit_form">
+<form name="vacation" method="post">
+<table>
+ <tr>
+ <td class="hlp_center"><input class="button" type="submit" name="fBack" value="<?php print $PALANG['pUsersVacation_button_back']; ?>" /></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 1f36a35045f40f188da2b475df6898e1800a6196 (mode 644)
--- /dev/null
+++ templates/users_vacation.tpl
+<div id="edit_form">
+<form name="vacation" method="post">
+<table>
+ <tr>
+ <td colspan="3"><h3><?php print $PALANG['pUsersVacation_welcome']; ?></h3></td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pUsersVacation_subject'] . ":"; ?></td>
+ <td><input type="text" name="fSubject" value="<?php print $PALANG['pUsersVacation_subject_text']; ?>" /></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><?php print $PALANG['pUsersVacation_body'] . ":"; ?></td>
+ <td>
+<textarea rows="10" cols="80" name="fBody">
+<?php print $PALANG['pUsersVacation_body_text']; ?>
+</textarea>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="hlp_center"><input class="button" type="submit" name="fAway" value="<?php print $PALANG['pUsersVacation_button_away']; ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="standout"><?php print $tMessage; ?></td>
+ </tr>
+</table>
+</form>
+</div>
blob - /dev/null
blob + 669bae16a9c3e91c035cfeba242d68e85c464e4d (mode 644)
--- /dev/null
+++ templates/viewlog.tpl
+<div id="overview">
+<form name="viewlog" method="post">
+<select name="fDomain" onChange="this.form.submit()";>
+<?php
+$count = count($list_domains);
+for ($i = 0; $i < $count; $i++) {
+ if ($fDomain == $list_domains[$i]) {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ } else {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+}
+?>
+</select>
+<input class="button" type="submit" name="go" value="<?php print $PALANG['pViewlog_button']; ?>" />
+</form>
+</div>
+<?php
+if (!empty($tLog)) {
+ $tLog_count = count($tLog);
+ if ($tLog_count > 0) {
+ print "<table id=\"log_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"5\"><h3>".$PALANG['pViewlog_welcome']." ".$fDomain."</h3></td>\n";
+ print " </tr>\n";
+ print " <tr class=\"header\">\n";
+ print " <td>" . $PALANG['pViewlog_timestamp'] . "</td>\n";
+ print " <td>" . $PALANG['pViewlog_username'] . "</td>\n";
+ print " <td>" . $PALANG['pViewlog_domain'] . "</td>\n";
+ print " <td>" . $PALANG['pViewlog_action'] . "</td>\n";
+ print " <td>" . $PALANG['pViewlog_data'] . "</td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < $tLog_count; $i++) {
+ if ((is_array($tLog) and $tLog_count > 0)) {
+ $log_data = $tLog[$i]['data'];
+ $data_length = strlen($log_data);
+ if ($data_length > 35) $log_data = substr($log_data, 0, 35) . " ...";
+
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ print " <td nowrap>" . $tLog[$i]['timestamp'] . "</td>\n";
+ print " <td nowrap>" . $tLog[$i]['username'] . "</td>\n";
+ print " <td nowrap>" . $tLog[$i]['domain'] . "</td>\n";
+ print " <td nowrap>" . $tLog[$i]['action'] . "</td>\n";
+ print " <td nowrap>" . $log_data . "</td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+ print "<p />\n";
+ }
+}
+?>
blob - /dev/null
blob + b8a233f9aa11298a2f05ce59bafadacaa9798175 (mode 644)
--- /dev/null
+++ users/edit-alias.php
+<?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: users_edit-alias.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tGoto
+//
+// Form POST \ GET Variables:
+//
+// fAddress
+// fDomain
+// fGoto
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$USERID_USERNAME = check_user_session();
+$USERID_DOMAIN = substr(strrchr($USERID_USERNAME, "@"), 1);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $result = db_query("SELECT * FROM alias WHERE address='$USERID_USERNAME'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tGoto = preg_replace('/vmail/', '', $row['goto']);
+ #$tGoto = $row['goto'];
+ } else {
+ $tMessage = $PALANG['pEdit_alias_address_error'];
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $pEdit_alias_goto = $PALANG['pEdit_alias_goto'];
+
+ if (isset($_POST['fGoto'])) $fGoto = escape_string($_POST['fGoto']);
+ $fGoto = strtolower($fGoto);
+
+ $goto = preg_replace('/\\\r\\\n/', ',', $fGoto);
+ $goto = preg_replace('/\r\n/', ',', $fGoto);
+ $goto = preg_replace('/[\s]+/i', '', $goto);
+ $goto = preg_replace('/\,*$/', '', $goto);
+ $array = preg_split('/,/', $goto);
+ for ($i = 0; $i < count($array); $i++) {
+ if (in_array("$array[$i]", $CONF['default_aliases'])) continue;
+ if (empty($array[$i])) continue;
+ if (!check_email($array[$i])) {
+ $error = 1;
+ $tGoto = $goto;
+ $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . "$array[$i]</font>";
+ }
+ }
+
+ if ($error != 1) {
+ if (empty($goto)) {
+ $goto = "vmail";
+ } else {
+ $goto = "vmail," . $goto;
+ }
+
+ $result = db_query("UPDATE alias SET goto='$goto',modified=NOW() WHERE address='$USERID_USERNAME'");
+ if ($result['rows'] != 1) {
+ $tMessage = $PALANG['pEdit_alias_result_error'];
+ } else {
+ db_log($USERID_USERNAME, $USERID_DOMAIN, "edit alias", "$USERID_USERNAME -> $goto");
+
+ header("Location: main.php");
+ exit;
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/users_menu.tpl");
+include("../templates/users_edit-alias.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 9c7dcefd96211dab8ee4744ad293817fa63438ac (mode 644)
--- /dev/null
+++ users/index.php
+<?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: login.php");
+exit;
+?>
blob - /dev/null
blob + 17676c28d1ab5aa5b5a6b3a7f05bd49dd643df88 (mode 644)
--- /dev/null
+++ users/login.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: login.php
+//
+// Template File: login.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tUsername
+//
+// Form POST \ GET Variables:
+//
+// fUsername
+// fPassword
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fUsername = escape_string($_POST['fUsername']);
+ $fPassword = escape_string($_POST['fPassword']);
+
+ $result = db_query("SELECT password FROM mailbox WHERE username='$fUsername' AND active='1'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ if (!password_verify($fPassword, $row['password'])) {
+ $error = 1;
+ $tMessage = $PALANG['pLogin_password_incorrect'];
+ $tUsername = $fUsername;
+ }
+ } else {
+ $error = 1;
+ $tMessage = $PALANG['pLogin_username_incorrect'];
+ }
+
+ if ($error != 1) {
+ session_start();
+ $_SESSION['userid']['username'] = $fUsername;
+ header("Location: main.php");
+ exit;
+ }
+}
+include("../templates/header.tpl");
+include("../templates/users_login.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 2f7ebf8240839b62d9674d44c44e9170a58c9ad7 (mode 644)
--- /dev/null
+++ users/logout.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: logout.php
+//
+// Template File: -none-
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+require("../config.inc.php");
+require("../functions.inc.php");
+
+$USERID_USERNAME = check_user_session();
+
+session_unset();
+session_destroy();
+
+header("Location: login.php");
+exit;
+?>
blob - /dev/null
blob + f40bd2c77b1f5cf88b96d9d3ef333a45ee7ffb41 (mode 644)
--- /dev/null
+++ users/main.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: main.php
+//
+// Template File: main.tpl
+//
+// Template Variables:
+//
+// -none-
+//
+// Form POST \ GET Variables:
+//
+// -none-
+//
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$USERID_USERNAME = check_user_session();
+
+include("../templates/header.tpl");
+include("../templates/users_menu.tpl");
+include("../templates/users_main.tpl");
+include("../templates/footer.tpl");
blob - /dev/null
blob + a3175fb3febfe5b75adf348bb39398bbf808a2b9 (mode 644)
--- /dev/null
+++ users/password.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: password.php
+//
+// Template File: users_password.tpl
+//
+// Template Variables:
+//
+// tMessage
+//
+// Form POST \ GET Variables:
+//
+// fPassword_current
+// fPassword
+// fPassword2
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$USERID_USERNAME = check_user_session();
+$USERID_DOMAIN = substr(strrchr($USERID_USERNAME, "@"), 1);
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fPassword_current = escape_string($_POST['fPassword_current']);
+ $fPassword = escape_string($_POST['fPassword']);
+ $fPassword2 = escape_string($_POST['fPassword2']);
+
+ $username = $USERID_USERNAME;
+
+ $result = db_query("SELECT * FROM mailbox WHERE username='$username'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ if (!password_verify($fPassword_current, $row['password'])) {
+ $error = 1;
+ $pPassword_password_current_text = $PALANG['pPassword_password_current_text_error'];
+ }
+ } else {
+ $error = 1;
+ $pPassword_email_text = $PALANG['pPassword_email_text_error'];
+ }
+
+ if (empty($fPassword) or ($fPassword != $fPassword2))
+ {
+ $error = 1;
+ $pPassword_password_text = $PALANG['pPassword_password_text_error'];
+ }
+
+ if ($error != 1) {
+ $password = pacrypt($fPassword);
+ $result = db_query("UPDATE mailbox SET password='$password',modified=NOW(),scheme='' WHERE username='$username'");
+ if ($result['rows'] == 1) {
+ $tMessage = $PALANG['pPassword_result_succes'];
+ db_log($USERID_USERNAME, $USERID_DOMAIN, "change password", "$USERID_USERNAME");
+ } else {
+ $tMessage = $PALANG['pPassword_result_error'];
+ }
+ }
+}
+include("../templates/header.tpl");
+include("../templates/users_menu.tpl");
+include("../templates/users_password.tpl");
+include("../templates/footer.tpl");
+?>
blob - /dev/null
blob + 162c9a34c56e136834f685893fe4f7c4093d34b7 (mode 644)
--- /dev/null
+++ users/vacation.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: vacation.php
+//
+// Template File: users_vacation.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tSubject
+// tBody
+//
+// Form POST \ GET Variables:
+//
+// fSubject
+// fBody
+//
+require("../variables.inc.php");
+require("../config.inc.php");
+require("../functions.inc.php");
+include("../languages/" . check_language() . ".lang");
+
+$USERID_USERNAME = check_user_session();
+$USERID_DOMAIN = substr(strrchr($USERID_USERNAME, "@"), 1);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ $result = db_query("SELECT * FROM vacation WHERE email='$USERID_USERNAME'");
+ if ($result['rows'] == 1) {
+ $row = db_array($result['result']);
+ $tMessage = $PALANG['pUsersVacation_welcome_text'];
+ $template = "users_vacation-get.tpl";
+ } else {
+ $template = "users_vacation.tpl";
+ }
+
+ include("../templates/header.tpl");
+ include("../templates/users_menu.tpl");
+ include("../templates/$template");
+ include("../templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ if (isset($_POST['fSubject'])) $fSubject = escape_string($_POST['fSubject']);
+ if (isset($_POST['fBody'])) $fBody = escape_string($_POST['fBody']);
+
+ if (!empty($_POST['fBack'])) {
+ $result = db_query("DELETE FROM vacation WHERE email='$USERID_USERNAME'");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pUsersVacation_result_error'];
+ } else {
+ $tMessage = $PALANG['pUsersVacation_result_succes'];
+ }
+ }
+
+ if (!empty($_POST['fAway'])) {
+ $result = db_query("INSERT INTO vacation (email,subject,body,cache,domain,created,active) VALUES ('$USERID_USERNAME','$fSubject','$fBody','','$USERID_DOMAIN',NOW(),'1')");
+ if ($result['rows'] != 1) {
+ $error = 1;
+ $tMessage = $PALANG['pUsersVacation_result_error'];
+ } else {
+ header("Location: main.php");
+ exit;
+ }
+ }
+
+ include("../templates/header.tpl");
+ include("../templates/users_menu.tpl");
+ include("../templates/users_vacation.tpl");
+ include("../templates/footer.tpl");
+}
+?>
blob - /dev/null
blob + cb0ed0dc9ca61ef6a69161b42923e1b19e72541f (mode 644)
--- /dev/null
+++ variables.inc.php
+<?php
+//
+// OpenSMTPD Admin
+// by Mischa Peters <mischa at high5 dot nl>
+// Copyright (c) 2022 High5!
+// License Info: LICENSE.TXT
+//
+// File: variables.inc.php
+//
+if (preg_match("/variables.inc.php/", $_SERVER['SCRIPT_NAME'])) {
+ header ("Location: login.php");
+ exit;
+}
+
+$error = "";
+$escaped_string = "";
+$quota = "";
+$vacation = "";
+$fActive = "";
+$fAddress = "";
+$fAliases = "";
+$fBackupmx = "";
+$fDefaultaliases = "";
+$fDelete = "";
+$fDescription = "";
+$fDomain = "";
+$fDomains = "";
+#$fDomains[0] = "";
+$fGoto = "";
+$fMail = "";
+$fMailboxes = "";
+$fMaxquota = "";
+$fName = "";
+$fPassword = "";
+$fPassword2 = "";
+$fQuota = "";
+$fSearch = "";
+$fTable = "";
+$fTransport = "";
+$fUsername = "";
+$fVacation = "";
+$fWhere = "";
+$tActive = "";
+$tActive = "";
+$tAddress = "";
+$tAlias = "";
+$tAliases = "";
+$tBody = "";
+$tDefaultaliases = "";
+$tDescription = "";
+$tDisplay_back = "";
+$tDisplay_back_show = "";
+$tDisplay_up_show = "";
+$tDisplay_next = "";
+$tDisplay_next_show = "";
+$tDomain = "";
+$tDomains = "";
+$tFrom = "";
+$tGoto = "";
+$tLog = array();
+$tMailbox = "";
+$tMailboxes = "";
+$tMaxquota = "";
+$tMessage = " ";
+$tName = "";
+$tQuota = "";
+$tSubject = "";
+$tUsername = "";
+$tTransport = "";
+
+$pAdminCreate_admin_password_text = " ";
+$pAdminCreate_admin_username_text = " ";
+$pAdminCreate_domain_defaultaliases_text = " ";
+$pAdminCreate_domain_domain_text = " ";
+$pAdminEdit_admin_password_text = " ";
+$pCreate_alias_address_text = " ";
+$pCreate_alias_goto_text = " ";
+$pCreate_mailbox_name_text = " ";
+$pCreate_mailbox_password_text = " ";
+$pCreate_mailbox_quota_text = " ";
+$pCreate_mailbox_username_text = " ";
+$pEdit_mailbox_password_text = " ";
+$pEdit_mailbox_quota_text = " ";
+$pEdit_mailbox_username_text = " ";
+$pPassword_admin_text = " ";
+$pPassword_password_current_text = " ";
+$pPassword_password_text = " ";
+?>
blob - /dev/null
blob + dabb73aa57f712129861761015376f6a3e0c9cf1 (mode 644)
--- /dev/null
+++ viewlog.php
+<?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:
+//
+// tMessage
+// tLog
+//
+// Form POST \ GET Variables:
+//
+// fDomain
+//
+require("./variables.inc.php");
+require("./config.inc.php");
+require("./functions.inc.php");
+include("./languages/" . check_language() . ".lang");
+
+$SESSID_USERNAME = check_session();
+$list_domains = list_domains_for_admin($SESSID_USERNAME);
+
+if ($_SERVER['REQUEST_METHOD'] == "GET") {
+ if ((is_array($list_domains) and count($list_domains) > 0)) $fDomain = $list_domains[0];
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tMessage = $PALANG['pViewlog_result_error'];
+ }
+
+ if ($error != 1) {
+ $result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tLog[] = $row;
+ }
+ }
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST") {
+ $fDomain = escape_string($_POST['fDomain']);
+
+ if (!check_owner($SESSID_USERNAME, $fDomain)) {
+ $error = 1;
+ $tMessage = $PALANG['pViewlog_error'];
+ }
+
+ if ($error != 1) {
+ $result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
+ if ($result['rows'] > 0) {
+ while ($row = db_array($result['result'])) {
+ $tLog[] = $row;
+ }
+ }
+ }
+}
+include("./templates/header.tpl");
+include("./templates/menu.tpl");
+include("./templates/viewlog.tpl");
+include("./templates/footer.tpl");
+?>