From 9f94438a786adedb7ffa743ef9c0a8edccdd30f8 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Tue, 19 Apr 2011 22:08:20 +0000 Subject: [PATCH] model/DomainHandler.php: - replace $domain with $this->username in add() - comment cleanup git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1047 a1433add-5e2c-0410-b055-b7f2511e0802 --- model/DomainHandler.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/model/DomainHandler.php b/model/DomainHandler.php index b19a88cf..b1413b57 100644 --- a/model/DomainHandler.php +++ b/model/DomainHandler.php @@ -32,8 +32,8 @@ class DomainHandler extends PFAHandler { # TODO: use a helper function to fill $struct with named keys instead of [0], [1], ... # TODO: find a way to handle field labels - not sure if the fetchmail way (construct $LANG keys from field name) is perfect - $this->struct=array( // list($editible,$view,$type) - # field name allow display field? type + $this->struct=array( + # field name allow display in... type # editing? form list "domain" => array( $this->new, 1, 1, 'text' ), "description" => array( 1, 1, 1, 'text' ), @@ -71,8 +71,6 @@ class DomainHandler extends PFAHandler { } public function add($values) { -# ($desc, $a, $m, $t, $q, $default, $backup) - # TODO: make this a generic function for add and edit # TODO: move DB writes etc. to separate save() function @@ -100,32 +98,30 @@ class DomainHandler extends PFAHandler { # TODO: more validation - $domain = $this->username; # TODO fix variable names below - $checked['domain'] = $this->username; $result = db_insert('domain', $checked); if ($result != 1) { - $this->errormsg[] = Lang::read('pAdminCreate_domain_result_error') . "\n($domain)\n"; + $this->errormsg[] = Lang::read('pAdminCreate_domain_result_error') . "\n(" . $this->username . ")\n"; return false; } else { if ($this->new && $values['default_aliases']) { foreach (Config::read('default_aliases') as $address=>$goto) { - $address = $address . "@" . $domain; + $address = $address . "@" . $this->username; # TODO: use AliasHandler->add instead of writing directly to the alias table $arr = array( 'address' => $address, 'goto' => $goto, - 'domain' => $domain, + 'domain' => $this->username, ); $result = db_insert ('alias', $arr); } } - $tMessage = Lang::read('pAdminCreate_domain_result_success') . "
($domain)
"; + $tMessage = Lang::read('pAdminCreate_domain_result_success') . "
(" . $this->username . ")
"; } - if (!domain_postcreation($domain)) { + if (!domain_postcreation($this->username)) { $tMessage = Lang::read('pAdminCreate_domain_error'); } - db_log ($domain, 'create_domain', ""); + db_log ($this->username, 'create_domain', ""); return true; }