making sure that imap server variable does not contain mapping.
[squirrelmail.git] / plugins / change_password / backend / poppassd.php
index 7e3b6842123cea6374aa5bd1e4a438d96353789a..1112ccc7c0341c2979771d81815bd9521e517b32 100644 (file)
@@ -21,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
@@ -91,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();