From 31524bcde493596e0c2c5a0134c71bf10c730f4a Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Thu, 31 Jan 2002 17:13:51 +0000 Subject: [PATCH] Sorry, last commit broke the code. I had to make a separate plugin function. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2327 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 2 +- functions/plugin.php | 25 +++++++++++++++++++++++-- plugins/filters/setup.php | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index f6fafd93..d9be41fd 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -51,7 +51,7 @@ function isSpecialMailbox( $box ) { ($save_as_draft && $box == $draft_folder ) ); if ( !$ret ) { - $ret = do_hook( 'special_mailbox', $box ); + $ret = do_hook_function( 'special_mailbox', $box ); } return( $ret ); diff --git a/functions/plugin.php b/functions/plugin.php index 9ef6d7f5..2d9083fb 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -28,7 +28,7 @@ function use_plugin ($name) { } /* This function executes a hook. */ -function do_hook ($name,$parm=NULL) { +function do_hook ($name) { global $squirrelmail_plugin_hooks; $data = func_get_args(); $ret = ''; @@ -38,7 +38,27 @@ function do_hook ($name,$parm=NULL) { foreach ($squirrelmail_plugin_hooks[$name] as $function) { /* Add something to set correct gettext domain for plugin. */ if (function_exists($function)) { - $ret = $function($data,$parm); + $function($data); + } + } + } + + /* Variable-length argument lists have a slight problem when */ + /* passing values by reference. Pity. This is a workaround. */ + return $data; +} + +/* This function executes a hook. */ +function do_hook_function($name,$parm=NULL) { + global $squirrelmail_plugin_hooks; + $ret = ''; + + if (isset($squirrelmail_plugin_hooks[$name]) + && is_array($squirrelmail_plugin_hooks[$name])) { + foreach ($squirrelmail_plugin_hooks[$name] as $function) { + /* Add something to set correct gettext domain for plugin. */ + if (function_exists($function)) { + $ret = $function($parm); } } } @@ -48,6 +68,7 @@ function do_hook ($name,$parm=NULL) { return $ret; } + /*************************************/ /*** MAIN PLUGIN LOADING CODE HERE ***/ /*************************************/ diff --git a/plugins/filters/setup.php b/plugins/filters/setup.php index c8f5749c..efa1cab9 100644 --- a/plugins/filters/setup.php +++ b/plugins/filters/setup.php @@ -72,7 +72,7 @@ $squirrelmail_plugin_hooks['special_mailbox']['filters'] = 'filters_special_mailbox'; } - function filters_special_mailbox( $data, $mb ) { + function filters_special_mailbox( $mb ) { if ( $mb == getPref($data_dir, $username, 'filters_spam_folder', 'na' ) ) { return( TRUE ); -- 2.25.1