From 72534801e0618d400e6a8e7cbc8e061542901398 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 May 2010 12:17:25 +0000 Subject: [PATCH] Updated command verifier git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18366 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../configViewer/class_commandVerifier.inc | 38 ++++--------------- .../addons/configViewer/commandVerifier.tpl | 18 +++------ 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc index b9b4b63c7..b068094f3 100644 --- a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc +++ b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc @@ -1,13 +1,10 @@ config = &$config; @@ -18,43 +15,24 @@ class commandVerifier function execute() { $smarty = get_smarty(); - $output= ""; - - if(isset($_POST['execute'])){ - exec ($this->command, $ret,$code); - $ret = implode($ret,'\n'); - $output = "code: {$code}\nreturn: {$ret}"; - } - - - - $descriptorspec = array( - 0 => array("pipe", "w"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w")); - - + $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
"; + + + + +
Result:
$res
Error:
$err
Return code:$code
"; } - $smarty->assign('value', htmlentities($this->command,ENT_COMPAT,'UTF-8')); $smarty->assign('output', $output); return($smarty->fetch(get_template_path('commandVerifier.tpl', 'TRUE'))); @@ -70,6 +48,4 @@ class commandVerifier $this->property->setValue($this->command); } } - - ?> diff --git a/gosa-core/plugins/addons/configViewer/commandVerifier.tpl b/gosa-core/plugins/addons/configViewer/commandVerifier.tpl index 7cc97234e..64b4382a2 100644 --- a/gosa-core/plugins/addons/configViewer/commandVerifier.tpl +++ b/gosa-core/plugins/addons/configViewer/commandVerifier.tpl @@ -1,19 +1,13 @@ - - -

{t}Command property verifier{/t}

+

{t}Command verifier{/t}

- {t}The command to check for{/t} - + {t}The command to check for{/t} + +

-

- {t}The generated output{/t} - {$output} -

- - - +
+ {$output}
-- 2.30.2