3
* $Horde: horde/admin/cmdshell.php,v 1.9.10.1 2005/01/03 12:25:29 jan Exp $
5
* Copyright 1999-2005 Chuck Hagenbuch <chuck@horde.org>
7
* See the enclosed file COPYING for license information (LGPL). If you
8
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
11
define('HORDE_BASE', dirname(__FILE__) . '/..');
12
require_once HORDE_BASE . '/lib/base.php';
13
require_once 'Horde/Menu.php';
14
require_once 'Horde/Help.php';
16
if (!Auth::isAdmin()) {
17
Horde::fatal('Forbidden.', __FILE__, __LINE__);
20
$title = _("Command Shell");
21
require HORDE_TEMPLATES . '/common-header.inc';
22
require HORDE_TEMPLATES . '/admin/common-header.inc';
24
if ($command = trim(Util::getFormData('cmd'))) {
25
echo '<div class="header">' . _("Command") . ':</div><br />';
26
echo '<table cellpadding="4" border="0"><tr><td class="text"><code>' . nl2br(htmlspecialchars($command)) . '</code></td></tr></table>';
28
echo '<br /><div class="header">' . _("Results") . ':</div><br />';
29
echo '<table cellpadding="4" border="0"><tr><td class="text"><pre>';
31
$cmds = explode("\n", $command);
32
foreach ($cmds as $cmd) {
37
echo htmlspecialchars(shell_exec($cmd));
41
echo '</pre></td></tr></table><br />';
45
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
46
<?php Util::pformInput() ?>
47
<textarea class="fixed" name="cmd" rows="10" cols="60">
48
<?php if (!empty($command)) echo htmlspecialchars($command) ?></textarea>
50
<input type="submit" class="button" value="<?php echo _("Execute") ?>">
51
<?php echo Help::link('admin', 'admin-cmdshell') ?>
56
require HORDE_TEMPLATES . '/common-footer.inc';