From c3bf54d6587ce03f15931aa0a1c8b32f0a9dc27b Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 23 Jul 2013 22:17:15 -0300 Subject: Add an id for each commands, define them earlier and initialize commands --- config/openbgpd/openbgpd_status.php | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'config/openbgpd/openbgpd_status.php') diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php index d337858e..f5930db0 100644 --- a/config/openbgpd/openbgpd_status.php +++ b/config/openbgpd/openbgpd_status.php @@ -30,6 +30,17 @@ require("guiconfig.inc"); +$commands = array(); + +defCmdT("summary", "OpenBGPD Summary", "bgpctl show summary"); +defCmdT("interfaces", "OpenBGPD Interfaces", "bgpctl show interfaces"); +defCmdT("routing", "OpenBGPD Routing", "bgpctl show rib"); +defCmdT("forwarding", "OpenBGPD Forwarding", "bgpctl show fib"); +defCmdT("network", "OpenBGPD Network", "bgpctl show network"); +defCmdT("nexthops", "OpenBGPD Nexthops", "bgpctl show nexthop"); +defCmdT("ip", "OpenBGPD IP", "bgpctl show ip bgp"); +defCmdT("neighbors", "OpenBGPD Neighbors", "bgpctl show neighbor"); + if ($config['version'] >= 6) $pgtitle = array("OpenBGPD", "Status"); else @@ -61,9 +72,9 @@ function doCmdT($command, $limit = 0, $filter = "") { return $result; } -function showCmdT($title, $command) { +function showCmdT($idx, $title, $command) { echo "

\n"; - echo " \n"; + echo " \n"; echo "\n"; echo "\n"; echo "
" . $title . "
";		/* no newline after pre */
@@ -73,10 +84,10 @@ function showCmdT($title, $command) {
 }
 
 /* Define a command, with a title, to be executed later. */
-function defCmdT($title, $command) {
+function defCmdT($idx, $title, $command) {
 	global $commands;
 	$title = htmlspecialchars($title,ENT_NOQUOTES);
-	$commands[] = array($title, $command);
+	$commands[$idx] = array($title, $command);
 }
 
 /* List all of the commands as an index. */
@@ -84,16 +95,16 @@ 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) - showCmdT($command[0], $command[1]); + foreach ($commands as $idx => $command) + showCmdT($idx, $command[0], $command[1]); } ?> @@ -129,18 +140,6 @@ function execCmds() {
-
-- cgit v1.2.3