adding some framework bits.
[anyhammer.git] / www / index.php
1 <?php
2
3
4 $WEB_ROOT_FS = realpath(dirname(__FILE__));
5 $BASE_URL = dirname($_SERVER["PHP_SELF"]);
6
7 global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
8
9 // add libglcas as if it were a path in ../libglcas
10 if(file_exists("../libanyhammer")) {
11         $path = realpath($WEB_ROOT_FS."/../");
12         error_log("added glcas path as $path");
13         set_include_path(get_include_path().PATH_SEPARATOR.$path);
14 }
15
16 // include the based library
17 require_once("libanyhammer/lib.php");
18
19 // load plugins
20 ah_pluginLoader();
21
22 // need to trigger installer here
23 $configpath = ah_getConfigPath();
24 if(!$configpath) $configpath = $WEB_ROOT_FS."/../var/anyhammer/config.db";
25 $config = new AHConfig($configpath);
26
27 $web = new AHWeb();
28
29 if(isset($_REQUEST["q"])) {
30         $url = $_REQUEST["q"];
31 } else $url = "/";
32 $web->go($url);
33
34 ?>