4 // some global menu stuff
5 $MENUS["home"]["url"] = "?action=home";
6 $MENUS["home"]["name"] = "Home";
7 $MENUS["hosts"]["url"] = "?action=hosts";
8 $MENUS["hosts"]["name"] = "Hosts";
9 $MENUS["add"]["url"] = "?action=addhost";
10 $MENUS["add"]["name"] = "Add Host";
11 $MENUS["config"]["url"] = "?action=config";
12 $MENUS["config"]["name"] = "Configure";
14 $FUNCTIONS["config"] = "www_configure";
15 $FUNCTIONS["addhost"] = "www_addhost";
16 $FUNCTIONS["addhostnext"] = "www_addHostStageTwo";
17 $FUNCTIONS["addhostthree"] = "www_addHostStageThree";
24 <title>Network Config Manager</title>
29 function www_pageLayout()
33 <tr><td colspan="2"><h1>Network Config Manager</h1></td></tr>
34 <tr valign="top"><td><?php www_menu() ?></td><td><?php www_body() ?></td></tr>
43 <br><font size="-1"><i>Copyright 2003-2011, Paul J Robinson</i></font><br>
52 foreach($MENUS as $menuitems) {
53 $url = $menuitems["url"];
54 $name = $menuitems["name"];
55 echo "<a href=\"$url\">$name</a><br>";
64 if(isset($_REQUEST["action"])) {
65 $req = $_REQUEST["action"];
66 if(isset($FUNCTIONS["$req"])) {
67 $func = $FUNCTIONS["$req"];
68 if(function_exists($func)) {
77 // here we do the normal body, whatever that
78 // we'll list the hosts, the size of the current config and
79 // the last time it was updated, plus the number of versions
83 function www_hostTypesDropDown()
87 foreach($HOST_TYPE as $tloop => $types) {
88 $typename = $types["name"];
90 echo "<option value=\"$typever\">$typename</option>";
94 function www_addhost()
97 <form method="post" action="?action=addhostnext">
99 <tr><td>Name</td><td><input type="text" name="cname"></td></tr>
100 <tr><td>Hostname/IP Address</td><td><input type="text" name="hname"></td></tr>
101 <tr><td>Host Type</td><td><select name="hosttype"><?php www_hostTypesDropDown() ?></select></td></tr>
103 <input type="submit" value="Next" name="Next">
108 function www_addHostStageTwo()
111 if(isset($_REQUEST["hosttype"])) {
112 $htype = $_REQUEST["hosttype"];
113 $func = $HOST_TYPE["$htype"]["configform"];
114 if(function_exists($func)) {
115 echo "<form method=\"post\" action=\"?action=addhostthree&hosttype=$htype\">";
117 echo "<input type=\"submit\" value=\"Add\" name=\"Add\">";
118 } else echo "would call $func for $htype but it doesnt exist\n";
122 function www_addHostStageThree()
125 if(isset($_REQUEST["hosttype"])) {
126 $htype = $_REQUEST["htype"];
127 $func = $HOST_TYPE["$htype"]["postfunction"];
128 if(function_exists($func)) {
130 } else echo "would call $func for $htype but it doesnt exist\n";