From db4f63e0e2c434ded60cd1fd324be62a2aadcae1 Mon Sep 17 00:00:00 2001 From: paulr Date: Tue, 20 Sep 2011 00:24:02 +1000 Subject: [PATCH] some config work --- bin/cbfwrd.php | 4 ++++ libcbfwr/comms.php | 8 ++++---- libcbfwr/config.php | 41 +++++++++++++++++++++++++++++++++++++++++ www/index.php | 3 ++- 4 files changed, 51 insertions(+), 5 deletions(-) delete mode 100644 etc/config.php diff --git a/bin/cbfwrd.php b/bin/cbfwrd.php index 23897e1..6f49afe 100644 --- a/bin/cbfwrd.php +++ b/bin/cbfwrd.php @@ -1,7 +1,9 @@ \ No newline at end of file diff --git a/etc/config.php b/etc/config.php deleted file mode 100644 index e69de29..0000000 diff --git a/libcbfwr/comms.php b/libcbfwr/comms.php index 0098db1..808d1f8 100644 --- a/libcbfwr/comms.php +++ b/libcbfwr/comms.php @@ -1,10 +1,10 @@ \ No newline at end of file diff --git a/libcbfwr/config.php b/libcbfwr/config.php index 67c94a5..c0873b5 100644 --- a/libcbfwr/config.php +++ b/libcbfwr/config.php @@ -1,2 +1,43 @@ 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 diff --git a/www/index.php b/www/index.php index dd6163c..33f5ab2 100644 --- a/www/index.php +++ b/www/index.php @@ -1,8 +1,9 @@