Просмотр исходного кода

Fix HTML encoding in preview filters (alternative) (#8259)

Alternative to https://github.com/FreshRSS/FreshRSS/pull/8222
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8222

Co-authored-by: Inverle <inverle@proton.me>
Alexandre Alapetite 4 месяцев назад
Родитель
Сommit
1621f12a15

+ 2 - 2
app/Controllers/categoryController.php

@@ -110,7 +110,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
 				$category->_attribute('read_when_same_title_in_category', null);
 			}
 
-			$category->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));
+			$category->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));	// Keep as HTML
 
 			if (Minz_Request::paramBoolean('use_default_purge_options')) {
 				$category->_attribute('archiving', null);
@@ -177,7 +177,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
 			Minz_Error::error(400);
 			return;
 		}
-		$filteractions = Minz_Request::paramTextToArray('filteractions_read');
+		$filteractions = Minz_Request::paramTextToArray('filteractions_read', plaintext: true);
 		$filteractions = array_map(fn(string $action): string => trim($action), $filteractions);
 		$filteractions = array_filter($filteractions, fn(string $action): bool => $action !== '');
 		$search = "c:$id (";

+ 3 - 3
app/Controllers/configureController.php

@@ -164,8 +164,8 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
 				'site' => Minz_Request::paramBoolean('mark_open_site'),
 				'focus' => Minz_Request::paramBoolean('mark_focus'),
 			];
-			FreshRSS_Context::userConf()->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));
-			FreshRSS_Context::userConf()->_filtersAction('star', Minz_Request::paramTextToArray('filteractions_star'));
+			FreshRSS_Context::userConf()->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));	// Keep as HTML
+			FreshRSS_Context::userConf()->_filtersAction('star', Minz_Request::paramTextToArray('filteractions_star'));	// Keep as HTML
 			FreshRSS_Context::userConf()->save();
 			invalidateHttpCache();
 
@@ -183,7 +183,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
 	public function viewFilterAction(): void {
 		$search = '';
 		$filters_name = Minz_Request::paramString('filters_name', plaintext: true);
-		$filteractions = Minz_Request::paramTextToArray($filters_name);
+		$filteractions = Minz_Request::paramTextToArray($filters_name, plaintext: true);
 		$filteractions = array_map(fn(string $action): string => trim($action), $filteractions);
 		$filteractions = array_filter($filteractions, fn(string $action): bool => $action !== '');
 		foreach ($filteractions as $action) {

+ 2 - 2
app/Controllers/subscriptionController.php

@@ -247,7 +247,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
 				]);
 			}
 
-			$feed->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));
+			$feed->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read'));	// Keep as HTML
 
 			$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) {
@@ -415,7 +415,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
 			Minz_Error::error(400);
 			return;
 		}
-		$filteractions = Minz_Request::paramTextToArray('filteractions_read');
+		$filteractions = Minz_Request::paramTextToArray('filteractions_read', plaintext: true);
 		$filteractions = array_map(fn(string $action): string => trim($action), $filteractions);
 		$filteractions = array_filter($filteractions, fn(string $action): bool => $action !== '');
 		$search = "f:$id (";

+ 1 - 1
app/Controllers/tagController.php

@@ -118,7 +118,7 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
 			}
 
 			if ($ok) {
-				$tag->_filtersAction('label', Minz_Request::paramTextToArray('filteractions_label'));
+				$tag->_filtersAction('label', Minz_Request::paramTextToArray('filteractions_label'));	// Keep as HTML
 				$ok = $tagDAO->updateTagAttributes($tag->id(), $tag->attributes()) !== false;
 			}