<?php
$CMD_ROOT_FS = realpath(dirname(__FILE__));
+$AM_DAEMON = true;
global $CMD_ROOT_FS;
+global $AM_DAEMON;
// add libglcas as if it were a path in ../libglcas
if(file_exists("../libcbfwr")) {
glcas_pluginLoader();
error_log("CBFWRD starting");
+
+$config = new Config();
?>
\ No newline at end of file
<?php
// C = msg key
// L = locking key
-$message_key = ftok(realpath(dirname(__FILE__)), "c");
-$locking_key = ftok(realpath(dirname(__FILE__)), "l");
-$store_key = ftok(realpath(dirname(__FILE__)), "s");
+$MESSAGE_KEY = ftok(realpath(dirname(__FILE__)), "c");
+$LOCKING_KEY = ftok(realpath(dirname(__FILE__)), "l");
+$STORE_KEY = ftok(realpath(dirname(__FILE__)), "s");
-echo "comms key: $message_key, $locking_key, $store_key\n";
+global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY;
?>
\ No newline at end of file
<?php
+
+class Config {
+ // here we load a config if we can find it
+ // there are two sides to every class, the fwd side
+ // and the web page site (command line is web for all intents)
+ function __construct()
+ {
+ global $AM_DAEMON;
+
+ if($AM_DAEMON) {
+ $this->config_file = null;
+ if(file_exists("../var/fw.conf")) {
+ $this->config_file = realpath("../var/fw.conf");
+ }
+ if(file_exists("/var/lib/fwd/fw.conf")) {
+ $this->config_file = "/var/lib/fwd/fw.conf";
+ }
+
+ if($this->config_file == null) {
+ $this->config["status"] = "noconf";
+ if(is_dir("/var/lib/fwd/")) {
+ echo "no config file found. Will use ../var/fw.conf for now\n";
+ $this->config_file = "/var/lib/fwd/fw.conf";
+ } else if(is_dir("../var/")) {
+ echo "no config file found. Will use ../var/fw.conf for now\n";
+ $this->config_file = "../var/";
+ } else {
+ echo "No directory where i can create a config, bailing\n";
+ exit(0);
+ }
+ }
+ } else {
+ // config comes from shm... we'll get there
+ }
+ }
+
+
+ private $config_file;
+ private $config;
+};
+
?>
\ No newline at end of file
<?php
$WEB_ROOT_FS = realpath(dirname(__FILE__));
$BASE_URL = dirname($_SERVER["PHP_SELF"]);
+$AM_DAEMON=false;
-global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL, $AM_DAEMON;
// add libglcas as if it were a path in ../libglcas
if(file_exists("../libcbfwr")) {