X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Ffwui.php;h=adc95416a886aa96ab5a9c21287fe547ba1c89eb;hp=e827c2ca879676fd4af03b2940af6e27a0aa8e16;hb=13e5ebe14a18fb0d217fdc6fc4fc786a678889da;hpb=86842492eae6203c9df0df46363b4e809d577c70 diff --git a/libcbfwr/fwui.php b/libcbfwr/fwui.php index e827c2c..adc9541 100644 --- a/libcbfwr/fwui.php +++ b/libcbfwr/fwui.php @@ -58,15 +58,8 @@ function CBFWZonesPage($urls) 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); + + addWebUserChange("delete zone name $zonetodelete"); header("Location: $BASE_URL/zones"); break; @@ -74,21 +67,16 @@ function CBFWZonesPage($urls) case "add": // UGLY - $cnum = 0; $nametoadd = $_REQUEST["toadd"]; $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); + + addWebUserChange("zone name $nametoadd $descbit"); header("Location: $BASE_URL/zones"); break; @@ -122,6 +110,28 @@ function CBFWZonesEditPage($urls) echo ""; } +function addWebUserChange($change) +{ + $comms = new Comms(); + $myconf = new Config(); + + $conf = $comms->getConfig(3); + + if(!isset($conf["status"])) { + $conf["status"] = "nochange"; + } + + $changes = $conf["status"]; + if($changes == "nochange") $conf["status"] = 1; + else $conf["status"] = $changes + 1; + $cnum = $conf["status"]; + + $conf["changes"][$cnum] = "$change"; + $comms->putConfig($conf, 3); + +} + +// TODO: we need to really sit and think about this one function getWebUserConfig() { $comms = new Comms(); @@ -140,13 +150,20 @@ function getWebUserConfig() } // it did not, do a new merge and cache - $config = $myconf->mergeConfig($comms->getConfig(), $conf2); + // TODO: need to do this part + $config = $comms->getConfig(); $reconfig = $config; + $myconf->setConfig($config); + if(isset($conf2["changes"])) foreach($conf2["changes"] as $key => $var) { + error_log("Adding config line $key, $var"); + $myconf->addConfigLine($var); + } + $reconfig = $myconf->getConfig(); $reconfig["status"] = $conf2["status"]; error_log("put pre-cache config"); $comms->putConfig($reconfig, 5); - return $config; + return $reconfig; } function CBFWZonesPageDisplay() @@ -175,6 +192,31 @@ function CBFWZonesPageDisplay() } +function CBFWRoutingPage($urls) +{ + if(isset($urls[1])) { + switch($urls[1]) { + case "edit": + CBFWpageBuilder(null, "CBFWRoutingPageEdit", null, null, $urls[2]); + break; + case "change": + CBFWRoutingChange(); + break; + default: + CBFWpageBuilder(null, "CBFWRoutingPageDisplay"); + } + } else { + error_log("main interface page"); + CBFWpageBuilder(null, "CBFWRoutingPageDisplay"); + } + +} + +function CBFWRoutingPageDisplay() +{ + echo "