phpDocumentor updates
[squirrelmail.git] / plugins / change_password / backend / template.php
index 73bd20f2408c222bade1952e2204e68a8a823657..776d4f2061204aed72a5835305e5d461152fedd7 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 &copy; 2003-2005 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_init']['template'] = 
-       'cpw_template_init';
+$squirrelmail_plugin_hooks['change_password_dochange']['template'] =
+        'cpw_template_dochange';
+$squirrelmail_plugin_hooks['change_password_init']['template'] =
+        'cpw_template_init';
 
 
 /**
@@ -30,7 +39,24 @@ $squirrelmail_plugin_hooks['change_password_init']['template'] =
  */
 function cpw_template_init()
 {
+    global $color;
 
+    /**
+     * If SM_PATH isn't defined, define it.  Required to include files.
+     * @ignore
+     */
+    if (!defined('SM_PATH'))  {
+        define('SM_PATH','../../../');
+    }
+
+    // load error_box() function
+    include_once(SM_PATH . 'functions/display_messages.php');
+
+    // plugin is not configured. Handle error gracefully.
+    error_box(_("No valid backend defined."),$color);
+    // close html and stop script execution
+    echo "</body></html>\n";
+    exit();
 }
 
 
@@ -44,7 +70,7 @@ function cpw_template_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_template_dochange($data)
@@ -62,4 +88,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