X-Git-Url: http://git.pjr.cc/?p=gwvp.git;a=blobdiff_plain;f=www%2Findex.php;h=218c5ad82749fbec6b4fd83e757929040b51b58e;hp=792b52aec5864787ed92640c08b3907f9866fa2c;hb=507bc8f2818a42d751ed6e2e2fc68ee2bde94016;hpb=2a3a171ba0f5059ca3e0e2ac62e6412e50cd6f76 diff --git a/www/index.php b/www/index.php index 792b52a..218c5ad 100644 --- a/www/index.php +++ b/www/index.php @@ -7,12 +7,35 @@ require_once("config.php"); $WEB_ROOT_FS = realpath(dirname(__FILE__)); $BASE_URL = dirname($_SERVER["PHP_SELF"]); -global $WEB_ROOT_FS, $BASE_URL, $repo_base, $data_directory, $db_type, $db_name, $db_username, $db_password; - -// add gwvplib as if it were a path in ../gwvplib -if(file_exists($lib_base)) { - $path = realpath($lib_base); - set_include_path(get_include_path().PATH_SEPARATOR.$path); +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
"; + 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
"; + echo "I have to bail"; + return; + } } require_once("gwvplib.php");