From 0838bfbd9623c681c4fc34f2774059e962de0829 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 May 2010 11:59:27 +0000 Subject: [PATCH] Updated command verifier git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18365 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../configViewer/class_commandVerifier.inc | 29 ++++++++++++++++++- .../addons/configViewer/commandVerifier.tpl | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc index a784ca74f..b9b4b63c7 100644 --- a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc +++ b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc @@ -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 = " + + + + +
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'))); diff --git a/gosa-core/plugins/addons/configViewer/commandVerifier.tpl b/gosa-core/plugins/addons/configViewer/commandVerifier.tpl index 1c912d3e2..7cc97234e 100644 --- a/gosa-core/plugins/addons/configViewer/commandVerifier.tpl +++ b/gosa-core/plugins/addons/configViewer/commandVerifier.tpl @@ -9,7 +9,7 @@

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

-- 2.30.2