untested uid_support fix
[squirrelmail.git] / functions / plugin.php
index 3ce547ca38ce8e4b52144274a8bc05fe947f2dc6..2d9083fbed8fdd89f7cb220df1e1cc033b391580 100644 (file)
@@ -31,6 +31,7 @@ function use_plugin ($name) {
 function do_hook ($name) {
     global $squirrelmail_plugin_hooks;
     $data = func_get_args();
+    $ret = '';
 
     if (isset($squirrelmail_plugin_hooks[$name])
           && is_array($squirrelmail_plugin_hooks[$name])) {
@@ -47,6 +48,27 @@ function do_hook ($name) {
     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 ***/
 /*************************************/