/exchange/code/trunk/administrator/components/com_exchange/exchange.php
PHP | 72 lines | 39 code | 13 blank | 20 comment | 8 complexity | d3e40fa6fe21728c0ba0ff630ecabd63 MD5 | raw file
- <?php
- /**
- * @version $Id: exchange.php 280 2010-09-18 02:14:15Z eddieajau $
- * @package NewLifeInIT
- * @subpackage com_exchange
- * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License version 2 or later.
- * @link http://www.theartofjoomla.com
- */
- // no direct access
- defined('_JEXEC') or die;
- require_once(JPATH_COMPONENT.'/version.php');
- require_once(JPATH_COMPONENT.'/helper.php');
- // Determine the request protocol
- $protocol = JRequest::getWord('protocol');
- // Get task command from the request
- $cmd = JRequest::getVar('task', null);
- // If it was a multiple option post get the selected option
- if (is_array($cmd)) {
- $cmd = array_pop(array_keys($cmd));
- }
- // Filter the command and instantiate the appropriate controller
- $cmd = JFilterInput::clean($cmd,'cmd');
- if (strpos($cmd, '.') != false) {
- // We have a defined controller/task pair -- lets split them out
- list($controllerName, $task) = explode('.', $cmd);
- // Define the controller name and path
- $controllerName = strtolower($controllerName);
- $controllerFile = ($protocol) ? $controllerName.'.'.$protocol : $controllerName;
- $controllerPath = JPATH_COMPONENT.DS.'controllers'.DS.$controllerFile.'.php';
- // If the controller file path exists, include it ... else lets die with a 500 error
- if (file_exists($controllerPath)) {
- require_once($controllerPath);
- }
- else {
- JError::raiseError(500, 'Invalid Controller');
- }
- }
- else {
- require_once(JPATH_COMPONENT.DS.'controller.php');
- // Base controller, just set the task :)
- $controllerName = null;
- $task = $cmd;
- }
- // Set the name for the controller and instantiate it
- $controllerClass = 'ExchangeController'.ucfirst($controllerName);
- if (class_exists($controllerClass)) {
- $controller = new $controllerClass();
- } else {
- JError::raiseError(500, 'Invalid Controller Class');
- }
- // Perform the Request task
- $controller->execute($task);
- // Redirect if set by the controller
- $controller->redirect();
- $version = new ExchangeVersion;
- echo '<div id="nlitcopy">Exchange Version '.$version->version.'.'.$version->subversion.':'.$version->getBuild().' '.$version->status;
- echo ' • Please support us by <a href="http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,4759/Itemid,35/" target="_blank" style="font-weight:bold">rating or writing a review</a> about this extension';
- echo '</div>';