dde9335e0e47139afb0fc5dadf6316704912551b
[glcas.git] / lib / lib.php
1 <?php
2
3 require_once("config.php");
4 require_once("wsdl.php");
5 require_once("www.php");
6 require_once("db.php");
7 require_once("messages.php");
8 require_once("datastore.php");
9 require_once("updates.php");
10
11 // first and foremost, load the plugins
12 $basedir = dirname(__FILE__);
13
14 // we load this first
15 if(file_exists("$basedir/plugins/www.php")) require_once("$basedir/plugins/www.php");
16
17 if(is_dir("$basedir/plugins")) {
18         $dh = opendir("$basedir/plugins");
19         if($dh) {
20                 while(($file = readdir($dh))!==false) {
21                         $mt = preg_match("/.*\.php$/", $file);
22                         if($mt > 0) {
23                                 require_once("$basedir/plugins/$file");
24                                 //echo "required $basedir/plugins/$file\n";
25                         }
26                 }
27         }
28 } else {
29         echo "No plugins dir ($basedir/plugins), continuing without\n";
30 }
31
32 function urlInterpretter()
33 {
34         global $BASE_URLS;
35         global $URL_COMPONENTS;
36         
37         if(isset($_REQUEST["q"])) $qry = $_REQUEST["q"];
38         else $qry = "";
39         
40         $urlcomps = preg_split("/[,\/]/", $qry);
41         $URL_COMPONENTS = $urlcomps;
42         
43         foreach($BASE_URLS as $bases_cd => $bases) {
44                 //echo "<br>checking $bases_cd for ".$bases["base"]." against \"".$urlcomps[0]."\"<br>";
45                 if(strtolower($urlcomps[0]) == strtolower($bases["base"])) {
46                         //echo "match<br>";
47                         $func = $bases["function"];
48                         return $func();
49                 }
50         }
51 }
52
53 $db = db_getDB();
54 db_createTable("options", "option_name", "option_value");
55 ?>