diff --git a/add-alias.php b/add-alias.php index 6deb5e9..6cd3c92 100644 --- a/add-alias.php +++ b/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 = ''; diff --git a/add-mailbox.php b/add-mailbox.php index a435ec2..febb098 100644 --- a/add-mailbox.php +++ b/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 = ''; diff --git a/admin/add-alias.php b/admin/add-alias.php index 85ea0fb..b33ef41 100644 --- a/admin/add-alias.php +++ b/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 = ''; diff --git a/admin/add-mailbox.php b/admin/add-mailbox.php index df39f76..a32fcc2 100644 --- a/admin/add-mailbox.php +++ b/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 = ''; diff --git a/admin/delete.php b/admin/delete.php index 3f1097d..72e6b67 100644 --- a/admin/delete.php +++ b/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); diff --git a/admin/edit-alias.php b/admin/edit-alias.php index 03d550c..12fa2a7 100644 --- a/admin/edit-alias.php +++ b/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']; diff --git a/admin/edit-mailbox.php b/admin/edit-mailbox.php index 01e60db..2ff5684 100644 --- a/admin/edit-mailbox.php +++ b/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']; diff --git a/delete.php b/delete.php index 7d753a9..8d76d06 100644 --- a/delete.php +++ b/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); diff --git a/edit-alias.php b/edit-alias.php index 7ae5c6c..bb51f29 100644 --- a/edit-alias.php +++ b/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']; diff --git a/edit-mailbox.php b/edit-mailbox.php index 6bddeb3..289b08c 100644 --- a/edit-mailbox.php +++ b/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']; diff --git a/languages/en.lang b/languages/en.lang index ecfb976..6f4df5e 100644 --- a/languages/en.lang +++ b/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 POP3/IMAP'; $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'] = 'Unable to find the logs $LANG['Sendmail_welcome'] = 'Send an email.'; $LANG['Sendmail_admin'] = 'From'; $LANG['Sendmail_to'] = 'To'; -$LANG['Sendmail_to_text_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 Modified'; $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['Edit_dbLog_editactive'] = 'change active state'; -$LANG['Edit_dbLog_editalias'] = 'edit alias'; -$LANG['Edit_dbLog_editmailbox'] = 'edit 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['Search_welcome'] = 'Searching for: '; ?> diff --git a/sendmail.php b/sendmail.php index b683444..495b481 100644 --- a/sendmail.php +++ b/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'; ?> diff --git a/templates/list-virtual.tpl b/templates/list-virtual.tpl new file mode 100644 index 0000000..a2d6ece --- /dev/null +++ b/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"; +} +?> diff --git a/templates/main.tpl b/templates/main.tpl index 71745f5..2996c17 100644 --- a/templates/main.tpl +++ b/templates/main.tpl @@ -5,11 +5,11 @@ - + - + diff --git a/templates/sendmail.tpl b/templates/sendmail.tpl index 21d2542..5921514 100644 --- a/templates/sendmail.tpl +++ b/templates/sendmail.tpl @@ -11,18 +11,18 @@ - +   - +   - +   @@ -30,7 +30,7 @@ - +