adding some framework bits.
[anyhammer.git] / www / index.php
index 4d0c107..e2b7ca1 100644 (file)
@@ -1,5 +1,34 @@
 <?php
 
-// placeholder
+
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
+
+global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+
+// add libglcas as if it were a path in ../libglcas
+if(file_exists("../libanyhammer")) {
+       $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("libanyhammer/lib.php");
+
+// load plugins
+ah_pluginLoader();
+
+// need to trigger installer here
+$configpath = ah_getConfigPath();
+if(!$configpath) $configpath = $WEB_ROOT_FS."/../var/anyhammer/config.db";
+$config = new AHConfig($configpath);
+
+$web = new AHWeb();
+
+if(isset($_REQUEST["q"])) {
+       $url = $_REQUEST["q"];
+} else $url = "/";
+$web->go($url);
 
 ?>