url manipulation
[glcas.git] / lib / lib.php
index 13d5757..0b5c221 100644 (file)
@@ -20,5 +20,21 @@ if(is_dir("$basedir/plugins")) {
        echo "No plugins dir ($basedir/plugins), continuing without\n";
 }
 
-
+function urlInterpretter()
+{
+       global $BASE_URLS;
+       
+       if(isset($_REQUEST["q"])) $qry = $_REQUEST["q"];
+       else $qry = "";
+       
+       $urlcomps = preg_split("/[,\/]/", $qry);
+       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