3 // some global menu stuff
4 $MENUS["home"]["url"] = "?action=home";
5 $MENUS["home"]["name"] = "Home";
6 $MENUS["hosts"]["url"] = "?action=hosts";
7 $MENUS["hosts"]["name"] = "Hosts";
8 $MENUS["add"]["url"] = "?action=addhost";
9 $MENUS["add"]["name"] = "Add Host";
10 $MENUS["config"]["url"] = "?action=config";
11 $MENUS["config"]["name"] = "Configure";
13 $FUNCTIONS["config"] = "www_configure";
14 $FUNCTIONS["addhost"] = "www_addhost";
15 $FUNCTIONS["addhostnext"] = "www_addHostStageTwo";
16 $FUNCTIONS["addhostthree"] = "www_addHostStageThree";
23 <title>Network Config Manager</title>
28 function www_pageLayout()
32 <tr><td colspan="2"><h1>Network Config Manager</h1></td></tr>
33 <tr valign="top"><td><?php www_menu() ?></td><td><?php www_body() ?></td></tr>
42 <br><font size="-1"><i>Copyright 2003-2011, Paul J Robinson</i></font><br>
51 foreach($MENUS as $menuitems) {
52 $url = $menuitems["url"];
53 $name = $menuitems["name"];
54 echo "<a href=\"$url\">$name</a><br>";
63 if(isset($_REQUEST["action"])) {
64 $req = $_REQUEST["action"];
65 if(isset($FUNCTIONS["$req"])) {
66 $func = $FUNCTIONS["$req"];
67 if(function_exists($func)) {
76 // here we do the normal body, whatever that
77 // we'll list the hosts, the size of the current config and
78 // the last time it was updated, plus the number of versions
82 function www_hostTypesDropDown()
86 foreach($HOST_TYPE as $tloop => $types) {
87 $typename = $types["name"];
89 echo "<option value=\"$typever\">$typename</option>";
93 function www_addhost()
96 <form method="post" action="?action=addhostnext">
98 <tr><td>Name</td><td><input type="text" name="cname"></td></tr>
99 <tr><td>Hostname/IP Address</td><td><input type="text" name="hname"></td></tr>
100 <tr><td>Host Type</td><td><select name="hosttype"><?php www_hostTypesDropDown() ?></select></td></tr>
102 <input type="submit" value="Next" name="Next">
107 function www_addHostStageTwo()
110 if(isset($_REQUEST["hosttype"])) {
111 $htype = $_REQUEST["hosttype"];
112 $func = $HOST_TYPE["$htype"]["configform"];
113 if(function_exists($func)) {
114 echo "<form method=\"post\" action=\"?action=addhostthree&hosttype=$htype\">";
116 echo "<input type=\"submit\" value=\"Add\" name=\"Add\">";
117 } else echo "would call $func for $htype but it doesnt exist\n";
121 function www_addHostStageThree()
124 if(isset($_REQUEST["hosttype"])) {
125 $htype = $_REQUEST["htype"];
126 $func = $HOST_TYPE["$htype"]["postfunction"];
127 if(function_exists($func)) {
129 } else echo "would call $func for $htype but it doesnt exist\n";