Setting up my convoluted web parsing structure... in short:
[glcas.git] / www / index.php
diff --git a/www/index.php b/www/index.php
new file mode 100644 (file)
index 0000000..4657e52
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+
+global $WEB_ROOT_FS, $URL_HANDLERS;
+
+// 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);
+}
+
+// include the based library
+require_once("libglcas/lib.php");
+
+// load plugins
+glcas_pluginLoader();
+
+// find our config
+$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");
+       }
+}
+
+
+$glconfig = new GLCASConfig();
+$glconfig->loadConfig($configpath);
+$webResponder = new GLCASWeb($glconfig);
+$webResponder->go($URL_HANDLERS);
+/*
+
+echo "<pre>";
+$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