| Current Path : /var/www/components/com_yendifvideoshare/ |
| Current File : /var/www/components/com_yendifvideoshare/yendifvideoshare.php |
<?php
/**
* @version 1.2.9
* @package Com_YendifVideoShare
* @author PluginsWare Interactive Pvt. Ltd <admin@yendifplayer.com>
* @copyright Copyright (c) 2012 - 2021 PluginsWare Interactive Pvt. Ltd. All Rights Reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Prevent direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if ( ! defined( 'DS' ) ) {
define( 'DS', DIRECTORY_SEPARATOR );
}
$app = JFactory::getApplication();
$user = JFactory::getUser();
// Get [or] Set the view
$id = $app->input->getInt( 'id', 0 );
if ( $app->input->get( 'view' ) == 'category' && $id == 0 ) {
$app->input->set( 'view', 'categories' );
} elseif ( $app->input->get( 'view' ) == 'video' ) {
if ( $id == 0 ) {
$app->input->set( 'view', 'videos' );
}
if ( $app->input->get( 'tmpl', '' ) == 'component' ) {
$app->input->set( 'view', 'player' );
}
}
$view = $app->input->get( 'view', 'categories' );
if ( $view == 'player' ) {
$app->input->set( 'format', 'raw' );
}
if ( $view == 'user' ) {
$userid = $user->get( 'id' );
if ( ! $userid ) {
$uri = JFactory::getURI();
$loginURL = 'index.php?option=com_users&view=login&Itemid=' . $app->input->getInt( 'Itemid' ) . '&return=' . base64_encode( $uri->toString() );
$app->redirect( $loginURL, JText::_( 'YENDIF_VIDEO_SHARE_PLEASE_LOGIN' ) );
return;
}
}
// Define constants for all pages
define( 'YENDIF_VIDEO_SHARE_UPLOAD_DIR', DS . 'media' . DS . 'yendifvideoshare' . DS );
define( 'YENDIF_VIDEO_SHARE_UPLOAD_BASE', JPATH_ROOT . YENDIF_VIDEO_SHARE_UPLOAD_DIR );
define( 'YENDIF_VIDEO_SHARE_UPLOAD_BASEURL', JURI::root( true ) . str_replace( DS, '/', YENDIF_VIDEO_SHARE_UPLOAD_DIR ) );
define( 'YENDIF_VIDEO_SHARE_USERID', $user->get( 'id' ) );
define( 'YENDIFVIDEOSHARE_VERSION', '1.2.9' );
// Register Libraries
JLoader::register( 'YendifVideoShareController', JPATH_COMPONENT_ADMINISTRATOR . '/controllers/controller.php' );
JLoader::register( 'YendifVideoShareModel', JPATH_COMPONENT_ADMINISTRATOR . '/models/model.php' );
JLoader::register( 'YendifVideoShareView', JPATH_COMPONENT_ADMINISTRATOR . '/views/view.php' );
JLoader::register( 'YendifVideoShareFields', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/fields.php' );
JLoader::register( 'YendifVideoSharePlayer', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/player.php' );
JLoader::register( 'YendifVideoShareUpload', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/upload.php' );
JLoader::register( 'YendifVideoShareUtils', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/utils.php' );
// Require the base controller
$controller = JString::strtolower( $view );
require_once JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php';
// Initialize the controller
$classname = 'YendifVideoShareController' . $controller;
$controller = new $classname();
// Perform the Request task
if ( $layout = $app->input->get( 'layout' ) ) {
$app->input->set( 'task', $layout );
}
$controller->execute( $app->input->get( 'task', $view ) );
$controller->redirect();