protected function beforestore() { if (isset($this->values['quota']) && $this->values['quota'] != -1) { $this->values['quota'] = $this->values['quota'] * Config::read('quota_multiplier'); # convert quota from MB to bytes } $ah = new AliasHandler($this->new, $this->admin_username); $ah->calledBy('MailboxHandler'); if (!$ah->init($this->id)) { $arraykeys = array_keys($ah->errormsg); $this->errormsg[] = $ah->errormsg[$arraykeys[0]]; # TODO: implement this as PFAHandler->firstErrormsg() return false; } $alias_data = array(); if (isset($this->values['active'])) { # might not be set in edit mode $alias_data['active'] = $this->values['active']; } if ($this->new) { $alias_data['goto'] = array($this->id); # 'goto_mailbox' = 1; # would be technically correct, but setting 'goto' is easier } if (!$ah->set($alias_data)) { $this->errormsg[] = $ah->errormsg[0]; return false; } if (!$ah->store()) { $this->errormsg[] = $ah->errormsg[0]; return false; } return true; # still here? good! }
/** * @param array of email addresses (Strings) * @param string flag to set ('forward_and_store' or 'remote_only') * @return boolean true */ public function update($addresses, $flags) { $ah = new AliasHandler(); $ah->init($_SESSION['sessid']['username']); $values['goto'] = $addresses; if ($flags == 'forward_and_store') { $values['goto_mailbox'] = 1; } elseif ($flags == 'remote_only') { $values['goto_mailbox'] = 0; } else { return false; # invalid parameter } if (!$ah->set($values)) { //error_log('ah->set failed' . print_r($values, true)); return false; } $store = $ah->store(); return $store; }
/** * add/remove the vacation alias * @param int $vacationActive */ protected function updateAlias($vacationActive) { $handler = new AliasHandler(); if (!$handler->init($this->id)) { # print_r($handler->errormsg); # TODO: error handling return false; } $values = array('on_vacation' => $vacationActive); if (!$handler->set($values)) { # print_r($handler->errormsg); # TODO: error handling return false; } # TODO: supress logging in AliasHandler if called from VacationHandler (VacationHandler should log itsself) if (!$handler->store()) { print_r($handler->errormsg); # TODO: error handling return false; } # still here? then everything worked return true; }
if ($email_check != '') { $error += 1; flash_error("{$address}: {$email_check}"); } else { $good_goto[] = $address; } } } } if ($error == 0) { $values = array('goto' => $good_goto, 'goto_mailbox' => $fForward_and_store); if (!$ah->set($values)) { $errormsg = $ah->errormsg; flash_error($errormsg[0]); } $updated = $ah->store(); if ($updated) { header("Location: main.php"); exit; } flash_error($PALANG['pEdit_alias_result_error']); } else { $tGotoArray = $goto; } $smarty->assign('tGotoArray', $tGotoArray); if ($fForward_and_store == 1) { $smarty->assign('forward_and_store', ' checked="checked"'); $smarty->assign('forward_only', ''); } else { $smarty->assign('forward_and_store', ''); $smarty->assign('forward_only', ' checked="checked"');