/** * */ function viewPlaylist($row) { global $mainframe, $Itemid, $smartyvs, $Itemid; $c = hwd_vs_Config::get_instance(); // 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 = html_entity_decode($row->playlist_name); // set the page/meta title $doc->setTitle( $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title ); $doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title ); hwd_vs_tools::generateActiveLink(1); hwd_vs_javascript::confirmdelete(); hwd_vs_tools::generateBreadcrumbs(); $smartyvs->assign("playlist_name", stripslashes($row->playlist_name)); $smartyvs->assign("playlist_description", stripslashes($row->playlist_description)); $smartyvs->assign("playlist_id", $row->id); $hwdvids_params['playlist'] = "pl_$row->id"; $hwdvids_params['single_id'] = 0; $hwdvids_params['width'] = 320; $hwdvids_params['height'] = 240; $hwdvids_params['autostart'] = 1; $hwdvids_params['extended'] = 1; $hwdvids_params['showdetails'] = 1; $hwdvids_params['novtd'] = 10; $hwdvids_params['thumb_width'] = 60; $hwdvids_params['mod_hwd_itemid'] = 0; $hwdvids_params['trunc_title'] = ''; $hwdvids_params['trunc_descr'] = ''; $hwdvids_params['showtt'] = '0'; if ($hwdvids_params['mod_hwd_itemid'] == 0) { $hwdvids_params['mod_hwd_itemid'] = hwd_vs_tools::generateValidItemid(); } require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php'); $parser = new HWDVS_xmlParse(); $parsed_list = $parser->parse($hwdvids_params['playlist']); if (count($parsed_list) > 0) { $smartyvs->assign("vid", $parsed_list[0]['id']); $row->video_id = ""; $row->video_type = "playlist"; $row->playlist = JURI::base( true )."/components/com_hwdvideoshare/xml/xspf/".$hwdvids_params['playlist'].".xml"; $video_player = hwd_vs_tools::generateVideoPlayer( $row, $hwdvids_params['width'], $hwdvids_params['height'], $hwdvids_params['autostart'] ); if ($hwdvids_params['extended'] == 1) { $tooltip = 1; $list = hwd_vs_tools::generateVideoListFromXml($parsed_list, $hwdvids_params['thumb_width'], $hwdvids_params['mod_hwd_itemid'], $tooltip, $hwdvids_params['trunc_title'], $hwdvids_params['trunc_descr'], "hwdvs_insert_playlist_video"); $smartyvs->assign("list", $list); } } else { hwd_vs_tools::infomessage(4, 0, "Empty playlist", "This playlist does not contactin any videos", "exclamation.png", 0); return; } if ($hwdvids_params['extended'] == 1) { if ($hwdvids_params['showdetails'] == 1) { $showdetails = '&showdetails=1'; $div_height = $hwdvids_params['height']+70; } else { $showdetails = '&showdetails=0'; $div_height = $hwdvids_params['height']+70; } $showdetails.= '&width='.$hwdvids_params['width'].'&height='.$hwdvids_params['height']; $random = rand(); $smartyvs->assign("print_extended", 1); $smartyvs->assign("random", $random); $hwdvs_ajax_video_js = "<script language=\"javascript\" type=\"text/javascript\"> <!-- //Browser Support Code function hwdvs_insert_playlist_video(video_id){ var ajaxRequest; // The variable that makes Ajax possible! document.getElementById('hwdvs_player_container".$random."').style.padding = \"0\"; document.getElementById('hwdvs_player_container".$random."').style.margin = \"0\"; document.getElementById('hwdvs_player_container".$random."').style.height = \"".$div_height."px\"; document.getElementById('hwdvs_player_container".$random."').innerHTML = '<div style=\"padding:5px;\">Loading...<br /><img src=\"".JURI::root( true )."/plugins/community/hwdvideoshare/loading.gif\"></div>'; try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject(\"Msxml2.XMLHTTP\"); } catch (e) { try{ ajaxRequest = new ActiveXObject(\"Microsoft.XMLHTTP\"); } catch (e){ // Something went wrong alert(\"Your browser broke!\"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.getElementById('hwdvs_player_container".$random."').style.padding = \"0\"; document.getElementById('hwdvs_player_container".$random."').style.margin = \"0\"; document.getElementById('hwdvs_player_container".$random."').innerHTML = ajaxRequest.responseText; var theInnerHTML = ajaxRequest.responseText; var theID = 'hwdvs_player_container".$random."'; setAndExecute(theID,theInnerHTML); var containerHeight = document.getElementById('hwdvs_player_container".$random."').offsetHeight; var calcHeight = containerHeight-40; document.getElementById('videoDetails').style.height = calcHeight+\"px\"; document.getElementById('videoDetails').style.overflow = \"auto\"; } } ajaxRequest.open(\"GET\", \"".JURI::root( true )."/index.php?option=com_hwdvideoshare&task=grabajaxplayer&Itemid=".$hwdvids_params['mod_hwd_itemid'].$showdetails."&template=mod_hwd_vs_video_playlist_container&tmpl=component&video_id=\" + video_id, true); ajaxRequest.send(null); function setAndExecute(divId, innerHTML) { var div = document.getElementById(divId); div.innerHTML = innerHTML; var x = div.getElementsByTagName(\"script\"); for(var i=0;i<x.length;i++) { eval(x[i].text); } } } //--> </script>"; $doc->addCustomTag($hwdvs_ajax_video_js); } $smartyvs->assign("hwdvids_params", $hwdvids_params); $smartyvs->assign("video_player", $video_player); $smartyvs->display('playlist_view.tpl'); return; }
/** * Make frontpage SQL queries with appropriate filters * * @return Nothing */ function frontpage() { global $mainframe, $limitstart, $limit, $smartyvs, $hwdvs_selectv, $hwdvs_joinv, $isModerator; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); // number of videos to display $limit = intval($c->vpp); $sort = JRequest::getWord( 'sort', 'recent' ); $rowsNbwType = ""; // sql search filters $where = ' WHERE video.approved = "yes"'; if (!$isModerator) { $where.= ' AND video.published = 1'; } if ($c->bviic == 1 && $my->id == 0) { $where.= ' AND video.public_private = "public"'; } if ($sort == "recent") { $order = ' ORDER BY video.date_uploaded DESC'; $smartyvs->assign("title", _HWDVIDS_RECENTVIDEOS); $smartyvs->assign("recent_selected", "selected=\"selected\""); } else if ($sort == "popular") { $order = ' ORDER BY video.number_of_views DESC'; $smartyvs->assign("title", _HWDVIDS_POPULARVIDEOS); $smartyvs->assign("popular_selected", "selected=\"selected\""); } else if ($sort == "rated") { $order = ' ORDER BY video.updated_rating DESC'; $smartyvs->assign("title", _HWDVIDS_RATEDVIDEOS); $smartyvs->assign("rated_selected", "selected=\"selected\""); } // get video count $db->SetQuery( 'SELECT count(*)' . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . $where ); $total = $db->loadResult(); echo $db->getErrorMsg(); jimport('joomla.html.pagination'); $pageNav = new JPagination( $total, $limitstart, $limit ); $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . $where . $order ; $db->SetQuery($query, $pageNav->limitstart, $pageNav->limit); $rows = $db->loadObjectList(); if ($c->feat_rand == 0) { $order = ' ORDER BY video.ordering ASC'; } else if ($c->feat_rand == 1) { $order = ' ORDER BY rand()'; } else if ($c->feat_rand == 3) { $order = ' ORDER BY video.date_uploaded DESC'; } if ($c->feat_show == 0) { $sqlLimit = ' LIMIT 0, '.$c->fpfeaturedvids; } else { $sqlLimit = ' LIMIT 0, '.($c->fpfeaturedvids+1); } // get featured videos $query = 'SELECT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . $hwdvs_joinv . $where . ' AND video.featured = 1' . $order . $sqlLimit ; $db->SetQuery($query); $rowsfeatured = $db->loadObjectList(); $rowsnow = array(); if ($c->frontpage_watched == "1") { if (file_exists(JPATH_SITE.DS.'modules'.DS.'mod_hwd_vs_beingwatched'.DS.'mod_hwd_vs_beingwatched.php')) { jimport( 'joomla.application.module.helper' ); $bwn_modName = 'hwd_vs_beingwatched'; $bwn_modObj = JModuleHelper::getModule($bwn_modName); if (!isset($bwn_modObj->id)) { $query = 'SELECT params FROM #__modules WHERE module = "mod_hwd_vs_beingwatched"'; $db->SetQuery($query); $bwn_modObj = $db->loadObject(); } $pluginParams = new JParameter( $bwn_modObj->params ); $override = $pluginParams->def( 'mod_replace_core', 0 ); if ($override == 1) { $rowsnow = "switch"; } else { $override = 0; } } if (!file_exists(JPATH_SITE.DS.'modules'.DS.'mod_hwd_vs_beingwatched'.DS.'mod_hwd_vs_beingwatched.php') || $override == 0) { if (file_exists(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'bwn.xml')) { require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php'); $parser = new HWDVS_xmlParse(); $rowsnow = $parser->parse("bwn"); $rowsNbwType = "xml"; } else { $query = 'SELECT DISTINCT'.$hwdvs_selectv . ' FROM #__hwdvidsvideos AS video' . ' LEFT JOIN #__hwdvidslogs_views AS l ON l.videoid = video.id' . $hwdvs_joinv . $where . ' AND l.date > NOW() - INTERVAL 1440 MINUTE' . ' ORDER BY l.date DESC' . ' LIMIT 0, 10' ; $db->SetQuery($query); $rowsnow = $db->loadObjectList(); $rowsNbwType = "sql"; } } } $mostviewed = array(); if ($c->frontpage_viewed !== "0") { // parse xml playlists require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php'); $parser = new HWDVS_xmlParse(); $mostviewed = $parser->parse("mostviewed_".$c->frontpage_viewed); } $mostfavoured = array(); if ($c->frontpage_favoured !== "0") { // parse xml playlists require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php'); $parser = new HWDVS_xmlParse(); $mostfavoured = $parser->parse("mostfavoured_".$c->frontpage_favoured); } $mostpopular = array(); if ($c->frontpage_popular !== "0") { // parse xml playlists require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php'); $parser = new HWDVS_xmlParse(); $mostpopular = $parser->parse("mostpopular_".$c->frontpage_popular); } // send out hwd_vs_html::frontpage($rows, $rowsfeatured, $pageNav, $total, $rowsnow, $mostviewed, $mostfavoured, $mostpopular, $rowsNbwType); }