Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] If RSS feed is blocked, don't allow access to RSS output #43692

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions components/com_content/src/View/Featured/FeedView.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public function display($tpl = null)
$feedEmail = $app->get('feed_email', 'none');
$siteEmail = $app->get('mailfrom');

// If the feed has been disabled, we want to bail out here
if ($params->get('show_feed_link', 1) == 0) {
throw new \Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}

$this->getDocument()->link = Route::_('index.php?option=com_content&view=featured');

// Get some data from the model
Expand Down
6 changes: 6 additions & 0 deletions components/com_finder/src/View/Search/FeedView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Document\Feed\FeedItem;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;

Expand Down Expand Up @@ -51,6 +52,11 @@ public function display($tpl = null)
$results = $this->get('Items');
$total = $this->get('Total');

// If the feed has been disabled, we want to bail out here
if ($params->get('show_feed_link', 1) == 0) {
throw new \Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}

// Push out the query data.
$explained = HTMLHelper::_('query.explained', $query);

Expand Down
7 changes: 7 additions & 0 deletions components/com_tags/src/View/Tag/FeedView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\Document\Feed\FeedItem;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;

Expand Down Expand Up @@ -39,6 +40,12 @@ public function display($tpl = null)
$ids = (array) $app->getInput()->get('id', [], 'int');
$i = 0;
$tagIds = '';
$params = $app->getParams();

// If the feed has been disabled, we want to bail out here
if ($params->get('show_feed_link', 1) == 0) {
throw new \Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}

// Remove zero values resulting from input filter
$ids = array_filter($ids);
Expand Down
7 changes: 7 additions & 0 deletions components/com_tags/src/View/Tags/FeedView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\Document\Feed\FeedItem;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;

Expand All @@ -37,6 +38,12 @@ public function display($tpl = null)
{
$app = Factory::getApplication();
$this->getDocument()->link = Route::_('index.php?option=com_tags&view=tags');
$params = $app->getParams();

// If the feed has been disabled, we want to bail out here
if ($params->get('show_feed_link', 1) == 0) {
throw new \Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}

$app->getInput()->set('limit', $app->get('feed_limit'));
$siteEmail = $app->get('mailfrom');
Expand Down
6 changes: 6 additions & 0 deletions libraries/src/MVC/View/CategoryFeedView.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public function display($tpl = null)
// Get some data from the model
$items = $this->get('Items');
$category = $this->get('Category');
$params = $app->getParams();

// If the feed has been disabled, we want to bail out here
if ($params->get('show_feed_link', 1) == 0) {
throw new \Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}

// Don't display feed if category id missing or non existent
if ($category == false || $category->alias === 'root') {
Expand Down