Code

Updated command verifier
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 11:59:27 +0000 (11:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 11:59:27 +0000 (11:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18365 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/configViewer/class_commandVerifier.inc
gosa-core/plugins/addons/configViewer/commandVerifier.tpl

index a784ca74fd029240a56a021f3d80eb3591428476..b9b4b63c74e1165a064bc95446092a1a3e7d7ebf 100644 (file)
@@ -27,7 +27,34 @@ class commandVerifier
             $output = "code: {$code}\nreturn: {$ret}";
         }
 
-  
+
+
+        $descriptorspec = array(
+                0 => array("pipe", "w"),
+                1 => array("pipe", "w"),
+                2 => array("pipe", "w"));
+
+
+        $process = proc_open($this->command, $descriptorspec, $pipes);
+        if (is_resource($process)) {
+
+            $send= stream_get_contents($pipes[0]);
+            $res = htmlentities(stream_get_contents($pipes[1]),ENT_COMPAT,'UTF-8');
+            $err = htmlentities(stream_get_contents($pipes[2]),ENT_COMPAT,'UTF-8');
+            fclose($pipes[0]);
+            fclose($pipes[1]);
+            fclose($pipes[2]);
+
+            $code = proc_close($process);
+            
+            $output = "
+                    <table summary='"._("Results")."'>
+                        <tr><td><b>Result:</b></td><td>$res</td></tr>
+                        <tr><td><b>Error:</b></td><td>$err</td></tr>
+                        <tr><td><b>Return code:</b></td><td>$code</td></tr>
+                    </table>";
+        }
+
         $smarty->assign('value', htmlentities($this->command,ENT_COMPAT,'UTF-8'));
         $smarty->assign('output', $output);
         return($smarty->fetch(get_template_path('commandVerifier.tpl', 'TRUE')));
index 1c912d3e28922e1cf495c126d9b9e4522f11cf98..7cc97234e811bb51a63c74c84b2e140af622c7eb 100644 (file)
@@ -9,7 +9,7 @@
 
 <p>
     {t}The generated output{/t}
-    <textarea size=10 style='width:100%'>{$output}</textarea>
+    {$output}
 </p>
 
 <button type='submit' name='execute'>{t}Test{/t}</button>