X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Ffwui.php;h=fb9ef70262b34f57bb47ecb0438f0dda88894dad;hp=5d78f384d4b44258ed2e42118becb649e3a649a1;hb=60673f4f00bab805471fcbb85c8816aebb3a9582;hpb=fa4d5e8e3250b981ee563f21df08c729dd3d4c57 diff --git a/libcbfwr/fwui.php b/libcbfwr/fwui.php index 5d78f38..fb9ef70 100644 --- a/libcbfwr/fwui.php +++ b/libcbfwr/fwui.php @@ -7,16 +7,89 @@ function CBFWZonesPage($urls) if(isset($urls[1])) { switch($urls[1]) { + case "modify": + + if($_REQUEST["description"] != "") $desc = $_REQUEST["description"]; + else $desc = null; + + $oldname = $_REQUEST["oldname"]; + $newname = $_REQUEST["zonename"]; + + $renewname = null; + if($oldname != $newname) { + $renewname = " rename $newname"; + } + + $oldconf = $comms->getConfig(0); + $olddesc = $oldconf["zone"][$oldname]["description"]; + if($desc != $olddesc) { + $newdesc = " # $desc"; + } else $newdesc = null; + + //echo "confs: \"$olddesc\", \"$newdesc\", $oldname, $newname
"; + //exit(0); + + if($renewname == null && $newdesc == null) { + header("Location: $BASE_URL/zones"); + return; + } + + + $conf = $comms->getConfig(3); + $changes = $conf["status"]; + if($changes == "nochange") $conf["status"] = 1; + else $conf["status"] = $changes + 1; + $cnum = $conf["status"]; + + $conf[$cnum]["modify"] = "zone $oldname$renewname$newdesc"; + $comms->putConfig($conf, 3); + header("Location: $BASE_URL/zones"); + + break; + + case "edit": + CBFWpageBuilder(null, "CBFWZonesEditPage", null, null, $urls); break; - case "change": + + + case "delete": + $zonetodelete = $urls[2]; + + $conf = $comms->getConfig(3); + $changes = $conf["status"]; + if($changes == "nochange") $conf["status"] = 1; + else $conf["status"] = $changes + 1; + $cnum = $conf["status"]; + + $conf[$cnum]["delete"] = "zone $zonetodelete"; + $comms->putConfig($conf, 3); + header("Location: $BASE_URL/zones"); break; + + case "add": + + // UGLY + $cnum = 0; $nametoadd = $_REQUEST["toadd"]; - $comms->sendMessage("zone add $nametoadd"); - //if($_REQUEST["desc"] != "") $comms->sendMessage("zone ") + $desc = $_REQUEST["desc"]; + $descbit = ""; + if($desc != "") $descbit = " # $desc"; + if($nametoadd == "" || $nametoadd == null) { + return; + } + $conf = $comms->getConfig(3); + $changes = $conf["status"]; + if($changes == "nochange") $conf["status"] = 1; + else $conf["status"] = $changes + 1; + $cnum = $conf["status"]; + $conf[$cnum]["add"] = "zone $nametoadd$descbit"; + $comms->putConfig($conf, 3); header("Location: $BASE_URL/zones"); break; + + default: CBFWpageBuilder(null, "CBFWZonesPageDisplay"); } @@ -25,20 +98,51 @@ function CBFWZonesPage($urls) } } +function CBFWZonesEditPage($urls) +{ + global $BASE_URL, $MENU_ITEMS; + + $zone = $urls[2]; + + $comms = new Comms(); + $myconf = new Config(); + + $config = $comms->getConfig(); + $conf2 = $comms->getConfig(3); + $config = $myconf->mergeConfig($config, $conf2); + + + echo "

Edit Zone $zone

"; + echo "
"; + echo ""; + echo "Name:
"; + + if(isset($config["zone"][$zone]["description"])) $desc = $config["zone"][$zone]["description"]; + + echo "Description:
"; + echo ""; + echo "
"; +} + function CBFWZonesPageDisplay() { global $BASE_URL, $MENU_ITEMS; $comms = new Comms(); + $myconf = new Config(); $config = $comms->getConfig(); + $conf2 = $comms->getConfig(3); + $config = $myconf->mergeConfig($config, $conf2); echo "

Zones

"; - echo ""; + echo "
ZoneInterfacesEdit
"; foreach($config["zone"] as $key => $var) { $name = $key; $url = "Edit"; - echo ""; + $url2 = "Delete"; + $desc = $var["description"]; + echo ""; } echo "
ZoneInterfacesDescriptionEdit
$name...$url
$name...$desc$url $url2

";