Move sqm_array_merge to arrays.php and subsequently move inclusion of arrays.php...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 22 Sep 2006 09:29:04 +0000 (09:29 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 22 Sep 2006 09:29:04 +0000 (09:29 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11736 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/arrays.php
functions/global.php
functions/plugin.php
include/init.php
src/options_order.php
src/read_body.php

index bec4c986d84e5a6ffefab36383afaec1ff32c52d..57eb30a2011a8ad1c66c6cd13d65f5f9b6970597 100644 (file)
@@ -139,3 +139,65 @@ if (!function_exists('array_combine')) {
         return $r;
     }
 }
+
+
+ /**
+  * Merges two variables into a single array
+  *
+  * Similar to PHP array_merge function, but provides same
+  * functionality as array_merge without losing array values
+  * with same key names.  If the values under identical array
+  * keys are both strings and $concat_strings is TRUE, those
+  * values are concatenated together, otherwise they are placed
+  * in a sub-array and are merged (recursively) in the same manner.
+  *
+  * If either of the elements being merged is not an array,
+  * it will simply be added to the returned array.
+  *
+  * If both values are strings and $concat_strings is TRUE,
+  * a concatenated string is returned instead of an array.
+  *
+  * @param mixed   $a              First element to be merged
+  * @param mixed   $b              Second element to be merged
+  * @param boolean $concat_strings Whether or not string values
+  *                                should be concatenated instead
+  *                                of added to different array
+  *                                keys (default TRUE)
+  *
+  * @return array The merged $a and $b in one array
+  *
+  * @since 1.5.2
+  * @author Paul Lesniewski 
+  *
+  */
+function sqm_array_merge($a, $b, $concat_strings=true) {
+
+    $ret = array();
+
+    if (is_array($a)) {
+        $ret = $a;
+    } else {
+        if (is_string($a) && is_string($b) && $concat_strings) {
+            return $a . $b;
+        }
+        $ret[] = $a;
+    }
+
+
+    if (is_array($b)) {
+        foreach ($b as $key => $value) {
+            if (isset($ret[$key])) {
+                $ret[$key] = sqm_array_merge($ret[$key], $value, $concat_strings);
+            } else {
+                $ret[$key] = $value;
+            }
+        }
+    } else {
+        $ret[] = $b;
+    }
+
+    return $ret;
+
+}
+
+
index 2ee2b837d3c03f681d7c8ce3697cdd706c805e68..3e7e0ec4e2b6c5c5162794274f5875a036bbf7a4 100644 (file)
@@ -83,64 +83,6 @@ function sqstripslashes(&$array) {
     }
 }
 
-/**
- * Merges two variables into a single array
- *
- * Similar to PHP array_merge function, but provides same
- * functionality as array_merge without losing array values
- * with same key names.  If the values under identical array
- * keys are both strings and $concat_strings is TRUE, those
- * values are concatenated together, otherwise they are placed
- * in a sub-array and are merged (recursively) in the same manner.  
- *
- * If either of the elements being merged is not an array,
- * it will simply be added to the returned array.
- * 
- * If both values are strings and $concat_strings is TRUE,
- * a concatenated string is returned instead of an array.
- * 
- * @param mixed   $a              First element to be merged
- * @param mixed   $b              Second element to be merged
- * @param boolean $concat_strings Whether or not string values 
- *                                should be concatenated instead 
- *                                of added to different array 
- *                                keys (default TRUE)
- *
- * @return array The merged $a and $b in one array
- *
- * @since 1.5.2
- *
- */
-function sq_array_merge($a, $b, $concat_strings=true) {
-
-    $ret = array();
-
-    if (is_array($a)) {
-        $ret = $a;
-    } else {
-        if (is_string($a) && is_string($b) && $concat_strings) {
-            return $a . $b;
-        }
-        $ret[] = $a;
-    }
-
-
-    if (is_array($b)) {
-        foreach ($b as $key => $value) {
-            if (isset($ret[$key])) {
-                $ret[$key] = sq_array_merge($ret[$key], $value, $concat_strings);
-            } else {
-                $ret[$key] = $value;
-            }
-        }
-    } else {
-        $ret[] = $b;
-    }
-
-    return $ret;
-
-}
-
 /**
  * Add a variable to the session.
  * @param mixed $var the variable to register
index c5b206fe2772cce3e6b1f096238e101bb660e748..062021c9cced356c53a89f6c77bd7f33917f68bb 100644 (file)
@@ -118,7 +118,7 @@ function concat_hook_function($name,$parm=NULL) {
             /* Add something to set correct gettext domain for plugin. */
             if (function_exists($function)) {
 //                $ret .= $function($parm);
-                $ret = sq_array_merge($ret, $function($parm));
+                $ret = sqm_array_merge($ret, $function($parm));
             }
         }
     }
index b0fc1e25ebaf3774bd072a0afe825cffd3dda63b..935515219b8cac75a4f0ef31764db695fac5cb9c 100644 (file)
@@ -134,6 +134,7 @@ $color[15] = '#002266';  /* (dark blue)   Unselectable folders */
 $color[16] = '#ff9933';  /* (orange)      Highlight color */
 
 require(SM_PATH . 'functions/global.php');
+require(SM_PATH . 'functions/arrays.php');
 
 /* load default configuration */
 require(SM_PATH . 'config/config_default.php');
index 76980b479118a4b2dfaf78af0b79bd6dad5fb78d..b643a0ca8fee6be18d476ce4e54b53767a98725b 100644 (file)
@@ -18,7 +18,6 @@ require('../include/init.php');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'functions/forms.php');
-require_once(SM_PATH . 'functions/arrays.php');
 
 /* get globals */
 if (sqgetGlobalVar('num',       $num,       SQ_GET)) {
@@ -160,4 +159,4 @@ $oTemplate->assign('addField_action', $PHP_SELF);
 $oTemplate->display('options_order.tpl');
 
 $oTemplate->display('footer.tpl');
-?>
\ No newline at end of file
+?>
index b04812b0b355c3b144a18601b6902dfda46332fe..1b65b9127c5cb574b9cbcc9e2c50b8f0fc1e555a 100644 (file)
@@ -26,7 +26,6 @@ require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/date.php');
 require_once(SM_PATH . 'functions/url_parser.php');
 require_once(SM_PATH . 'functions/identity.php');
-require_once(SM_PATH . 'functions/arrays.php');
 require_once(SM_PATH . 'functions/mailbox_display.php');
 require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'functions/attachment_common.php');