3 // if i believed in name spacing in php, i'd use it.
4 error_log("glcasweb loaded");
8 function __construct($config)
10 $this->config = $config;
13 function go($urlhandlers)
16 if(isset($_REQUEST["q"])) {
17 $url = $_REQUEST["q"];
20 // create a url parser
21 $urlparser = new GLCASUrlParser($urlhandlers, $this->config);
24 $call_class = $urlparser->getClass($url);
25 error_log("urldecode: ".urldecode($url));
26 $call_class->go($url);
33 function GLCASMenuBuilder()
37 <a href="<?php echo $BASE_URL ?>">Home</a>
38 <a href="<?php echo $BASE_URL."/admin/"?>">Admin</a>
42 function GLCASMessageBuilder()
44 echo "<i>Messages not implemented yet</i>";
47 function GLCASpageBuilder($bodyClass, $bodyFunction, $bodycontent, $title="GLCAS")
49 global $WEB_ROOT_FS, $BASE_URL;
53 echo "<html><head><title>$title</title>";
56 if(file_exists("$WEB_ROOT_FS/css")) {
57 $dh = opendir("$WEB_ROOT_FS/css");
59 while(($file = readdir($dh))!==false) {
60 $mt = preg_match("/.*.css$/", $file);
62 error_log("loading css $file");
63 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$BASE_URL/css/$file\">";
64 //echo "required $basedir/$file\n";
71 if(file_exists("$WEB_ROOT_FS/js")) {
72 $dh = opendir("$WEB_ROOT_FS/js");
74 while(($file = readdir($dh))!==false) {
75 $mt = preg_match("/.*.js$/", $file);
77 error_log("loading js $file");
78 echo "<script type=\"text/javascript\" src=\"$BASE_URL/css/$file\"></script>";
79 //echo "required $basedir/$file\n";
90 echo "<h1>GLCAS</h1><br>";
91 echo "<table><tr><td>";
92 GLCASMessageBuilder();
93 echo "<td></tr><tr><td>";
96 echo "<table><tr><td>";
98 echo "</td></tr><tr><td>";
101 if(isset($_REQUEST["q"])) {
102 $url = $_REQUEST["q"];
105 if($bodyClass != null) {
106 $bodyClass->$bodyFunction($url);
107 } else if( $bodyFunction != null) {
109 } else echo $bodycontent;
110 echo "</td></tr></table>";
113 // close the big wrap-around table
114 echo "</td></tr></table>";
117 echo "<br><font size=\"-1\">Copyright 2011, PJR</font><br></body></html>";