diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-02-24 10:17:19 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-02-24 10:17:19 +0000 |
| commit | 121ae23a83555b34c28b9967113a0cdf1755387a (patch) | |
| tree | 8fe7044c54773f041b2111808ff11e973e801a90 /plugins/password/drivers/hmail.php | |
| parent | 85fefe3e33be4824377161c4587ec4141bfc57f4 (diff) | |
- Fixed drivers namespace issues
git-svn-id: https://svn.roundcube.net/trunk@5902 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/password/drivers/hmail.php')
| -rw-r--r-- | plugins/password/drivers/hmail.php | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php index 39a87ab34..104c851ae 100644 --- a/plugins/password/drivers/hmail.php +++ b/plugins/password/drivers/hmail.php @@ -3,59 +3,61 @@ /** * hMailserver password driver * - * @version 1.3 - 05.11.2010 + * @version 2.0 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net> * */ -function password_save($curpass, $passwd) +class rcube_hmail_password { - $rcmail = rcmail::get_instance(); + public function save($curpass, $passwd) + { + $rcmail = rcmail::get_instance(); - if ($curpass == '' || $passwd == '') - return PASSWORD_ERROR; + if ($curpass == '' || $passwd == '') { + return PASSWORD_ERROR; + } - try { - $remote = $rcmail->config->get('hmailserver_remote_dcom', false); - if ($remote) - $obApp = new COM("hMailServer.Application", $rcmail->config->get('hmailserver_server')); - else - $obApp = new COM("hMailServer.Application"); - } - catch (Exception $e) { - write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); - write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); - return PASSWORD_ERROR; - } + try { + $remote = $rcmail->config->get('hmailserver_remote_dcom', false); + if ($remote) + $obApp = new COM("hMailServer.Application", $rcmail->config->get('hmailserver_server')); + else + $obApp = new COM("hMailServer.Application"); + } + catch (Exception $e) { + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); + return PASSWORD_ERROR; + } - $username = $rcmail->user->data['username']; - if (strstr($username,'@')){ - $temparr = explode('@', $username); - $domain = $temparr[1]; - } - else { - $domain = $rcmail->config->get('username_domain',false); - if (!$domain) { - write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); - write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); - return PASSWORD_ERROR; - } - $username = $username . "@" . $domain; - } + $username = $rcmail->user->data['username']; + if (strstr($username,'@')){ + $temparr = explode('@', $username); + $domain = $temparr[1]; + } + else { + $domain = $rcmail->config->get('username_domain',false); + if (!$domain) { + write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); + write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); + return PASSWORD_ERROR; + } + $username = $username . "@" . $domain; + } - $obApp->Authenticate($username, $curpass); - try { - $obDomain = $obApp->Domains->ItemByName($domain); - $obAccount = $obDomain->Accounts->ItemByAddress($username); - $obAccount->Password = $passwd; - $obAccount->Save(); - return PASSWORD_SUCCESS; - } - catch (Exception $e) { - write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); - write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); - return PASSWORD_ERROR; + $obApp->Authenticate($username, $curpass); + try { + $obDomain = $obApp->Domains->ItemByName($domain); + $obAccount = $obDomain->Accounts->ItemByAddress($username); + $obAccount->Password = $passwd; + $obAccount->Save(); + return PASSWORD_SUCCESS; + } + catch (Exception $e) { + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); + return PASSWORD_ERROR; + } } } - -?> |
