X-Git-Url: http://git.pjr.cc/?p=glcas.git;a=blobdiff_plain;f=libglcas%2Fconfig_old.php;fp=libglcas%2Fconfig_old.php;h=2009823460466a5afff92850dbf35c29daf5e664;hp=0000000000000000000000000000000000000000;hb=fd77672af03a95b0d016c0c1cd76c0441a8857d1;hpb=ddd1046cdf03ee9df49543da5a11c804c1498a41 diff --git a/libglcas/config_old.php b/libglcas/config_old.php new file mode 100644 index 0000000..2009823 --- /dev/null +++ b/libglcas/config_old.php @@ -0,0 +1,92 @@ +configPath = ""; + $this->config = ""; + } + + function loadConfig($configpath) + { + error_log("loadConfig $configpath"); + $this->configPath = $configpath; + $flt = file_get_contents($configpath); + $this->config = unserialize(base64_decode($flt)); + + + } + + function getConfigVar($var) + { + if(isset($this->config["$var"])) { + return $this->config["$var"]; + } else return false; + } + + function setConfigVar($var, $value) + { + if(is_array($this->config)) { + foreach($this->config as $vkey => $val) { + if($vkey == "$var") { + error_log("reset config of $var to $value"); + $this->config[$var] = $value; + return true; + } + } + } else error_log("config isnt array"); + + // otherwise, set it + error_log("set config of $var to $value"); + $this->config[$var] = $value; + + } + + function delConfigVar($var) + { + if(is_array($this->config)) { + foreach($this->config as $vkey => $val) { + if($vkey == "$var") { + error_log("remove config of $var to $value"); + unset($this->config[$var]); + return true; + } + } + } else error_log("config isnt array"); + } + + function saveConfig() + { + file_put_contents($this->configPath, base64_encode(serialize($this->config))); + } + + function debug() + { + echo "
";
+		echo "path: ".$this->configPath."\n";
+		print_r($this->config);
+		echo "
"; + } + + private $configPath; + private $config; + +} + +function glcas_getWebConfigPath() +{ + global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; + + // if you wish to add more places to find webconfig, add them here. + $configpath = false; + if(file_exists($WEB_ROOT_FS."/../var/glcas/webconfig")) return realpath($WEB_ROOT_FS."/../var/glcas/webconfig"); + if(file_exists("/var/lib/glcas/webconfig")) return realpath("/var/lib/glcas/webconfig"); + if(file_exists("/var/run/glcas/webconfig")) return realpath("/var/run/glcas/webconfig"); + + return $configpath; + //return false; +} + + +?> \ No newline at end of file