cmdline tool for hooking into update githook
[gwvp-mini.git] / www / index.php
1 <?php
2 error_log("INCALLSTART ".print_r($_COOKIE, true)." -------------------- ".print_r($_SERVER,true)." ---------- ".print_r($_REQUEST, true));
3 $WEB_ROOT_FS = realpath(dirname(__FILE__));\r
4 $BASE_URL = dirname($_SERVER["PHP_SELF"]);\r
5 \r
6 global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password, $IS_WEB_REQUEST;
7
8 $IS_WEB_REQUEST = false;\r
9
10 if(file_exists("./config.php")) require_once("./config.php");
11 else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");
12 else $noconfig = true;
13
14 if(file_exists("../gwvpmini/gwvpmini.php")) require_once("../gwvpmini/gwvpmini.php");
15 else if(file_exists("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php")) require_once("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php");
16
17
18 if(isset($noconfig)) {
19         gwvpmini_goSetup();
20         return;
21 }
22
23 // need to make this db agnostic
24 if(!gwvpmini_DBExists($db_name)) {
25         if(!is_dir("$data_directory/repos")) mkdir("$data_directory/repos");
26         
27         error_log("CREATEDATABASE");
28         gwvpmini_dbCreateSQLiteStructure($db_name);
29         gwvpmini_setConfigVal("repodir", "$data_directory/repos");
30 }
31
32 error_log("REQUEST BEGIN");
33 gwvpmini_goWeb();
34
35
36 /*echo "<pre>";
37 print_r($_SERVER);
38 print_r($_REQUEST);
39 print_r($_SESSION);
40 echo "</pre>";*/
41
42 ?>