Пример #1
0
    /**
     *
     */
    function viewVideo($row, $userrows, $related_videos, $categoryrows)
    {
		global $mainframe, $Itemid, $smartyvs, $hwdvsTemplateOverride, $videoplayer;
		$c = hwd_vs_Config::get_instance();
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();

		// 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();

		$active = &$menu->getActive();

		if (!empty($mparams_pt)) {
			$metatitle = $mparams_pt;
		} else if (!empty($active->name)) {
			$metatitle = $active->name;
		} else {
			$metatitle = _HWDVIDS_META_DEFAULT;
		}

		// decode
		$meta_title = hwd_vs_tools::generateMetaText(stripslashes($row->title));
		$meta_description = hwd_vs_tools::generateMetaText($row->description);
		$meta_tags = hwd_vs_tools::generateMetaText($row->tags);

		// set the page/meta title
		$doc->setTitle( $metatitle." - ".$meta_title );
		$doc->setMetaData( 'title' , $metatitle." - ".$meta_title );
		$doc->setMetaData( 'description' , $meta_description );
		$doc->setMetaData( 'keywords' , $meta_tags );
		$doc->addCustomTag('<link rel="image_src" href="'.hwd_vs_tools::generateThumbnailURL( $row->id, $row->video_id, $row->video_type, $row->thumbnail ).'" />');
		hwd_vs_tools::generateActiveLink(1);
		hwd_vs_tools::generateBreadcrumbs($row, $meta_title);

		$smartyvs->assign("videoplayer", hwd_vs_tools::generateVideoDetails($row, null, null, null, $Itemid, null, null));
		//$smartyvs->assign("videoplayer", $videoplayer);

		if (count($related_videos) > 0 && $c->showrevi == "1")
		{
			if (isset($hwdvsTemplateOverride['thumbWidth8']))
			{
				$thumbwidth = $hwdvsTemplateOverride['thumbWidth8'];
			}
			else
			{
				$thumbwidth = null;
			}
			$smartyvs->assign("print_relatedlist", 1);
			$listrelated = hwd_vs_tools::generateVideoListFromSql($related_videos, "", $thumbwidth);
			$smartyvs->assign("listrelated", $listrelated);
		}
		else
		{
			$smartyvs->assign("listrelated", "There are no related videos.");
		}

		if (count($userrows) > 0 && $c->showuldr == "1")
		{
			if (isset($hwdvsTemplateOverride['thumbWidth7']))
			{
				$thumbwidth = $hwdvsTemplateOverride['thumbWidth7'];
			}
			else
			{
				$thumbwidth = null;
			}
			$smartyvs->assign("print_uservideolist", 1);
			$userlist = hwd_vs_tools::generateVideoListFromSql($userrows, "", $thumbwidth);
			$smartyvs->assign("userlist", $userlist);
		}
		else
		{
			$smartyvs->assign("userlist", "This user does not have any other videos.");
		}

		if (count($categoryrows) > 0 && $c->showmftc == "1")
		{
			if (isset($hwdvsTemplateOverride['thumbWidth9']))
			{
				$thumbwidth = $hwdvsTemplateOverride['thumbWidth9'];
			}
			else
			{
				$thumbwidth = null;
			}
			$smartyvs->assign("print_categoryvideolist", 1);
			$categoryvideolist = hwd_vs_tools::generateVideoListFromSql($categoryrows, "", $thumbwidth);
			$smartyvs->assign("categoryvideolist", $categoryvideolist);
		}
		else
		{
			$smartyvs->assign("categoryvideolist", "There are no more videos in this category.");
		}

		//$params = array();
		//$limitstart = 0;
		//$article->text = $smartyvs->fetch('video_player.tpl');
		//JPluginHelper::importPlugin('content');
		//$dispatcher =& JDispatcher::getInstance();
		//$results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, $limitstart));

		$smartyvs->assign("showMoreButton", 1);

		$smartyvs->display('video_player.tpl');

		return;
    }
Пример #2
0
    /**
     * 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;
	}