From 94317b12cc11fe741459606160752401fcc4444d Mon Sep 17 00:00:00 2001 From: Synox Date: Sat, 13 Jan 2018 20:15:54 +0100 Subject: [PATCH] Changed: - make blocked_usernames configurable - improved validation of user input - fixed problem where only one domain is defined --- src/config.sample.php | 7 ++- src/frontend.template.php | 25 ++++---- src/index.php | 123 ++++++++++++++++++++++++++------------ 3 files changed, 102 insertions(+), 53 deletions(-) diff --git a/src/config.sample.php b/src/config.sample.php index 204333a..238b638 100644 --- a/src/config.sample.php +++ b/src/config.sample.php @@ -25,4 +25,9 @@ $config['imap']['password'] = "mypassword"; $config['domains'] = array('mydomain.com', 'example.com'); // When to delete old messages? -$config['delete_messages_older_than'] = '30 days ago'; \ No newline at end of file +$config['delete_messages_older_than'] = '30 days ago'; + + +// Mails to those usernames can not be accessed: +$config['blocked_usernames'] = array('root', 'admin', 'administrator', 'hostmaster', 'postmaster', 'webmaster'); + diff --git a/src/frontend.template.php b/src/frontend.template.php index b511329..4080ed7 100644 --- a/src/frontend.template.php +++ b/src/frontend.template.php @@ -2,14 +2,9 @@ /* input: -$address - username and domain -$username - username -$domain - domain - +$user - User object $config - config array - $emails - array of emails - */ // Load HTML Purifier @@ -22,7 +17,7 @@ $purifier = new HTMLPurifier($purifier_config); - <?php echo $address ?> + <?php echo $user->address ?> @@ -112,19 +107,21 @@ $purifier = new HTMLPurifier($purifier_config);
+ value="username ?>">
@" . $config['domains'][0] . ""; + $domain = $config['domains'][0]; + print "

@$domain

"; + print ""; } else { ?>