not entirely sure, think its all the messaging components
[glcas.git] / www / index.php
index d42091a..621c61d 100644 (file)
@@ -1,17 +1,67 @@
-<?php 
+<?php
 
-require_once("../lib/lib.php");
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
 
+global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
 
-if(function_exists("goWebProcessor")) {
-       $calls = urlInterpretter();
-       goWebProcessor($calls);
-       exit(0);
+// add libglcas as if it were a path in ../libglcas
+if(file_exists("../libglcas")) {
+       $path = realpath($WEB_ROOT_FS."/../");
+       error_log("added glcas path as $path");
+       set_include_path(get_include_path().PATH_SEPARATOR.$path);
 }
 
-?>
-<html>
-<body>
-No Web Component Installed
-</body>
-</html>
+// include the based library
+require_once("libglcas/lib.php");
+
+// load plugins
+glcas_pluginLoader();
+
+// find our config
+$configpath = "";
+
+// TODO: do this better
+$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";
+       var_dump($$var);
+       echo "\n\n";
+}
+
+echo "</pre>";
+/**/
+
+?>
\ No newline at end of file