Private
Server IP : 195.201.23.43  /  Your IP : 3.145.152.98
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/kdecoratie/public_html/administrator/components/com_admintools/Dispatcher/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/kdecoratie/public_html/administrator/components/com_admintools/Dispatcher/Dispatcher.php
<?php
/**
 * @package   admintools
 * @copyright Copyright (c)2010-2019 Nicholas K. Dionysopoulos / Akeeba Ltd
 * @license   GNU General Public License version 3, or later
 */

namespace Akeeba\AdminTools\Admin\Dispatcher;

defined('_JEXEC') or die;

use Akeeba\AdminTools\Admin\Model\ConfigureWAF;
use Akeeba\AdminTools\Admin\Model\MasterPassword;
use FOF30\Container\Container;
use FOF30\Dispatcher\Mixin\ViewAliases;
use FOF30\Utils\Ip;

class Dispatcher extends \FOF30\Dispatcher\Dispatcher
{
    use ViewAliases {
        onBeforeDispatch as onBeforeDispatchViewAliases;
    }

    /** @var   string  The name of the default view, in case none is specified */
    public $defaultView = 'ControlPanel';

    public function __construct(Container $container, array $config)
    {
        parent::__construct($container, $config);

        $this->viewNameAliases = [
            'adminpw'            => 'AdminPassword',
            'badwords'           => 'BadWords',
            'badword'            => 'BadWords',
            'cpanel'             => 'ControlPanel',
            'cleantmp'           => 'CleanTempDirectory',
            'dbchcol'            => 'ChangeDBCollation',
            'dbtools'            => 'DatabaseTools',
            'eom'                => 'EmergencyOffline',
            'fixperms'           => 'FixPermissions',
            'fixpermsconfig'     => 'ConfigureFixPermissions',
            'geoblock'           => 'GeographicBlocking',
            'htmaker'            => 'HtaccessMaker',
            'importexport'       => 'ImportAndExport',
            'importexports'      => 'ImportAndExport',
            'ipautobanhistories' => 'IPAutoBanHistories',
            'ipautobanhistory'   => 'IPAutoBanHistories',
            'ipautobans'         => 'AutoBannedAddresses',
            'ipautoban'          => 'AutoBannedAddressed',
            'ipbls'              => 'BlacklistedAddresses',
            'ipbl'               => 'BlacklistedAddressed',
            'ipwls'              => 'WhitelistedAddresses',
            'ipwl'               => 'WhitelistedAddressed',
            'logs'               => 'SecurityExceptions',
            'log'                => 'SecurityExceptions',
            'masterpw'           => 'MasterPassword',
            'nginxmaker'         => 'NginXConfMaker',
            'quickstart'         => 'QuickStart',
            'redirs'             => 'Redirections',
            'redir'              => 'Redirection',
            'scanalerts'         => 'ScanAlerts',
            'scanalert'          => 'ScanAlert',
            'scanner'            => 'Scanner',
            'scan'               => 'Scan',
            'scans'              => 'Scans',
            'schedules'          => 'SchedulingInformation',
            'schedule'           => 'SchedulingInformation',
            'seoandlink'         => 'SEOAndLinkTools',
            'tmplogcheck'        => 'CheckTempAndLogDirectories',
            'waf'                => 'WebApplicationFirewall',
            'wafblacklists'      => 'WAFBlacklistedRequests',
            'wafblacklist'       => 'WAFBlacklistedRequests',
            'waftemplates'       => 'WAFEmailTemplates',
            'waftemplate'        => 'WAFEmailTemplates',
            'wafconfig'          => 'ConfigureWAF',
            'wafexceptions'      => 'ExceptionsFromWAF',
            'wcmaker'            => 'WebConfigMaker',
        ];
    }

    public function onBeforeDispatch()
    {
        $this->onBeforeDispatchViewAliases();

	    // Load the FOF language
	    $lang = $this->container->platform->getLanguage();
	    $lang->load('lib_fof30', JPATH_ADMINISTRATOR, 'en-GB', true, true);
	    $lang->load('lib_fof30', JPATH_ADMINISTRATOR, null, true, false);

		// FEF Renderer options. Used to load the common CSS file.
		$this->container->renderer->setOptions([
			'custom_css' => 'admin://components/com_admintools/media/css/backend.min.css'
		]);

	    // Load the version file
        @include_once($this->container->backEndPath . '/version.php');

        if (!defined('ADMINTOOLS_VERSION'))
        {
            define('ADMINTOOLS_VERSION', 'dev');
            define('ADMINTOOLS_DATE', date('Y-m-d'));
        }

        // Work around non-transparent proxy and reverse proxy IP issues when the feature is enabled and the plugin
        // has not done the same already.
        if (defined('ADMINTOOLS_PRO') && (ADMINTOOLS_PRO == 1))
        {
            /** @var ConfigureWAF $wafModel */
            $wafModel = $this->container->factory->model('ConfigureWAF')->tmpInstance();
            $wafConfig = $wafModel->getConfig();

            if ($wafConfig['ipworkarounds'] && !isset($_SERVER['FOF_REMOTE_ADDR']))
            {
                Ip::workaroundIPIssues();
            }
        }

        // ========== Master password check ==========
        // Control Check
        $view = $this->container->inflector->singularize($this->input->getCmd('view', $this->defaultView));

        /** @var MasterPassword $model */
        $model = $this->container->factory->model('MasterPassword')->tmpInstance();
        if (!$model->accessAllowed($view))
        {
            $url = ($view == 'cpanel') ? 'index.php' : 'index.php?option=com_admintools&view=ControlPanel';
            $this->container->platform->redirect($url, 303, \JText::_('COM_ADMINTOOLS_ERR_CONTROLPANEL_NOTAUTHORIZED'), 'error');

            return;
        }

        // Inject JS code to namespace the current jQuery instance
        if($this->container->platform->getDocument()->getType() == 'html')
        {
            \JHtml::_('jquery.framework');
            $this->container->template->addJS('admin://components/com_admintools/media/js/namespace.min.js', false, false, ADMINTOOLS_VERSION);
        }
    }
}
Private