aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-06 21:40:19 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-06 21:40:19 +0100
commitdd41642ce617ccf873974d884043c21c1fe10223 (patch)
treec1aa6da8c3508ed608aa6088a74a3b0441aff1fb /lib/lib_rss.php
parent17a280230f1e47d092d8e22bc5d1041e7a84979f (diff)
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
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php23
1 files changed, 23 insertions, 0 deletions
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'] : '';
}