コード例 #1
0
 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!
 }
コード例 #2
0
ファイル: VacationHandler.php プロジェクト: port22/mail
 /**
  * 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;
 }
コード例 #3
0
ファイル: xmlrpc.php プロジェクト: mpietruschka/postfixadmin
 /**
  * @return boolean true if the user has 'store_and_forward' set.
  * (i.e. their email address is also in the alias table). IF it returns false, then it's 'remote_only'
  */
 public function hasStoreAndForward()
 {
     $ah = new AliasHandler();
     $ah->init($_SESSION['sessid']['username']);
     $ah->view();
     $result = $ah->result;
     return $result['goto_mailbox'] == 1;
 }
コード例 #4
0
ファイル: list-virtual.php プロジェクト: stepkh/postfixadmin
    if (count($search) > 0) {
        $aliasdomain_data['struct']['target_domain']['linkto'] = 'target';
    }
}
#
# aliases
#
$table_alias = table_by_key('alias');
$table_mailbox = table_by_key('mailbox');
if (count($search) == 0 || !isset($search['_'])) {
    $list_param = "domain='{$fDomain}'";
} else {
    $searchterm = escape_string($search['_']);
    $list_param = "(address LIKE '%{$searchterm}%' OR goto LIKE '%{$searchterm}%')";
}
$handler = new AliasHandler(0, $admin_username);
$formconf = $handler->webformConfig();
# might change struct
$alias_data = array('formconf' => $formconf, 'struct' => $handler->getStruct(), 'msg' => $handler->getMsg());
$alias_data['struct']['goto_mailbox']['display_in_list'] = 0;
# not useful/defined for non-mailbox aliases
$alias_data['struct']['on_vacation']['display_in_list'] = 0;
$alias_data['msg']['show_simple_search'] = False;
# hide search box
$handler->getList($list_param, array(), $page_size, $fDisplay);
$pagebrowser_alias = $handler->getPagebrowser($list_param, array());
$tAlias = $handler->result();
#
# mailboxes
#
$display_mailbox_aliases = Config::bool('alias_control_admin');
コード例 #5
0
ファイル: AliasHandler.php プロジェクト: port22/mail
 protected function setmore($values)
 {
     if ($this->new) {
         if ($this->struct['address']['display_in_form'] == 1) {
             # default mode - split off 'domain' field from 'address' # TODO: do this unconditional?
             list(, $domain) = explode('@', $values['address']);
             $this->values['domain'] = $domain;
         }
     }
     if (!$this->new) {
         # edit mode - preserve vacation and mailbox alias if they were included before
         $old_ah = new AliasHandler();
         if (!$old_ah->init($this->id)) {
             $this->errormsg[] = $old_ah->errormsg[0];
         } elseif (!$old_ah->view()) {
             $this->errormsg[] = $old_ah->errormsg[0];
         } else {
             $oldvalues = $old_ah->result();
             if (!isset($values['goto'])) {
                 # no new value given?
                 $values['goto'] = $oldvalues['goto'];
             }
             if (!isset($values['on_vacation'])) {
                 # no new value given?
                 $values['on_vacation'] = $oldvalues['on_vacation'];
             }
             if ($values['on_vacation']) {
                 $values['goto'][] = $this->getVacationAlias();
             }
             if ($oldvalues['is_mailbox']) {
                 # alias belongs to a mailbox - add/keep mailbox to/in goto
                 if (!isset($values['goto_mailbox'])) {
                     # no new value given?
                     $values['goto_mailbox'] = $oldvalues['goto_mailbox'];
                 }
                 if ($values['goto_mailbox']) {
                     $values['goto'][] = $this->id;
                     # if the alias points to the mailbox, don't display the "empty goto" error message
                     if (isset($this->errormsg['goto']) && $this->errormsg['goto'] == Config::lang('pEdit_alias_goto_text_error1')) {
                         unset($this->errormsg['goto']);
                     }
                 }
             }
         }
     }
     $this->values['goto'] = join(',', $values['goto']);
 }
コード例 #6
0
 * 
 * @version $Id$ 
 * @license GNU GPL v2 or later. 
 * 
 * File: edit-alias.php
 * Users can use this to set forwards etc for their mailbox.
 *
 * Template File: users_edit-alias.tpl
 *
 */
$rel_path = '../';
require_once '../common.php';
$smarty->assign('smarty_template', 'users_edit-alias');
authentication_require_role('user');
$USERID_USERNAME = authentication_get_username();
$ah = new AliasHandler();
$ah->init($USERID_USERNAME);
$smarty->assign('USERID_USERNAME', $USERID_USERNAME);
if (!$ah->view()) {
    die("Can't get alias details. Invalid alias?");
}
# this can only happen if a admin deleted the user since the user logged in
$result = $ah->result();
$tGotoArray = $result['goto'];
$tStoreAndForward = $result['goto_mailbox'];
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if ($tStoreAndForward) {
        $smarty->assign('forward_and_store', ' checked="checked"');
        $smarty->assign('forward_only', '');
    } else {
        $smarty->assign('forward_and_store', '');