[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_privacy/src/Controller/ -> DisplayController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_privacy
   6   *
   7   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Privacy\Site\Controller;
  12  
  13  use Joomla\CMS\MVC\Controller\BaseController;
  14  use Joomla\CMS\Router\Route;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Privacy Controller
  22   *
  23   * @since  3.9.0
  24   */
  25  class DisplayController extends BaseController
  26  {
  27      /**
  28       * Method to display a view.
  29       *
  30       * @param   boolean  $cachable   If true, the view output will be cached
  31       * @param   array    $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  32       *
  33       * @return  $this
  34       *
  35       * @since   3.9.0
  36       */
  37      public function display($cachable = false, $urlparams = [])
  38      {
  39          $view = $this->input->get('view', $this->default_view);
  40  
  41          // Submitting information requests and confirmation through the frontend is restricted to authenticated users at this time
  42          if (in_array($view, ['confirm', 'request']) && $this->app->getIdentity()->guest) {
  43              $this->setRedirect(
  44                  Route::_('index.php?option=com_users&view=login&return=' . base64_encode('index.php?option=com_privacy&view=' . $view), false)
  45              );
  46  
  47              return $this;
  48          }
  49  
  50          // Set a Referrer-Policy header for views which require it
  51          if (in_array($view, ['confirm', 'remind'])) {
  52              $this->app->setHeader('Referrer-Policy', 'no-referrer', true);
  53          }
  54  
  55          return parent::display($cachable, $urlparams);
  56      }
  57  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer