From b89b94cf8346f1c250c11648e72cded015410998 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 28 Mar 2011 23:15:11 +0000 Subject: [PATCH] Renamed UserHandler to MailboxHandler to make clear it's about mailboxes (as discussed with GingerDog on IRC yesterday). Also renamed user to mailbox in the CLI. - renamed model/UserHandler.php to MailboxHandler.php - renamed scripts/shells/user.php to mailbox.php - replaced UserHandler / user with MailboxHandler / mailbox in various files - unrelated cleanup: deleted obsolete scripts/models-ext directory git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1019 a1433add-5e2c-0410-b055-b7f2511e0802 --- model/{UserHandler.php => MailboxHandler.php} | 4 +- scripts/postfixadmin-cli.php | 10 ++--- scripts/shells/alias.php | 4 +- scripts/shells/{user.php => mailbox.php} | 38 +++++++++---------- users/login.php | 2 +- users/password.php | 4 +- xmlrpc.php | 6 +-- 7 files changed, 34 insertions(+), 34 deletions(-) rename model/{UserHandler.php => MailboxHandler.php} (98%) rename scripts/shells/{user.php => mailbox.php} (91%) diff --git a/model/UserHandler.php b/model/MailboxHandler.php similarity index 98% rename from model/UserHandler.php rename to model/MailboxHandler.php index 5a8e3eb7..87c47443 100644 --- a/model/UserHandler.php +++ b/model/MailboxHandler.php @@ -4,7 +4,7 @@ /** * Simple class to represent a user. */ -class UserHandler { +class MailboxHandler { protected $username = null; @@ -15,7 +15,7 @@ class UserHandler { } public function change_pass($old_password, $new_password) { - error_log('UserHandler->change_pass is deprecated. Please use UserHandler->change_pw!'); + error_log('MailboxHandler->change_pass is deprecated. Please use MailboxHandler->change_pw!'); return $this->change_pw($new_password, $old_password); } diff --git a/scripts/postfixadmin-cli.php b/scripts/postfixadmin-cli.php index 76b1d89e..03879eee 100644 --- a/scripts/postfixadmin-cli.php +++ b/scripts/postfixadmin-cli.php @@ -533,11 +533,11 @@ class PostfixAdmin { return array( - 'user' => array( - 'add'=> 'Adds a new user with mailbox.', - 'update'=> 'Updates a user.', - 'delete' => 'Deletes a user.', - 'pw' => 'Changes the PW for a user.', + 'mailbox' => array( + 'add'=> 'Adds a new mailbox.', + 'update'=> 'Updates a mailbox.', + 'delete' => 'Deletes a mailbox.', + 'pw' => 'Changes the PW for a mailbox.', ), 'alias' => array( 'add' => 'Adds a new alias.', diff --git a/scripts/shells/alias.php b/scripts/shells/alias.php index f6a5c112..cc486e4c 100644 --- a/scripts/shells/alias.php +++ b/scripts/shells/alias.php @@ -222,8 +222,8 @@ class DeleteTask extends Shell { */ function __handle($address) { -### TODO: don't use UserHandler, instead add delete function to AliasHandler (if not already there) -### using UserHandler for deleting aliases is like taking a sledgehammer to crack a nut +### TODO: don't use MailboxHandler, instead add delete function to AliasHandler (if not already there) +### using MailboxHandler for deleting aliases is like taking a sledgehammer to crack a nut ### (and will probably cause some error messages that I added today ;-) ### Implemented check it please! diff --git a/scripts/shells/user.php b/scripts/shells/mailbox.php similarity index 91% rename from scripts/shells/user.php rename to scripts/shells/mailbox.php index bc4adb15..2afa92fa 100644 --- a/scripts/shells/user.php +++ b/scripts/shells/mailbox.php @@ -1,7 +1,7 @@ [
] [] [-m ]\n"; + $head = "Usage: postfixadmin-cli mailbox [
] [] [-m ]\n"; $head .= "-----------------------------------------------\n"; $head .= "Parameters:\n\n"; $commands = array( 'task' => "\t\n" . "\t\tAvailable values:\n\n". - "\t\t".sprintf("%-20s %s", "view: ", "View an existing user.")."\n". - "\t\t".sprintf("%-20s %s", "add: ", "Adds a new user with mailbox.")."\n". - "\t\t".sprintf("%-20s %s", "update: ", "Updates a user.")."\n". - "\t\t".sprintf("%-20s %s", "delete: ", "Deletes a user")."\n". - "\t\t".sprintf("%-20s %s", "password: ", "Changes the PW for a user.")."\n", + "\t\t".sprintf("%-20s %s", "view: ", "View an existing mailbox.")."\n". + "\t\t".sprintf("%-20s %s", "add: ", "Adds a new mailbox.")."\n". + "\t\t".sprintf("%-20s %s", "update: ", "Updates a mailbox.")."\n". + "\t\t".sprintf("%-20s %s", "delete: ", "Deletes a mailbox")."\n". + "\t\t".sprintf("%-20s %s", "password: ", "Changes the PW for a mailbox.")."\n", 'address' => "\t[
]\n" . "\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n", ); @@ -138,7 +138,7 @@ class AddTask extends Shell { $pw = $password; } - $handler = new UserHandler($address); + $handler = new MailboxHandler($address); $return = $handler->add($pw, $name, $quota, true, true ); #CHECK! if ( !empty($this->params['q']) ) { @@ -175,7 +175,7 @@ if ( !empty($this->params['q']) ) { */ function help() { $this->hr(); - $this->out("Usage: postfixadmin-cli user add
[] [-g]"); + $this->out("Usage: postfixadmin-cli mailbox add
[] [-g]"); $this->hr(); $this->out('Commands:'); $this->out("\n\tadd\n\t\tAdds mailbox in interactive mode."); @@ -217,7 +217,7 @@ class UpdateTask extends Shell { function help() { $this->hr(); $this->out("Not Implemented yet! If you want to change a password use the password command."); - /*$this->out("Usage: postfixadmin-cli user update "); + /*$this->out("Usage: postfixadmin-cli mailbox update "); $this->hr(); $this->out('Commands:'); $this->out("\n\tmodel\n\t\tbakes model in interactive mode."); @@ -274,7 +274,7 @@ class DeleteTask extends Shell { function __handle($address) { - $handler = new UserHandler($address); + $handler = new MailboxHandler($address); $status = $handler->delete(); if ( ! $status ) { $this->error("Error:", join("\n", $handler->errormsg)); @@ -292,7 +292,7 @@ class DeleteTask extends Shell { */ function help() { $this->hr(); - $this->out("Usage: postfixadmin-cli user model "); + $this->out("Usage: postfixadmin-cli mailbox model "); $this->hr(); $this->out('Commands:'); $this->out("\n\tdelete\n\t\tdeletes mailbox in interactive mode."); @@ -391,7 +391,7 @@ class PasswordTask extends Shell { $password = generate_password(); } if ($password != NULL) { - $handler = new UserHandler($address); + $handler = new MailboxHandler($address); if ( ! $handler->change_pw($password, NULL, false) ){ $this->error("Change Password",join("\n", $handler->errormsg)); @@ -415,7 +415,7 @@ class PasswordTask extends Shell { function help() { $this->out(""); $this->hr(); - $this->out("Usage: postfixadmin-cli user password
[] [-g]"); + $this->out("Usage: postfixadmin-cli mailbox password
[] [-g]"); $this->hr(); $this->out('Commands:'); $this->out("\n\tpassword\n\t\tchanges the password in interactive mode."); @@ -466,9 +466,9 @@ class ViewTask extends Shell { function __handle($address) { - $handler = new UserHandler($address); + $handler = new MailboxHandler($address); if ( ! $handler->view() ) { - $this->error("Not Found!", "The user you have searched could not be found."); + $this->error("Not Found!", "The mailbox you have searched could not be found."); } # TODO: offer alternative output formats (based on parameter) # TODO: whitespace fix - 8 lines below @@ -492,11 +492,11 @@ class ViewTask extends Shell { function help() { $this->out(""); $this->hr(); - $this->out("Usage: postfixadmin-cli user view
"); + $this->out("Usage: postfixadmin-cli mailbox view
"); $this->hr(); $this->out('Commands:'); - $this->out("\n\tview\n\t\tView user. Select address in interactive mode."); - $this->out("\n\tview
\n\t\tView user with address
"); + $this->out("\n\tview\n\t\tView mailbox. Select address in interactive mode."); + $this->out("\n\tview
\n\t\tView mailbox with address
"); $this->out(""); $this->_stop(); } diff --git a/users/login.php b/users/login.php index e9354950..e90f4012 100644 --- a/users/login.php +++ b/users/login.php @@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") $fUsername = escape_string ($_POST['fUsername']); $fPassword = escape_string ($_POST['fPassword']); - if(UserHandler::login($_POST['fUsername'], $_POST['fPassword'])) { + if(MailboxHandler::login($_POST['fUsername'], $_POST['fPassword'])) { session_regenerate_id(); $_SESSION['sessid'] = array(); $_SESSION['sessid']['roles'] = array(); diff --git a/users/password.php b/users/password.php index 3c8eb44e..cbb62e48 100644 --- a/users/password.php +++ b/users/password.php @@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") $error += 1; flash_error(sprintf($PALANG['pPasswordTooShort'], $CONF['min_password_length'])); } - if(!UserHandler::login($username, $fPassword_current)) { + if(!MailboxHandler::login($username, $fPassword_current)) { $error += 1; $pPassword_password_current_text = $PALANG['pPassword_password_current_text_error']; } @@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") if ($error == 0) { - $uh = new UserHandler($username); + $uh = new MailboxHandler($username); if($uh->change_pw($fPassword, $fPassword_current) ) { flash_info($PALANG['pPassword_result_success']); header("Location: main.php"); diff --git a/xmlrpc.php b/xmlrpc.php index 56ea6733..669e01d7 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -45,7 +45,7 @@ $server = new Zend_XmlRpc_Server(); * @return boolean true on success, else false. */ function login($username, $password) { - if(UserHandler::login($username, $password)) { + if(MailboxHandler::login($username, $password)) { session_regenerate_id(); $_SESSION['authenticated'] = true; $_SESSION['username'] = $username; @@ -73,7 +73,7 @@ class UserProxy { * @return boolean true on success */ public function changePassword($old_password, $new_password) { - $uh = new UserHandler($_SESSION['username']); + $uh = new MailboxHandler($_SESSION['username']); return $uh->change_pw($new_password, $old_password); } @@ -83,7 +83,7 @@ class UserProxy { * @return boolean true if successful. */ public function login($username, $password) { - $uh = new UserHandler($_SESSION['username']); + $uh = new MailboxHandler($_SESSION['username']); return $uh->login($username, $password); } }