adding missing identity hooks
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 3 Sep 2005 06:21:19 +0000 (06:21 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 3 Sep 2005 06:21:19 +0000 (06:21 +0000)
removing duplicate generic_header hook call

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10029 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
doc/Development/plugin.txt
functions/identity.php
src/right_main.php

index de47fe31e23e44d77609a134e753a4962e3ac809..2280bab87c758c58cc368a0d94a306fe8a2dd29b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -435,6 +435,9 @@ Version 1.5.1 -- CVS
     place form elements before login button (#1245070).
   - Forwarding broken when not using compose in new window (#1222436).
   - Drop data/ dir from distributed tarball.
     place form elements before login button (#1245070).
   - Forwarding broken when not using compose in new window (#1222436).
   - Drop data/ dir from distributed tarball.
+  - Readded options_identity_process and options_identity_renumber hooks
+    broken by CAN-2005-2095 fixes.
+  - Removed duplicate generic_header hook call in src/right_main.php (#1269189).
 
 Version 1.5.0 - 2 February 2004
 -------------------------------
 
 Version 1.5.0 - 2 February 2004
 -------------------------------
index c2dcb2f4df65ae6e47a8f01a2ee210155f6f381f..1c1b4af11e0553f5c88a0af5e5b7d1606d299a56 100644 (file)
@@ -282,6 +282,8 @@ but may be out of date soon thereafter.  You never know.  ;-)
   error_box                      functions/display_messages.php  concat_hook
   get_pref_override              functions/file_prefs.php        hook_func
   get_pref                       functions/file_prefs.php        hook_func
   error_box                      functions/display_messages.php  concat_hook
   get_pref_override              functions/file_prefs.php        hook_func
   get_pref                       functions/file_prefs.php        hook_func
+& options_identities_process     functions/identity.php          do_hook
+&% options_identities_renumber   functions/identity.php          do_hook
   special_mailbox                functions/imap_mailbox.php      hook_func
 % rename_or_delete_folder        functions/imap_mailbox.php      hook_func
   mailbox_index_before           functions/mailbox_display.php   do_hook
   special_mailbox                functions/imap_mailbox.php      hook_func
 % rename_or_delete_folder        functions/imap_mailbox.php      hook_func
   mailbox_index_before           functions/mailbox_display.php   do_hook
@@ -340,9 +342,7 @@ but may be out of date soon thereafter.  You never know.  ;-)
 * options_folder_bottom          src/options.php                 do_hook
 * options_order_bottom           src/options.php                 do_hook
 * options_highlight_bottom       src/options_highlight.php       do_hook
 * options_folder_bottom          src/options.php                 do_hook
 * options_order_bottom           src/options.php                 do_hook
 * options_highlight_bottom       src/options_highlight.php       do_hook
-& options_identities_process     src/options_identities.php      do_hook
 & options_identities_top         src/options_identities.php      do_hook
 & options_identities_top         src/options_identities.php      do_hook
-&% options_identities_renumber   src/options_identities.php      do_hook
 & options_identities_table       src/options_identities.php      concat_hook
 & options_identities_buttons     src/options_identities.php      concat_hook
   message_body                   src/printer_friendly_bottom.php do_hook
 & options_identities_table       src/options_identities.php      concat_hook
 & options_identities_buttons     src/options_identities.php      concat_hook
   message_body                   src/printer_friendly_bottom.php do_hook
@@ -354,7 +354,6 @@ but may be out of date soon thereafter.  You never know.  ;-)
   read_body_bottom               src/read_body.php               do_hook
   login_before                   src/redirect.php                do_hook
   login_verified                 src/redirect.php                do_hook
   read_body_bottom               src/read_body.php               do_hook
   login_before                   src/redirect.php                do_hook
   login_verified                 src/redirect.php                do_hook
-  generic_header                 src/right_main.php              do_hook
   right_main_after_header        src/right_main.php              do_hook
   right_main_bottom              src/right_main.php              do_hook
   search_before_form             src/search.php                  do_hook
   right_main_after_header        src/right_main.php              do_hook
   right_main_bottom              src/right_main.php              do_hook
   search_before_form             src/search.php                  do_hook
@@ -394,6 +393,7 @@ options_identities_process
    for each identity or catch any custom submit buttons that you may
    have added to the identities page.  The arguments to this hook are:
 
    for each identity or catch any custom submit buttons that you may
    have added to the identities page.  The arguments to this hook are:
 
+    (SquirrelMail 1.4.4 or older and 1.5.0)
       [0] = hook name (always "options_identities_process")
       [1] = should I run the SaveUpdateFunction() (alterable)
 
       [0] = hook name (always "options_identities_process")
       [1] = should I run the SaveUpdateFunction() (alterable)
 
@@ -401,6 +401,15 @@ options_identities_process
    trigger SaveUpdateFunction() after the hook is finished - by default,
    it will not be called.
 
    trigger SaveUpdateFunction() after the hook is finished - by default,
    it will not be called.
 
+    (SquirrelMail 1.4.6+ or 1.5.1+)
+      [0] = hook name (always "options_identities_process")
+      [1] = action (hook is used only in 'update' action and any custom 
+            action added to form with option_identities_table and 
+            option_identities_buttons hooks)
+      [2] = processed identity number
+
+   Hook is not available in SquirrelMail 1.4.5.
+
 options_identities_renumber
 
    This hook is called when one of the identities is being renumbered,
 options_identities_renumber
 
    This hook is called when one of the identities is being renumbered,
@@ -413,6 +422,9 @@ options_identities_renumber
       [1] = being renumbered from ('default' or 1 through (# idents) - 1)
       [2] = being renumbered to ('default' or 1 through (# idents) - 1)
 
       [1] = being renumbered from ('default' or 1 through (# idents) - 1)
       [2] = being renumbered to ('default' or 1 through (# idents) - 1)
 
+   Hook is not available in SquirrelMail 1.4.5. Renumbering order differs
+   in 1.4.5+ and 1.5.1+.
+
 options_identities_table
 
    This hook allows you to insert additional rows into the table that
 options_identities_table
 
    This hook allows you to insert additional rows into the table that
@@ -454,6 +466,16 @@ options_identities_buttons
               . '" value="Press Me" />';
       }
 
               . '" value="Press Me" />';
       }
 
+   Input element should use 'smaction[action_name][identity_no]' value in 
+   'name' attribute, if you want to be process your button actions in
+   SquirrelMail 1.4.6+ and 1.5.1+ options_identity_process hook.
+
+
+See sample implementation of identity hooks in SquirrelMail demo plugin.
+
+  cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/squirrelmail \
+    co plugins/demo
+
 
 (^) Attachment Hooks
 --------------------
 
 (^) Attachment Hooks
 --------------------
index e4fc93255db4acb20b878039f0ce3868f2fec8f1..ed3d8973285d540b7855daa3c287e4068d028c6f 100644 (file)
@@ -142,6 +142,10 @@ function sqfixidentities( $identities, $id, $action ) {
 
                 if ($key == $id) {
                     $fixed[0] = $ident;
 
                 if ($key == $id) {
                     $fixed[0] = $ident;
+
+                    // inform plugins about renumbering of ids
+                    do_hook('options_identities_renumber', $id, 'default');
+
                     continue 2;
                 } else {
                     $fixed[$i+1] = $ident;
                     continue 2;
                 } else {
                     $fixed[$i+1] = $ident;
@@ -152,6 +156,10 @@ function sqfixidentities( $identities, $id, $action ) {
 
                 if ($key == ($id - 1)) {
                     $tmp_hold = $ident;
 
                 if ($key == ($id - 1)) {
                     $tmp_hold = $ident;
+
+                    // inform plugins about renumbering of ids
+                    do_hook('options_identities_renumber', $id , $id - 1);
+
                     continue 2;
                 } else {
                     $fixed[$i] = $ident;
                     continue 2;
                 } else {
                     $fixed[$i] = $ident;
@@ -172,8 +180,16 @@ function sqfixidentities( $identities, $id, $action ) {
                 }
                 break;
 
                 }
                 break;
 
-            // we should never hit this but just in case //
+            // Process actions from plugins and save/update action //
             default:
             default:
+                /**
+                 * send action and id information. number of hook arguments 
+                 * differs from 1.4.4 or older and 1.5.0. count($args) can 
+                 * be used to detect modified hook. Older hook does not 
+                 * provide information that can be useful for plugins.
+                 */
+                do_hook('options_identities_process', $action, $id);
+
                 $fixed[$i] = $ident;
 
         }
                 $fixed[$i] = $ident;
 
         }
index e7e5d7d02d7d9d3f6da693147ed6038607341b3e..bcb02f36009b7809231881f28594cf2e00d6e7a7 100644 (file)
@@ -122,10 +122,6 @@ if ($imap_server_type == 'uw' && (strstr($mailbox, '../') ||
  * preferences.
  */
 
  * preferences.
  */
 
-
-/* not sure if this hook should be capable to alter the global pref array */
-do_hook ('generic_header');
-
 $aMailboxPrefSer=getPref($data_dir, $username,'pref_'.$account.'_'.$mailbox);
 if ($aMailboxPrefSer) {
     $aMailboxPref = unserialize($aMailboxPrefSer);
 $aMailboxPrefSer=getPref($data_dir, $username,'pref_'.$account.'_'.$mailbox);
 if ($aMailboxPrefSer) {
     $aMailboxPref = unserialize($aMailboxPrefSer);