コード例 #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
ファイル: 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
 * 
 * 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', '');
        $smarty->assign('forward_only', ' checked="checked"');
    }
    $smarty->assign('tGotoArray', $tGotoArray);