/** * getConfig * * @return Config */ public static function getConfig() { if (self::$config) { return self::$config; } $defaultConfig = __DIR__ . '/Resource/config.yml'; $userConfig = JPATH_ROOT . '/tmp/sqlsync/config.yml'; if (!file_exists($userConfig)) { $content = ''; \JFile::write($userConfig, $content); } $config = new Config(); $config->loadFile($defaultConfig, 'yaml')->loadFile($userConfig, 'yaml'); return self::$config = $config; }
public function testLoadWrongFile() { $this->assertFalse($this->config->loadFile('wrong_file')); }
define('UI_DIR', ROOTDIR . '/ui/'); define('TEMPLATE_DIR', UI_DIR . '/templates/'); define('CONFIG_DIR', ROOTDIR . '/config/'); define('PRIV_PATH', ROOTDIR . '/private/'); session_start(); require_once 'functions.php'; require_once 'XSSProtection.php'; require_once 'autoload.php'; $_REQUEST->setType('id', array('numeric', '#[a-z_0-9]+#i')); $_REQUEST->setType('edit', array('numeric', '#[a-z_0-9]+#i')); $_REQUEST->setType('with', '#[a-z][a-z_0-9]+#i'); /** * Load and initiate the configuration class, loading database configuration */ $CONFIG = new Config(); $CONFIG->loadFile(CONFIG_DIR . "/config.php"); require_once CONFIG_DIR . '/pwdEncode.php'; /** * Fire up the database * @var Database $DB The database object */ $DB = new Database($CONFIG->DB->host, $CONFIG->DB->username, $CONFIG->DB->password, $CONFIG->DB->db, $CONFIG->DB->prefix, $CONFIG->DB->charset); /** * Load the configuration stored in the database */ $CONFIG->loadFromDatabase(); //FIXME: Clean, automate and move /* Language and encoding */ $CONFIG->Site->setDescription('charset', 'Default text-encoding'); $CONFIG->Site->setDescription('locale', 'Default locale'); if (empty($CONFIG->Site->charset)) {