commit 71b5e665b02807b07ff223a1014432f503ace7c4 from: mischa date: Sun Sep 04 14:28:04 2022 UTC added Language variabes for logging, never worked commit - 826796d1612618f6edef40bf344e83e70da2a378 commit + 71b5e665b02807b07ff223a1014432f503ace7c4 blob - 6deb5e9852bfa424c9867e7bf155b249a3433905 blob + 6cd3c924c8c9115e37db5c52c24c0daf19ee9cac --- add-alias.php +++ add-alias.php @@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $goto, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "create alias", "$from -> $goto"); + logging($admin, $domain, $LANG['Logging_alias_add'], "$from -> $goto"); $message = $LANG['Create_alias_result_succes'] . "
($from -> $goto)
"; $address = ''; $goto = ''; blob - a435ec2e2c48ed027b2587eb6bb4ab4829d354b8 blob + febb098681cdbbd7aaf654218c2292f7d93ac4de --- add-mailbox.php +++ add-mailbox.php @@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(4, $maildir, PDO::PARAM_STR); $sth->bindParam(5, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "create mailbox", "$from"); + logging($admin, $domain, $LANG['Logging_mailbox_add'], "$from"); $message = $LANG['Create_mailbox_result_succes'] . "
($from)"; $username = ''; $name = ''; blob - 85ea0fb54974b8ce8c2fc728b8fdf8a3a0d6599a blob + b33ef41c1110d88a476ba8b2c7e64a7165f49ce1 --- admin/add-alias.php +++ admin/add-alias.php @@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $goto, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "create alias", "$from -> $goto"); + logging($admin, $domain, $LANG['Logging_alias_add'], "$from -> $goto"); $message = $LANG['Create_alias_result_succes'] . "
($from -> $goto)
"; $address = ''; $goto = ''; blob - df39f7677d4de5f231e8506790400b2184c90abb blob + a32fcc2cb11a24f3d70be6b031775aa692312bc7 --- admin/add-mailbox.php +++ admin/add-mailbox.php @@ -82,7 +82,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(4, $maildir, PDO::PARAM_STR); $sth->bindParam(5, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "create mailbox", "$from"); + logging($admin, $domain, $LANG['Logging_mailbox_add'], "$from"); $message = $LANG['Create_mailbox_result_succes'] . "
($from)"; $username = ''; $name = ''; blob - 3f1097d052e174f73af2431e1f32945c64c570ed blob + 72e6b6744fa4441dab3f3a90b49bb333983b0ce8 --- admin/delete.php +++ admin/delete.php @@ -154,7 +154,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($sth->rowCount() != 1) { throw new RuntimeException('alias'); } - logging($admin, $domain, "delete alias", $delete); + logging($admin, $domain, $LANG['Logging_alias_delete'], $delete); header("Location: list-virtual.php?domain=$domain"); } catch (RuntimeException $e) { @@ -172,7 +172,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($sth->rowCount() != 1) { throw new RuntimeException('mailbox'); } - logging($admin, $domain, "delete mailbox", $delete); + logging($admin, $domain, $LANG['Logging_mailbox_delete'], $delete); $sth = $dbh->prepare("DELETE FROM vacation WHERE email=? AND domain=?"); $sth->bindParam(1, $delete, PDO::PARAM_STR); blob - 03d550c2fb0306a1ac6134d3661bc69166b43766 blob + 12fa2a7c89af3caf0c0a1e06d80f2ea96db0beb6 --- admin/edit-alias.php +++ admin/edit-alias.php @@ -79,7 +79,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $address, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "edit alias", "$address -> $goto"); + logging($admin, $domain, $LANG['Logging_alias_edit'], "$address -> $goto"); header("Location: list-virtual.php?domain=$domain"); } catch(PDOException $e) { $message = $LANG['Edit_alias_result_error']; blob - 01e60dbaea9985658642113aabf09ac15c1352df blob + 2ff56843846975ecd66029aa078e5d15f113516c --- admin/edit-mailbox.php +++ admin/edit-mailbox.php @@ -85,7 +85,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $username, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "edit mailbox", $username); + logging($admin, $domain, $LANG['Logging_mailbox_edit'], $username); header("Location: list-virtual.php?domain=$domain"); } catch(PDOException $e) { $message = $LANG['Edit_mailbox_result_error']; blob - 7d753a9dbcb72afcf1ad471d4c9b4023b1c31ded blob + 8d76d06eec3bd3e15f46c8204f052ce3e363a2f4 --- delete.php +++ delete.php @@ -44,7 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($sth->rowCount() != 1) { throw new RuntimeException('alias'); } - logging($admin, $domain, "delete alias", $delete); + logging($admin, $domain, $LANG['Logging_alias_delete'], $delete); header("Location: list-virtual.php?domain=$domain"); } catch (RuntimeException $e) { @@ -67,7 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($sth->rowCount() != 1) { throw new RuntimeException('mailbox'); } - logging($admin, $domain, "delete mailbox", $delete); + logging($admin, $domain, $LANG['Logging_mailbox_delete'], $delete); $sth = $dbh->prepare("DELETE FROM vacation WHERE email=? AND domain=?"); $sth->bindParam(1, $delete, PDO::PARAM_STR); blob - 7ae5c6c366610e046129f43a2958879b54fc489d blob + bb51f29bb4e9ecfeeeb32cc85aee197bd33830c5 --- edit-alias.php +++ edit-alias.php @@ -80,7 +80,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $address, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "edit alias", "$address -> $goto"); + logging($admin, $domain, $LANG['Logging_alias_edit'], "$address -> $goto"); header("Location: list-virtual.php?domain=$domain"); } catch(PDOException $e) { $message = $LANG['Edit_alias_result_error']; blob - 6bddeb312dab0dc6519917902a62b1572d82ee6a blob + 289b08c768d591f4cf9eb7cdaf7b56f7c4f31fed --- edit-mailbox.php +++ edit-mailbox.php @@ -86,7 +86,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $sth->bindParam(2, $username, PDO::PARAM_STR); $sth->bindParam(3, $domain, PDO::PARAM_STR); $sth->execute(); - logging($admin, $domain, "edit mailbox", $username); + logging($admin, $domain, $LANG['Logging_mailbox_edit'], $username); header("Location: list-virtual.php?domain=$domain"); } catch(PDOException $e) { $message = $LANG['Edit_mailbox_result_error']; blob - ecfb976921b9ff791face38ae31ce882f7bf0f95 blob + 6f4df5ebe9e8fe2ee736c0061a87ad9bd4bbd6af --- languages/en.lang +++ languages/en.lang @@ -53,7 +53,6 @@ $LANG['Overview_alias_modified'] = 'Last Modified'; $LANG['Overview_mailbox_username'] = 'Email'; $LANG['Overview_mailbox_name'] = 'Name'; $LANG['Overview_mailbox_modified'] = 'Last Modified'; -$LANG['Overview_mailbox_active'] = 'Active'; $LANG['Overview_get_domain'] = 'Domain'; $LANG['Overview_get_aliases'] = 'Aliases'; @@ -95,7 +94,6 @@ $LANG['Create_mailbox_password_text'] = 'Password for $LANG['Create_mailbox_password_text_error'] = 'The passwords that you supplied don\'t match, or are empty.'; $LANG['Create_mailbox_name'] = 'Name'; $LANG['Create_mailbox_name_text'] = 'Full name'; -$LANG['Create_mailbox_active'] = 'Active'; $LANG['Create_mailbox_mail'] = 'Create mailbox'; $LANG['Create_mailbox_button'] = 'Add Mailbox'; $LANG['Create_mailbox_result_error'] = 'Unable to add the mailbox to the mailbox table.'; @@ -137,12 +135,12 @@ $LANG['Viewlog_result_error'] = 'To is empty or is not a valid email address.'; +$LANG['Sendmail_to_text_error'] = 'TO is empty or is not a valid email address.'; $LANG['Sendmail_subject'] = 'Subject'; $LANG['Sendmail_subject_text'] = 'Welcome'; $LANG['Sendmail_body'] = 'Body'; $LANG['Sendmail_button'] = 'Send Message'; -$LANG['Sendmail_result_error'] = 'Unable to create mailbox.'; +$LANG['Sendmail_result_error'] = 'Unable to send message.'; $LANG['Sendmail_result_succes'] = 'The mailbox has been created.'; $LANG['AdminMenu_list_admin'] = 'Admin List'; @@ -160,14 +158,12 @@ $LANG['AdminList_admin_domain'] = 'Domain'; $LANG['AdminList_admin_username'] = 'Admin'; $LANG['AdminList_admin_count'] = 'Domains'; $LANG['AdminList_admin_modified'] = 'Last Modified'; -$LANG['AdminList_admin_active'] = 'Active'; $LANG['AdminList_domain_domain'] = 'Domain'; $LANG['AdminList_domain_description'] = 'Description'; $LANG['AdminList_domain_aliases'] = 'Aliases'; $LANG['AdminList_domain_mailboxes'] = 'Mailboxes'; $LANG['AdminList_domain_modified'] = 'Last Modified'; -$LANG['AdminList_domain_active'] = 'Active'; $LANG['AdminList_virtual_button'] = 'Go'; $LANG['AdminList_virtual_welcome'] = 'Overview for '; @@ -179,7 +175,6 @@ $LANG['AdminList_virtual_alias_modified'] = 'Last Modi $LANG['AdminList_virtual_mailbox_username'] = 'Email'; $LANG['AdminList_virtual_mailbox_name'] = 'Name'; $LANG['AdminList_virtual_mailbox_modified'] = 'Last Modified'; -$LANG['AdminList_virtual_mailbox_active'] = 'Active'; $LANG['AdminAdd_domain_welcome'] = 'Add a new domain'; $LANG['AdminAdd_domain_domain'] = 'Domain'; @@ -200,7 +195,6 @@ $LANG['AdminEdit_domain_aliases'] = 'Aliases'; $LANG['AdminEdit_domain_aliases_text'] = '-1 = disable | 0 = unlimited'; $LANG['AdminEdit_domain_mailboxes'] = 'Mailboxes'; $LANG['AdminEdit_domain_mailboxes_text'] = '-1 = disable | 0 = unlimited'; -$LANG['AdminEdit_domain_active'] = 'Active'; $LANG['AdminEdit_domain_button'] = 'Edit Domain'; $LANG['AdminEdit_domain_result_error'] = 'Unable to modify domain.'; @@ -221,7 +215,6 @@ $LANG['AdminEdit_admin_username'] = 'Admin'; $LANG['AdminEdit_admin_password'] = 'Password'; $LANG['AdminEdit_admin_password2'] = 'Password (again)'; $LANG['AdminEdit_admin_password_text_error'] = 'The passwords that you supplied don\'t match, or are empty.'; -$LANG['AdminEdit_admin_active'] = 'Active'; $LANG['AdminEdit_admin_button'] = 'Edit Admin'; $LANG['AdminEdit_admin_result_error'] = 'Unable to modify admin.'; $LANG['AdminEdit_admin_result_succes'] = 'Admin has been modified.'; @@ -255,14 +248,12 @@ $LANG['UsersVacation_button_back'] = 'Coming Back'; $LANG['UsersVacation_result_error'] = 'Unable to update your auto response settings.'; $LANG['UsersVacation_result_succes'] = 'Your auto response has been removed.'; -$LANG['Create_dbLog_createmailbox'] = 'create mailbox'; -$LANG['Create_dbLog_createalias'] = 'create alias'; -$LANG['Delete_dbLog_deletealias'] = 'delete alias'; -$LANG['Delete_dbLog_deletemailbox'] = 'delete mailbox'; +$LANG['Logging_alias_add'] = 'add alias'; +$LANG['Logging_alias_edit'] = 'edit alias'; +$LANG['Logging_alias_delete'] = 'delete alias'; +$LANG['Logging_mailbox_add'] = 'add mailbox'; +$LANG['Logging_mailbox_edit'] = 'edit mailbox'; +$LANG['Logging_mailbox_delete'] = 'delete mailbox'; -$LANG['Edit_dbLog_editactive'] = 'change active state'; -$LANG['Edit_dbLog_editalias'] = 'edit alias'; -$LANG['Edit_dbLog_editmailbox'] = 'edit mailbox'; - $LANG['Search_welcome'] = 'Searching for: '; ?> blob - b6834445cf0ca7e83c3a68df1e35391aaf45c5a3 blob + 495b4818506eed6c4223155e73cd314181cc0185 --- sendmail.php +++ sendmail.php @@ -11,47 +11,45 @@ // // Template Variables: // -// tMessage -// tFrom -// tSubject -// tBody +// message +// from +// subject +// body // // Form POST \ GET Variables: // -// fTo -// fSubject -// fBody +// to +// subject +// body // -require("./functions.inc.php"); -include("./languages/" . check_language() . ".lang"); +require_once './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']); + $to = strtolower(filter_input(INPUT_POST, 'to', FILTER_VALIDATE_EMAIL)); + $subject = filter_input(INPUT_POST, 'subject', FILTER_DEFAULT); + $body = filter_input(INPUT_POST, 'body', FILTER_DEFAULT); - 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 = $LANG['Sendmail_to_text_error']; + $headers = "From: " . $SESSID_USERNAME . "\r\n"; + $headers .= "Content-Type: text/plain; charset=utf-8\r\n"; + + if (empty($to)) { + $message = $LANG['Sendmail_to_text_error']; } - if ($error != 1) { - if (!mail($fTo, $fSubject, $fBody, $fHeaders)) { - $tMessage .= $LANG['Sendmail_result_error']; + if (empty($message)) { + if (!mail($to, $subject, $body, $headers)) { + $message = $LANG['Sendmail_result_error']; } else { - $tMessage .= $LANG['Sendmail_result_succes']; + $message = $LANG['Sendmail_result_succes']; } } } -include("./templates/header.tpl"); -include("./templates/menu.tpl"); -include("./templates/sendmail.tpl"); -include("./templates/footer.tpl"); + +include './templates/header.tpl'; +include './templates/menu.tpl'; +include './templates/sendmail.tpl'; +include './templates/footer.tpl'; ?> blob - /dev/null blob + a2d6ecea9013237b4d43438eecf30f8c4f859656 (mode 644) --- /dev/null +++ templates/list-virtual.tpl @@ -0,0 +1,96 @@ +
+
+ + + +
+ +

+

+

+ +
+ +
+
+ $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) { + echo "
\n"; + if ($offset >= $limit) { + + echo "\n"; + } + if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) { + + echo "\n"; + } + if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) { + echo "\n"; + } + echo "
\n"; +} + +if (count($list_alias) > 0) { + echo "\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + foreach ($list_alias as $row) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + echo "

".$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'] . "
\n"; +} + +if (count($list_mailbox) > 0) { + echo "\n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + foreach ($list_mailbox as $row) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + echo "

".$LANG['Overview_mailbox_title']."

" . $LANG['Overview_mailbox_username'] . "" . $LANG['Overview_mailbox_name'] . "" . $LANG['Overview_mailbox_modified'] . " 
" . $row['username'] . "" . $row['name'] . "" . $row['modified'] . "" . $LANG['edit'] . "" . $LANG['del'] . "
\n"; +} +?> blob - 71745f57e1fbaee3114c992257e9e0d33f58598a blob + 2996c17e4667dcace4d683308e6a65da70fbfca9 --- templates/main.tpl +++ templates/main.tpl @@ -5,11 +5,11 @@ - + - + blob - 21d2542e18659d5b2745bc9bc5a700f75a251476 blob + 5921514c836191d6c74de33655a07a01df468130 --- templates/sendmail.tpl +++ templates/sendmail.tpl @@ -11,18 +11,18 @@ - +   - +   - +   @@ -30,7 +30,7 @@ - +