model/AliasHandler.php:

changed behaviour of get()

- get() now returns only true (success) / false (failure) instead of
  the alias list
  (result of partly merging in scripts/models-ext/AliasHandler.php)
- new method result() to get the real result (alias targets)
- added TODO on if(sizeof($addresses) == 0) - this should never happen

model/VacationHandler.php:
- updated for new AliasHandler bevaviour

xmlrpc.php:
- updated for new AliasHandler bevaviour
- switched from obsolete change_pass to change_pw method


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@912 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 14 years ago
parent 5381f96426
commit 42573d3e4e

@ -45,9 +45,10 @@ class AliasHandler {
}
}
$list = $new_list;
return $list;
$this->return = $list;
return true;
}
return array();
return false;
}
/**
@ -141,7 +142,8 @@ class AliasHandler {
$goto = escape_string(implode(',', $addresses));
$table_alias = table_by_key('alias');
if(sizeof($addresses) == 0) {
$sql = "DELETE FROM $table_alias WHERE address = '$username'";
$sql = "DELETE FROM $table_alias WHERE address = '$username'"; # TODO: should never happen
error_log("Alias set to empty / deleted: $username"); # TODO: more/better error handling - maybe just return false?
}
if($this->hasAliasRecord() == false) {
$true = db_get_boolean(True);
@ -184,4 +186,13 @@ class AliasHandler {
}
return false;
}
}
/**
* @return return value of previously called method
*/
public function result() {
return $this->return;
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */

@ -13,7 +13,8 @@ class VacationHandler {
*/
function remove() {
$ah = new AliasHandler($this->username);
$aliases = $ah->get(true); // fetch all.
$result = $ah->get(true); // fetch all # TODO check $result, error handling
$aliases = $ah->result;
$new_aliases = array();
$table_vacation = table_by_key('vacation');
$table_vacation_notification = table_by_key('vacation_notification');
@ -130,3 +131,4 @@ class VacationHandler {
return $vacation_goto;
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */

@ -74,7 +74,7 @@ class UserProxy {
*/
public function changePassword($old_password, $new_password) {
$uh = new UserHandler($_SESSION['username']);
return $uh->change_pass($old_password, $new_password);
return $uh->change_pw($new_password, $old_password);
}
/**
@ -141,7 +141,8 @@ class AliasProxy {
public function get() {
$ah = new AliasHandler($_SESSION['username']);
/* I see no point in returning special addresses to the user. */
return $ah->get(false);
$ah->get(false);
return $ah->result;
}
/**
@ -167,3 +168,4 @@ class AliasProxy {
return $ah->hasStoreAndForward();
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */

Loading…
Cancel
Save