Code

Do not execute the command on every page reload
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 12:34:04 +0000 (12:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 12:34:04 +0000 (12:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18368 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index b068094f363e6754ed36e5c5cd609ae236ace74b..952ccdb4fcd46f84c1486965e391807c89333a51 100644 (file)
@@ -16,22 +16,25 @@ class commandVerifier
     {
         $smarty = get_smarty();      
         $output= "";
-        $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><pre>$res</pre></td></tr>
-                <tr><td><b>Error:</b></td><td><pre>$err</pre></td></tr>
-                <tr><td><b>Return code:</b></td><td>$code</td></tr>
-                </table>";
+
+        if(isset($_POST['execute'])){
+            $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><pre>$res</pre></td></tr>
+                    <tr><td><b>Error:</b></td><td><pre>$err</pre></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);