- md5
- 07ce57b5cd1f23790e5d9ab239957e01
- sha1
- 2b5d7d4853f1e547b4c6fc96d1ca27b7a7c6825d
- sha256
- 3cfa8cfd37b4b95e0cbf6f4549618bbafec304b60962dd00ec46c4cd14bb4278
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
<?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\Dispatcher;
use Joomla\CMS\MVC\Controller\BaseController;
/**
* Dispatcher class for com_media
*
* @since __DEPLOY_VERSION__
*/
class MediaDispatcher extends Dispatcher
{
/**
* The extension namespace
*
* @var string
*
* @since __DEPLOY_VERSION__
*/
protected $namespace = 'Joomla\\Component\\Media';
/**
* Constructor
*
* @param CMSApplication $app The application instance
* @param Input $input The input instance
*
* @since __DEPLOY_VERSION__
*/
public function __construct(\Joomla\CMS\Application\CMSApplication $app, \JInput $input = null)
{
parent::__construct($app, $input);
// As default the view is set to featured, so we need to initialize it
$this->input->set('view', 'media');
}
/**
* Load the language
*
* @since __DEPLOY_VERSION__
*
* @return void
*/
protected function loadLanguage()
{
// Load the administrator languages needed for the media manager
$this->app->getLanguage()->load('', JPATH_ADMINISTRATOR);
$this->app->getLanguage()->load($this->option, JPATH_ADMINISTRATOR);
parent::loadLanguage();
}
/**
* Method to check component access permission
*
* @since __DEPLOY_VERSION__
*
* @return void
*/
protected function checkAccess()
{
$user = $this->app->getIdentity();
$asset = $this->input->get('asset');
$author = $this->input->get('author');
// Access check
if (!$user->authorise('core.manage', 'com_media')
&& (!$asset || (!$user->authorise('core.edit', $asset)
&& !$user->authorise('core.create', $asset)
&& count($user->getAuthorisedCategories($asset, 'core.create')) == 0)
&& !($user->id == $author && $user->authorise('core.edit.own', $asset))))
{
throw new \Joomla\CMS\Access\Exception\Notallowed(JText::_('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 __DEPLOY_VERSION__
*/
public function getController(string $name, string $client = '', array $config = array()): BaseController
{
$config['base_path'] = JPATH_ADMINISTRATOR . '/components/com_media';
// Force to load the admin controller
return parent::getController($name, 'Administrator', $config);
}
}
No other release has this exact content. See every version of this file.