1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<?php
/**
* $Horde: horde/admin/phpshell.php,v 1.24.10.1 2005/01/03 12:25:29 jan Exp $
*
* Copyright 1999-2005 Chuck Hagenbuch <chuck@horde.org>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*/
define('HORDE_BASE', dirname(__FILE__) . '/..');
require_once HORDE_BASE . '/lib/base.php';
require_once 'Horde/Menu.php';
require_once 'Horde/Help.php';
if (!Auth::isAdmin()) {
Horde::authenticationFailureRedirect();
}
$title = _("PHP Shell");
require HORDE_TEMPLATES . '/common-header.inc';
require HORDE_TEMPLATES . '/admin/common-header.inc';
$apps = $registry->listApps();
$application = Util::getFormData('app', 'horde');
?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<?php Util::pformInput() ?>
<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td class="header"><?php echo _("Application") ?></td></tr></table>
<select name="app">
<?php foreach ($apps as $app): ?>
<option value="<?php echo $app ?>"<?php if ($application == $app) echo ' selected="selected"' ?>><?php echo $registry->get('name', $app) ?></option>
<?php endforeach; ?>
</select><br /><br />
<?php
if ($command = trim(Util::getFormData('php'))) {
if (@file_exists($registry->get('fileroot', $application) . '/lib/base.php')) {
include $registry->get('fileroot', $application) . '/lib/base.php';
} else {
$registry->pushApp($application);
}
require_once 'Horde/MIME/Viewer.php';
require_once 'Horde/MIME/Viewer/source.php';
$pretty = highlight_string('<?php ' . $command . "\n", true);
$pretty = str_replace(array('<?php',
"\r\n",
"\r",
"<code><font color=\"#000000\">\n",
"\n</code>",
"\n</font></code>"),
array('',
"\n",
"\n",
'<code><font color="#000000">',
'</code>',
'</font></code>'),
$pretty);
$pretty = MIME_Viewer_Source::lineNumber(trim($pretty));
echo '<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td class="header">' . _("PHP Code") . '</td></tr></table><br />';
echo $pretty;
echo '<br /><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td class="header">' . _("Results") . '</td></tr></table>';
echo '<table cellpadding="4" border="0"><tr><td class="text"><pre>';
eval($command);
echo '</pre></td></tr></table><br />';
}
?>
<textarea class="fixed" name="php" rows="10" cols="60">
<?php if (!empty($command)) echo htmlspecialchars($command) ?></textarea>
<br />
<input type="submit" class="button" value="<?php echo _("Execute") ?>">
<?php echo Help::link('admin', 'admin-phpshell') ?>
</form>
<?php
require HORDE_TEMPLATES . '/common-footer.inc';
|