7 $this->configPath = "";
11 function loadConfig($configpath)
13 error_log("loadConfig $configpath");
14 $this->configPath = $configpath;
15 $flt = file_get_contents($configpath);
16 $this->config = unserialize(base64_decode($flt));
21 function getConfigVar($var)
23 if(isset($this->config["$var"])) {
24 return $this->config["$var"];
28 function setConfigVar($var, $value)
30 if(is_array($this->config)) {
31 foreach($this->config as $vkey => $val) {
33 error_log("reset config of $var to $value");
34 $this->config[$var] = $value;
38 } else error_log("config isnt array");
41 error_log("set config of $var to $value");
42 $this->config[$var] = $value;
46 function delConfigVar($var)
48 if(is_array($this->config)) {
49 foreach($this->config as $vkey => $val) {
51 error_log("remove config of $var to $value");
52 unset($this->config[$var]);
56 } else error_log("config isnt array");
61 file_put_contents($this->configPath, base64_encode(serialize($this->config)));
67 echo "path: ".$this->configPath."\n";
68 print_r($this->config);
77 function glcas_getWebConfigPath()
79 global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
81 // if you wish to add more places to find webconfig, add them here.
83 if(file_exists($WEB_ROOT_FS."/../var/glcas/webconfig")) return realpath($WEB_ROOT_FS."/../var/glcas/webconfig");
84 if(file_exists("/var/lib/glcas/webconfig")) return realpath("/var/lib/glcas/webconfig");
85 if(file_exists("/var/run/glcas/webconfig")) return realpath("/var/run/glcas/webconfig");