Browse Source

add configOption test

Andre Genrich 5 years ago
parent
commit
7d193df522
2 changed files with 20 additions and 28 deletions
  1. 19 27
      zimbraSingle.inc
  2. 1 1
      zimbraSingle.php

+ 19 - 27
zimbraSingle.inc

@@ -353,22 +353,6 @@ function zimbraSingleClientArea($userData)
     }
 }
 
-function recursiveFindAll($haystack, $needle)
-{
-    $values = array();
-    $iterator  = new RecursiveArrayIterator($haystack);
-    $recursive = new RecursiveIteratorIterator(
-        $iterator,
-        RecursiveIteratorIterator::SELF_FIRST
-    );
-    foreach ($recursive as $key => $value) {
-        if ($key === $needle) {
-            array_push($values, $value);
-        }
-    }
-    return $values;
-}
-
 function zimbraSingleConfigOptions() {
     $accessData = zimbraSingleGetAccess();
 
@@ -396,23 +380,31 @@ function zimbraSingleConfigOptions() {
         );
         return false;
     }
+    $cosNames =  recursiveFindAll($response, 'NAME');
     logModuleCall(
         'zimbrasingle',
         __FUNCTION__,
         $params,
         "All COS Array",
-        $response
+        $cosNames
     );
-    $configOptions = array ( [
-        "test" => [
-            "FriendlyName" => "Test",
-            "Type" => "text", # Text Box
-            "Size" => "25", # Defines the Field Width
-            "Description" => "Textbox",
-            "Default" => "Example",
-        ],
-    ]);
-    return $configOptions;
+    return $cosNames;
+}
+
+function recursiveFindAll($haystack, $needle)
+{
+    $values = array();
+    $iterator  = new RecursiveArrayIterator($haystack);
+    $recursive = new RecursiveIteratorIterator(
+        $iterator,
+        RecursiveIteratorIterator::SELF_FIRST
+    );
+    foreach ($recursive as $key => $value) {
+        if ($key === $needle) {
+            array_push($values, $value);
+        }
+    }
+    return $values;
 }
 
 function zimbraSingleCheckPassword($pwd)

+ 1 - 1
zimbraSingle.php

@@ -110,7 +110,7 @@ function zimbraSingle_ChangePackage($params)
 
 function zimbraSingle_ConfigOptions()
 {
-    $response = zimbraSingle_ConfigOptions();
+    $response = zimbraSingleConfigOptions();
     if($response) {
         return $response;
     }