2011-10-11 13:02:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-12-05 17:43:54 +00:00
|
|
|
* Patch testing component for the Joomla! CMS
|
2013-07-13 02:26:21 +00:00
|
|
|
*
|
2018-09-01 14:32:23 +00:00
|
|
|
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
|
2013-07-13 02:26:21 +00:00
|
|
|
* @license GNU General Public License version 2 or later
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
2017-08-17 23:22:01 +00:00
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
|
2011-10-11 13:02:57 +00:00
|
|
|
// Access check.
|
2017-08-17 23:22:01 +00:00
|
|
|
if (!Factory::getUser()->authorise('core.manage', 'com_patchtester'))
|
2012-06-12 18:42:45 +00:00
|
|
|
{
|
2016-03-11 16:36:53 +00:00
|
|
|
throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
|
|
|
|
2014-05-03 23:48:08 +00:00
|
|
|
// Application reference
|
2017-08-17 23:22:01 +00:00
|
|
|
$app = Factory::getApplication();
|
2014-05-03 01:56:15 +00:00
|
|
|
|
2017-01-21 19:37:31 +00:00
|
|
|
// Import our Composer autoloader to load the component classes
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
2014-05-03 23:48:08 +00:00
|
|
|
|
|
|
|
// Build the controller class name based on task
|
|
|
|
$task = $app->input->getCmd('task', 'display');
|
|
|
|
|
|
|
|
// If $task is an empty string, apply our default since JInput might not
|
|
|
|
if ($task === '')
|
|
|
|
{
|
|
|
|
$task = 'display';
|
|
|
|
}
|
|
|
|
|
|
|
|
$class = '\\PatchTester\\Controller\\' . ucfirst(strtolower($task)) . 'Controller';
|
|
|
|
|
2016-06-12 21:10:42 +00:00
|
|
|
if (!class_exists($class))
|
|
|
|
{
|
2016-06-12 21:15:18 +00:00
|
|
|
throw new InvalidArgumentException(JText::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $class), 404);
|
2016-06-12 21:10:42 +00:00
|
|
|
}
|
|
|
|
|
2014-05-03 23:48:08 +00:00
|
|
|
// Instantiate and execute the controller
|
2016-06-12 21:10:42 +00:00
|
|
|
/** @var \PatchTester\Controller\AbstractController $controller */
|
2019-08-28 00:50:21 +00:00
|
|
|
$controller = new $class($app);
|
2014-05-03 23:48:08 +00:00
|
|
|
$controller->execute();
|