updates and such
[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 global $VERSION;
12
13 $VERSION["main"]["major"] = "0";
14 $VERSION["main"]["minor"] = "0";
15 $VERSION["main"]["release"] = "0";
16 $VERSION["updateurl"]["main"] = "http://localhost/src/eclipse-workspace/glcas/release.txt";
17
18 // first and foremost, load the plugins
19 $basedir = dirname(__FILE__);
20
21 // we load this first
22 if(file_exists("$basedir/plugins/www.php")) require_once("$basedir/plugins/www.php");
23
24 if(is_dir("$basedir/plugins")) {
25         $dh = opendir("$basedir/plugins");
26         if($dh) {
27                 while(($file = readdir($dh))!==false) {
28                         $mt = preg_match("/.*\.php$/", $file);
29                         if($mt > 0) {
30                                 require_once("$basedir/plugins/$file");
31                                 //echo "required $basedir/plugins/$file\n";
32                         }
33                 }
34         }
35 } else {
36         echo "No plugins dir ($basedir/plugins), continuing without\n";
37 }
38
39 function urlInterpretter()
40 {
41         global $BASE_URLS;
42         global $URL_COMPONENTS;
43         
44         if(isset($_REQUEST["q"])) $qry = $_REQUEST["q"];
45         else $qry = "";
46         
47         $urlcomps = preg_split("/[,\/]/", $qry);
48         $URL_COMPONENTS = $urlcomps;
49         
50         foreach($BASE_URLS as $bases_cd => $bases) {
51                 //echo "<br>checking $bases_cd for ".$bases["base"]." against \"".$urlcomps[0]."\"<br>";
52                 if(strtolower($urlcomps[0]) == strtolower($bases["base"])) {
53                         //echo "match<br>";
54                         $func = $bases["function"];
55                         return $func();
56                 }
57         }
58 }
59
60 $db = db_getDB();
61 db_createTable("options", "option_name", "option_value");
62 ?>