moved some stuff back to lib from plugins
[glcas.git] / lib / lib.php
index 5e7cf40..63462fe 100644 (file)
@@ -1,7 +1,16 @@
 <?php
 
+require_once("config.php");
+require_once("wsdl.php");
+require_once("www.php");
+require_once("db.php");
+
 // first and foremost, load the plugins
 $basedir = dirname(__FILE__);
+
+// we load this first
+if(file_exists("$basedir/plugins/www.php")) require_once("$basedir/plugins/www.php");
+
 if(is_dir("$basedir/plugins")) {
        $dh = opendir("$basedir/plugins");
        if($dh) {
@@ -17,5 +26,24 @@ if(is_dir("$basedir/plugins")) {
        echo "No plugins dir ($basedir/plugins), continuing without\n";
 }
 
-
+function urlInterpretter()
+{
+       global $BASE_URLS;
+       global $URL_COMPONENTS;
+       
+       if(isset($_REQUEST["q"])) $qry = $_REQUEST["q"];
+       else $qry = "";
+       
+       $urlcomps = preg_split("/[,\/]/", $qry);
+       $URL_COMPONENTS = $urlcomps;
+       
+       foreach($BASE_URLS as $bases_cd => $bases) {
+               //echo "<br>checking $bases_cd for ".$bases["base"]." against \"".$urlcomps[0]."\"<br>";
+               if(strtolower($urlcomps[0]) == strtolower($bases["base"])) {
+                       //echo "match<br>";
+                       $func = $bases["function"];
+                       return $func();
+               }
+       }
+}
 ?>
\ No newline at end of file