/** * Check video player access and cache settings and query SQL for video data * * @return Nothing */ function viewvideo() { global $hwdvs_joinv, $hwdvs_selectv, $smartyvs, $mainframe, $isModerator; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); // check component access settings and deny those without privileges if (!hwd_vs_access::allowAccess( $c->gtree_plyr, $c->gtree_plyr_child, hwd_vs_access::userGID( $my->id ))) { if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) { $smartyvs->assign("showconnectionbox", 1); hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORPLYR, "exclamation.png", 1); return; } else { $smartyvs->assign("showconnectionbox", 1); hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_PLYR_NOT_AUTHORIZED, "exclamation.png", 1); return; } } // get video id from POST array $video_id = JRequest::getInt( 'video_id', 0 ); // check video can be viewed by user $where = ' WHERE video.id = '.$video_id; $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . $where . ' ORDER BY video.date_uploaded DESC' ; $db->SetQuery($query); $row = $db->loadObject(); if (!hwd_vs_tools::validateVideoAccess($row)) { return; } // get view count hwd_vs_tools::logViewing($video_id); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php'); hwd_vs_recount::recountVideoViews($video_id); // get more videos from user if ($c->showuldr == "1") { $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . ' WHERE video.user_id = '.$row->user_id . ' AND video.published = 1' . ' AND video.approved = "yes"' . ' AND video.id <> '.$row->id . ' ORDER BY video.date_uploaded DESC' . ' LIMIT 0, '.$c->mbtu_no ; $db->SetQuery($query); $userrows = $db->loadObjectList(); } else { $userrows = null; } // get related videos if ($c->showrevi == "1") { $searchterm = addslashes($row->title." ".$row->description." ".$row->tags); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'search.php'); $whereVideos = hwd_vs_search::search_perform_videos("related",$searchterm); // get matching video data $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . $whereVideos . ' AND video.published = 1' . ' AND video.approved = "yes"' . ' AND video.id <> '.$row->id //. ' ORDER BY video.date_uploaded DESC' . ' LIMIT 0, '.$c->revi_no ; $db->SetQuery($query); $relatedrows = $db->loadObjectList(); } else { $relatedrows = null; } // get more from category if ( $c->cvordering == "orderASC" ) { $order = ' ORDER BY video.ordering ASC'; } else if ( $c->cvordering == "orderDESC" ) { $order = ' ORDER BY video.ordering DESC'; } else if ( $c->cvordering == "dateASC" ) { $order = ' ORDER BY video.date_uploaded ASC'; } else if ( $c->cvordering == "dateDESC" ) { $order = ' ORDER BY video.date_uploaded DESC'; } else if ( $c->cvordering == "nameASC" ) { $order = ' ORDER BY video.title ASC'; } else if ( $c->cvordering == "nameDESC" ) { $order = ' ORDER BY video.title DESC'; } else if ( $c->cvordering == "hitsASC" ) { $order = ' ORDER BY video.number_of_views ASC'; } else if ( $c->cvordering == "hitsDESC" ) { $order = ' ORDER BY video.number_of_views DESC'; } else if ( $c->cvordering == "voteASC" ) { $order = ' ORDER BY video.updated_rating ASC'; } else if ( $c->cvordering == "voteDESC" ) { $order = ' ORDER BY video.updated_rating DESC'; } else { $order = ' ORDER BY video.date_uploaded DESC'; } if ($c->showmftc == "1") { $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . ' WHERE video.category_id = '.$row->category_id . ' AND video.published = 1' . ' AND video.approved = "yes"' . ' AND video.id <> '.$row->id . $order . ' LIMIT 0, '.$c->mftc_no ; $db->SetQuery($query); $categoryrows = $db->loadObjectList(); } else { $categoryrows = null; } // send out hwd_vs_html::viewVideo($row, $userrows, $relatedrows, $categoryrows); }
/** * */ function frontpage($rows, $rowsfeatured, $pageNav, $total, $rowsnow, $mostviewed, $mostfavoured, $mostpopular, $rowsNbwType) { global $Itemid, $smartyvs, $mainframe, $hwdvsTemplateOverride, $limit, $limitstart; $c = hwd_vs_Config::get_instance(); $db =& JFactory::getDBO(); // load the menu name jimport( 'joomla.application.menu' ); $menu = &JMenu::getInstance('site'); $mparams = &$menu->getParams($Itemid); $mparams_pt = $mparams->get( 'page_title', ''); jimport( 'joomla.document.document' ); $doc = & JFactory::getDocument(); $app = & JFactory::getApplication(); $active = &$menu->getActive(); if (!empty($mparams_pt)) { $metatitle = $mparams_pt; } else if (!empty($active->name)) { $metatitle = $active->name; } else { $metatitle = _HWDVIDS_META_DEFAULT; } if ($limitstart > 0) { $pageNumber = intval(($limitstart/$c->vpp) + 1); if ($pageNumber > 1) { $metatitle.= " - ".JText::_('PAGE')." $pageNumber"; } } // set the page/meta title $doc->setTitle( $metatitle ); $doc->setMetaData( 'title' , $metatitle ); hwd_vs_tools::generateActiveLink(1); hwd_vs_tools::generateBreadcrumbs(); // define javascript hwd_vs_javascript::confirmdelete(); if ($limitstart == "0") { if ($rowsnow == "switch" && $c->frontpage_watched == "1") { jimport( 'joomla.application.module.helper' ); $bwn_modName = 'hwd_vs_beingwatched'; $bwn_modObj = JModuleHelper::getModule($bwn_modName); if (!isset($bwn_modObj->id)) { $query = 'SELECT id, title, module, position, showtitle, control, params FROM #__modules WHERE module = "mod_hwd_vs_beingwatched"'; $db->SetQuery($query); $bwn_modObj = $db->loadObject(); $bwn_modObj->user = 0; $bwn_modObj->content = ''; $bwn_modObj->name = ''; $bwn_modObj->style = ''; } $bwn_modContent = JModuleHelper::renderModule($bwn_modObj); $smartyvs->assign("print_nowlist", 2); $smartyvs->assign("bwn_modContent", $bwn_modContent); } if ($rowsnow !== "switch" && count($rowsnow) > 0 && $c->frontpage_watched == "1") { $params = array(); if (isset($hwdvsTemplateOverride['beingWatchNow'])) { $params['novtd'] = $hwdvsTemplateOverride['beingWatchNow']; } else { $params['novtd'] = $c->bwn_no; } if (isset($hwdvsTemplateOverride['thumbWidth5'])) { $thumbwidth = $hwdvsTemplateOverride['thumbWidth5']; $params['thumb_width'] = $hwdvsTemplateOverride['thumbWidth5']; } else { $thumbwidth = null; $params['thumb_width'] = $hwdvsTemplateOverride['thumbWidth5']; } $smartyvs->assign("print_nowlist", 1); if ($rowsNbwType == "xml") { $nowlist = hwd_vs_tools::generateVideoListFromXml($rowsnow, $thumbwidth); } else { $nowlist = hwd_vs_tools::generateVideoListFromSql($rowsnow, null, $thumbwidth); } $smartyvs->assign("nowlist", $nowlist); if ($c->loadmootools == "on") { JHTML::_('behavior.mootools'); } if (isset($hwdvsTemplateOverride['loadCarousel']) && $hwdvsTemplateOverride['loadCarousel'] == 0) { // continue; } else { require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'carousel.php'); $iCID = 'hwdvs_bwn'; hwdvsCarousel::setup($iCID, $params); $smartyvs->assign("iCID", $iCID); } } $k = 0; if (count($rowsfeatured) > 0) { $smartyvs->assign("print_featured", 1); if ($c->fvid_w == 0) { $c->fvid_w = "100%"; } if ($c->feat_show == 3) { $xspf_playlist = JPATH_SITE.'/components/com_hwdvideoshare/xml/xspf/featured.xml'; if (file_exists($xspf_playlist) && filesize($xspf_playlist) > 210) { $featured_file = null; $featured_file->id = null; $featured_file->video_type = "playlist"; $featured_file->playlist = JURI::root(true).'/components/com_hwdvideoshare/xml/xspf/featured.xml'; $array_i = 0; $featured_file->description = null; $featured_file->tags = null; } } if ($c->feat_show !== 3 || !isset($featured_file->video_type)) { if ($c->feat_show == 2) { $smartyvs->assign("showFeaturedDetails", 1); } $array_i = 0; $featured_file = $rowsfeatured[$array_i]; } if ($c->feat_as == "yes") { $as = "1"; } else if ($c->feat_as == "no") { $as = "0"; } else if ($c->feat_as == "first") { $fas_check = $mainframe->getUserState( "hwdvs_fas_check", "notviewed" ); if ($fas_check !== "viewed") { $mainframe->setUserState( "hwdvs_fas_check", "viewed" ); $as = "1"; } else { $as = "0"; } } else { $as = null; } hwd_vs_tools::logViewing($featured_file->id); //require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php'); //hwd_vs_recount::recountVideoViews($featured_file->id); if ($c->usehq == "1") { $quality = "hd"; } else if ($c->usehq == "2") { $quality = "sd"; } else { $quality = null; } $featured_video_player = hwd_vs_tools::generateVideoPlayer($featured_file, $c->fvid_w, $c->fvid_h, $as, $quality); $smartyvs->assign("featured_video_player", $featured_video_player); $meta_description = hwd_vs_tools::generateMetaText($featured_file->description); $meta_tags = hwd_vs_tools::generateMetaText($featured_file->tags); // set the page/meta title $doc->setMetaData( 'description' , $meta_description ); $doc->setMetaData( 'keywords' , $meta_tags ); if (isset($hwdvsTemplateOverride['thumbWidth6'])) { $thumbwidth = $hwdvsTemplateOverride['thumbWidth6']; } else { $thumbwidth = null; } $featuredlist = hwd_vs_tools::generateVideoListFromSql($rowsfeatured, "featuredthumbs", $thumbwidth); $smartyvs->assign("featuredlist", $featuredlist); if ($c->feat_show == "2") { $smartyvs->assign("featured_video_details", hwd_vs_tools::generateVideoDetails($rowsfeatured[$array_i], null, null, null, $Itemid, null, null)); } } if (count($rowsfeatured) > 1) { $smartyvs->assign("print_multiple_featured", 1); } if (count($mostviewed) > 0 && $c->frontpage_viewed !== "0") { $smartyvs->assign("print_mostviewed", 1); if (isset($hwdvsTemplateOverride['thumbWidth2'])) { $thumbwidth = $hwdvsTemplateOverride['thumbWidth2']; } else { $thumbwidth = null; } $mostviewedlist = hwd_vs_tools::generateVideoListFromXml($mostviewed, $thumbwidth); $smartyvs->assign("mostviewedlist", $mostviewedlist); if ($c->frontpage_viewed == "today") { $smartyvs->assign("title_mostviewed", _HWDVIDS_MVTD); } else if ($c->frontpage_viewed == "thisweek") { $smartyvs->assign("title_mostviewed", _HWDVIDS_MVTW); } else if ($c->frontpage_viewed == "thismonth") { $smartyvs->assign("title_mostviewed", _HWDVIDS_MVTM); } else if ($c->frontpage_viewed == "alltime") { $smartyvs->assign("title_mostviewed", _HWDVIDS_MVAT); } } if (count($mostfavoured) > 0 && $c->frontpage_favoured !== "0") { $smartyvs->assign("print_mostfavoured", 1); if (isset($hwdvsTemplateOverride['thumbWidth3'])) { $thumbwidth = $hwdvsTemplateOverride['thumbWidth3']; } else { $thumbwidth = null; } $mostfavouredlist = hwd_vs_tools::generateVideoListFromXml($mostfavoured, $thumbwidth); $smartyvs->assign("mostfavouredlist", $mostfavouredlist); if ($c->frontpage_favoured == "today") { $smartyvs->assign("title_mostfavoured", _HWDVIDS_MFTD); } else if ($c->frontpage_favoured == "thisweek") { $smartyvs->assign("title_mostfavoured", _HWDVIDS_MFTW); } else if ($c->frontpage_favoured == "thismonth") { $smartyvs->assign("title_mostfavoured", _HWDVIDS_MFTM); } else if ($c->frontpage_favoured == "alltime") { $smartyvs->assign("title_mostfavoured", _HWDVIDS_MFAT); } } if (count($mostpopular) > 0 && $c->frontpage_popular !== "0") { $smartyvs->assign("print_mostpopular", 1); if (isset($hwdvsTemplateOverride['thumbWidth4'])) { $thumbwidth = $hwdvsTemplateOverride['thumbWidth4']; } else { $thumbwidth = null; } $mostpopularlist = hwd_vs_tools::generateVideoListFromXml($mostpopular, $thumbwidth); $smartyvs->assign("mostpopularlist", $mostpopularlist); if ($c->frontpage_popular == "today") { $smartyvs->assign("title_mostpopular", _HWDVIDS_MPTD); } else if ($c->frontpage_popular == "thisweek") { $smartyvs->assign("title_mostpopular", _HWDVIDS_MPTW); } else if ($c->frontpage_popular == "thismonth") { $smartyvs->assign("title_mostpopular", _HWDVIDS_MPTM); } else if ($c->frontpage_popular == "alltime") { $smartyvs->assign("title_mostpopular", _HWDVIDS_MPAT); } } } if (count($rows) > 0) { $smartyvs->assign("print_videolist", 1); $list = hwd_vs_tools::generateVideoListFromSql($rows, null, $hwdvsTemplateOverride['thumbWidth1']); $smartyvs->assign("list", $list); } $smartyvs->assign( "featured_link" , JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=featuredvideos") ); $smartyvs->assign( "print_featured_player", $c->feat_show ); $page = $total - $c->vpp; $pageNavigation = null; if ( $page > 0 ) { $link = "index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&limit=".$limit; $pageNavigation.= $pageNav->getPagesLinks($link)."<br />"; $pageNavigation.= $pageNav->getPagesCounter(); } $smartyvs->assign("pageNavigation", $pageNavigation); $smartyvs->display('index.tpl'); return; }
/** * Outputs frontpage HTML * * @return Nothing */ function grabAjaxPlayer() { global $Itemid, $smartyvs, $hwdvs_selectv, $hwdvs_joinv, $mainframe, $hwdvsAjaxPlayer; header('Content-type: text/html; charset=utf-8'); $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); $video_id = JRequest::getInt( 'video_id', 0 ); $template = JRequest::getVar( 'template', '' ); $showdetails = JRequest::getInt( 'showdetails', '1' ); $width = JRequest::getInt( 'width', null ); $height = JRequest::getInt( 'height', null ); $quality = JRequest::getWord( 'quality', 'hd' ); $autostart = JRequest::getInt( 'autostart', null ); $hwdvsAjaxPlayer = true; if (!hwd_vs_access::allowAccess( $c->gtree_plyr, $c->gtree_plyr_child, hwd_vs_access::userGID( $my->id ))) { if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) { hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORPLYR, "exclamation.png", 0, 0); exit; } else { hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_PLYR_NOT_AUTHORIZED, "exclamation.png", 0, 0); exit; } } $where = ' WHERE video.id = '.$video_id; $query = "SELECT".$hwdvs_selectv." FROM #__hwdvidsvideos AS video ".$hwdvs_joinv." ".$where; $db->SetQuery($query); $row = $db->loadObject(); if (!hwd_vs_tools::validateVideoAccess($row)) { exit; } hwd_vs_tools::logViewing($row->id); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php'); if ($showdetails == 1) { $smartyvs->assign("showdetails", 1); } $videoplayer = hwd_vs_tools::generateVideoDetails($row, $width, $height, null, $Itemid, null, null, $autostart); $smartyvs->assign("videoplayer", $videoplayer); hwd_vs_javascript::ajaxRate($row); if (empty($template) || $template == '') { $html = $smartyvs->fetch('plug_jomsocial_ajax.tpl'); } else if ($template == 'playeronly') { $html = $videoplayer->player; } else { $html = $smartyvs->fetch($template.'.tpl'); } print $html; exit; }