mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
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
This commit is contained in:
parent
39fde20ccc
commit
9f94438a78
@ -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') . "<br />($domain)</br />";
|
||||
$tMessage = Lang::read('pAdminCreate_domain_result_success') . "<br />(" . $this->username . ")</br />";
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user