a17992439a3f0b3fbe49371d58f771b40adab29a
[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 require_once("libcbfwr/web.php");
24 require_once("libcbfwr/fwui.php");
25
26
27 function glcas_pluginLoader($path="")
28 {
29         global $LIB_ROOT_FS;
30         if($path ==  "") {
31                 // try and find it
32                 $plpath = realpath($LIB_ROOT_FS."/../plugins/");
33                 if(file_exists($plpath."/plugin.php")) {
34                         // here it is, load away
35                         error_log("attempting to load plugins from $plpath");
36                         $dh = opendir("$plpath");
37                         if($dh) {
38                                 while(($file = readdir($dh))!==false) {
39                                         $mt = preg_match("/.*.php$/", $file);
40                                         if($mt > 0) {
41                                                 error_log("loading plugin $file");
42                                                 require_once("$plpath/$file");
43                                                 //echo "required $basedir/$file\n";
44                                         }
45                                 }
46                         }                       
47                 }
48         }
49 }
50
51
52 ?>