/** * AliasHandler needs some special handling in init() and therefore overloads the function. * It also calls parent::init() */ public function init($id) { @(list($local_part, $domain) = explode('@', $id)); # supress error message if $id doesn't contain '@' if ($local_part == '*') { # catchall - postfix expects '@domain', not '*@domain' $id = '@' . $domain; } $retval = parent::init($id); if (!$retval) { return false; } # parent::init() failed, no need to continue # hide 'goto_mailbox' for non-mailbox aliases # parent::init called view() before, so we can rely on having $this->result filled # (only validate_new_id() is called from parent::init and could in theory change $this->result) if ($this->new || $this->result['is_mailbox'] == 0) { $this->struct['goto_mailbox']['editable'] = 0; $this->struct['goto_mailbox']['display_in_form'] = 0; $this->struct['goto_mailbox']['display_in_list'] = 0; } if (!$this->new && $this->result['is_mailbox'] && $this->admin_username != '' && !authentication_has_role('global-admin')) { # domain admins are not allowed to change mailbox alias $CONF['alias_control_admin'] = NO # TODO: apply the same restriction to superadmins? if (!Config::bool('alias_control_admin')) { # TODO: make translateable $this->errormsg[] = "Domain administrators do not have the ability to edit user's aliases (check config.inc.php - alias_control_admin)"; return false; } } return $retval; }
public function init($id) { $success = parent::init($id); if ($success) { if (count($this->struct['alias_domain']['options']) == 0 && $this->new) { $this->errormsg[] = Config::lang('pCreate_alias_domain_error4'); return false; } # TODO: check if target domains are available (in new and edit mode) } return $success; }
public function init($id) { # hardcode to logged in admin if ($this->admin_username == '') { die("No admin logged in"); } $this->id = $this->admin_username; $this->values['username'] = $this->id; $this->struct['username']['default'] = $this->id; # hardcode to edit mode $this->new = 0; return parent::init($this->id); }
public function init($id) { if (!parent::init($id)) { return false; } if ($this->new) { $currentquota = 0; } else { $currentquota = $this->result['quotabytes']; # parent::init called ->view() } $this->updateMaxquota($this->domain, $currentquota); return true; # still here? good. }