<?php
$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
-global $WEB_ROOT_FS, $URL_HANDLERS;
+global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
// add libglcas as if it were a path in ../libglcas
if(file_exists("../libglcas")) {
$configpath = "";
// TODO: do this better
-if(file_exists($WEB_ROOT_FS."/../var")) {
-
- // is it there?
- if(file_exists($WEB_ROOT_FS."/../var/glcas/webconfig")) {
- $configpath = realpath("$WEB_ROOT_FS/../var/glcas/webconfig");
- } else {
- // if not, attempt to create
- if(!file_exists($WEB_ROOT_FS."/../var/glcas")) {
- mkdir($WEB_ROOT_FS."/../var/glcas");
- }
- // success!
- touch("$WEB_ROOT_FS/../var/glcas/webconfig");
- $configpath = realpath("$WEB_ROOT_FS/../var/glcas/webconfig");
- }
-}
+$configpath = glcas_getWebConfigPath();
+header("Accept-Ranges: bytes");
+if($configpath == false) {
+ glcas_startInstaller();
+ return;
+}
$glconfig = new GLCASConfig();
+global $glconfig;
$glconfig->loadConfig($configpath);
+
+// the global action handler
+if(isset($_REQUEST["glcasbasesendmsg"])) {
+ GLCASAddMessage($_REQUEST["msglev"], $_REQUEST["message"]);
+ header("Location: ".$_SERVER["HTTP_REFERER"]);
+ return;
+}
+
+// step up to the web responder
$webResponder = new GLCASWeb($glconfig);
$webResponder->go($URL_HANDLERS);
-/*
+
+
+
+/*
echo "<pre>";
+echo "BASEURL: $BASE_URL\n";
+echo "CUSTOM\n";
+print_r($_SERVER);
+
$vars = get_defined_vars();
foreach($vars as $var => $vkey) {
echo "VAR $var is:\n";