Use constant instead of hard-coded string for plugin incompatibility indicator
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 7 May 2007 05:43:56 +0000 (05:43 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 7 May 2007 05:43:56 +0000 (05:43 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12369 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/plugin.php
include/constants.php
src/configtest.php

index dfaefd72901c5e11b81cd678ac50bdb206423750..9deb591733640ce73b93850028a4e2438faa94c2 100644 (file)
@@ -562,7 +562,7 @@ function check_plugin_version($plugin_name,
   *
   * @return mixed NULL is returned if the plugin could not be 
   *               found or does not include the given requirement,
-  *               the string "INCOMPATIBLE" is returned if the
+  *               the constant SQ_INCOMPATIBLE is returned if the
   *               given plugin is entirely incompatible with the
   *               current SquirrelMail version, otherwise the 
   *               value of the requirement is returned, whatever 
@@ -668,7 +668,7 @@ function get_plugin_requirement($plugin_name, $requirement,
          $c = $version_array[2];
 
          if (check_sm_version($a, $b, $c) 
-          && ( !empty($requirement_overrides['INCOMPATIBLE']) 
+          && ( !empty($requirement_overrides[SQ_INCOMPATIBLE]) 
           || (isset($requirement_overrides[$requirement])
           && !is_null($requirement_overrides[$requirement]))))
          {
@@ -682,8 +682,8 @@ function get_plugin_requirement($plugin_name, $requirement,
              && $highest_version_array[2] < $c))
             {
                $highest_version_array = $version_array;
-               if (!empty($requirement_overrides['INCOMPATIBLE']))
-                  $requirement_value_override = 'INCOMPATIBLE';
+               if (!empty($requirement_overrides[SQ_INCOMPATIBLE]))
+                  $requirement_value_override = SQ_INCOMPATIBLE;
                else
                   $requirement_value_override = $requirement_overrides[$requirement];
             }
@@ -746,7 +746,7 @@ function get_plugin_requirement($plugin_name, $requirement,
   * @return mixed Boolean FALSE is returned if the plugin
   *               could not be found or does not indicate
   *               whether it has other plugin dependencies, 
-  *               the string "INCOMPATIBLE" is returned if 
+  *               the constant SQ_INCOMPATIBLE is returned if 
   *               the given plugin is entirely incompatible 
   *               with the current SquirrelMail version, 
   *               otherwise an array is returned where keys 
@@ -775,7 +775,7 @@ function get_plugin_dependencies($plugin_name, $force_inclusion = FALSE,
 
    // the plugin is simply incompatible, no need to continue here
    //
-   if ($plugin_dependencies === 'INCOMPATIBLE')
+   if ($plugin_dependencies === SQ_INCOMPATIBLE)
       return $plugin_dependencies;
 
 
@@ -886,7 +886,7 @@ function get_plugin_dependencies($plugin_name, $force_inclusion = FALSE,
   *
   * @return mixed Boolean TRUE if all of the plugin's 
   *               required plugins are correctly installed,
-  *               the string "INCOMPATIBLE" is returned if 
+  *               the constant SQ_INCOMPATIBLE is returned if 
   *               the given plugin is entirely incompatible 
   *               with the current SquirrelMail version, 
   *               otherwise an array of the required plugins
@@ -908,7 +908,7 @@ function check_plugin_dependencies($plugin_name, $force_inclusion = FALSE)
 
    $dependencies = get_plugin_dependencies($plugin_name, $force_inclusion);
    if (!$dependencies) return TRUE;
-   if ($dependencies === 'INCOMPATIBLE') return $dependencies;
+   if ($dependencies === SQ_INCOMPATIBLE) return $dependencies;
    $missing_or_bad = array();
 
    foreach ($dependencies as $depend_name => $depend_requirements)
index 5fc115c05cda6604e4d5b81d74b701326d451b4b..62e507521c22868d4b228ebd84461411c28b3732 100644 (file)
@@ -173,3 +173,9 @@ define('SQ_TYPE_ARRAY', 'array');
 define('SQ_PHP_TEMPLATE', 'PHP_');
 define('SQ_SMARTY_TEMPLATE', 'Smarty_');
 
+/**
+ * Used by plugins to indicate an incompatibility with a SM version
+ * @since 1.5.2
+ */
+define('SQ_INCOMPATIBLE', 'INCOMPATIBLE');
+
index 92afb37578d3d82cf66cbba657ca0d856b8fab03..274f9c98dbfab898b4d9cf383f0c4dc2e227050e 100644 (file)
@@ -410,7 +410,7 @@ if (isset($plugins[0])) {
         // dependencies and if they are satisfied
         //
         $failed_dependencies = check_plugin_dependencies($name);
-        if ($failed_dependencies === 'INCOMPATIBLE') {
+        if ($failed_dependencies === SQ_INCOMPATIBLE) {
             do_err($name . ' is NOT COMPATIBLE with this version of SquirrelMail', FALSE);
         }
         else if (is_array($failed_dependencies)) {