diff --git a/config.php b/config.php index f15ae00..08befd5 100644 --- a/config.php +++ b/config.php @@ -20,6 +20,14 @@ class config /** Use the .php to protect the informations */ public $confFile = "./datas/configuration.php"; + /** The constructor can update the confFile variable if it is defined in a + constant */ + public function __construct () + { + if (defined("CONFIGFILE")) + $this->confFile = CONFIGFILE; + } + /** List all the parameters configurable in the software */ public function params () { @@ -40,9 +48,13 @@ class config "confFile)); + _("No configuration file '%s' available and it can't be created"), + $this->confFile)); } + elseif (! is_readable ($this->confFile)) + throw new Exception (sprintf ( + _("The configuration file '%s' is not readable"), + $this->confFile)); $conf = array (); $rc = include ($this->confFile); if ($rc !== 1) @@ -69,6 +81,10 @@ class config "No configuration file '%s' available and it can't be created", $this->confFile)); } + elseif (! is_readable ($this->confFile)) + throw new Exception (sprintf ( + _("The configuration file '%s' is not readable"), + $this->confFile)); if (!is_writeable ($this->confFile)) throw new Exception (sprintf ( "Configuration file '%s' is write protected",