basic layout stuff
[CBFWR.git] / libcbfwr / lib.php
1 <?php
2 /*
3  * 
4  * The Main lib.php file.
5  * 
6  */
7
8 //require_once();
9
10 // get the lib root, and set include path from it
11 $LIB_ROOT_FS = realpath(dirname(__FILE__));
12 global $LIB_ROOT_FS;
13
14 /*
15  * I shouldnt ever need to do this bit, but its here, just in case
16 $adpath = realpath($LIB_ROOT_FS."/../");
17 error_log("added libglcas path as $adpath");
18 set_include_path(get_include_path().PATH_SEPARATOR.$adpath);
19
20 */
21 require_once("libcbfwr/config.php");
22 require_once("libcbfwr/comms.php");
23
24 function glcas_pluginLoader($path="")
25 {
26         global $LIB_ROOT_FS;
27         if($path ==  "") {
28                 // try and find it
29                 $plpath = realpath($LIB_ROOT_FS."/../plugins/");
30                 if(file_exists($plpath."/plugin.php")) {
31                         // here it is, load away
32                         error_log("attempting to load plugins from $plpath");
33                         $dh = opendir("$plpath");
34                         if($dh) {
35                                 while(($file = readdir($dh))!==false) {
36                                         $mt = preg_match("/.*.php$/", $file);
37                                         if($mt > 0) {
38                                                 error_log("loading plugin $file");
39                                                 require_once("$plpath/$file");
40                                                 //echo "required $basedir/$file\n";
41                                         }
42                                 }
43                         }                       
44                 }
45         }
46 }
47
48
49 ?>