From 91b92d456a08b2766c57114b428c042a8fccb677 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Tue, 22 Mar 2011 15:53:47 +0100 Subject: [PATCH] bacula-web: New classe BW_Config in config.classe.php --- gui/bacula-web/classes/cfg/config.classe.php | 30 ++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/gui/bacula-web/classes/cfg/config.classe.php b/gui/bacula-web/classes/cfg/config.classe.php index 4ee62fae70..eeab16c0b8 100644 --- a/gui/bacula-web/classes/cfg/config.classe.php +++ b/gui/bacula-web/classes/cfg/config.classe.php @@ -1,29 +1,49 @@ Check_Config_file() ) + return true; } public function Check_Config_file() { - + // Check if config file exist and is readable + return is_readable( CONFIG_FILE ); } public function Get_Config() { + $this->config = parse_ini_file( $this->config_file, true ); + if( !$this->config == false ) { + // Loading database connection information + foreach( $this->config as $parameter => $value ) + { + if( is_array($value) ) // Parsing database section + array_push( $this->catalogs, $value ); + } + return true; + }else + return false; } public function Get_Config_Params( $params = array() ) { - + if( isset( $this->config[$param] ) ) + return $this->config[$param]; + else + return false; } public function Count_Catalogs() { - + return count( $this->catalogs ); } public function Get_Dsn( $catalog_id ) @@ -33,7 +53,7 @@ function __destruct() { - + } } // end classe BW_Config -- 2.39.5