Happy New Year
[squirrelmail.git] / plugins / change_password / backend / peardb.php
index e3d10413d9061b600d01f46f4e7827843a54a453..002b41021d25c49d170e1de0769dc41abf2176df 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * Change password PearDB backend
  *
- * @copyright © 2005-2006 The SquirrelMail Project Team
+ * @copyright 2005-2020 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -78,7 +78,7 @@ if ( isset($cpw_peardb) && is_array($cpw_peardb) && !empty($cpw_peardb) ) {
     if (isset($cpw_peardb['dsn']))
         $cpw_peardb_dsn=$cpw_peardb['dsn'];
     if (isset($cpw_peardb['connect_opts']))
-        $cpw_peardb_connect_opts=$cpw_peaddb['connect_opts'];
+        $cpw_peardb_connect_opts=$cpw_peardb['connect_opts'];
     if (isset($cpw_peardb['table']))
         $cpw_peardb_table=$cpw_peardb['table'];
     if (isset($cpw_peardb['uid_field']))
@@ -106,19 +106,19 @@ $squirrelmail_plugin_hooks['change_password_init']['peardb'] =
  * Checks if configuration is correct
  */
 function cpw_peardb_init() {
-    global $color, $cpw_peardb_detect, $cpw_peardb_dsn, $cpw_peardb_table;
+    global $oTemplate, $cpw_peardb_detect, $cpw_peardb_dsn, $cpw_peardb_table;
 
     if (! $cpw_peardb_detect) {
-        error_box(_("Plugin is unable to use PHP Pear DB libraries. PHP Pear includes must be available in your PHP include_path setting."),$color);
-        echo "</body></html>\n";
+        error_box(_("Plugin is unable to use PHP Pear DB libraries. PHP Pear includes must be available in your PHP include_path setting."));
+        $oTemplate->display('footer.tpl');
         exit();
     }
 
     // Test required settings
     if ((is_string($cpw_peardb_dsn) && trim($cpw_peardb_dsn)=='')
         || trim($cpw_peardb_table)=='' ) {
-        error_box(_("Required change password backend configuration options are missing."),$color);
-        echo "</body></html>\n";
+        error_box(_("Required change password backend configuration options are missing."));
+        $oTemplate->display('footer.tpl');
         exit();
     }
 }
@@ -152,16 +152,16 @@ function cpw_peardb_dochange($data) {
     // connect to database and make sure that table exists
     $cpw_db = DB::connect($cpw_peardb_dsn, $cpw_peardb_connect_opts);
     if (PEAR::isError($cpw_db)) {
-        array_push($msgs,sprintf(_("Connection error: %s"),htmlspecialchars($cpw_db->getMessage())));
+        array_push($msgs,sprintf(_("Connection error: %s"),sm_encode_html_special_chars($cpw_db->getMessage())));
         if ($cpw_peardb_debug)
-            array_push($msgs,htmlspecialchars($cpw_db->getuserinfo()));
+            array_push($msgs,sm_encode_html_special_chars($cpw_db->getuserinfo()));
         return $msgs;
     }
 
     // get table information
     $table_info = $cpw_db->tableinfo($cpw_peardb_table);
     if (PEAR::isError($table_info)) {
-        array_push($msgs,sprintf(_("Invalid table name: %s"),htmlspecialchars($cpw_peardb_table)));
+        array_push($msgs,sprintf(_("Invalid table name: %s"),sm_encode_html_special_chars($cpw_peardb_table)));
         $cpw_db->disconnect();
         return $msgs;
     }
@@ -210,7 +210,7 @@ function cpw_peardb_dochange($data) {
           '');
     $cpw_res=$cpw_db->query($query);
     if (PEAR::isError($cpw_res)) {
-        array_push($msgs,sprintf(_("Query failed: %s"),htmlspecialchars($cpw_res->getMessage())));
+        array_push($msgs,sprintf(_("Query failed: %s"),sm_encode_html_special_chars($cpw_res->getMessage())));
         $cpw_db->disconnect();
         return $msgs;
     }
@@ -284,7 +284,7 @@ function cpw_peardb_dochange($data) {
 
     // check for update error
     if (PEAR::isError($cpw_res)) {
-        array_push($msgs,sprintf(_("Unable to set new password: %s"),htmlspecialchars($cpw_res->getMessage())));
+        array_push($msgs,sprintf(_("Unable to set new password: %s"),sm_encode_html_special_chars($cpw_res->getMessage())));
     }
 
     // close database connection
@@ -427,8 +427,7 @@ function cpw_peardb_passwd_hash($password,$crypto,&$msgs,$forced_salt='') {
         $ret = $password;
         break;
     default:
-        array_push($msgs,sprintf(_("Unsupported crypto: %s"),htmlspecialchars($crypto)));
+        array_push($msgs,sprintf(_("Unsupported crypto: %s"),sm_encode_html_special_chars($crypto)));
     }
     return $ret;
 }
-?>
\ No newline at end of file