X-Git-Url: http://git.pjr.cc/?p=gwvp.git;a=blobdiff_plain;f=gwvplib%2Fgwvpweb.php;h=f01e53751651bba4091252be213b342c36d6e23f;hp=01215abe64be3bc6c8a719dcca67f54e4140f2a7;hb=942b821d861aba1da43ef6c999141853e9f8b3a8;hpb=047523a5083efd83dcd94b6d2763c9fddb913c90 diff --git a/gwvplib/gwvpweb.php b/gwvplib/gwvpweb.php index 01215ab..f01e537 100644 --- a/gwvplib/gwvpweb.php +++ b/gwvplib/gwvpweb.php @@ -3,6 +3,9 @@ // this function is the initial insertion point for the web calls, here we need to determine where we go global $CALL_ME_FUNCTIONS; +// the home_page_provders bit is an array +global $HOME_PAGE_PROVIDERS; + $MENU_ITEMS["00home"]["text"] = "Home"; $MENU_ITEMS["00home"]["link"] = "$BASE_URL"; @@ -94,7 +97,7 @@ function gwvp_goMainPage($bodyFunction = null) echo ""; } - echo ""; + echo ""; gwvp_MenuBuilder(); echo ""; gwvp_LoginBuilder(); @@ -109,7 +112,7 @@ function gwvp_goMainPage($bodyFunction = null) if(function_exists($bodyFunction)) { $bodyFunction(); } else { - error_log("Got called with non-existant body function"); + error_log("Got called with non-existant body function, $bodyFunction"); gwvp_BodyBuilder(); } } @@ -147,15 +150,40 @@ function gwvp_MessageBuilder() // builds the menu structure function gwvp_MenuBuilder() { - global $MENU_ITEMS; + global $MENU_ITEMS, $BASE_URL; ksort($MENU_ITEMS); - echo ""; + echo "
Menu
"; foreach($MENU_ITEMS as $key => $val) { $link = $val["link"]; $text = $val["text"]; - echo ""; + + // TODO: redo this bit with stristr to find urls - special case for home + $menucolor = ""; + if(isset($_REQUEST["q"])) { + $extlink = str_replace("$BASE_URL/", "", $link); + error_log("trying to do replace of $BASE_URL in $link, got $extlink for ".$_REQUEST["q"]); + if(stristr($_REQUEST["q"], $extlink)!==false) { + $menucolor = " bgcolor=\"#ffdddd\""; + + } + } else { + // special case for home + if($link == $BASE_URL) $menucolor = " bgcolor=\"#ffdddd\""; + } + + + + + if(isset($val["userlevel"])) { + if(gwvp_CheckAuthLevel($val["userlevel"])) { + echo "$text"; + } + + } else { + echo "$text"; + } } echo "
Menu$text
"; @@ -169,14 +197,23 @@ function gwvp_LoginBuilder() if($login === false) { gwvp_SingleLineLoginForm(); } else { - echo "Hello, ".gwvp_GetFullName($login); + echo "Hello, ".gwvp_GetFullName($login)." logout"; } } // builds the body structure function gwvp_BodyBuilder() { - echo "I AM THE MAIN BODY, FEAR ME!!!!"; + global $HOME_PAGE_PROVIDERS; + + echo "I AM THE MAIN BODY, FEAR ME!!!! - have no idea whats going to go here"; + if(isset($HOME_PAGE_PROVIDERS)) { + ksort($HOME_PAGE_PROVIDERS); + foreach($HOME_PAGE_PROVIDERS as $provider) { + error_log("Loading home_page_provider, $provider"); + $provider(); + } + } } // builds the tail structure @@ -185,4 +222,18 @@ function gwvp_TailBuilder() echo "Copyright 2011, PJR - licensed under GPL"; } +function gwvp_fourZeroThree() +{ + error_log("403 called"); + header("HTTP/1.0 403 Permission Denied"); +} + +function gwvp_fourZeroFour() +{ + error_log("404 called"); + header("HTTP/1.0 404 No Such Thing"); +} + + + ?> \ No newline at end of file