From fb6ed610fa905e99f03544a3e6f5b4cee075349b Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Fri, 26 Nov 2010 23:19:44 +0000 Subject: [PATCH] UserHandler.php: - add some FIXME and TODO notes UserHandler.php, AliasHandler.php: - whitespace fixes git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@888 a1433add-5e2c-0410-b055-b7f2511e0802 --- scripts/models-ext/AliasHandler.php | 6 +++--- scripts/models-ext/UserHandler.php | 17 +++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/models-ext/AliasHandler.php b/scripts/models-ext/AliasHandler.php index 1c1e3f71..2801e3b8 100644 --- a/scripts/models-ext/AliasHandler.php +++ b/scripts/models-ext/AliasHandler.php @@ -98,8 +98,8 @@ class AliasHandler { $addresses = array_unique($addresses); $original = $this->get(true); - $tmp = preg_split('/@/', $this->username); - $domain = $tmp[1]; + $tmp = preg_split('/@/', $this->username); + $domain = $tmp[1]; foreach($original as $address) { if($vacation_persist) { @@ -146,7 +146,7 @@ class AliasHandler { } if($this->hasAliasRecord() == false) { $true = db_get_boolean(True); - $sql = "INSERT INTO $table_alias (address, goto, domain, created, modified, active) VALUES ('$username', '$goto', '$domain', NOW(), NOW(), '$true')"; + $sql = "INSERT INTO $table_alias (address, goto, domain, created, modified, active) VALUES ('$username', '$goto', '$domain', NOW(), NOW(), '$true')"; } else { $sql = "UPDATE $table_alias SET goto = '$goto', modified = NOW() WHERE address = '$username'"; diff --git a/scripts/models-ext/UserHandler.php b/scripts/models-ext/UserHandler.php index bbd119af..116e57ab 100644 --- a/scripts/models-ext/UserHandler.php +++ b/scripts/models-ext/UserHandler.php @@ -95,6 +95,10 @@ class UserHandler { * */ public function add($password, $name = '', $quota = 0, $active = true, $mail = true ) { +# FIXME: change default value of $quota to something that is not an allowed value, like "-9" (0 is "unlimited", and I don't like that as default) +# FIXME: Should the parameters be optional at all? +# TODO: check if parameters are valid/allowed (quota?). Checks should live in a separate function that can be used by add and edit. +# TODO: On the longer term, the web interface should also use this class. global $config; $username = $this->username; $tmp = preg_split ('/@/', $username); @@ -120,11 +124,12 @@ class UserHandler { $plain = $password; $password = pacrypt ($password); - - if ( preg_match("/^dovecot:/", Config::read('encrypt')) ) { - $split_method = preg_split ('/:/', Config::read('encrypt')); - $method = strtoupper($split_method[1]); - $password = '{' . $method . '}' . $password; + +# TODO: Decide if we want to have the encryption method in the encrypted password string, and edit pacrypt() accordingly. No special handling here, please! + if ( preg_match("/^dovecot:/", Config::read('encrypt')) ) { + $split_method = preg_split ('/:/', Config::read('encrypt')); + $method = strtoupper($split_method[1]); + $password = '{' . $method . '}' . $password; } if (Config::read('domain_path') == "YES") @@ -143,7 +148,7 @@ class UserHandler { $maildir = $address . "/"; } - $quota = multiply_quota ($quota); + $quota = multiply_quota ($quota); if ('pgsql'== Config::read('database_type'))