diff --git a/model/AliasHandler.php b/model/AliasHandler.php index 675af501..b1493e03 100644 --- a/model/AliasHandler.php +++ b/model/AliasHandler.php @@ -296,45 +296,6 @@ class AliasHandler extends PFAHandler { They still work, but are deprecated and will be removed. **********************************************************************************************************************************************************/ - /** - * @return bool true if succeed - * (may be an empty list, especially if $CONF['alias_control'] is turned off...) - * @param boolean - by default we don't return special addresses (e.g. vacation and mailbox alias); pass in true here if you wish to. - */ - public function get($all=false) { - $E_username = escape_string($this->id); - $table_alias = table_by_key('alias'); - - $sql = "SELECT * FROM $table_alias WHERE address='$E_username'"; - $result = db_query($sql); - if($result['rows'] != 1) { - return false; - } - - $row = db_array ($result['result']); - // At the moment Postfixadmin stores aliases in it's database in a comma seperated list; this may change one day. - $list = explode(',', $row['goto']); - if($all) { - $this->return = $list; - return true; - } - - $filtered_list = array(); - /* if !$all, remove vacation & mailbox aliases */ - foreach($list as $address) { - if($address != '' ) { - if($this->is_vacation_address($address) || $this->is_mailbox_alias($address)) { - # TODO: store "vacation_active" and "mailbox" status - should be readable public - } - else { - $filtered_list[] = $address; - } - } - } - $this->return = $filtered_list; - return true; - } - /** * @param string $address * @param string $username @@ -461,19 +422,6 @@ class AliasHandler extends PFAHandler { return true; } - /** - * Determine whether a local delivery address is present. This is - * stores as an alias with the same name as the mailbox name (username) - * @return boolean true if local delivery is enabled - */ - public function hasStoreAndForward() { - $result = $this->get(true); # TODO: error checking? - if(in_array($this->id, $this->return)) { - return true; - } - return false; - } - /** * @return boolean true if the user has an alias record (i.e row in alias table); else false. */ diff --git a/scripts/shells/alias.php b/scripts/shells/alias.php index 34692205..46aed6bd 100644 --- a/scripts/shells/alias.php +++ b/scripts/shells/alias.php @@ -300,30 +300,25 @@ class ViewTask extends Shell { $handler = new AliasHandler(); $handler->init($address); - $status = $handler->get(); # TODO: set the "all" flag? - if ( ! $status) { + if ( ! $handler->view() ) { $this->error("Error: Not Found", "The requested alias was not found!"); } else { $result = $handler->return; $this->out(sprintf("Entries for: %s\n", $address)); $this->out("Goto: \t"); - foreach($result AS $goto) { + foreach($result['goto'] AS $goto) { $this->out("\t -> ".$goto); } - # TODO: display "deliver to mailbox" - ##NEED fix in is_mailbox_alias because user is not set correctly in this scenario! - /** - if( $handler->is_mailbox_alias($address) ) + if( $result['is_mailbox'] ) { $this->out("A mailbox was set for this alias!\n"); - } - */ - # TODO: display if vacation is on? - /** - if( $handler->is_vacation_address($address) ) { + } + if( $result['goto_mailbox'] ) { + $this->out("The alias delivers to the mailbox!\n"); + } + if( $result['on_vacation'] ) { $this->out("This alias is a vacation address!"); - } - */ + } } return; diff --git a/users/edit-alias.php b/users/edit-alias.php index ff433997..156eac5d 100644 --- a/users/edit-alias.php +++ b/users/edit-alias.php @@ -17,15 +17,6 @@ * * Template File: users_edit-alias.tpl * - * Template Variables: - * - * tGotoArray - * tStoreAndForward - * - * Form POST \ GET Variables: - * - * fAddress - * fGoto */ require_once('../common.php'); @@ -40,9 +31,10 @@ $ah->init($USERID_USERNAME); $smarty->assign ('USERID_USERNAME', $USERID_USERNAME); -if ( ! $ah->get() ) die("Can't get alias details. Invalid alias?"); # this can only happen if a admin deleted the user since the user logged in -$tGotoArray = $ah->result(); -$tStoreAndForward = $ah->hasStoreAndForward(); +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") { diff --git a/xmlrpc.php b/xmlrpc.php index 5cb037c3..5da35374 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -142,8 +142,9 @@ class AliasProxy { $ah = new AliasHandler(); $ah->init($_SESSION['username']); /* I see no point in returning special addresses to the user. */ - $ah->get(false); - return $ah->result; + $ah->view(); + $result = $ah->result; + return $result['goto']; } /** @@ -168,7 +169,9 @@ class AliasProxy { public function hasStoreAndForward() { $ah = new AliasHandler(); $ah->init($_SESSION['username']); - return $ah->hasStoreAndForward(); + $ah->view(); + $result = $ah->result; + return $result['goto_mailbox'] == 1; } } /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */