Account for servers that send extra unsolicited FETCH responses (such as when flags...
[squirrelmail.git] / functions / plugin.php
index 9ffbe27c7dd334f53dd31c2d3899d05527678185..9b1a61483a2842ab4e9eb6ffa8617e386bc6b845 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Documentation on how to write plugins might show up some time.
  *
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2012 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -58,7 +58,7 @@ function use_plugin ($name) {
  * independent of) the return value for this hook.
  *
  * @param string $name Name of hook being executed
- * @param mixed  $args A single value or an array of arguments 
+ * @param mixed &$args A single value or an array of arguments 
  *                     that are to be passed to all plugins 
  *                     operating off the hook being called.  
  *                     Note that this argument is passed by 
@@ -120,7 +120,7 @@ function do_hook($name, &$args) {
  * independent of) the return value for this hook.
  *
  * @param string  $name Name of hook being executed
- * @param mixed   $args A single value or an array of arguments 
+ * @param mixed &$args A single value or an array of arguments 
  *                      that are to be passed to all plugins 
  *                      operating off the hook being called.  
  *                      Note that this argument is passed by 
@@ -187,7 +187,7 @@ function concat_hook_function($name, &$args, $force_array=FALSE) {
  * independent of) the return value for this hook.
  *
  * @param string  $name     The hook name
- * @param mixed   $args     A single value or an array of arguments 
+ * @param mixed   &$args    A single value or an array of arguments 
  *                          that are to be passed to all plugins 
  *                          operating off the hook being called.  
  *                          Note that this argument is passed by 
@@ -975,8 +975,10 @@ function check_plugin_dependencies($plugin_name, $force_inclusion = FALSE)
          {
             $version = explode('.', substr($depend_requirements['version'], strpos($depend_requirements['version'], ':') + 1), 3);
             $version[0] = intval($version[0]);
-            $version[1] = intval($version[1]);
-            $version[2] = intval($version[2]);
+            if (isset($version[1])) $version[1] = intval($version[1]);
+            else $version[1] = 0;
+            if (isset($version[2])) $version[2] = intval($version[2]);
+            else $version[2] = 0;
 
             if (!check_sm_version($version[0], $version[1], $version[2]))
                $missing_or_bad[$depend_name] = $depend_requirements;
@@ -1003,8 +1005,10 @@ function check_plugin_dependencies($plugin_name, $force_inclusion = FALSE)
       //
       $version = explode('.', $depend_requirements['version'], 3);
       $version[0] = intval($version[0]);
-      $version[1] = intval($version[1]);
-      $version[2] = intval($version[2]);
+      if (isset($version[1])) $version[1] = intval($version[1]);
+      else $version[1] = 0;
+      if (isset($version[2])) $version[2] = intval($version[2]);
+      else $version[2] = 0;
 
       $force_dependency_inclusion = !$depend_requirements['activate'];