Add ability to control the display of the "Check Spelling" button. Allows administrat...
[squirrelmail.git] / plugins / change_password / backend / template.php
index 2669fc2248ad0200887070b0bd545d9d745d9b51..6aa85e0eb8b9e7e25aaadd23dcd9b8bc827f5adc 100644 (file)
@@ -1,11 +1,20 @@
 <?php
-/*
- This is a template for a password changing mechanism. Currently,
- this contains two parts: the first is to register your function
- in the squirrelmail_plugin_hooks global, and the second is
- the function that does the actual changing.
 
- Replace the word template everywhere with a name for your backend.
+/**
+ * Change password backend template
+ *
+ * This is a template for a password changing mechanism. Currently,
+ * this contains two parts: the first is to register your function
+ * in the squirrelmail_plugin_hooks global, and the second is
+ * the function that does the actual changing.
+ *
+ * Replace the word template everywhere with a name for your backend.
+ *
+ * @copyright 2003-2017 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package plugins
+ * @subpackage change_password
  */
 
 /**
  * Define here the name of your password changing function.
  */
 global $squirrelmail_plugin_hooks;
-$squirrelmail_plugin_hooks['change_password_dochange']['template'] = 
-       'cpw_template_dochange';
+$squirrelmail_plugin_hooks['change_password_dochange']['template'] =
+        'cpw_template_dochange';
+$squirrelmail_plugin_hooks['change_password_init']['template'] =
+        'cpw_template_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_template_init()
+{
+    global $oTemplate;
+
+    // plugin is not configured. Handle error gracefully.
+    error_box(_("No valid backend defined."));
+    // close html and stop script execution
+    $oTemplate->display('footer.tpl');
+    exit();
+}
+
 
 /**
  * This is the function that is specific to your backend. It takes
@@ -30,7 +59,7 @@ $squirrelmail_plugin_hooks['change_password_dochange']['template'] =
  * 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_template_dochange($data)
@@ -48,4 +77,4 @@ function cpw_template_dochange($data)
     user_error('No valid backend defined: this is just a template', E_USER_ERROR);
 
     return $msgs;
-}
+}
\ No newline at end of file