From a157a579322130375c6d5130eb3e51afd609d0d9 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 May 2010 12:34:04 +0000 Subject: [PATCH] Do not execute the command on every page reload git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18368 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../configViewer/class_commandVerifier.inc | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc index b068094f3..952ccdb4f 100644 --- a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc +++ b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc @@ -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 = " - - - - -
Result:
$res
Error:
$err
Return code:$code
"; + + 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 = " + + + + +
Result:
$res
Error:
$err
Return code:$code
"; + } } $smarty->assign('value', htmlentities($this->command,ENT_COMPAT,'UTF-8')); $smarty->assign('output', $output); -- 2.30.2