Moving the old code aside into the archive as i begin a new
[glcas.git] / archive / v1 / lib / lib.php
diff --git a/archive/v1/lib/lib.php b/archive/v1/lib/lib.php
new file mode 100644 (file)
index 0000000..6c48c4c
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+
+require_once("config.php");
+require_once("wsdl.php");
+require_once("www.php");
+require_once("db.php");
+require_once("messages.php");
+require_once("datastore.php");
+require_once("updates.php");
+
+global $VERSION;
+
+$VERSION["main"]["major"] = "0";
+$VERSION["main"]["minor"] = "0";
+$VERSION["main"]["release"] = "0";
+$VERSION["updateurl"]["main"] = "http://localhost/src/eclipse-workspace/glcas/release.txt";
+
+// 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) {
+               while(($file = readdir($dh))!==false) {
+                       $mt = preg_match("/.*\.php$/", $file);
+                       if($mt > 0) {
+                               require_once("$basedir/plugins/$file");
+                               //echo "required $basedir/plugins/$file\n";
+                       }
+               }
+       }
+} else {
+       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();
+               }
+       }
+}
+
+$db = db_getDB();
+db_createTable("options", "option_name", "option_value");
+?>
\ No newline at end of file