<?php
/*
 * @package Joomla 3.0
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 *
 * @component XMovie Component
 * @copyright Copyright (C) Dana Harris optikool.com
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die('Restricted access');

if (!defined('DS'))
    define('DS', DIRECTORY_SEPARATOR);

JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
require_once(JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'movie.php');
require_once(JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'category.php');
require_once(JPATH_COMPONENT_SITE . DS . 'router.php');

$cfgParams = JComponentHelper::getParams('com_xmovie');
$image_path = JComponentHelper::getParams('com_media') -> get('image_path', 'images');

if (empty($cfgParams)) {
    JError::raiseWarning(404, JText::_('COM_XMOVIE_NO_CONFIG_SET'));

    $imagPath = '';
    $moviePath = '';
    $errorChecking = '';
} else {
    $imagPath = $cfgParams -> get('movie_thumb_path');
    $moviePath = $cfgParams -> get('movie_path');
    $errorChecking = $cfgParams -> get('enable_error');
}

define('COM_XMOVIE_BASE', JPATH_ROOT . DS . $image_path . DS . $imagPath);
define('COM_XMOVIE_BASEURL', JURI::root() . DS . $moviePath);
define('COM_XMOVIE_BASEPATH', $cfgParams -> get('movie_thumb_path'));

if ($errorChecking) {
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
}

MovieHelper::setCookieParams();

// Include dependancies
jimport('joomla.application.component.controller');

JHtml::_('jquery.framework');   // Make sure jQuery is loaded before component JS

$controller = JControllerLegacy::getInstance('XMovie');
$controller -> execute(JRequest::getVar('task'));
$controller -> redirect();
?>
