<?php
/**
* @version 1.0.0
* @package RSFiles! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

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

//add scripts
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::root(true).'/components/com_rsfiles/style.css');
$doc->addScript(JURI::root(true).'/components/com_rsfiles/assets/js/script.js');

//load files
require_once( JPATH_COMPONENT.DS.'controller.php' );
require_once( JPATH_COMPONENT.DS.'helper.php' );

//read configuration
RsfilesHelper::readConfig();

if($controller = JRequest::getWord('controller')) 
{
	$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
	if (file_exists($path)) require_once $path; else $controller = '';
}

$classname	= 'rsfilesController'.$controller;
$controller	= new $classname( );
$controller->execute(JRequest::getVar('task'));
$controller->redirect();