فهرست منبع

Add a new hook to the plugin to enable backends to perform any
specific checks before starting. Fix a bug in the Location:
redirect which redirected the user back to the plugin, which
should have been the general options page.

Thijs Kinkhorst 22 سال پیش
والد
کامیت
3a1bee740d
3فایلهای تغییر یافته به همراه16 افزوده شده و 1 حذف شده
  1. 14 0
      plugins/change_password/backend/template.php
  2. 1 1
      plugins/change_password/functions.php
  3. 1 0
      plugins/change_password/options.php

+ 14 - 0
plugins/change_password/backend/template.php

@@ -19,6 +19,20 @@
 global $squirrelmail_plugin_hooks;
 $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()
+{
+
+}
+
 
 /**
  * This is the function that is specific to your backend. It takes

+ 1 - 1
plugins/change_password/functions.php

@@ -90,6 +90,6 @@ function cpw_do_change()
 
     /* make sure we write the session data before we redirect */
     session_write_close();
-    header('Location: '.get_location(). '/options.php?optmode=submit&plugin_change_password=1');
+    header('Location: '.SM_PATH. 'src/options.php?optmode=submit&plugin_change_password=1');
     exit;
 }

+ 1 - 0
plugins/change_password/options.php

@@ -19,6 +19,7 @@ if(sqgetGlobalVar('cpw_go', $cpw_go, SQ_POST)) {
 
 displayPageHeader($color, 'None');
 
+do_hook('change_password_init');
 ?>
 
 <br />