"; /* no newline after pre */
if ($command == "dumpconfigxml") {
$fd = @fopen("/conf/config.xml", "r");
if ($fd) {
while (!feof($fd)) {
$line = fgets($fd);
/* remove sensitive contents */
$line = preg_replace("/.*?<\\/password>/", "xxxxx", $line);
$line = preg_replace("/.*?<\\/pre-shared-key>/", "xxxxx", $line);
$line = preg_replace("/.*?<\\/rocommunity>/", "xxxxx", $line);
$line = str_replace("\t", " ", $line);
echo htmlspecialchars($line,ENT_NOQUOTES);
}
}
fclose($fd);
} else {
$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 "