From 509c8cae6381ec46af7c8303eb92fda6ce496a4a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 4 Jul 2022 09:53:26 +0200 Subject: Dynamic OPML (#4407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dynamic OPML draft #fix https://github.com/FreshRSS/FreshRSS/issues/4191 * Export dynamic OPML http://opml.org/spec2.opml#1629043127000 * Restart with simpler approach * Minor revert * Export dynamic OPML also for single feeds * Special category type for importing dynamic OPML * Parameter for excludeMutedFeeds * Details * More draft * i18n * Fix update * Draft manual import working * Working manual refresh * Draft automatic update * Working Web refresh + fixes * Import/export dynamic OPML settings * Annoying numerous lines in SQL logs * Fix minor JavaScript error * Fix auto adding new columns * Add require * Add missing 🗲 * Missing space * Disable adding new feeds to dynamic categories * Link from import * i18n typo * Improve theme icon function * Fix pink-dark --- app/Controllers/subscriptionController.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'app/Controllers/subscriptionController.php') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 8c7cf7e4a..cdf30b378 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -19,7 +19,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $catDAO->checkDefault(); $feedDAO->updateTTL(); - $this->view->categories = $catDAO->listSortedCategories(false); + $this->view->categories = $catDAO->listSortedCategories(false, true, true); $this->view->default_category = $catDAO->getDefault(); $signalError = false; @@ -120,11 +120,8 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $cat = intval(Minz_Request::param('category', 0)); - $mute = Minz_Request::param('mute', false); - $ttl = intval(Minz_Request::param('ttl', FreshRSS_Feed::TTL_DEFAULT)); - if ($mute && FreshRSS_Feed::TTL_DEFAULT === $ttl) { - $ttl = FreshRSS_Context::$user_conf->ttl_default; - } + $feed->_ttl(intval(Minz_Request::param('ttl', FreshRSS_Feed::TTL_DEFAULT))); + $feed->_mute(boolval(Minz_Request::param('mute', false))); $feed->_attributes('read_upon_gone', Minz_Request::paramTernary('read_upon_gone')); $feed->_attributes('mark_updated_article_unread', Minz_Request::paramTernary('mark_updated_article_unread')); @@ -196,8 +193,8 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $feed->_filtersAction('read', preg_split('/[\n\r]+/', Minz_Request::param('filteractions_read', ''))); - $feed_kind = Minz_Request::param('feed_kind', FreshRSS_Feed::KIND_RSS); - if ($feed_kind == FreshRSS_Feed::KIND_HTML_XPATH) { + $feed->_kind(intval(Minz_Request::param('feed_kind', FreshRSS_Feed::KIND_RSS))); + if ($feed->kind() == FreshRSS_Feed::KIND_HTML_XPATH) { $xPathSettings = []; if (Minz_Request::param('xPathItem', '') != '') $xPathSettings['item'] = Minz_Request::param('xPathItem', '', true); if (Minz_Request::param('xPathItemTitle', '') != '') $xPathSettings['itemTitle'] = Minz_Request::param('xPathItemTitle', '', true); @@ -214,7 +211,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $values = array( 'name' => Minz_Request::param('name', ''), - 'kind' => $feed_kind, + 'kind' => $feed->kind(), 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), 'website' => checkUrl(Minz_Request::param('website', '')), 'url' => checkUrl(Minz_Request::param('url', '')), @@ -222,7 +219,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { 'pathEntries' => Minz_Request::param('path_entries', ''), 'priority' => intval(Minz_Request::param('priority', FreshRSS_Feed::PRIORITY_MAIN_STREAM)), 'httpAuth' => $httpAuth, - 'ttl' => $ttl * ($mute ? -1 : 1), + 'ttl' => $feed->ttl(true), 'attributes' => $feed->attributes(), ); @@ -300,7 +297,17 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $position = Minz_Request::param('position'); $category->_attributes('position', '' === $position ? null : (int) $position); + $opml_url = checkUrl(Minz_Request::param('opml_url', '')); + if ($opml_url != '') { + $category->_kind(FreshRSS_Category::KIND_DYNAMIC_OPML); + $category->_attributes('opml_url', $opml_url); + } else { + $category->_kind(FreshRSS_Category::KIND_NORMAL); + $category->_attributes('opml_url', null); + } + $values = [ + 'kind' => $category->kind(), 'name' => Minz_Request::param('name', ''), 'attributes' => $category->attributes(), ]; -- cgit v1.2.3