"; /* 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 {
$execOutput = "";
$execStatus = "";
exec ($command . " 2>&1", $execOutput, $execStatus);
for ($i = 0; isset($execOutput[$i]); $i++) {
if ($i > 0) {
echo "\n";
}
echo htmlspecialchars($execOutput[$i],ENT_NOQUOTES);
}
}
echo " |
\n";
echo "