4dc08e893685f0b8f8223bb336aa708d9632e62e
[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, $cmd_line_tool;
7
8 $IS_WEB_REQUEST = true;\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 // error_log("CMDLINETOOL: ".$cmd_line_tool);
24
25 // need to make this db agnostic
26 if(!gwvpmini_DBExists($db_name)) {
27         if(!is_dir("$data_directory/repos")) mkdir("$data_directory/repos");
28         
29         error_log("CREATEDATABASE");
30         gwvpmini_dbCreateSQLiteStructure($db_name);
31         gwvpmini_setConfigVal("repodir", "$data_directory/repos");
32 }
33
34 // error_log("REQUEST BEGIN");
35 gwvpmini_goWeb();
36
37
38 /*echo "<pre>";
39 print_r($_SERVER);
40 print_r($_REQUEST);
41 print_r($_SESSION);
42 echo "</pre>";*/
43
44 ?>