Exemple #1
0
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Clear com_modules and com_plugins cache (needed when we alter module/plugin state)
         $core_components = array('com_modules', 'com_plugins');
         foreach ($core_components as $component) {
             try {
                 $cache = JFactory::getCache($component);
                 $cache->clean();
             } catch (Exception $e) {
                 // suck it up
             }
         }
         // Merge the language overrides
         $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
         $jlang = JFactory::getLanguage();
         $jlang->load($this->component, $paths[0], 'en-GB', true);
         $jlang->load($this->component, $paths[0], null, true);
         $jlang->load($this->component, $paths[1], 'en-GB', true);
         $jlang->load($this->component, $paths[1], null, true);
         $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[0], null, true);
         $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[1], null, true);
         // Load Akeeba Strapper
         if (!defined('ADMINTOOLSMEDIATAG')) {
             $staticFilesVersioningTag = md5(ADMINTOOLS_VERSION . ADMINTOOLS_DATE);
             define('ADMINTOOLSMEDIATAG', $staticFilesVersioningTag);
         }
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = ADMINTOOLSMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addCSSfile('admin://components/com_admintools/media/css/backend.css');
         // Work around non-transparent proxy and reverse proxy IP issues
         if (class_exists('F0FUtilsIp', true)) {
             F0FUtilsIp::workaroundIPIssues();
         }
         // Control Check
         $view = F0FInflector::singularize($this->input->getCmd('view', $this->defaultView));
         if ($view == 'liveupdate') {
             $url = JUri::base() . 'index.php?option=com_admintools';
             JFactory::getApplication()->redirect($url);
             return;
         }
         // ========== Master PW check ==========
         /** @var AdmintoolsModelMasterpw $model */
         $model = F0FModel::getAnInstance('Masterpw', 'AdmintoolsModel');
         if (!$model->accessAllowed($view)) {
             $url = $view == 'cpanel' ? 'index.php' : 'index.php?option=com_admintools&view=cpanel';
             JFactory::getApplication()->redirect($url, JText::_('ATOOLS_ERR_NOTAUTHORIZED'), 'error');
             return;
         }
     }
     return $result;
 }
Exemple #2
0
 /**
  * Work around non-transparent proxy and reverse proxy IP issues
  *
  * @return  void
  */
 protected function workaroundIP()
 {
     $enableWorkarounds = $this->componentParams->getValue('ipworkarounds', -1);
     // Upgrade from older versions (default: enable IP workarounds)
     if ($enableWorkarounds == -1) {
         $enableWorkarounds = 1;
         $this->componentParams->setValue('ipworkarounds', 1, true);
     }
     if (class_exists('F0FUtilsIp', true)) {
         F0FUtilsIp::setAllowIpOverrides($enableWorkarounds);
         F0FUtilsIp::workaroundIPIssues();
     }
 }
Exemple #3
0
if (!defined('ADMINTOOLS_VERSION') && JFile::exists($version_php)) {
    require_once $version_php;
}
// If JSON functions don't exist, load our compatibility layer
if (!function_exists('json_encode') || !function_exists('json_decode')) {
    require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'jsonlib.php';
}
JLoader::import('joomla.application.component.model');
require_once JPATH_ADMINISTRATOR . '/components/com_admintools/models/storage.php';
$paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT);
$jlang = JFactory::getLanguage();
$jlang->load('com_admintools', $paths[0], 'en-GB', true);
$jlang->load('com_admintools', $paths[0], null, true);
$jlang->load('com_admintools', $paths[1], 'en-GB', true);
$jlang->load('com_admintools', $paths[1], null, true);
$jlang->load('com_admintools' . '.override', $paths[0], 'en-GB', true);
$jlang->load('com_admintools' . '.override', $paths[0], null, true);
$jlang->load('com_admintools' . '.override', $paths[1], 'en-GB', true);
$jlang->load('com_admintools' . '.override', $paths[1], null, true);
// Force the view and task
JFactory::getApplication()->input->set('view', 'blocks');
JFactory::getApplication()->input->set('task', 'browse');
if (class_exists('JRequest')) {
    JRequest::setVar('view', 'blocks');
    JRequest::setVar('task', 'browse');
}
// Work around non-transparent proxy and reverse proxy IP issues
if (class_exists('F0FUtilsIp', true)) {
    F0FUtilsIp::workaroundIPIssues();
}
F0FDispatcher::getTmpInstance('com_admintools')->dispatch();
Exemple #4
0
	/**
	 * Work around non-transparent proxy and reverse proxy IP issues
	 *
	 * @return  void
	 */
	protected function workaroundIP()
	{
		// IP workarounds are always disabled in the Core version
		if (!defined('ADMINTOOLS_PRO'))
		{
			require_once JPATH_ADMINISTRATOR . '/components/com_admintools/version.php';
		}

		if (!ADMINTOOLS_PRO)
		{
			return;
		}

		$enableWorkarounds = $this->componentParams->getValue('ipworkarounds', -1);

		// Upgrade from older versions (default: enable IP workarounds)
		if ($enableWorkarounds == -1)
		{
			$enableWorkarounds = 1;
			$this->componentParams->setValue('ipworkarounds', 1, true);
		}

		if (class_exists('F0FUtilsIp', true))
		{
			F0FUtilsIp::setAllowIpOverrides($enableWorkarounds);
			F0FUtilsIp::workaroundIPIssues();
		}
	}