monthlyarchive.php 3.9 KB
<?php
/* ======================================================
# Monthly Archive - Joomla! Component v4.3.3 (PRO version)
# -------------------------------------------------------
# For Joomla! 3.x
# Author: Yiannis Christodoulou (yiannis@web357.eu)
# Copyright (©) 2009-2018 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https://www.web357.eu/
# Demo: http://demo.web357.eu/?item=monthlyarchive
# Support: support@web357.eu
# Last modified: 09 Feb 2018, 13:55:18
========================================================= */

defined( '_JEXEC' ) or die( 'Restricted access' );

// BEGIN: Check if Web357 Framework plugin exists
jimport('joomla.plugin.helper');
if(!JPluginHelper::isEnabled('system', 'web357framework')):
	$web357framework_required_msg = JText::_('<p>The <strong>"Web357 Framework"</strong> is required for this extension and must be active. Please, download and install it from <a href="http://downloads.web357.eu/?item=web357framework&type=free">here</a>. It\'s FREE!</p>');
	JFactory::getApplication()->enqueueMessage($web357framework_required_msg, 'error');
	return false;
endif;
// END: Check if Web357 Framework plugin exists

// BEGIN: Check if the plugin exists
if(!JPluginHelper::isEnabled('system', 'monthlyarchive')):
	$plugin_required_msg = JText::_('<p>The <strong>"Monthly Archive"</strong> plugin is required for this extension and must be active. Check if is unpublished. If does not exists in the Plugins list, download and install it from <a href="https://www.web357.eu/downloads/" target="_blank">web357.eu/downloads</a>.</p>');
	JFactory::getApplication()->enqueueMessage($plugin_required_msg, 'error');
	return false;
endif;
// END: Check if the plugin exists

// BEGIN: Check if Download ID has been specified
if(JPluginHelper::isEnabled('system', 'monthlyarchive')):
	$comParams = JComponentHelper::getParams('com_monthlyarchive');
	$download_id = $comParams->get('download_id');

	if (empty($download_id) || $download_id == ''): // check also if is validated?
		$download_id_required_msg = JText::_('<p>You need to specify your <strong>Download ID</strong> before you can receive updates for <strong>Monthly Archive PRO</strong>. For more information please follow our instructions <a href="https://www.web357.eu/download-id" target="_blank"><strong>here</strong></a>.</p>');
		JFactory::getApplication()->enqueueMessage($download_id_required_msg, 'warning');
	endif;
endif;
// END: Check if Download ID has been specified
		
// Joomla version
JLoader::import( "joomla.version" );
$version = new JVersion();
if ($version->RELEASE >= '3.3') :
	// joomla 3.x
	JHtml::_('behavior.tabstate');
endif;

// Added for Joomla 3.0
if(!defined('DS')){
	define('DS',DIRECTORY_SEPARATOR);
};

// ACL
if (!JFactory::getUser()->authorise('core.manage', 'com_monthlyarchive')):
	return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
endif;

// CSS
jimport('joomla.environment.uri' );
$host = JURI::root();
$document = JFactory::getDocument();
$document->addStyleSheet($host.'administrator/components/com_monthlyarchive/assets/css/default.css');

// Preferences
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_monthlyarchive')):
	JToolBarHelper::preferences('com_monthlyarchive',600);
endif;

// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');

// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);

// require helper files
JLoader::register('MonthlyarchiveHelper', dirname(__FILE__) . DS . 'helpers' . DS . 'helper.php');

// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by Estore
$controller = JControllerLegacy::getInstance('Monthlyarchive');

// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));

// Redirect if set by the controller
$controller->redirect();