From a3641a1896dc110cab0e135514391a8628bffdb1 Mon Sep 17 00:00:00 2001 From: mischa Date: Sun, 4 Sep 2022 09:38:47 +0000 Subject: [PATCH] print -> echo --- README.md | 42 ++++++++-- admin/add-alias.php | 2 +- admin/admin.php | 6 +- admin/backup.php | 60 ++++++------- admin/edit-alias.php | 111 ++++++++++++------------ admin/edit-mailbox.php | 140 +++++++++++++------------------ admin/viewlog.php | 42 ++++------ templates/add-mailbox.tpl | 22 ++--- templates/admin_admin.tpl | 2 +- templates/admin_domain.tpl | 4 +- templates/admin_list-virtual.tpl | 80 +++++++++--------- templates/admin_search.tpl | 72 ++++++++-------- templates/create-mailbox.tpl | 38 ++++----- templates/edit-alias.tpl | 20 ++--- templates/edit-mailbox.tpl | 46 ++++------ templates/footer.tpl | 4 +- templates/header.tpl | 18 ++-- templates/login.tpl | 14 ++-- templates/main.tpl | 28 +++---- templates/menu.tpl | 14 ++-- templates/menu.tpl.orig | 24 ------ templates/message.tpl | 2 +- templates/overview-get.tpl | 40 ++++----- templates/password.tpl | 22 ++--- templates/search.tpl | 76 ++++++++--------- templates/sendmail.tpl | 20 ++--- templates/users_edit-alias.tpl | 14 ++-- templates/users_login.tpl | 12 +-- templates/users_main.tpl | 18 ++-- templates/users_menu.tpl | 12 +-- templates/users_password.tpl | 22 ++--- templates/users_vacation-get.tpl | 2 +- templates/users_vacation.tpl | 14 ++-- templates/viewlog.tpl | 71 +++++++--------- 34 files changed, 524 insertions(+), 590 deletions(-) delete mode 100644 templates/menu.tpl.orig diff --git a/README.md b/README.md index 1f2c86f..dcdace0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ Database needed to use SQL with OpenSMTPD `password` varchar(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Admins'; + PRIMARY KEY (`username`), + KEY `username` (`username`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Virtual Admins' CREATE TABLE `alias` ( `address` varchar(255) NOT NULL DEFAULT '', @@ -20,7 +22,9 @@ Database needed to use SQL with OpenSMTPD `domain` varchar(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Aliases'; + PRIMARY KEY (`address`), + KEY `address` (`address`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Virtual Aliases' CREATE TABLE `domain` ( `domain` varchar(255) NOT NULL DEFAULT '', @@ -29,22 +33,48 @@ Database needed to use SQL with OpenSMTPD `mailboxes` int(10) NOT NULL DEFAULT 0, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Domains'; + PRIMARY KEY (`domain`), + KEY `domain` (`domain`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Virtual Domains' CREATE TABLE `domain_admins` ( `username` varchar(255) NOT NULL DEFAULT '', `domain` varchar(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Domain Admins'; + KEY `username` (`username`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Domain Admins' CREATE TABLE `log` ( `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `username` varchar(255) NOT NULL DEFAULT '', `domain` varchar(255) NOT NULL DEFAULT '', `action` varchar(255) NOT NULL DEFAULT '', - `data` varchar(255) NOT NULL DEFAULT '' - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Log'; + `data` varchar(255) NOT NULL DEFAULT '', + KEY `timestamp` (`timestamp`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Log' + CREATE TABLE `mailbox` ( + `username` varchar(255) NOT NULL DEFAULT '', + `password` varchar(255) NOT NULL DEFAULT '', + `name` varchar(255) NOT NULL DEFAULT '', + `maildir` varchar(255) NOT NULL DEFAULT '', + `domain` varchar(255) NOT NULL DEFAULT '', + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`username`), + KEY `username` (`username`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Virtual Mailboxes' + + CREATE TABLE `vacation` ( + `email` varchar(255) NOT NULL DEFAULT '', + `subject` varchar(255) NOT NULL DEFAULT '', + `body` text NOT NULL, + `cache` text NOT NULL, + `domain` varchar(255) NOT NULL DEFAULT '', + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`email`), + KEY `email` (`email`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='as60131 Admin - Virtual Vacation' Config for OpenSMTPTD, MySQL/MariaDB example: diff --git a/admin/add-alias.php b/admin/add-alias.php index 6c742c6..8d1c032 100644 --- a/admin/add-alias.php +++ b/admin/add-alias.php @@ -23,7 +23,7 @@ // goto // require_once '../functions.inc.php'; -include '../languages/' . check_language() . ".lang'; +include '../languages/' . check_language() . '.lang'; $list_domains = list_domains(); diff --git a/admin/admin.php b/admin/admin.php index 60bf51f..3c3e4a1 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -84,11 +84,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($password1 != $password2) { $message = $LANG['AdminAdd_admin_password_error']; } - if (empty($message)) { + if (!empty($password1) && empty($message)) { + $hashed = bcrypt($password1); try { $dbh = connect_db(); - $hashed = bcrypt($password1); - $sth= $dbh->prepare("UPDATE admin SET password=?,modified=NOW() WHERE username=?"); + $sth = $dbh->prepare("UPDATE admin SET password=?,modified=NOW() WHERE username=?"); $sth->bindParam(1, $hashed, PDO::PARAM_STR); $sth->bindParam(2, $username, PDO::PARAM_STR); $sth->execute(); diff --git a/admin/backup.php b/admin/backup.php index 2996e68..aafc11f 100644 --- a/admin/backup.php +++ b/admin/backup.php @@ -17,52 +17,42 @@ // // -none- // -require("../config.inc.php"); -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); +require_once '../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"; + $backup = "/tmp" . $filename; + $header = "#\n# OpenSMTPD Admin " . VERSION . "\n# Date: " . date("D M j G:i:s T Y") . "\n#\n"; + $tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation'); if (!$fh = fopen($backup, 'w')) { - $tMessage = "
Cannot open file ($backup)
"; - include("../templates/header.tpl"); - include("../templates/admin_menu.tpl"); - include("../templates/message.tpl"); - include("../templates/footer.tpl"); + $message = "
Cannot open file ($backup)
"; + 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'); + $dbh = connect_db(); + foreach ($tables as $table) { + $sth = $dbh->query("SHOW CREATE TABLE $table"); + $row = $sth->fetch(PDO::FETCH_ASSOC); + fwrite ($fh, $row['Create Table']. "\n\n"); + } - 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(); + foreach ($tables as $table) { + $sth = $dbh->query("SELECT * FROM $table"); + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { + foreach ($row as $k => $v) { + $keys[] = $k; + $values[] = $v; } + fwrite($fh, "INSERT INTO ". $table . " (". implode (',',$keys) . ") VALUES ('" . implode ('\',\'',$values) . "')\n"); + $keys = array(); + $values = array(); } } } diff --git a/admin/edit-alias.php b/admin/edit-alias.php index c7544c3..7f1a027 100644 --- a/admin/edit-alias.php +++ b/admin/edit-alias.php @@ -11,77 +11,74 @@ // // Template Variables: // -// tMessage -// tGoto +// message +// goto // // Form POST \ GET Variables: // -// fAddress -// fDomain -// fGoto +// address +// domain +// goto // -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); +require_once '../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 = $LANG['Edit_alias_address_error']; + $address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL); + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN); + + try { + $dbh = connect_db(); + $sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?"); + $sth->bindParam(1, $address, PDO::PARAM_STR); + $sth->bindParam(2, $domain, PDO::PARAM_STR); + $sth->execute(); + $goto = $sth->fetch(PDO::FETCH_COLUMN); + $goto = explode(',', $goto); + } catch(PDOException $e) { + $message = $LANG['Edit_alias_address_error']; } } if ($_SERVER['REQUEST_METHOD'] == "POST") { - $pEdit_alias_goto = $LANG['Edit_alias_goto']; + $address = strtolower(filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL)); + $domain = strtolower(filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN)); + $goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT)); - $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 = $LANG['Edit_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 = $LANG['Edit_alias_goto_text_error2'] . "$array[$i]"; + if (empty($goto)) { + $goto = array(); + $message = $LANG['Edit_alias_goto_text_error1']; + } else { + $goto = preg_replace('/\\\r\\\n/', ',', $goto); + $goto = preg_replace('/\r\n/', ',', $goto); + $goto = preg_replace('/[\s]+/i', '', $goto); + $goto = preg_replace('/\,*$/', '', $goto); + $validate_goto = explode(',', $goto); + foreach ($validate_goto as $row) { + if (!filter_var($row, FILTER_VALIDATE_EMAIL)) { + $goto = explode(',', $goto); + $message = $LANG['Edit_alias_goto_text_error2'] . "$row"; + } } } - - if ($error != 1) { - $result = db_query("UPDATE alias SET goto='$goto',modified=NOW() WHERE address='$fAddress' AND domain='$fDomain'"); - if ($result['rows'] != 1) { - $tMessage = $LANG['Edit_alias_result_error']; - } else { - db_log($CONF['admin_email'], $fDomain, "edit alias", "$fAddress -> $goto"); - - header("Location: list-virtual.php?domain=$fDomain"); - exit; + + if (empty($message)) { + try { + $dbh = connect_db(); + $sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?"); + $sth->bindParam(1, $goto, PDO::PARAM_STR); + $sth->bindParam(2, $address, PDO::PARAM_STR); + $sth->bindParam(3, $domain, PDO::PARAM_STR); + $sth->execute(); + logging(ADMIN_EMAIL, $domain, "edit alias", "$address -> $goto"); + header("Location: list-virtual.php?domain=$domain"); + } catch(PDOException $e) { + $message = $LANG['Edit_alias_result_error']; } } } -include("../templates/header.tpl"); -include("../templates/admin_menu.tpl"); -include("../templates/edit-alias.tpl"); -include("../templates/footer.tpl"); +include '../templates/header.tpl'; +include '../templates/admin_menu.tpl'; +include '../templates/edit-alias.tpl'; +include '../templates/footer.tpl'; ?> diff --git a/admin/edit-mailbox.php b/admin/edit-mailbox.php index 2727832..c85fea4 100644 --- a/admin/edit-mailbox.php +++ b/admin/edit-mailbox.php @@ -11,102 +11,80 @@ // // Template Variables: // -// tMessage -// tName -// tQuota +// message +// name // // Form POST \ GET Variables: // -// fUsername -// fDomain -// fPassword -// fPassword2 -// fName -// fQuota -// fActive +// username +// domain +// password1 +// password2 +// name // -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); +require_once '../functions.inc.php'; +include '../languages/' . check_language() . '.lang'; if ($_SERVER['REQUEST_METHOD'] == "GET") { - $fUsername = escape_string($_GET['username']); - $fDomain = escape_string($_GET['domain']); + $username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT)); + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_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 = $LANG['Edit_mailbox_login_error']; + try { + $dbh = connect_db(); + $sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?"); + $sth->bindParam(1, $username, PDO::PARAM_STR); + $sth->bindParam(2, $domain, PDO::PARAM_STR); + $sth->execute(); + $mailbox_details = $sth->fetch(); + $name = $mailbox_details['name']; + } catch(PDOException $e) { + $message = $LANG['Edit_mailbox_login_error']; } } if ($_SERVER['REQUEST_METHOD'] == "POST") { - $pEdit_mailbox_password_text = $LANG['Edit_mailbox_password_text_error']; - $pEdit_mailbox_quota_text = $LANG['Edit_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 = $LANG['Edit_mailbox_password_text_error']; + $username = strtolower(filter_input(INPUT_GET, 'username', FILTER_DEFAULT)); + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN); + $password1 = filter_input(INPUT_POST, 'password1', FILTER_DEFAULT); + $password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT); + $name = filter_input(INPUT_POST, 'name', FILTER_DEFAULT); + + if ($password1 != $password2) { + $message = $LANG['Edit_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 = $LANG['Edit_mailbox_quota_text_error']; - } + if (!empty($pqassword1) && empty($message)) { + $hashed = bcrypt($password1); + try { + $dbh = connect_db(); + $sth = $dbh->prepare("UPDATE mailbox SET password=?,name=?,modified=NOW() WHERE username=? AND domain=?"); + $sth->bindParam(1, $hashed, PDO::PARAM_STR); + $sth->bindParam(2, $name, PDO::PARAM_STR); + $sth->bindParam(3, $username, PDO::PARAM_STR); + $sth->bindParam(4, $domain, PDO::PARAM_STR); + $sth->execute(); + } catch(PDOException $e) { + $message = $LANG['Edit_mailbox_result_error']; + } } - if ($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 = $LANG['Edit_mailbox_result_error']; - } else { - db_log($CONF['admin_email'], $fDomain, "edit mailbox", $fUsername); - header("Location: list-virtual.php?domain=$fDomain"); - exit; - } + if (empty($message)) { + try { + $dbh = connect_db(); + $sth = $dbh->prepare("UPDATE mailbox SET name=?,modified=NOW() WHERE username=? AND domain=?"); + $sth->bindParam(1, $name, PDO::PARAM_STR); + $sth->bindParam(2, $username, PDO::PARAM_STR); + $sth->bindParam(3, $domain, PDO::PARAM_STR); + $sth->execute(); + logging(ADMIN_EMAIL, $domain, "edit mailbox", $username); + header("Location: list-virtual.php?domain=$domain"); + } catch(PDOException $e) { + $message = $LANG['Edit_mailbox_result_error']; + } } } -include("../templates/header.tpl"); -include("../templates/admin_menu.tpl"); -include("../templates/edit-mailbox.tpl"); -include("../templates/footer.tpl"); +include '../templates/header.tpl'; +include '../templates/admin_menu.tpl'; +include '../templates/edit-mailbox.tpl'; +include '../templates/footer.tpl'; ?> diff --git a/admin/viewlog.php b/admin/viewlog.php index 763372e..43fdcad 100644 --- a/admin/viewlog.php +++ b/admin/viewlog.php @@ -11,42 +11,28 @@ // // Template Variables: // -// tMessage -// tLog +// log // // Form POST \ GET Variables: // -// fDomain +// domain // -require("../functions.inc.php"); -include("../languages/" . check_language() . ".lang"); +require_once '../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; - } - } + $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain']; + $dbh = connect_db(); + $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10"); + $sth->bindParam(1, $domain, PDO::PARAM_STR); + $sth->execute(); + $log = $sth->fetchAll(); } -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"); +include '../templates/header.tpl'; +include '../templates/admin_menu.tpl'; +include '../templates/viewlog.tpl'; +include '../templates/footer.tpl'; ?> diff --git a/templates/add-mailbox.tpl b/templates/add-mailbox.tpl index 416c48e..35306c5 100644 --- a/templates/add-mailbox.tpl +++ b/templates/add-mailbox.tpl @@ -2,11 +2,11 @@
- + - - + + - + - + - + - - - + + + - + - +

 
diff --git a/templates/admin_admin.tpl b/templates/admin_admin.tpl index 7044b78..4c92fb9 100644 --- a/templates/admin_admin.tpl +++ b/templates/admin_admin.tpl @@ -11,7 +11,7 @@ - + diff --git a/templates/admin_domain.tpl b/templates/admin_domain.tpl index 18de2da..1507c4d 100644 --- a/templates/admin_domain.tpl +++ b/templates/admin_domain.tpl @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/templates/admin_list-virtual.tpl b/templates/admin_list-virtual.tpl index 15489d2..0bce685 100644 --- a/templates/admin_list-virtual.tpl +++ b/templates/admin_list-virtual.tpl @@ -12,12 +12,12 @@ if (count($list_domains) > 0) { ?> - + -

-

-

+

+

+

@@ -41,50 +41,50 @@ if ($list_domains[$selected_domain]['alias_count'] > $limit || $list_domains[$se echo "\n"; } if (count($list_alias) > 0) { - print "

 
\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

" . $LANG['Overview_alias_title'] . "

" . $LANG['AdminList_virtual_alias_address'] . "" . $LANG['AdminList_virtual_alias_goto'] . "" . $LANG['AdminList_virtual_alias_modified'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; foreach ($list_alias as $row) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } - print "

" . $LANG['Overview_alias_title'] . "

" . $LANG['AdminList_virtual_alias_address'] . "" . $LANG['AdminList_virtual_alias_goto'] . "" . $LANG['AdminList_virtual_alias_modified'] . " 
" . $row['address'] . "" . preg_replace("/,/", "
", $row['goto']) . "
" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $row['address'] . "" . preg_replace("/,/", "
", $row['goto']) . "
" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } if (count($list_mailbox) > 0) { - print "\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

" . $LANG['Overview_mailbox_title'] . "

" . $LANG['AdminList_virtual_mailbox_username'] . "" . $LANG['AdminList_virtual_mailbox_name'] . "" . $LANG['AdminList_virtual_mailbox_modified'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; foreach ($list_mailbox as $row) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } - print "

" . $LANG['Overview_mailbox_title'] . "

" . $LANG['AdminList_virtual_mailbox_username'] . "" . $LANG['AdminList_virtual_mailbox_name'] . "" . $LANG['AdminList_virtual_mailbox_modified'] . " 
" . $row['username'] . "" . $row['name'] . "" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $row['username'] . "" . $row['name'] . "" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } ?> diff --git a/templates/admin_search.tpl b/templates/admin_search.tpl index c63b698..ede9048 100644 --- a/templates/admin_search.tpl +++ b/templates/admin_search.tpl @@ -1,54 +1,54 @@
-

+

0) { - print "\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

".$LANG['Overview_alias_title']."

" . $LANG['Overview_alias_address'] . "" . $LANG['Overview_alias_goto'] . "" . $LANG['Overview_alias_modified'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; foreach ($list_alias as $row) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } - print "

".$LANG['Overview_alias_title']."

" . $LANG['Overview_alias_address'] . "" . $LANG['Overview_alias_goto'] . "" . $LANG['Overview_alias_modified'] . " 
" . $row['address'] . "" . preg_replace("/,/", "
", $row['goto']) . "
" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $row['address'] . "" . preg_replace("/,/", "
", $row['goto']) . "
" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } if (count($list_mailbox) > 0) { - print "\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

".$LANG['Overview_mailbox_title']."

" . $LANG['Overview_mailbox_username'] . "" . $LANG['Overview_mailbox_name'] . "" . $LANG['Overview_mailbox_modified'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; foreach ($list_mailbox as $row) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } - print "

".$LANG['Overview_mailbox_title']."

" . $LANG['Overview_mailbox_username'] . "" . $LANG['Overview_mailbox_name'] . "" . $LANG['Overview_mailbox_modified'] . " 
" . $row['username'] . "" . $row['name'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $row['username'] . "" . $row['name'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } ?> diff --git a/templates/create-mailbox.tpl b/templates/create-mailbox.tpl index 18db241..2c69af0 100644 --- a/templates/create-mailbox.tpl +++ b/templates/create-mailbox.tpl @@ -2,63 +2,63 @@
- + - - + + - + - + - + - - - + + + - - - + + + - + - + - + - +

- +
 
 
 
diff --git a/templates/edit-alias.tpl b/templates/edit-alias.tpl index 74e52a9..2e1e522 100644 --- a/templates/edit-alias.tpl +++ b/templates/edit-alias.tpl @@ -2,22 +2,20 @@
- + - - + + - + - + - +

 
- @@ -25,10 +23,10 @@ for ($i = 0 ; $i < count($array) ; $i++) {  
diff --git a/templates/edit-mailbox.tpl b/templates/edit-mailbox.tpl index 26debaf..88ad945 100644 --- a/templates/edit-mailbox.tpl +++ b/templates/edit-mailbox.tpl @@ -2,45 +2,33 @@
- + - - - - - - - - - - - - + + - - - - - - - - - - - - - - + + - + + + - + + + + + + + + +

 
 
>  
 
 
diff --git a/templates/footer.tpl b/templates/footer.tpl index 1e2d5f2..37b19b6 100644 --- a/templates/footer.tpl +++ b/templates/footer.tpl @@ -2,8 +2,8 @@ OpenSMTPD Admin " . $CONF['footer_text'] . "\n"; + echo "   |   "; + echo "" . $CONF['footer_text'] . "\n"; } ?> diff --git a/templates/header.tpl b/templates/header.tpl index 580f97b..8d09479 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -8,27 +8,27 @@ - + \n"; -if (file_exists(realpath("../stylesheet.css"))) print "\n"; +if (file_exists(realpath("./stylesheet.css"))) echo "\n"; +if (file_exists(realpath("../stylesheet.css"))) echo "\n"; ?> -OpenSMTPD Admin - <?php print $_SERVER['HTTP_HOST']; ?> +OpenSMTPD Admin - <?php echo $_SERVER['HTTP_HOST']; ?>
\n"; - print "\n"; + echo "\n"; + echo "\n"; } if (file_exists(realpath("../stylesheet.css"))) { - print "\n"; - print "\n"; + echo "\n"; + echo "\n"; } if (($CONF['show_header_text'] == "YES") and ($CONF['header_text'])) { - print "

" . $CONF['header_text'] . "

\n"; + echo "

" . $CONF['header_text'] . "

\n"; } ?>
diff --git a/templates/login.tpl b/templates/login.tpl index 9853f1a..dc50f05 100644 --- a/templates/login.tpl +++ b/templates/login.tpl @@ -2,24 +2,24 @@
- + - - + + - + - + - + - +

diff --git a/templates/main.tpl b/templates/main.tpl index 8119e66..be9515c 100644 --- a/templates/main.tpl +++ b/templates/main.tpl @@ -1,32 +1,32 @@ "; } ?> diff --git a/templates/menu.tpl.orig b/templates/menu.tpl.orig deleted file mode 100644 index cab095f..0000000 --- a/templates/menu.tpl.orig +++ /dev/null @@ -1,24 +0,0 @@ - - - -

diff --git a/templates/message.tpl b/templates/message.tpl index 7d2fa98..cf59990 100644 --- a/templates/message.tpl +++ b/templates/message.tpl @@ -1 +1 @@ - + diff --git a/templates/overview-get.tpl b/templates/overview-get.tpl index 6a93afd..5d40c42 100644 --- a/templates/overview-get.tpl +++ b/templates/overview-get.tpl @@ -4,30 +4,30 @@ $list_domains[$i]\n"; + echo "\n"; } else { - print "\n"; + echo "\n"; } } ?> - +

\n"; - print " \n"; - print "

".$LANG['Overview_title']."

"; - print " "; - print " \n"; - print " " . $LANG['Overview_get_domain'] . "\n"; - print " " . $LANG['Overview_get_aliases'] . "\n"; - print " " . $LANG['Overview_get_mailboxes'] . "\n"; - if ($CONF['quota'] == 'YES') print " " . $LANG['Overview_get_quota'] . "\n"; - print " \n"; + echo "\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($CONF['quota'] == 'YES') echo " \n"; + echo " \n"; for ($i = 0; $i < count($list_domains); $i++) { if ((is_array($list_domains) and count($list_domains) > 0)) { @@ -40,13 +40,13 @@ for ($i = 0; $i < count($list_domains); $i++) { if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $LANG['Overview_disabled']; if ($limit['maxquota'] < 0) $limit['maxquota'] = $LANG['Overview_disabled']; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - if ($CONF['quota'] == 'YES') print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($CONF['quota'] == 'YES') echo " \n"; + echo " \n"; } } - print "

".$LANG['Overview_title']."

" . $LANG['Overview_get_domain'] . "" . $LANG['Overview_get_aliases'] . "" . $LANG['Overview_get_mailboxes'] . "" . $LANG['Overview_get_quota'] . "
" . $list_domains[$i] . "" . $limit['alias_count'] . " / " . $limit['aliases'] . "" . $limit['mailbox_count'] . " / " . $limit['mailboxes'] . "" . $limit['maxquota'] . "
" . $list_domains[$i] . "" . $limit['alias_count'] . " / " . $limit['aliases'] . "" . $limit['mailbox_count'] . " / " . $limit['mailboxes'] . "" . $limit['maxquota'] . "
\n"; + echo "\n"; ?> diff --git a/templates/password.tpl b/templates/password.tpl index 2e1f6e4..5672e74 100644 --- a/templates/password.tpl +++ b/templates/password.tpl @@ -2,33 +2,33 @@
- + - - - + + + - + - + - + - + - + - + - +

 
diff --git a/templates/search.tpl b/templates/search.tpl index 4de0e5b..7fcbd94 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -1,61 +1,61 @@
-

+

0) { - print "\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

".$LANG['Overview_alias_title']."

" . $LANG['Overview_alias_address'] . "" . $LANG['Overview_alias_goto'] . "" . $LANG['Overview_alias_modified'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; for ($i = 0; $i < count($tAlias); $i++) { if ((is_array($tAlias) and count($tAlias) > 0)) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } } - print "

".$LANG['Overview_alias_title']."

" . $LANG['Overview_alias_address'] . "" . $LANG['Overview_alias_goto'] . "" . $LANG['Overview_alias_modified'] . " 
" . $tAlias[$i]['address'] . "" . preg_replace("/,/", "
", $tAlias[$i]['goto']) . "
" . $tAlias[$i]['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $tAlias[$i]['address'] . "" . preg_replace("/,/", "
", $tAlias[$i]['goto']) . "
" . $tAlias[$i]['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } if (count($tMailbox) > 0) { - print "\n"; - print " \n"; - print " "; - print " "; - print " \n"; - print " \n"; - print " \n"; - if ($CONF['quota'] == 'YES') print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo "

".$LANG['Overview_mailbox_title']."

" . $LANG['Overview_mailbox_username'] . "" . $LANG['Overview_mailbox_name'] . "" . $LANG['Overview_mailbox_quota'] . "" . $LANG['Overview_mailbox_modified'] . "" . $LANG['Overview_mailbox_active'] . " 
\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + if ($CONF['quota'] == 'YES') echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; for ($i = 0; $i < count($tMailbox); $i++) { if ((is_array($tMailbox) and count($tMailbox) > 0)) { - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } } - print "

".$LANG['Overview_mailbox_title']."

" . $LANG['Overview_mailbox_username'] . "" . $LANG['Overview_mailbox_name'] . "" . $LANG['Overview_mailbox_quota'] . "" . $LANG['Overview_mailbox_modified'] . "" . $LANG['Overview_mailbox_active'] . " 
" . $tMailbox[$i]['username'] . "" . $tMailbox[$i]['name'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
" . $tMailbox[$i]['username'] . "" . $tMailbox[$i]['name'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; + echo "\n"; } ?> diff --git a/templates/sendmail.tpl b/templates/sendmail.tpl index bc9b068..21d2542 100644 --- a/templates/sendmail.tpl +++ b/templates/sendmail.tpl @@ -2,35 +2,35 @@
- + - - + + - + - - + + - + - + - +

 
 
 
- +  
diff --git a/templates/users_edit-alias.tpl b/templates/users_edit-alias.tpl index 1093547..9a44087 100644 --- a/templates/users_edit-alias.tpl +++ b/templates/users_edit-alias.tpl @@ -2,15 +2,15 @@
- + - - + + - + - + - +

 
@@ -26,10 +26,10 @@ for ($i = 0 ; $i < count($array) ; $i++) {  
diff --git a/templates/users_login.tpl b/templates/users_login.tpl index 0f833e2..520ceb4 100644 --- a/templates/users_login.tpl +++ b/templates/users_login.tpl @@ -2,21 +2,21 @@
- + - - + + - + - + - +

diff --git a/templates/users_main.tpl b/templates/users_main.tpl index 8986a19..503f0a9 100644 --- a/templates/users_main.tpl +++ b/templates/users_main.tpl @@ -2,25 +2,25 @@ - + - - + + - - + + - - + + - - + +
 
diff --git a/templates/users_menu.tpl b/templates/users_menu.tpl index eb29f44..37bf7c2 100644 --- a/templates/users_menu.tpl +++ b/templates/users_menu.tpl @@ -1,18 +1,18 @@ \n"; + echo "
\n"; include("../motd-users.txt"); - print "
"; + echo ""; } ?> diff --git a/templates/users_password.tpl b/templates/users_password.tpl index fd4b567..bbaae9a 100644 --- a/templates/users_password.tpl +++ b/templates/users_password.tpl @@ -2,33 +2,33 @@
- + - - - + + + - + - + - + - + - + - + - +

 
diff --git a/templates/users_vacation-get.tpl b/templates/users_vacation-get.tpl index 5f1a11c..f537d5f 100644 --- a/templates/users_vacation-get.tpl +++ b/templates/users_vacation-get.tpl @@ -2,7 +2,7 @@
- +
diff --git a/templates/users_vacation.tpl b/templates/users_vacation.tpl index 828d238..8092423 100644 --- a/templates/users_vacation.tpl +++ b/templates/users_vacation.tpl @@ -2,27 +2,27 @@
- + - - + + - + - + - +

 
 
diff --git a/templates/viewlog.tpl b/templates/viewlog.tpl index a8f655b..0350ea9 100644 --- a/templates/viewlog.tpl +++ b/templates/viewlog.tpl @@ -1,53 +1,44 @@
-
- $list_domains[$i]\n"; - } else { - print "\n"; +if (count($list_domains) > 0) { + foreach ($list_domains as $row) { + echo '\n"; } } ?> - +
0) { - print "\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; +if (count($log) > 0) { + echo "

".$LANG['Viewlog_welcome']." ".$fDomain."

" . $LANG['Viewlog_timestamp'] . "" . $LANG['Viewlog_username'] . "" . $LANG['Viewlog_domain'] . "" . $LANG['Viewlog_action'] . "" . $LANG['Viewlog_data'] . "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \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 " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - } - } - print "

".$LANG['Viewlog_welcome']." ".$domain."

" . $LANG['Viewlog_timestamp'] . "" . $LANG['Viewlog_username'] . "" . $LANG['Viewlog_domain'] . "" . $LANG['Viewlog_action'] . "" . $LANG['Viewlog_data'] . "
" . $tLog[$i]['timestamp'] . "" . $tLog[$i]['username'] . "" . $tLog[$i]['domain'] . "" . $tLog[$i]['action'] . "" . $log_data . "
\n"; - print "

\n"; + foreach ($log as $row) { + if (strlen($row['data']) > 35) $row['data'] = substr($row['data'], 0, 35) . " ..."; + echo " \n"; + echo " " . $row['timestamp'] . "\n"; + echo " " . $row['username'] . "\n"; + echo " " . $row['domain'] . "\n"; + echo " " . $row['action'] . "\n"; + echo " " . $row['data'] . "\n"; + echo " \n"; } + echo "\n"; + echo "

\n"; } ?>