summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0838bfb)
raw | patch | inline | side by side (parent: 0838bfb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 11 May 2010 12:17:25 +0000 (12:17 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 11 May 2010 12:17:25 +0000 (12:17 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18366 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/addons/configViewer/class_commandVerifier.inc | patch | blob | history | |
gosa-core/plugins/addons/configViewer/commandVerifier.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc b/gosa-core/plugins/addons/configViewer/class_commandVerifier.inc
index b9b4b63c74e1165a064bc95446092a1a3e7d7ebf..b068094f363e6754ed36e5c5cd609ae236ace74b 100644 (file)
<?php
-
-
class commandVerifier
{
private $property = NULL;
private $config = NULL;
-
private $command = "";
-
+
function __construct($config, $property)
{
$this->config = &$config;
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 = "
- <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>";
+ <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);
return($smarty->fetch(get_template_path('commandVerifier.tpl', 'TRUE')));
$this->property->setValue($this->command);
}
}
-
-
?>
diff --git a/gosa-core/plugins/addons/configViewer/commandVerifier.tpl b/gosa-core/plugins/addons/configViewer/commandVerifier.tpl
index 7cc97234e811bb51a63c74c84b2e140af622c7eb..64b4382a261e0c1ea16e508fd9b09f326bbff006 100644 (file)
-
-
-<h3>{t}Command property verifier{/t}</h3>
+<h3>{t}Command verifier{/t}</h3>
<p>
- {t}The command to check for{/t}
- <input type='text' name='command' value="{$value}" style='width: 100%;'>
+ {t}The command to check for{/t}
+ <input type='text' name='command' value="{$value}" style='width: 600px;'>
+ <button type='submit' name='execute'>{t}Test{/t}</button>
</p>
-<p>
- {t}The generated output{/t}
- {$output}
-</p>
-
-<button type='submit' name='execute'>{t}Test{/t}</button>
-
+<hr>
+ {$output}
<hr>
<div class="plugin-actions">
<button type='submit' name='commandVerifier_save'>{msgPool type='okButton'}</button>