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/xmail.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/xmail.php')
| -rw-r--r-- | plugins/password/drivers/xmail.php | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/plugins/password/drivers/xmail.php b/plugins/password/drivers/xmail.php index c7f426158..33a49ffe3 100644 --- a/plugins/password/drivers/xmail.php +++ b/plugins/password/drivers/xmail.php @@ -4,7 +4,7 @@ * * Driver for XMail password * - * @version 1.0 + * @version 2.0 * @author Helio Cavichiolo Jr <helio@hcsistemas.com.br> * * Setup xmail_host, xmail_user, xmail_pass and xmail_port into @@ -17,38 +17,43 @@ * */ -function password_save($currpass, $newpass) +class rcube_xmail_password { - $rcmail = rcmail::get_instance(); - list($user,$domain) = explode('@', $_SESSION['username']); + function save($currpass, $newpass) + { + $rcmail = rcmail::get_instance(); + list($user,$domain) = explode('@', $_SESSION['username']); - $xmail = new XMail; + $xmail = new XMail; - $xmail->hostname = $rcmail->config->get('xmail_host'); - $xmail->username = $rcmail->config->get('xmail_user'); - $xmail->password = $rcmail->config->get('xmail_pass'); - $xmail->port = $rcmail->config->get('xmail_port'); + $xmail->hostname = $rcmail->config->get('xmail_host'); + $xmail->username = $rcmail->config->get('xmail_user'); + $xmail->password = $rcmail->config->get('xmail_pass'); + $xmail->port = $rcmail->config->get('xmail_port'); - if (!$xmail->connect()) { - raise_error(array( - 'code' => 600, - 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, - 'message' => "Password plugin: Unable to connect to mail server" - ), true, false); - return PASSWORD_CONNECT_ERROR; - } else if (!$xmail->send("userpasswd\t".$domain."\t".$user."\t".$newpass."\n")) { - $xmail->close(); - raise_error(array( - 'code' => 600, - 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, - 'message' => "Password plugin: Unable to change password" - ), true, false); - return PASSWORD_ERROR; - } else { - $xmail->close(); - return PASSWORD_SUCCESS; + if (!$xmail->connect()) { + raise_error(array( + 'code' => 600, + 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Password plugin: Unable to connect to mail server" + ), true, false); + return PASSWORD_CONNECT_ERROR; + } + else if (!$xmail->send("userpasswd\t".$domain."\t".$user."\t".$newpass."\n")) { + $xmail->close(); + raise_error(array( + 'code' => 600, + 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Password plugin: Unable to change password" + ), true, false); + return PASSWORD_ERROR; + } + else { + $xmail->close(); + return PASSWORD_SUCCESS; + } } } |
