コード例 #1
0
ファイル: VacationHandler.php プロジェクト: port22/mail
 /**
  * @return boolean true if on vacation, otherwise false
  * Why do we bother storing true/false in the vacation table if the alias dictates it anyway?
  */
 function check_vacation()
 {
     $handler = new AliasHandler();
     if (!$handler->init($this->id)) {
         # print_r($handler->errormsg); # TODO: error handling
         return false;
     }
     if (!$handler->view()) {
         # print_r($handler->errormsg); # TODO: error handling
         return false;
     }
     $result = $handler->result();
     if ($result['on_vacation']) {
         return true;
     }
     return false;
 }
コード例 #2
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']);
 }
コード例 #3
0
ファイル: list-virtual.php プロジェクト: stepkh/postfixadmin
} 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');
# build the sql query
$sql_select = "SELECT {$table_mailbox}.* ";
$sql_from = " FROM {$table_mailbox} ";
$sql_join = "";
$sql_where = " WHERE ";
$sql_order = " ORDER BY {$table_mailbox}.username ";
$sql_limit = " LIMIT {$page_size} OFFSET {$fDisplay}";
if (count($search) == 0 || !isset($search['_'])) {
    $sql_where .= " {$table_mailbox}.domain='{$fDomain}' ";
} else {
    $searchterm = escape_string($search['_']);
コード例 #4
0
 * 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', '');
        $smarty->assign('forward_only', ' checked="checked"');
    }
    $smarty->assign('tGotoArray', $tGotoArray);
    $smarty->display('index.tpl');
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    // user clicked on cancel button