<?php

/*
 * @component UserPoints
 * @copyright Copyright (C) 2015-2022 Bernard Gilly - Adrien Roussel - Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use BlackSheepResearch\Component\UserPoints\Administrator\AdminController;
use BlackSheepResearch\Component\UserPoints\Site\UserPoints;

require_once JPATH_SITE.'/components/com_userpoints/userpoints_setup.php';

// Access check.
$app = Factory::getApplication();
if (!UserPoints::getUser()->authorise('core.manage', 'com_userpoints')) {
    return $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'warning');
}

$style = '.icon-32-export { background-image: url(../administrator/components/com_userpoints/assets/images/icon-32-export.png); }';
Factory::getDocument()->addStyleDeclaration($style);

// Create the controller and Perform the Request task
(new AdminController())->execute($app->input->get('task', 'cpanel', 'cmd'));

$version = USERPOINTS_NUM_VERSION;
$copyright = USERPOINTS_COPYRIGHT;
echo <<<FOOTER
    <br />
    <div align="center">
	<span><b>UserPoints <a href="https://remository.com" target="_blank">
            Version $version </a> </b> $copyright
            <a href="https://remository.com" target="_blank">https://remository.com</a>
	| <a href="https://remository.com/support/support-tickets" target="_blank" >Support Tickets</a>
        | <a href="https://docs.black-sheep-research.com/userpoints:developer" target="_blank">API Documentation</a>
            <br />UserPoints is Free Software released under the <a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GNU/GPL License</a>
        </span>
    </div>

FOOTER;
