= 6)
$pgtitle = array("OpenBGPD", "Status");
else
$pgtitle = "OpenBGPD: Status";
include("head.inc");
function doCmdT($title, $command) {
echo "
\n";
echo " \n";
echo "
\n";
echo "" . $title . " |
\n";
echo ""; /* no newline after pre */
$fd = popen("{$command} 2>&1", "r");
$ct = 0;
while (($line = fgets($fd)) !== FALSE) {
echo htmlspecialchars($line, ENT_NOQUOTES);
if ($ct++ > 1000) {
ob_flush();
$ct = 0;
}
}
pclose($fd);
echo " |
\n";
echo "
\n";
}
/* Define a command, with a title, to be executed later. */
function defCmdT($title, $command) {
global $commands;
$title = htmlspecialchars($title,ENT_NOQUOTES);
$commands[] = array($title, $command);
}
/* List all of the commands as an index. */
function listCmds() {
global $commands;
echo "This status page includes the following information:\n";
echo "
\n";
}
/* Execute all of the commands which were defined by a call to defCmd. */
function execCmds() {
global $commands;
foreach ($commands as $command)
doCmdT($command[0], $command[1]);
}
?>
' . $pgtitle . '';
?>