CoreFiles by mySites.guru
DisplayController.php57 lines, 1,548 bytes, from Joomla_4.0.0-rc5-Release_Candidate-Full_Package.zip
Raw History Compare with 4.0.0-rc4
md5
e0c6ec651cbe6e24e5c48dceedc332dc
sha1
da4fabeb5d1c5846d31e8e1d57f7a757f20f800d
sha256
fdc08ca7de0251ccb4a755e90bb913bb155862feddc43502176921e8b6f164ba
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_privacy
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Privacy\Site\Controller;

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;

/**
 * Privacy Controller
 *
 * @since  3.9.0
 */
class DisplayController extends BaseController
{
	/**
	 * Method to display a view.
	 *
	 * @param   boolean  $cachable   If true, the view output will be cached
	 * @param   array    $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return  $this
	 *
	 * @since   3.9.0
	 */
	public function display($cachable = false, $urlparams = [])
	{
		$view = $this->input->get('view', $this->default_view);

		// Submitting information requests through the frontend is restricted to authenticated users at this time
		if ($view === 'request' && $this->app->getIdentity()->guest)
		{
			$this->setRedirect(
				Route::_('index.php?option=com_users&view=login&return=' . base64_encode('index.php?option=com_privacy&view=request'), false)
			);

			return $this;
		}

		// Set a Referrer-Policy header for views which require it
		if (in_array($view, ['confirm', 'remind']))
		{
			Factory::getApplication()->setHeader('Referrer-Policy', 'no-referrer', true);
		}

		return parent::display($cachable, $urlparams);
	}
}

The same content is in 20 releases, Joomla 4.0.0-rc5 to 4.1.0-beta3. See them all, or every version of this file.