From b6411921409c63d6e5381e8f13136f2aab3aa251 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Aug 2009 14:59:15 -0600 Subject: [PATCH] Move authCredentials() into Horde_Registry_Application --- imp/lib/Api.php | 38 -------------------------------------- imp/lib/Application.php | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/imp/lib/Api.php b/imp/lib/Api.php index cfc2911b9..f90dd63c1 100644 --- a/imp/lib/Api.php +++ b/imp/lib/Api.php @@ -45,44 +45,6 @@ class IMP_Api extends Horde_Registry_Api ); } - /** - * Returns a list of authentication credentials, i.e. server settings that - * can be specified by the user on the login screen. - * - * @return array A hash with credentials, suited for the preferences - * interface. - */ - public function authCredentials() - { - $app_name = $GLOBALS['registry']->get('name'); - - $servers = IMP_Imap::loadServerConfig(); - $server_list = array(); - foreach ($servers as $key => $val) { - $server_list[$key] = $val['name']; - } - reset($server_list); - - $credentials = array( - 'username' => array( - 'desc' => sprintf(_("%s for %s"), _("Username"), $app_name), - 'type' => 'text' - ), - 'password' => array( - 'desc' => sprintf(_("%s for %s"), _("Password"), $app_name), - 'type' => 'password' - ), - 'server' => array( - 'desc' => sprintf(_("%s for %s"), _("Server"), $app_name), - 'type' => 'enum', - 'enum' => $server_list, - 'value' => key($server_list) - ) - ); - - return $credentials; - } - /* IMP-specific functions. */ /** diff --git a/imp/lib/Application.php b/imp/lib/Application.php index ad9887d6b..ef3842c0c 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -746,4 +746,44 @@ class IMP_Application extends Horde_Registry_Application $GLOBALS['imp_search']->initialize(true); } + /* Horde_Prefs_Credentials:: methods. */ + + /** + * Returns a list of authentication credentials, i.e. server settings that + * can be specified by the user on the login screen. + * + * @return array A hash with credentials, suited for the preferences + * interface. + */ + public function authCredentials() + { + $app_name = $GLOBALS['registry']->get('name'); + + $servers = IMP_Imap::loadServerConfig(); + $server_list = array(); + foreach ($servers as $key => $val) { + $server_list[$key] = $val['name']; + } + reset($server_list); + + $credentials = array( + 'username' => array( + 'desc' => sprintf(_("%s for %s"), _("Username"), $app_name), + 'type' => 'text' + ), + 'password' => array( + 'desc' => sprintf(_("%s for %s"), _("Password"), $app_name), + 'type' => 'password' + ), + 'server' => array( + 'desc' => sprintf(_("%s for %s"), _("Server"), $app_name), + 'type' => 'enum', + 'enum' => $server_list, + 'value' => key($server_list) + ) + ); + + return $credentials; + } + } -- 2.11.0