primo commit
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contenthistory
|
||||
*
|
||||
* @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\Contenthistory\Site\Controller;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Input\Input;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* History manager display controller.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
* @param ?CMSApplication $app The Application for the dispatcher
|
||||
* @param ?Input $input The Input object for the request
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
|
||||
{
|
||||
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
|
||||
|
||||
parent::__construct($config, $factory, $app, $input);
|
||||
}
|
||||
}
|
||||
77
components/com_contenthistory/src/Dispatcher/Dispatcher.php
Normal file
77
components/com_contenthistory/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contenthistory
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Contenthistory\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Access\Exception\NotAllowed;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcher;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* ComponentDispatcher class for com_contenthistory
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Dispatcher extends ComponentDispatcher
|
||||
{
|
||||
/**
|
||||
* Load the language
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function loadLanguage()
|
||||
{
|
||||
// Load common and local language files.
|
||||
$this->app->getLanguage()->load($this->option, JPATH_ADMINISTRATOR) ||
|
||||
$this->app->getLanguage()->load($this->option, JPATH_SITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check component access permission
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception|NotAllowed
|
||||
*/
|
||||
protected function checkAccess()
|
||||
{
|
||||
// Check the user has permission to access this component if in the backend
|
||||
if ($this->app->getIdentity()->guest) {
|
||||
throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a controller from the component
|
||||
*
|
||||
* @param string $name Controller name
|
||||
* @param string $client Optional client (like Administrator, Site etc.)
|
||||
* @param array $config Optional controller config
|
||||
*
|
||||
* @return BaseController
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function getController(string $name, string $client = '', array $config = []): BaseController
|
||||
{
|
||||
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
|
||||
$client = 'Administrator';
|
||||
|
||||
return parent::getController($name, $client, $config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user