From 9c4a2493372bc5c80b612b0be825013c4bbcb287 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 6 Mar 2010 15:21:42 -0500 Subject: Fix error --- config/openospfd/status_ospfd.php | 69 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/openospfd/status_ospfd.php b/config/openospfd/status_ospfd.php index caf7f32e..b20b7d04 100644 --- a/config/openospfd/status_ospfd.php +++ b/config/openospfd/status_ospfd.php @@ -32,12 +32,79 @@ require("guiconfig.inc"); $pgtitle = "OpenOSPFD: Status"; include("head.inc"); +/* List all of the commands as an index. */ +function listCmds() { + global $commands; + echo "

This status page includes the following information:\n"; + echo "

\n"; +} + +function execCmds() { + global $commands; + for ($i = 0; isset($commands[$i]); $i++ ) { + doCmdT($commands[$i][0], $commands[$i][1]); + } +} + +/* 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); +} + +function doCmdT($title, $command) { + echo "

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
" . $title . "
";		/* 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"; +} + +$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); +if(strstr($pfSversion, "1.2")) + $one_two = true; + ?> -

+ +

+
-- cgit v1.2.3