X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fchange_password%2Fbackend%2Fpoppassd.php;h=1112ccc7c0341c2979771d81815bd9521e517b32;hp=d4ab89022852fc3fc216a0d5c3ce3b2ddfc87752;hb=4d2ff38f2b400d95609b7fbe45631933d9e82599;hpb=30a4bda798a44ea91bb4ce6d2f2079d7605d09ff diff --git a/plugins/change_password/backend/poppassd.php b/plugins/change_password/backend/poppassd.php index d4ab8902..1112ccc7 100644 --- a/plugins/change_password/backend/poppassd.php +++ b/plugins/change_password/backend/poppassd.php @@ -1,9 +1,12 @@ + * + * @author Seth Randall + * @version $Id$ + * @package plugins + * @subpackage change_password */ /** @@ -18,21 +21,14 @@ global $poppassd_server; $poppassd_server = ''; +/* get overrides from config.php */ +if (isset($cpw_poppassd['server'])) $poppassd_server=$cpw_poppassd['server']; + /** * Define here the name of your password changing function. */ global $squirrelmail_plugin_hooks; $squirrelmail_plugin_hooks['change_password_dochange']['poppassd'] = 'cpw_poppassd_dochange'; -$squirrelmail_plugin_hooks['change_password_init']['template'] = 'cpw_poppassd_init'; - - -/** - * Use this function to do any backend-specific initialization, - * e.g. checking requirements, before the password change form - * is displayed to the user. - */ -function cpw_poppassd_init() { -} /** * This is the function that is specific to your backend. It takes @@ -44,7 +40,7 @@ function cpw_poppassd_init() { * CPW_CURRENT_NOMATCH -> "Your current password is not correct." * CPW_INVALID_PW -> "Your new password contains invalid characters." * - * @param array data The username/currentpw/newpw data. + * @param array data The username/currentpw/newpw data. * @return array Array of error messages. */ function cpw_poppassd_dochange($data) { @@ -88,8 +84,15 @@ function cpw_poppassd_go($username, $old_pw, $new_pw, $debug = 0) { global $poppassd_server; global $imapServerAddress; + /** @ignore */ + if (!defined('SM_PATH')) define('SM_PATH','../../../'); + /** sqimap_get_user_server() function */ + include_once(SM_PATH . 'functions/imap_general.php'); + if($poppassd_server == '') { - $poppassd_server = $imapServerAddress; + // if poppassd address is not set, use imap server's address + // make sure that setting contains address and not mapping + $poppassd_server = sqimap_get_user_server($imapServerAddress,$username); } $messages = array(); @@ -99,7 +102,7 @@ function cpw_poppassd_go($username, $old_pw, $new_pw, $debug = 0) { } $pop_socket = fsockopen($poppassd_server, 106, $errno, $errstr); if (!$pop_socket) { - $messages[] = _("ERROR:") . "$errstr ($errno)"; + $messages[] = _("ERROR") . ': ' . "$errstr ($errno)"; return $messages; } @@ -133,4 +136,4 @@ function cpw_poppassd_go($username, $old_pw, $new_pw, $debug = 0) { return $messages; } -?> +?> \ No newline at end of file