From 59ea9f2a3b131432236745483e20cb50338110df Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 10:14:45 +0100 Subject: Remove calls to syslog() Temporary fix: - Change syslog by Minz_Log::notice in most of the files - Logs are stored in USERS_PATH/_/log.txt for actualize_script.php - Simply comment syslog in SimplePie See https://github.com/FreshRSS/FreshRSS/issues/711 --- lib/lib_rss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 083e87745..3b3f6d279 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -180,7 +180,7 @@ function sanitizeHTML($data, $base = '') { function get_content_by_parsing ($url, $path) { require_once (LIB_PATH . '/lib_phpQuery.php'); - syslog(LOG_INFO, 'FreshRSS GET ' . $url); + Minz_Log::notice('FreshRSS GET ' . $url); $html = file_get_contents ($url); if ($html) { -- cgit v1.2.3 From 40f45c92ed96c34e1342cb50b3582b587e36a9bb Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 10:26:16 +0100 Subject: Fix get_user_configuration() There is no need to prefix namespace by the time: if conf has already been registered, it will be returned anyway! --- lib/lib_rss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 3b3f6d279..68abe602c 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -248,7 +248,7 @@ function listUsers() { * @return a Minz_Configuration object, null if the configuration cannot be loaded. */ function get_user_configuration($username) { - $namespace = time() . '_user_' . $username; + $namespace = 'user_' . $username; try { Minz_Configuration::register($namespace, join_path(USERS_PATH, $username, 'config.php'), -- cgit v1.2.3 From e078f9fdac8f666e2d2aad1b1cc8ba3aadb68ab2 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 10:47:33 +0100 Subject: Introduce url_remove_credentials() function See https://github.com/FreshRSS/FreshRSS/issues/711 --- lib/lib_rss.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 68abe602c..d4f41cf5c 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -429,3 +429,13 @@ function array_push_unique(&$array, $value) { function array_remove(&$array, $value) { $array = array_diff($array, array($value)); } + + +/** + * Sanitize a URL by removing HTTP credentials. + * @param $url the URL to sanitize. + * @return the same URL without HTTP credentials. + */ +function url_remove_credentials($url) { + return preg_replace('#((.+)://)((.+)@)?(.+)#', '${1}${5}', $url); +} -- cgit v1.2.3 From 8ff3e5363d28dff2eed6d7f152921ed093196a04 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 10:57:11 +0100 Subject: Use url_remove_credentials to log URL See https://github.com/FreshRSS/FreshRSS/issues/711 --- app/Models/Feed.php | 11 ++++------- lib/lib_rss.php | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'lib/lib_rss.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 74869bf11..5ce03be5d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -240,19 +240,16 @@ class FreshRSS_Feed extends Minz_Model { $subscribe_url = $feed->subscribe_url(true); } + $clean_url = url_remove_credentials($subscribe_url); if ($subscribe_url !== null && $subscribe_url !== $url) { - if ($this->httpAuth != '') { - // on enlève les id si authentification HTTP - $subscribe_url = preg_replace('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url); - } - $this->_url($subscribe_url); + $this->_url($clean_url); } if (($mtime === true) ||($mtime > $this->lastUpdate)) { - Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url); + Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); $this->loadEntries($feed); // et on charge les articles du flux } else { - Minz_Log::notice('FreshRSS use cache for ' . $subscribe_url); + Minz_Log::notice('FreshRSS use cache for ' . $clean_url); $this->entries = array(); } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index d4f41cf5c..e2fcb1fee 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -180,7 +180,7 @@ function sanitizeHTML($data, $base = '') { function get_content_by_parsing ($url, $path) { require_once (LIB_PATH . '/lib_phpQuery.php'); - Minz_Log::notice('FreshRSS GET ' . $url); + Minz_Log::notice('FreshRSS GET ' . url_remove_credentials($url)); $html = file_get_contents ($url); if ($html) { -- cgit v1.2.3 From 01a1179b1ae0ee92234a0ef0a67c3e5d6d0b3c7e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Jan 2015 11:05:20 +0100 Subject: Improve url_remove_credentials Use @aledeg old function instead See https://github.com/FreshRSS/FreshRSS/pull/715 See https://github.com/FreshRSS/FreshRSS/issues/711 --- lib/lib_rss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index e2fcb1fee..e5fe73041 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -437,5 +437,5 @@ function array_remove(&$array, $value) { * @return the same URL without HTTP credentials. */ function url_remove_credentials($url) { - return preg_replace('#((.+)://)((.+)@)?(.+)#', '${1}${5}', $url); + return preg_replace('/[^\/]*:[^:]*@/', '', $url); } -- cgit v1.2.3