From: Philippe M. <phi...@us...> - 2002-01-31 17:13:54
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv17663/functions Modified Files: imap_mailbox.php plugin.php Log Message: Sorry, last commit broke the code. I had to make a separate plugin function. Index: imap_mailbox.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_mailbox.php,v retrieving revision 1.117 retrieving revision 1.118 diff -u -w -r1.117 -r1.118 --- imap_mailbox.php 2002/01/31 16:53:53 1.117 +++ imap_mailbox.php 2002/01/31 17:13:51 1.118 @@ -51,7 +51,7 @@ ($save_as_draft && $box == $draft_folder ) ); if ( !$ret ) { - $ret = do_hook( 'special_mailbox', $box ); + $ret = do_hook_function( 'special_mailbox', $box ); } return( $ret ); Index: plugin.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/plugin.php,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- plugin.php 2002/01/31 16:53:53 1.21 +++ plugin.php 2002/01/31 17:13:51 1.22 @@ -28,7 +28,7 @@ } /* 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,15 +38,36 @@ 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); + } + } + } + + /* Variable-length argument lists have a slight problem when */ + /* passing values by reference. Pity. This is a workaround. */ return $ret; } + /*************************************/ /*** MAIN PLUGIN LOADING CODE HERE ***/ |