X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Fweb.php;h=87e7bf46854b638e92e9a194eb357f183a15ba33;hp=8e4967cdcea57ec062370699f7ba4562555fc557;hb=c184472f1c4206a3bcd76ff8e9d27dc2eb1a4c4c;hpb=9d42ecae8d0c5139e119af983a5fe65f4b0fe149
diff --git a/libcbfwr/web.php b/libcbfwr/web.php
index 8e4967c..87e7bf4 100644
--- a/libcbfwr/web.php
+++ b/libcbfwr/web.php
@@ -1,12 +1,14 @@
loadConfig($comms->getConfig(0));
+ $rconfig = $conf->getConfig();
+
+ if($rconfig["status"] != "conf") {
+ if($rconfig["status"] == "nodir") {
+ cbfw_startnodir();
+ return 0;
+ }
+ cbfw_startinstaller();
+ return 0;
+ }
+
+
if(isset($_REQUEST["q"])) {
$url = $_REQUEST["q"];
// ok, now we try and find the basics
$url_s = explode("/", $url);
+ $bodyFunction = null;
switch($url_s[0]) {
case "zones":
- $bodycontent = CBFWZonesPage($url_s);
+ CBFWZonesPage($url_s);
break;
case "interfaces":
- $bodycontent = CBFWInterfacesPage($url_s);
+ CBFWInterfacesPage($url_s);
break;
case "objects":
- $bodycontent = CBFWObjectsPage($url_s);
+ $bodyFunction = "CBFWObjectsPage";
break;
case "rules":
- $bodycontent = CBFWRulesPage($url_s);
+ $bodyFunction = "CBFWRulesPage";
+ break;
+ case "admin":
+ $bodyFunction = "CBFWAdminPage";
break;
default:
- $bodycontent = findUrl($url_s);
+ $bodyFunction = findUrl($url_s);
}
+ } else {
+ $bodyFunction = "CBFBuildHomePage";
}
- CBFWpageBuilder(null, null, $bodycontent);
+ if($bodyFunction != null) CBFWpageBuilder(null, $bodyFunction);
}
}
+
+function CBFWAdminPage($urls)
+{
+ echo "im an admin page";
+}
+
+function CBFBuildHomePage($urls)
+{
+ echo "Must remember this, gotta rules could apply to multiple zones not just one
";
+ echo "i.e.: add rule reject from object/host/hostname to address6/2003::123 in zones Zone/zonename/rulenum Zone/zonename/rulenum";
+ $conf = new Config();
+ $conf->loadConfig();
+
+ echo "
"; + print_r($conf->getConfig()); + echo "\n\n\n"; + print_r($conf->getBootConfig()); + echo ""; + +} + function CBFWMenuBuilder() { global $BASE_URL, $MENU_ITEMS; @@ -84,7 +129,7 @@ function CBFWMessageBuilder() } -function CBFWpageBuilder($bodyClass, $bodyFunction, $bodycontent=null, $title="CBFW") +function CBFWpageBuilder($bodyClass, $bodyFunction, $bodycontent=null, $title="CBFW", $bodyfunctiondata=null) { global $WEB_ROOT_FS, $BASE_URL; @@ -143,9 +188,9 @@ function CBFWpageBuilder($bodyClass, $bodyFunction, $bodycontent=null, $title="C } if($bodyClass != null) { - $bodyClass->$bodyFunction($url); + $bodyClass->$bodyFunction($bodyfunctiondata); } else if( $bodyFunction != null) { - $bodyFunction($url); + $bodyFunction($bodyfunctiondata); } else echo $bodycontent; echo ""; @@ -196,45 +241,6 @@ function cbfw_tdiffToAgo($time_in_sec) return $last; } -function cbfw_isRemoteDir($url) -{ - file_get_contents($url); - //error_log("did file_get_contents on $url"); - foreach($http_response_header as $key => $val) { - //error_log("got header of $key for $val"); - if(preg_match("/.*Location:.*/", $val)) { - //error_log("in details apt got location as $val from $url"); - $realloc = preg_replace("/.*: /", "", $val); - $urlwithslash = $url."/"; - //echo "