示例#1
5
 function checkPermission($function)
 {
     $c = jomtube_configs::get_instance();
     $user =& JFactory::getUser();
     if ($user->gid < $c->{$function} && $c->{$function} != 29) {
         // Redirect to login
         $uri = JFactory::getURI();
         $return = $uri->toString();
         $url = 'index.php?option=com_user&view=login';
         $url .= '&return=' . base64_encode($return);
         $r = new JApplication();
         $r->redirect($url, JText::_('You do not have permission to upload videos'));
         return;
     }
 }
 function integrateVideoComments($row)
 {
     $c = jomtube_configs::get_instance();
     $jomtubeCommentingSystemCode = '';
     if ($c->commenting_system != 'No') {
         //integrate commenting system with JomComment
         if ($c->commenting_system == 'JomComment') {
             if (file_exists(JPATH_ROOT . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php')) {
                 require_once JPATH_ROOT . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
                 $jomtubeCommentingSystemCode = jomcomment($row->id, 'com_jomtube');
             } else {
                 $jomtubeCommentingSystemCode = '<b>You must install JomComment component to use comment function</b>';
             }
         }
         //integrate commenting system with JComment
         if ($c->commenting_system == 'JComment') {
             if (file_exists(JPATH_SITE . DS . 'components/com_jcomments/jcomments.php')) {
                 require_once JPATH_SITE . DS . 'components/com_jcomments/jcomments.php';
                 $jomtubeCommentingSystemCode = JComments::showComments($row->id, 'com_jomtube', $row->video_title);
             } else {
                 $jomtubeCommentingSystemCode = '<b>You must install JComment component to use comment function</b>';
             }
         }
     }
     return $jomtubeCommentingSystemCode;
 }
 function display($tpl = null)
 {
     global $mainframe;
     $link = JRequest::getVar('inputlink', '');
     $vidlink = jomtube_urldecode($link);
     $yesno[] = JHTML::_('select.option', 0, 'No');
     $yesno[] = JHTML::_('select.option', 1, 'Yes');
     //$ispublished = JHTML::_('select.genericlist', $yesno, 'published', '', 'value', 'text', $row->published == '' ? 1 : $row->published);
     //$isdownloadable = JHTML::_('select.genericlist', $yesno, 'downloadable', '', 'value', 'text', $row->downloadable == '' ? 1 : $row->downloadable );
     //$isfeatured = JHTML::_('select.genericlist', $yesno, 'featured', '', 'value', 'text', $row->featured);
     //get parent option
     $categories = JRequest::getVar('category');
     $parentOptions[] = JHTML::_('select.option', '', '-Select Parent-');
     foreach ($categories as $category) {
         $category_name = str_repeat('&nbsp;', 4 * substr_count($category->family_id, "/")) . "+" . $category->category_name;
         $parentOptions[] = JHTML::_('select.option', $category->id, $category_name);
     }
     $selectedCat = '';
     $parentSelect = JHTML::_('select.genericlist', $parentOptions, 'category_id', 'class="inputbox" size="1" ', 'value', 'text', $selectedCat);
     //assign data to template
     $this->assignRef('ispublished', $ispublished);
     $this->assignRef('isdownloadable', $isdownloadable);
     $this->assignRef('isfeatured', $isfeatured);
     $this->assignRef('parentSelect', $parentSelect);
     $this->assignRef('inputlink', $link);
     $this->assignRef('videodetails', JRequest::getVar('videodetails'));
     $this->assignRef('existed_video', JRequest::getVar('existed_video'));
     // ###########################################################
     // ###### GET ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     $this->assignRef('c', $c);
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     global $mainframe;
     //check permission
     jomtube::checkPermission("acl_addvideo");
     $c = jomtube_configs::get_instance();
     $this->assignRef('c', $c);
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     global $mainframe, $option;
     //initialise variables
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $document =& JFactory::getDocument();
     $params = clone $mainframe->getParams('com_jomtube');
     $this->assignRef('header_title', $mainframe->getPageTitle());
     // Set defaults
     $params->def('video_category', -1);
     $params->def('video_order', 'newestvideos');
     $params->def('video_layout', 'grid');
     $params->def('video_layout_columns', 4);
     $params->def('show_video_title', 1);
     $params->def('show_video_description', 0);
     $params->def('show_video_rating', 1);
     $params->def('show_video_views', 1);
     $params->def('show_video_dateadded', 1);
     $params->def('show_video_duration', 1);
     $params->def('show_video_author', 1);
     $this->assignRef('params', $params);
     $model =& $this->getModel();
     if (JRequest::getVar("category_id", 0, '', 'int') != 0) {
         $this->assignRef('breadcrum', $model->getBreadcrumb());
     }
     //Get data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $pageNav =& $this->get('Pagination');
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('user', $user);
     $this->assignRef('total', $total);
     // ###########################################################
     // ###### GET ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     //prepare %column
     /*Show player in main page*/
     $playerpath = JPATH_COMPONENT . DS . 'views' . DS . 'video' . DS . 'tmpl' . DS . 'video_player.php';
     $this->assignRef('playerpath', $playerpath);
     $this->assignRef('vidwidth', $c->width_player_in_mainpage);
     $this->assignRef('vidheight', $c->height_player_in_mainpage);
     //get video for to play in main page
     $model->_data = null;
     $row = $model->getData(1);
     $this->assignRef('row', $row[0]);
     $autostart = false;
     $this->assignRef('autostart', $autostart);
     $percent_column = 100 / intval($c->columns_per_page);
     $this->assignRef('percent_column', $percent_column);
     $this->assignRef('c', $c);
     parent::display($tpl);
 }
 /**
  * Constructor
  *
  * @since 0.9
  */
 function __construct()
 {
     parent::__construct();
     global $mainframe, $option;
     // ###########################################################
     // ###### GET ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     //$limit		= $mainframe->getUserStateFromRequest( $option.'.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limit = $c->videos_per_page;
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $array = JRequest::getVar('vid', 0, '', 'array');
     $this->setId((int) $array[0]);
 }
 function display($tpl = null)
 {
     global $mainframe, $option;
     //initialise variables
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $document =& JFactory::getDocument();
     $model =& $this->getModel();
     //Get data from the model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     $pageNav =& $this->get('Pagination');
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('user', $user);
     $this->assignRef('breadcrum', $model->getBreadcrumb());
     //Get data from the model
     $items = JRequest::getVar('items');
     $total = JRequest::getVar('totals');
     $pageNav = JRequest::getVar('pagNav');
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('user', $user);
     //get category list
     $categories =& $this->get('CategoryList');
     $parentOptions[] = JHTML::_('select.option', '', '-Select Category-');
     foreach ($categories as $category) {
         $category_name = str_repeat('&nbsp;', 4 * substr_count($category->family_id, "/")) . "+" . $category->category_name;
         $parentOptions[] = JHTML::_('select.option', $category->id, $category_name);
     }
     $categoryList = JHTML::_('select.genericlist', $parentOptions, 'category_id', 'id="catid" class="inputbox" size="1"  onchange="selectCategory(this)"', 'value', 'text', JRequest::getVar("id", "int"));
     $this->assignRef('categoryList', $categoryList);
     // ###########################################################
     // ###### GET ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     $this->assignRef('c', $c);
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     global $mainframe;
     $c = jomtube_configs::get_instance();
     //check user login
     $user =& JFactory::getUser();
     jomtube::checkPermission("acl_uploadvideo");
     //$this->setModel('video');
     $model = $this->getModel('video');
     $categories = $model->getParentOption();
     $parentOptions[] = JHTML::_('select.option', '', '-Select Parent-');
     foreach ($categories as $category) {
         $category_name = str_repeat('&nbsp;', 4 * substr_count($category->family_id, "/")) . "+" . $category->category_name;
         $parentOptions[] = JHTML::_('select.option', $category->id, $category_name);
     }
     $parentSelect = JHTML::_('select.genericlist', $parentOptions, 'category_id', 'class="inputbox" size="1" ', 'value', 'text', '');
     $this->assignRef('c', $c);
     $this->assignRef('parentSelect', $parentSelect);
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     global $mainframe;
     //Load pane behavior
     jimport('joomla.html.pane');
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $pane =& JPane::getInstance('sliders');
     $c = jomtube_configs::get_instance();
     $this->assignRef('c', $c);
     //get vars
     $cid = JRequest::getVar('cid');
     //create the toolbar
     if ($cid) {
         JToolBarHelper::title(JText::_('EDIT VIDEO'), 'jomtube-videos');
     } else {
         JToolBarHelper::title(JText::_('ADD VIDEO'), 'jomtube-videos');
     }
     JToolBarHelper::apply();
     JToolBarHelper::spacer();
     JToolBarHelper::save();
     JToolBarHelper::spacer();
     JToolBarHelper::cancel();
     //Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Data');
     if ($row->id != 0 && $row->video_type != 'local' && $row->video_type != null) {
         $r = new JApplication();
         $r->redirect('index.php?option=com_jomtube&controller=videos&task=applylink&cid=' . $row->id);
         $ispublished = JHTML::_('select.genericlist', $yesno, 'published', '', 'value', 'text', $row->published == '' ? 1 : $row->published);
         $isdownloadable = JHTML::_('select.genericlist', $yesno, 'downloadable', '', 'value', 'text', $row->downloadable == '' ? 1 : $row->downloadable);
         $isfeatured = JHTML::_('select.genericlist', $yesno, 'featured', '', 'value', 'text', $row->featured);
     }
     $yesno[] = JHTML::_('select.option', 0, 'No');
     $yesno[] = JHTML::_('select.option', 1, 'Yes');
     //get video list in local directory
     if (JRequest::getVar('category_id', '') != '') {
         $row->directory =& $this->get('CatDirectory');
         $selectedCat = JRequest::getVar('category_id', '');
     } else {
         $selectedCat = $row->id ? $row->category_id : '';
     }
     $currentdir = JPATH_SITE . (@$row->directory == '' ? '/jomtubefiles' : $row->directory);
     $dir = @opendir($currentdir);
     $videos = array();
     while ($file = @readdir($dir)) {
         if ($file != "." and $file != "..") {
             $vidfile = $file;
             $thumbdir = "_thumbs";
             $displaydir = "_display";
             if ($vidfile != $thumbdir || $vidfile != $displaydir) {
                 if (!is_dir($vidfile)) {
                     $ext = JTHelper::getFileExt($vidfile);
                     if (!$c->use_ffmpeg && $ext != 'flv') {
                         continue;
                     }
                     $list_file[] = $vidfile;
                     //JHTML::_('select.option', $vidfile);
                 }
             }
         }
         //if
     }
     @closedir($dir);
     @sort($list_file);
     if (is_array($list_file)) {
         foreach ($list_file as $file) {
             $videos[] = JHTML::_('select.option', $file);
         }
     }
     $videolist = JHTML::_('select.genericlist', $videos, 'video_url', 'id="localvideolist" class="inputbox" style="width:326px;font-size:10px;" size="7" onchange="selectthisvideo()"', 'value', 'text', $row->id ? $row->video_url : '');
     $this->assignRef('category_dir', $currentdir);
     $thumbdir = "_thumbs";
     $current_dir = $currentdir . "/" . $thumbdir;
     $dir = @opendir($current_dir);
     $thumbs = array();
     $thumb_file = array();
     while ($file = @readdir($dir)) {
         if ($file != "." and $file != "..") {
             $thumbfile = $file;
             $thumb_file[] = $thumbfile;
         }
     }
     @closedir($dir);
     if (is_array($thumb_file)) {
         sort($thumb_file);
         foreach ($thumb_file as $file) {
             $thumbs[] = JHTML::_('select.option', $thumbfile, $file);
         }
     }
     //******************************************
     $thumblist = JHTML::_('select.genericlist', $thumbs, 'video_thumb', 'id="localthumblist" class="inputbox" style="width:326px; font-size:10px;" size="7" onchange="selectthisthumb()"', 'value', 'text', $row->id ? $row->video_thumb : '');
     //get parent option
     $categories =& $this->get('ParentOption');
     $parentOptions[] = JHTML::_('select.option', '', '-Select Parent-');
     foreach ($categories as $category) {
         $category_name = str_repeat('&nbsp;', 4 * substr_count($category->family_id, "/")) . "+" . $category->category_name;
         $parentOptions[] = JHTML::_('select.option', $category->id, $category_name);
     }
     $parentSelect = JHTML::_('select.genericlist', $parentOptions, 'category_id', 'id="catid" class="inputbox" size="1"  onchange="selectCategory()"', 'value', 'text', $selectedCat);
     //clean data
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'catdescription');
     //assign data to template
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('parentSelect', $parentSelect);
     $this->assignRef('pane', $pane);
     $this->assignRef('ispublished', $ispublished);
     $this->assignRef('isdownloadable', $isdownloadable);
     $this->assignRef('isfeatured', $isfeatured);
     $this->assignRef('localvideolist', $videolist);
     $this->assignRef('localthumblist', $thumblist);
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('my', $my =& JFactory::getUser());
     parent::display($tpl);
 }
示例#10
0
 function uploadbatch($data)
 {
     $db =& JFactory::getDBO();
     $counter = 0;
     $upload_batch_dir = JPATH_SITE . "/jomtubefiles/_batch_upload/";
     $c = jomtube_configs::get_instance();
     //get category directory
     $query = 'SELECT id, directory FROM #__jomtube_categories WHERE id = \'' . $_POST['category_id'] . '\'';
     $db->setQuery($query);
     $category = $db->loadObject();
     $path_file = JPATH_SITE . $category->directory . '/';
     $path_thumb = JPATH_SITE . $category->directory . '/_thumbs/';
     $path_display = JPATH_SITE . $category->directory . '/_display/';
     if (!is_dir($path_display)) {
         $oldumask = umask(0);
         @mkdir($path_display, 0755);
         umask($oldumask);
     }
     //get video from upload batch dir
     $dir = opendir($upload_batch_dir);
     $counter = 0;
     if ($category) {
         while ($file = readdir($dir)) {
             if ($file != "." and $file != "..") {
                 $vidfile = $file;
                 if (!is_dir($vidfile)) {
                     //move file to the proper category directory
                     if (copy($upload_batch_dir . $vidfile, $path_file . $vidfile)) {
                         unlink($upload_batch_dir . $vidfile);
                         //delete original file
                         //Capitalize the first letter
                         $video_title = str_replace('_', ' ', $vidfile);
                         //remove extension of file
                         $video_title = explode('.', $video_title);
                         $video_title = $video_title[0];
                         $video_title = ucwords($video_title);
                         $_POST['video_title'] = $_POST['video_desc'] = $video_title;
                         $_POST['video_url'] = $vidfile;
                         //get video duration
                         if ($c->use_php_ffmpeg) {
                             //use php-ffmpeg
                             $sec = JTHelper::getMovieDuration($path_file . $vidfile);
                             $duration = JTHelper::sec2hms($sec);
                             //covert to 00:00:00 i.e. hrs:min:sec*/
                         } else {
                             //not use php-ffmpeg
                             $sec = 6;
                             $duration = '';
                         }
                         //get the middle of the movie (time; 00:00:00 format) for thumbnail
                         if ($c->use_ffmpeg) {
                             //use ffmpeg
                             $sec2 = $sec / 2;
                             $sec2 = @round($sec2);
                             if ($sec < 20) {
                                 $thumb_position = 5;
                             } else {
                                 $thumb_position = JTHelper::sec2hms($sec2);
                             }
                             //convert video to flv or mp4
                             if ($c->h264_convert2mp4) {
                                 $path_new = $path_file . $vidfile . '.mp4';
                                 JTHelper::movieToMp4H264_alduccino($path_file . $vidfile, $path_new, $c);
                                 //update video_url
                                 $_POST['video_url'] = $_POST['video_url'] . '.mp4';
                             } else {
                                 $path_new = $path_file . $vidfile . '.flv';
                                 $ext = JTHelper::getFileExt($vidfile);
                                 if ($ext != 'flv') {
                                     JTHelper::movieToFlv($path_file . $vidfile, $path_new, $c);
                                     //update video_url
                                     $_POST['video_url'] = $_POST['video_url'] . '.flv';
                                 }
                             }
                             $_POST['duration'] = $duration;
                             //create thumb
                             JTHelper::flvToThumbnail($path_file . $_POST['video_url'], $path_thumb . $_POST['video_url'] . '.jpg', 120, 90, $thumb_position, $c);
                             //create display image
                             JTHelper::flvToThumbnail($path_file . $_POST['video_url'], $path_display . $_POST['video_url'] . '.jpg', 470, 320, $thumb_position, $c);
                             $_POST['video_thumb'] = $_POST['video_url'] . '.jpg';
                             $this->store($_POST, 1);
                             $counter++;
                         } else {
                             // not use ffmpeg
                         }
                     }
                 }
             }
             //if
         }
         closedir($dir);
     }
     //var_dump($counter); exit();
     return $counter;
 }
 function uploadvideo()
 {
     $post = $_POST;
     //get category directory
     $categories_model = $this->getModel('categories');
     $category_directory = $categories_model->getCategoryDirectory($post['category_id']);
     $category_path = JPATH_SITE . $category_directory;
     //var_dump($category_path); exit();
     $c = jomtube_configs::get_instance();
     if ($c->uploader_type == "flashupload") {
         // ###########################################################
         // ###### USE FLASHUPLOADER PROGRESS
         // ###########################################################
         // === Instantiate the class
         $solmetraUploader = new SolmetraUploader('../administrator/components/com_jomtube/assets/lib/FlashUploader/', 'upload.php', 'administrator/components/com_jomtube/assets/lib/FlashUploader/config.php');
         // === Gather uploaded files
         // Flash Uploader populates PHP's own $_FILE global variable
         // with the information about uploaded files
         $solmetraUploader->gatherUploadedFiles();
         if (isset($_FILES) && sizeof($_FILES)) {
             //                echo '<h2>Uploaded files</h2>';
             //                echo '<pre class="info">';
             //                print_r($_FILES);
             //                echo '</pre>';
             $file_info = $_FILES['file'];
             //remove space
             $file_name = JTHelper::removeSpaceFileName($file_info['name']);
             $file_name = JTHelper::vietDecode($file_name);
             //check duplicate
             JTHelper::getNoDuplicateFileName($category_path, $file_name, 'flv');
             $tmp_name = $file_info['tmp_name'];
             if (!JFolder::exists($category_path)) {
                 JFolder::create($category_path, 775);
             }
             @copy($tmp_name, $category_path . '/' . $file_name);
             @unlink($tmp_name);
             $post['video_url'] = $file_name;
             $post['catdir'] = $category_path;
         }
     } else {
         if ($c->uploader_type == "normal") {
             // ###########################################################
             // ###### USE NORMAL UPLOAD
             // ###########################################################
             $file_info = $_FILES['file'];
             //print_r($file_info);
             //die();
             //remove space
             //$file_name = JTHelper::removeSpaceFileName($file_info['name']);
             //$file_name = JTHelper::vietDecode($file_name);
             $file_name = JTHelper::cGenRandomFilename(category_path, $file_info['name'], '');
             //echo $file_name;
             //$post['filename_random'] = $file_name;
             //check duplicate
             //JTHelper::getNoDuplicateFileName($category_path, $file_name, 'flv');
             $tmp_name = $file_info['tmp_name'];
             if (!JFolder::exists($category_path)) {
                 JFolder::create($category_path, 775);
             }
             if (move_uploaded_file($tmp_name, $category_path . '/' . $file_name)) {
                 $post['video_url'] = $file_name;
                 $post['catdir'] = $category_path;
             }
         }
     }
     // ###########################################################
     // ###### upload thumbnail if user dose not use ffmpeg
     // ###########################################################
     if (!$c->use_ffmpeg) {
         $thumb_file_tmp = $_FILES['thumbnail']['tmp_name'];
         $thumb_file = $_FILES['thumbnail']['name'];
         if (move_uploaded_file($thumb_file_tmp, $category_path . '/' . $thumb_file)) {
             $post['video_thumb'] = $thumb_file;
         }
     }
     //Store video info
     $model = $this->getModel('video');
     if ($returnid = $model->store($post, 0)) {
         $msg = JText::_('VIDEO SAVED');
         $link = JRoute::_('index.php?option=com_jomtube&view=video&id=' . $returnid);
         $cache =& JFactory::getCache('com_jomtube');
         $cache->clean();
     } else {
         $msg = '';
         $link = JRoute::_('index.php?view=videos');
     }
     $this->setRedirect($link, $msg);
 }
<?php

// no direct access
define('_JEXEC', 1);
define('JPATH_BASE', realpath(dirname(__FILE__) . '/../..'));
define('DS', DIRECTORY_SEPARATOR);
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
// Include the jomtube configs file
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jomtube' . DS . 'configs' . DS . 'configs.jomtube.php';
$c = jomtube_configs::get_instance();
//Require helperfile
require_once JPATH_BASE . DS . 'components' . DS . 'com_jomtube' . DS . 'helpers' . DS . 'helpers.php';
require_once JPATH_BASE . DS . 'components' . DS . 'com_jomtube' . DS . 'assets' . DS . 'lib' . DS . 'mix.php';
// include language file
$lang_file = JPATH_BASE . DS . 'components' . DS . 'com_jomtube' . DS . 'languages' . DS . $c->jtube_language . '.php';
$lang_default_file = JPATH_BASE . DS . 'components' . DS . 'com_jomtube' . DS . 'languages' . DS . 'english.php';
if (file_exists($lang_file)) {
    require_once $lang_file;
} else {
    require_once $lang_default_file;
}
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$task = JRequest::getVar('task', '');
switch ($task) {
    case 'aio':
        return aio();
}
function aio()
{
示例#13
0
 function _createThumb($video_path, $thumb_path, $width = 120, $height = 90, $time = 0)
 {
     $c = jomtube_configs::get_instance();
     $ffmpeg_path = $c->ffmpeg_path;
     //$command = "$ffmpeg_path -y -v 0 -i ". escapeshellarg($video_path) ." -s 120x90 -f mjpeg -t 0.001 -ss  $time". escapeshellarg($thumb_path);
     //$command = "$ffmpeg_path -y -v 0 -i ". escapeshellarg($video_path) ." -s ".$width ."x". $height . " -f mjpeg -t 0.001 -ss $time ". escapeshellarg($thumb_path);
     if ($time < 10) {
         $command = "{$ffmpeg_path} -y -itsoffset -2 -i " . escapeshellarg($video_path) . " -vcodec mjpeg -vframes 1 -an -f rawvideo -s " . $width . "x" . $height . " -ss {$time} " . escapeshellarg($thumb_path);
     } else {
         $command = "{$ffmpeg_path} -y -itsoffset -10 -i " . escapeshellarg($video_path) . " -vcodec mjpeg -vframes 1 -an -f rawvideo -s " . $width . "x" . $height . " -ss {$time} " . escapeshellarg($thumb_path);
     }
     $command .= " 2>&1";
     //echo $command; exit();
     return @exec($command, $output);
 }
 function display($tpl = null)
 {
     global $mainframe;
     //Load pane behavior
     jimport('joomla.html.pane');
     $pane =& JPane::getInstance('tabs');
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     //get vars
     $cid = JRequest::getVar('cid');
     //create the toolbar
     if ($cid) {
         JToolBarHelper::title(JText::_('CONFIGURATON'), 'jomtube-videos');
     } else {
         JToolBarHelper::title(JText::_('CONFIGURATION'), 'jomtube-videos');
     }
     //JToolBarHelper::apply();
     //JToolBarHelper::spacer();
     JToolBarHelper::save();
     JToolBarHelper::spacer();
     JToolBarHelper::cancel();
     $tmplpath = dirname(__FILE__) . DS . 'tmpl';
     $this->assignRef('tmplpath', $tmplpath);
     $this->assignRef('my', $my =& JFactory::getUser());
     $this->assignRef('pane', $pane);
     // ###########################################################
     // ###### SHOW ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     $yesno[] = JHTML::_('select.option', '0', 'No');
     $yesno[] = JHTML::_('select.option', '1', 'Yes');
     $this->assignRef('c', $c);
     $this->assignRef('yesno', $yesno);
     /*System Settings*/
     //read .ini file to get dropdown style
     $styles_file = JPATH_SITE . DS . DS . 'components' . DS . 'com_jomtube' . DS . 'assets' . DS . 'styles' . DS . 'styles.ini';
     /*if (file_exists($styles_file)) {
           $styles_contents = file_get_contents($styles_file);
           $styles = explode("\n", $styles_contents);
           foreach ($styles as $style) {
               $style = explode("-", $style);
               $jtube_skin[] = JHTML::_('select.option', trim($style[0]), trim($style[1]));
           }
       } else {
           $jtube_skin[] = JHTML::_('select.option', 'no', 'No Style');
       }*/
     //$jtube_skin = $this->getOptionFromFile($styles_file, 'no');
     $jtube_skin = $this->getTemplatesOptions('no');
     $languages_file = JPATH_SITE . DS . DS . 'components' . DS . 'com_jomtube' . DS . 'languages' . DS . 'languages.ini';
     $jtube_language = $this->getOptionFromFile($languages_file, 'english');
     /*Disply Settings*/
     $this->assignRef('jtube_skin', $jtube_skin);
     $this->assignRef('jtube_language', $jtube_language);
     /*Vdieo Player In Main Page Settings*/
     $video_play_in_mainpage[] = JHTML::_('select.option', 'Lastest Video', 'Lastest Video');
     $video_play_in_mainpage[] = JHTML::_('select.option', 'Most Viewed Video', 'Most Viewed Video');
     $video_play_in_mainpage[] = JHTML::_('select.option', 'Highest Rated Video', 'Highest Rated Video');
     $video_play_in_mainpage[] = JHTML::_('select.option', 'Featured Video', 'Featured Video');
     $this->assignRef('video_play_in_mainpage', $video_play_in_mainpage);
     /*Integratin Settings*/
     $commenting_integration[] = JHTML::_('select.option', 'No', 'No');
     $commenting_integration[] = JHTML::_('select.option', 'JComment', 'JComment');
     $commenting_integration[] = JHTML::_('select.option', 'JomComment', 'JomComment');
     $this->assignRef('commenting_integration', $commenting_integration);
     $community[] = JHTML::_('select.option', 'No', 'No');
     $community[] = JHTML::_('select.option', 'JomSocial', 'Jom Social');
     $this->assignRef('community', $community);
     /*Access Lever Settings*/
     $acl =& JFactory::getACL();
     $group_tree = array();
     //$group_tree[] = JHTML::_('select.option', -2 , '- Everybody -');
     //$group_tree[] = JHTML::_('select.option', -1, '- All Registerred Users -');
     $group_tree = array_merge($group_tree, $acl->get_group_children_tree(null, 'USERS', false));
     //var_dump($group_tree); exit();
     $this->assignRef('group_tree', $group_tree);
     /*Conversions Settings*/
     $convert_frame_size[] = JHTML::_('select.option', '160x128', 'DEFAULT 160x128');
     $convert_frame_size[] = JHTML::_('select.option', '320x240', 'QVGA 320x240 [4:3]');
     $convert_frame_size[] = JHTML::_('select.option', '320x200', 'CGA 320x200 [8:5]');
     $convert_frame_size[] = JHTML::_('select.option', '600x338', 'WVGA 640x480 [16:9]');
     $convert_frame_size[] = JHTML::_('select.option', '640x480', 'VGA 640x480 [4:3]');
     $convert_frame_size[] = JHTML::_('select.option', '720x480', 'NTSC 720x480 [3:2]');
     $convert_frame_size[] = JHTML::_('select.option', '768x576', 'PAL 768x576 [4:3]');
     $convert_frame_size[] = JHTML::_('select.option', '800x600', 'SVGA 800x600 [4:3]');
     $convert_frame_size[] = JHTML::_('select.option', '800x480', 'WVGA 800x480 [5:3]');
     $convert_frame_size[] = JHTML::_('select.option', '854x480', 'WVGA 854x480 [16:9]');
     $convert_frame_size[] = JHTML::_('select.option', '1024x600', 'WSVGA 1024x600');
     $convert_frame_size[] = JHTML::_('select.option', '1280x1024', 'SXGA 1280x1024 [5:4]');
     $convert_frame_size[] = JHTML::_('select.option', '1280x720', 'HD720 1280x720 [16:9]');
     $convert_frame_size[] = JHTML::_('select.option', '1280x768', 'WXGA 1280x768 [5:3]');
     $convert_frame_size[] = JHTML::_('select.option', '1280x800', 'WXGA 1280x800 [8:5]');
     $this->assignRef('convert_frame_size', $convert_frame_size);
     $convert_video_bitrate[] = JHTML::_('select.option', '16', '16 kbit/s - Videophone Quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '200', '200 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '300', '300 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '400', '400 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '500', '500 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '600', '600 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '700', '700 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '800', '800 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '900', '900 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '1000', '1000 kbit/s - Video-conferencing system quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '1250', '1250 kbit/s - VCD quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '5000', '5000 kbit/s - DVD quality');
     $convert_video_bitrate[] = JHTML::_('select.option', '15000', '15000 kbit/s - HDTV quality');
     $this->assignRef('convert_video_bitrate', $convert_video_bitrate);
     $convert_audio_bitrate[] = JHTML::_('select.option', '32', '32 kbit/s - AM quality');
     $convert_audio_bitrate[] = JHTML::_('select.option', '64', '64 kbit/s - Default quality');
     $convert_audio_bitrate[] = JHTML::_('select.option', '96', '96 kbit/s - FM quality');
     $convert_audio_bitrate[] = JHTML::_('select.option', '128', '128 kbit/s - Standard Bitrate quality');
     $convert_audio_bitrate[] = JHTML::_('select.option', '192', '192 kbit/s - DAB (Digital Audio Broadcasting) quality');
     $convert_audio_bitrate[] = JHTML::_('select.option', '224', '224 kbit/s - CD quality');
     $this->assignRef('convert_audio_bitrate', $convert_audio_bitrate);
     $this->h264_quality[] = JHTML::_('select.option', 'highest', 'Highest');
     $this->h264_quality[] = JHTML::_('select.option', 'default', 'Default');
     $this->h264_quality[] = JHTML::_('select.option', 'lowest', 'Lowest');
     /*Uploader Settings*/
     $uploader_type[] = JHTML::_('select.option', 'normal', 'Normal');
     $uploader_type[] = JHTML::_('select.option', 'flashupload', 'Flash Uploader Progress');
     $this->assignRef('uploader_type', $uploader_type);
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     global $mainframe;
     $mosConfig_live_site = substr(JURI::base(), 0, strlen(JURI::base()) - 1);
     //Load pane behavior
     jimport('joomla.html.pane');
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $pane =& JPane::getInstance('sliders');
     //get vars
     $cid = JRequest::getVar('id');
     //Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Data');
     //$groups 	= & $this->get( 'Groups' );
     $yesno[] = JHTML::_('select.option', 0, 'No');
     $yesno[] = JHTML::_('select.option', 1, 'Yes');
     $ispublished = JHTML::_('select.genericlist', $yesno, 'published', '', 'value', 'text', $row->published);
     $isdownloadable = JHTML::_('select.genericlist', $yesno, 'downloadable', '', 'value', 'text', $row->downloadable);
     $isfeatured = JHTML::_('select.genericlist', $yesno, 'featured', '', 'value', 'text', $row->featured);
     // ###########################################################
     // ###### SHOW ALL SETTINGS
     // ###########################################################
     $c = jomtube_configs::get_instance();
     $this->assignRef('c', $c);
     //get video list in local directory
     if (JRequest::getVar('category_id', '') != '') {
         $row->directory =& $this->get('CatDirectory');
         $selectedCat = JRequest::getVar('category_id', '');
     } else {
         $selectedCat = $row->category_id;
     }
     $currentdir = JPATH_SITE . ($row->directory == '' ? '/jomtubefiles' : $row->directory);
     $dir = @opendir($currentdir);
     $videos = array();
     while ($file = @readdir($dir)) {
         if ($file != "." and $file != "..") {
             $vidfile = $file;
             $thumbdir = "_thumbs";
             if ($vidfile != $thumbdir) {
                 if (!is_dir($vidfile)) {
                     $videos[] = JHTML::_('select.option', $vidfile);
                 }
             }
         }
         //if
     }
     @closedir($dir);
     $videolist = JHTML::_('select.genericlist', $videos, 'video_url', 'id="localvideolist" class="inputbox" style="width:326px;font-size:10px;" size="7" onchange="selectthisvideo()"', 'value', 'text', $row->video_url);
     $this->assignRef('category_dir', $currentdir);
     $thumbdir = "_thumbs";
     $current_dir = $currentdir . "/" . $thumbdir;
     $dir = @opendir($current_dir);
     $thumbs = array();
     while ($file = @readdir($dir)) {
         if ($file != "." and $file != "..") {
             $thumbfile = $file;
             $thumbs[] = JHTML::_('select.option', $thumbfile, $thumbfile);
         }
     }
     @closedir($dir);
     //******************************************
     $thumblist = JHTML::_('select.genericlist', $thumbs, 'video_thumb', 'id="localthumblist" class="inputbox" style="width:326px; font-size:10px;" size="7" onchange="selectthisthumb()"', 'value', 'text', $row->video_thumb);
     //get parent option
     $categories =& $this->get('ParentOption');
     $parentOptions[] = JHTML::_('select.option', '', '-Select Category-');
     foreach ($categories as $category) {
         $category_name = str_repeat('&nbsp;', 4 * substr_count($category->family_id, "/")) . "+" . $category->category_name;
         $parentOptions[] = JHTML::_('select.option', $category->id, $category_name);
     }
     $parentSelect = JHTML::_('select.genericlist', $parentOptions, 'category_id', 'id="catid" class="inputbox" size="1"  onchange="selectCategory(this)"', 'value', 'text', $selectedCat);
     //clean data
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'catdescription');
     //load remote video
     if ($row->video_type != 'local' && $row->video_type != 'remote' && $row->video_type != NULL) {
         $current_dir = JPATH_ADMINISTRATOR . '/components/com_jomtube/plugins/videoserver/';
         require_once $current_dir . $row->video_type . '.php';
         $fvtype = str_replace(".", "", $row->video_type);
         $popupvtype = jalemurlencode($row->video_type);
         $functionname = $fvtype . "embed";
         $embed = $functionname($row, $c);
         $this->assignRef('embed', $embed);
         //download link
         //$functiondownload = $fvtype . "generatevideodownloadlink";
         //$row->download_link = $functiondownload($row->video_url);
     } else {
         //download link
         $row->download_link = $mosConfig_live_site . $row->directory . '/' . $row->video_url;
     }
     //link tags
     $videotags_array = explode(' ', $row->tags);
     $videotagslinked = '';
     foreach ($videotags_array as $vt) {
         $link = JRoute::_("index.php?view=videos&searchkey={$vt}");
         $videotagslinked .= "<a href=\"{$link}\">{$vt}</a> ";
     }
     $uri =& JURI::getInstance();
     $baseUrl = $uri->toString(array('scheme', 'host', 'port'));
     //assign data to template
     $this->assignRef('row', $row);
     $this->assignRef('user_id', $user->id);
     $this->assignRef('user', $user);
     $this->assignRef('editor', $editor);
     $this->assignRef('parentSelect', $parentSelect);
     $this->assignRef('pane', $pane);
     $this->assignRef('ispublished', $ispublished);
     $this->assignRef('isdownloadable', $isdownloadable);
     $this->assignRef('isfeatured', $isfeatured);
     $this->assignRef('localvideolist', $videolist);
     $this->assignRef('localthumblist', $thumblist);
     $this->assignRef('videosincategory', $model->getVideosincategory());
     $this->assignRef('countvideosincategory', intval($model->getCountVideoincategory()));
     $this->assignRef('breadcrum', $model->getBreadcrumb());
     $this->assignRef('videotaglinked', $videotagslinked);
     $this->assignRef('basUrl', $baseUrl);
     //jom comments integration
     //$this->assignRef( 'jomtubeComments', toolsHelpers::integrateVideoComments($row));
     if ($c->commenting_system == "JomComment") {
         if (file_exists(JPATH_ROOT . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php')) {
             include_once JPATH_COMPONENT . DS . 'plugins' . DS . 'JomComment/comments.php';
             $this->assignRef('jomtubeComments', new JVComments());
         } else {
             $warningMsg = 'notinstall';
             $this->assignRef('jomtubeComments', $warningMsg);
         }
     }
     // ##################################################
     // ##### SETS THE PAGE TITLE AND KEYWORDS DESCRIPTION
     // ##################################################
     $document->setTitle(stripslashes(htmlspecialchars_decode($row->video_title, ENT_QUOTES)));
     $document->setMetadata('keywords', $row->tags);
     $document->setMetadata('description', $row->video_desc);
     $this->assignRef('vidwidth', $c->video_player_width);
     $this->assignRef('vidheight', $c->video_player_height);
     $this->assignRef('autostart', $c->auto_play_on_load);
     parent::display($tpl);
 }