public function __construct()
    {
        $config = Config::GetConfig();
        
        $this->_dba = DatabaseAdapter::Create($config['db_adapter']);
        $this->_dba->connect($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_flags']);

        // Connect to the default database
        // @todo Move this decision out of this class
        if (class_exists('Bootstrap', false))
        {
            $this->_dba->selectDatabase(Bootstrap::GetDefaultDatabase());       // @todo Abstraction violation!
        }
        else
        {
            $default_db = Config::GetValue('default_db');
            
            if (isset($default_db))
            {
                $this->_dba->selectDatabase($default_db);                       // @todo Hack!
            }
        }
        
        return;
    }
                    if (!is_array($masterdetails)) {
                        pla_error("Error in configuration file, [{$masterdetails}] should be an ARRAY.");
                    }
                    foreach ($masterdetails as $key => $value) {
                        # Test that the key is correct.
                        if (!in_array($key, array_keys($this->default->{$masterkey}))) {
                            pla_error("Error in configuration file, [{$key}] has not been defined as a PLA configurable variable.");
                        }
                        # Test if its should be an array or not.
                        if (is_array($this->default->{$masterkey}[$key]['default']) && !is_array($value)) {
                            pla_error("Error in configuration file, {$masterkey}['{$key}'] SHOULD be an array of values.");
                        }
                        if (!is_array($this->default->{$masterkey}[$key]['default']) && is_array($value)) {
                            pla_error("Error in configuration file, {$masterkey}['{$key}'] should NOT be an array of values.");
                        }
                    }
                } else {
                    pla_error("Error in configuration file, [{$masterkey}] has not been defined as a PLA MASTER configurable variable.");
                }
            }
        }
    }
}
# Define our configuration variable.
$config = new Config();
require CONFDIR . 'config.php';
if (($config->GetValue('debug', 'syslog') || $config->GetValue('debug', 'file')) && $config->GetValue('debug', 'level')) {
    define('DEBUG_ENABLED', 1);
} else {
    define('DEBUG_ENABLED', 0);
}
Example #3
0
/**
 * Get/Set Config table preferences value
 */
function _pref($key, $value = '')
{
    if ($value == '') {
        $value = Config::GetValue($key);
        $value = $value['value'];
    } else {
        Config::UpdateValue($key, $value);
    }
    return $value;
}
Example #4
0
 public static function GetProperty($key)
 {
     return Config::GetValue($key);
 }