aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/subscriptionController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-12-15 23:04:29 +0100
committerGravatar GitHub <noreply@github.com> 2023-12-15 23:04:29 +0100
commit6bb45a87268157aab961a6a4a728d9a9bbe043b0 (patch)
treed1c36638d5ee61e2e663d214d724a71f07a89354 /app/Controllers/subscriptionController.php
parenta3ed8269132303eebc03d3e6df822f1f101fa95b (diff)
Add filter actions (auto mark read) at category and global levels (#5942)
* Add filter actions (auto mark read) at category level fix https://github.com/FreshRSS/FreshRSS/issues/3497 * Add filter actions (auto mark read) at global level fix https://github.com/FreshRSS/FreshRSS/issues/2788 * Fix feed category ID * Minor comment
Diffstat (limited to 'app/Controllers/subscriptionController.php')
-rw-r--r--app/Controllers/subscriptionController.php75
1 files changed, 1 insertions, 74 deletions
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 8d1fc0b68..21c5abb30 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -197,7 +197,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
]);
}
- $feed->_filtersAction('read', preg_split('/[\n\r]+/', Minz_Request::paramString('filteractions_read')) ?: []);
+ $feed->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));
$feed->_kind(Minz_Request::paramInt('feed_kind') ?: FreshRSS_Feed::KIND_RSS);
if ($feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH || $feed->kind() === FreshRSS_Feed::KIND_XML_XPATH) {
@@ -279,79 +279,6 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
}
}
- public function categoryAction(): void {
- if (Minz_Request::paramBoolean('ajax')) {
- $this->view->_layout(null);
- }
-
- $categoryDAO = FreshRSS_Factory::createCategoryDao();
-
- $id = Minz_Request::paramInt('id');
- $category = $categoryDAO->searchById($id);
- if ($id === 0 || null === $category) {
- Minz_Error::error(404);
- return;
- }
- $this->view->category = $category;
-
- FreshRSS_View::prependTitle($category->name() . ' · ' . _t('sub.title') . ' · ');
-
- if (Minz_Request::isPost()) {
- if (Minz_Request::paramBoolean('use_default_purge_options')) {
- $category->_attributes('archiving', null);
- } else {
- if (!Minz_Request::paramBoolean('enable_keep_max')) {
- $keepMax = false;
- } elseif (($keepMax = Minz_Request::paramInt('keep_max')) !== 0) {
- $keepMax = FreshRSS_Feed::ARCHIVING_RETENTION_COUNT_LIMIT;
- }
- if (Minz_Request::paramBoolean('enable_keep_period')) {
- $keepPeriod = FreshRSS_Feed::ARCHIVING_RETENTION_PERIOD;
- if (is_numeric(Minz_Request::paramString('keep_period_count')) && preg_match('/^PT?1[YMWDH]$/', Minz_Request::paramString('keep_period_unit'))) {
- $keepPeriod = str_replace('1', Minz_Request::paramString('keep_period_count'), Minz_Request::paramString('keep_period_unit'));
- }
- } else {
- $keepPeriod = false;
- }
- $category->_attributes('archiving', [
- 'keep_period' => $keepPeriod,
- 'keep_max' => $keepMax,
- 'keep_min' => Minz_Request::paramInt('keep_min'),
- 'keep_favourites' => Minz_Request::paramBoolean('keep_favourites'),
- 'keep_labels' => Minz_Request::paramBoolean('keep_labels'),
- 'keep_unreads' => Minz_Request::paramBoolean('keep_unreads'),
- ]);
- }
-
- $position = Minz_Request::paramInt('position') ?: null;
- $category->_attributes('position', $position);
-
- $opml_url = checkUrl(Minz_Request::paramString('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::paramString('name'),
- 'attributes' => $category->attributes(),
- ];
-
- invalidateHttpCache();
-
- $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id, 'type' => 'category']];
- if (false !== $categoryDAO->updateCategory($id, $values)) {
- Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect);
- } else {
- Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect);
- }
- }
- }
-
/**
* This action displays the bookmarklet page.
*/