fixing up the "is setup" check in the installer
[gwvp.git] / www / index.php
index fb71493..6864c2c 100644 (file)
@@ -1,7 +1,44 @@
 <?php
 
+// get config
+if(file_exists("config.php")) require_once("config.php");
+
 // initial http file
-require_once("config.php");
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
+
+global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password;
+
+// the index will search for the base library depending on:
+// if lib_base is set in config.php, it'll go there and nowhere else
+// if lib_base is not set, it'll look for ../gwvplib, /usr/share/php/gwbplib and /usr/share/gwvp/gwvplib
+if(isset($lib_base)) {
+       if(file_exists($lib_base."/gwvplib.php")) {
+               $path = realpath($lib_base);
+               set_include_path(get_include_path().PATH_SEPARATOR.$path);
+       } else {
+               echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
+               echo "I have to bail";
+               return;
+       }
+} else {
+       if(file_exists("../gwvplib/gwvplib.php")) {
+               $path = realpath("../gwvplib/");
+               set_include_path(get_include_path().PATH_SEPARATOR.$path);
+       } else if(file_exists("/usr/share/php/gwvplib/gwvplib.php")) {
+               $path = realpath("/usr/share/php/gwvplib/");
+               set_include_path(get_include_path().PATH_SEPARATOR.$path);
+       } else if(file_exists("/usr/share/gwvp/gwvplib/gwvplib.php")) {
+               $path = realpath("/usr/share/gwvp/gwvplib/");
+               set_include_path(get_include_path().PATH_SEPARATOR.$path);
+       } else {
+               echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
+               echo "I have to bail";
+               return;
+       }
+}
+
+require_once("gwvplib.php");
 
 /* first determine the url, it will be something that does either or the following:
  * 
@@ -13,16 +50,13 @@ require_once("config.php");
  * 5. do we auth?
  */
 
-goWeb();
-
-echo "<pre>";
-echo "BASEURL: $BASE_URL\n";
-echo "CUSTOM\n";
-print_r($_SERVER);
-print_r($_REQUEST);
+gwvp_goWebBegin();
+//goWebGitBackEnd();
 
 
-echo "</pre>";
+if(function_exists("gwvp_DebugEnabled")) {
+       gwvp_DebugEnabled();
+}
 
 
 ?>