From 278d9ee2836df7d805845077f26f8cecd16f0f4f Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 9 Jun 2016 20:04:02 +0200 Subject: ConfigManager no longer uses singleton pattern --- index.php | 317 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 190 insertions(+), 127 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index ac4a680d..d061f912 100644 --- a/index.php +++ b/index.php @@ -48,6 +48,8 @@ error_reporting(E_ALL^E_WARNING); require_once 'application/ApplicationUtils.php'; require_once 'application/Cache.php'; require_once 'application/CachedPage.php'; +require_once 'application/config/ConfigManager.php'; +require_once 'application/config/ConfigPlugin.php'; require_once 'application/FeedBuilder.php'; require_once 'application/FileUtils.php'; require_once 'application/HttpUtils.php'; @@ -59,8 +61,6 @@ require_once 'application/PageBuilder.php'; require_once 'application/TimeZone.php'; require_once 'application/Url.php'; require_once 'application/Utils.php'; -require_once 'application/config/ConfigManager.php'; -require_once 'application/config/ConfigPlugin.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; @@ -105,13 +105,13 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) { $_COOKIE['shaarli'] = session_id(); } -$conf = ConfigManager::getInstance(); +$conf = new ConfigManager(); $conf->setEmpty('general.timezone', date_default_timezone_get()); $conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); RainTPL::$tpl_dir = $conf->get('path.raintpl_tpl'); // template directory RainTPL::$cache_dir = $conf->get('path.raintpl_tmp'); // cache directory -$pluginManager = PluginManager::getInstance(); +$pluginManager = new PluginManager($conf); $pluginManager->load($conf->get('general.enabled_plugins')); date_default_timezone_set($conf->get('general.timezone', 'UTC')); @@ -133,9 +133,9 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); -if (! is_file($conf->getConfigFile())) { +if (! is_file($conf->getConfigFileExt())) { // Ensure Shaarli has proper access to its resources - $errors = ApplicationUtils::checkResourcePermissions(); + $errors = ApplicationUtils::checkResourcePermissions($conf); if ($errors != array()) { $message = '

Insufficient permissions: