From b552abb3327f09baa1c0f4e821dc9f6bd6ef738e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 1 May 2018 17:02:11 +0200 Subject: JSON column for feeds (#1838) * Draft of JSON column for feeds https://github.com/FreshRSS/FreshRSS/issues/1654 * Add some per-feed options * Feed cURL timeout * Mark updated articles as read https://github.com/FreshRSS/FreshRSS/issues/891 * Mark as read upon reception https://github.com/FreshRSS/FreshRSS/issues/1702 * Ignore SSL (unsafe) https://github.com/FreshRSS/FreshRSS/issues/1811 * Try PHPCS workaround While waiting for a better syntax support --- app/Controllers/subscriptionController.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'app/Controllers/subscriptionController.php') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 37efd3b57..860cd912f 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -15,7 +15,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { } $catDAO = new FreshRSS_CategoryDAO(); - $feedDAO = new FreshRSS_FeedDAO(); + $feedDAO = FreshRSS_Factory::createFeedDao(); $catDAO->checkDefault(); $feedDAO->updateTTL(); @@ -74,9 +74,10 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { return; } - $this->view->feed = $this->view->feeds[$id]; + $feed = $this->view->feeds[$id]; + $this->view->feed = $feed; - Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $this->view->feed->name() . ' · '); + Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $feed->name() . ' · '); if (Minz_Request::isPost()) { $user = trim(Minz_Request::param('http_user_feed' . $id, '')); @@ -95,6 +96,13 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $ttl = FreshRSS_Context::$user_conf->ttl_default; } + $feed->_attributes('mark_updated_article_unread', Minz_Request::paramTernary('mark_updated_article_unread')); + $feed->_attributes('read_upon_reception', Minz_Request::paramTernary('read_upon_reception')); + $feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify')); + + $timeout = intval(Minz_Request::param('timeout', 0)); + $feed->_attributes('timeout', $timeout > 0 ? $timeout : null); + $values = array( 'name' => Minz_Request::param('name', ''), 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), @@ -106,14 +114,15 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { 'httpAuth' => $httpAuth, 'keep_history' => intval(Minz_Request::param('keep_history', FreshRSS_Feed::KEEP_HISTORY_DEFAULT)), 'ttl' => $ttl * ($mute ? -1 : 1), + 'attributes' => $feed->attributes() ); invalidateHttpCache(); $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id)); if ($feedDAO->updateFeed($id, $values) !== false) { - $this->view->feed->_category($cat); - $this->view->feed->faviconPrepare(); + $feed->_category($cat); + $feed->faviconPrepare(); Minz_Request::good(_t('feedback.sub.feed.updated'), $url_redirect); } else { -- cgit v1.2.3 From 4ec1ebade400725266d65dcdd368b4cee238284e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 29 May 2018 19:11:28 +0200 Subject: Feed attributes only for admin (#1905) * Feed attributes only for admin https://github.com/FreshRSS/FreshRSS/pull/1838 * Changelog 1905 https://github.com/FreshRSS/FreshRSS/pull/1905 --- CHANGELOG.md | 5 +++-- app/Controllers/subscriptionController.php | 11 ++++++++--- app/views/helpers/feed/update.phtml | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'app/Controllers/subscriptionController.php') diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cdce03e..759f5eaaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ * Several per-feed options (implemented in JSON) [#1838](https://github.com/FreshRSS/FreshRSS/pull/1838) * Mark updated articles as read [#891](https://github.com/FreshRSS/FreshRSS/issues/891) * Mark as read upon reception [#1702](https://github.com/FreshRSS/FreshRSS/issues/1702) - * Feed cURL timeout - * Ignore SSL (unsafe) [#1811](https://github.com/FreshRSS/FreshRSS/issues/1811) + * Only for admin user [#1905](https://github.com/FreshRSS/FreshRSS/pull/1905) + * Feed cURL timeout + * Ignore SSL (unsafe) [#1811](https://github.com/FreshRSS/FreshRSS/issues/1811) * Light Boolean search implementation [#879](https://github.com/FreshRSS/FreshRSS/issues/879) * All parts are implicitly `AND` (which must not be written), except if `OR` is stated. * No use of parentheses. Support for quotes to disable the Boolean search, like `"This or that"`. diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 860cd912f..701a588e0 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -98,10 +98,15 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $feed->_attributes('mark_updated_article_unread', Minz_Request::paramTernary('mark_updated_article_unread')); $feed->_attributes('read_upon_reception', Minz_Request::paramTernary('read_upon_reception')); - $feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify')); - $timeout = intval(Minz_Request::param('timeout', 0)); - $feed->_attributes('timeout', $timeout > 0 ? $timeout : null); + if (FreshRSS_Auth::hasAccess('admin')) { + $feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify')); + $timeout = intval(Minz_Request::param('timeout', 0)); + $feed->_attributes('timeout', $timeout > 0 ? $timeout : null); + } else { + $feed->_attributes('ssl_verify', null); + $feed->_attributes('timeout', null); + } $values = array( 'name' => Minz_Request::param('name', ''), diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 88a38ea58..7144aab46 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -205,6 +205,7 @@ +
@@ -224,6 +225,7 @@
+
-- cgit v1.2.3