From dd41642ce617ccf873974d884043c21c1fe10223 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 6 Jan 2015 21:40:19 +0100 Subject: Fix calls to FreshRSS_Configuration Replaced by a get_user_configuration() function in lib_rss. This function register a new configuration based on the given username and return the corresponding configuration. See https://github.com/FreshRSS/FreshRSS/issues/730 --- lib/lib_rss.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 3a929631e..8bfc6eb10 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -237,6 +237,29 @@ function listUsers() { return $final_list; } + +/** + * Register and return the configuration for a given user. + * + * Note this function has been created to generate temporary configuration + * objects. If you need a long-time configuration, please don't use this function. + * + * @param $username the name of the user of which we want the configuration. + * @return a Minz_Configuration object, null if the configuration cannot be loaded. + */ +function get_user_configuration($username) { + $namespace = time() . '_user_' . $username; + try { + Minz_Configuration::register($namespace, + join_path(USERS_PATH, $username, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php')); + return Minz_Configuration::get($namespace); + } catch(Minz_ConfigurationException $e) { + return null; + } +} + + function httpAuthUser() { return isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : ''; } -- cgit v1.2.3