fixing up the "is setup" check in the installer
[gwvp.git] / www / index.php
1 <?php
2
3 // get config
4 if(file_exists("config.php")) require_once("config.php");
5
6 // initial http file
7 $WEB_ROOT_FS = realpath(dirname(__FILE__));
8 $BASE_URL = dirname($_SERVER["PHP_SELF"]);
9
10 global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password;
11
12 // the index will search for the base library depending on:
13 // if lib_base is set in config.php, it'll go there and nowhere else
14 // if lib_base is not set, it'll look for ../gwvplib, /usr/share/php/gwbplib and /usr/share/gwvp/gwvplib
15 if(isset($lib_base)) {
16         if(file_exists($lib_base."/gwvplib.php")) {
17                 $path = realpath($lib_base);
18                 set_include_path(get_include_path().PATH_SEPARATOR.$path);
19         } else {
20                 echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
21                 echo "I have to bail";
22                 return;
23         }
24 } else {
25         if(file_exists("../gwvplib/gwvplib.php")) {
26                 $path = realpath("../gwvplib/");
27                 set_include_path(get_include_path().PATH_SEPARATOR.$path);
28         } else if(file_exists("/usr/share/php/gwvplib/gwvplib.php")) {
29                 $path = realpath("/usr/share/php/gwvplib/");
30                 set_include_path(get_include_path().PATH_SEPARATOR.$path);
31         } else if(file_exists("/usr/share/gwvp/gwvplib/gwvplib.php")) {
32                 $path = realpath("/usr/share/gwvp/gwvplib/");
33                 set_include_path(get_include_path().PATH_SEPARATOR.$path);
34         } else {
35                 echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
36                 echo "I have to bail";
37                 return;
38         }
39 }
40
41 require_once("gwvplib.php");
42
43 /* first determine the url, it will be something that does either or the following:
44  * 
45  * 
46  * 1. admin functions (create/delete repo)
47  * 2. user functions (patch pushes, pull requests)
48  * 3. gitweb functions (to display git web output)
49  * 4. git-http-backend functions (to interact with command line functions)
50  * 5. do we auth?
51  */
52
53 gwvp_goWebBegin();
54 //goWebGitBackEnd();
55
56
57 if(function_exists("gwvp_DebugEnabled")) {
58         gwvp_DebugEnabled();
59 }
60
61
62 ?>