/** * */ function editPlaylist($row, $pl_videos) { 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); if (count($pl_videos) > 0) { $smartyvs->assign("print_pl_videos", 1); for ($i=0, $n=count($pl_videos); $i < $n; $i++) { $row = $pl_videos[$i]; $pl_video_list[$i]->thumbnail_url = hwd_vs_tools::generateThumbnailURL( $row->id, $row->video_id, $row->video_type, $row->thumbnail ); $pl_video_list[$i]->title = hwd_vs_tools::truncateText(strip_tags(stripslashes($row->title)), $c->truntitle); $pl_video_list[$i]->vid = $row->id; $pl_video_list[$i]->counter = $i+1; } $smartyvs->assign("pl_video_list", $pl_video_list); } $smartyvs->assign("form_edit_playlist", JURI::root(true)."/index.php?option=com_hwdvideoshare&task=updatePlaylist"); $smartyvs->display('playlist_edit.tpl'); return; }
/** * Outputs frontpage HTML * * @return Nothing */ function recent() { global $Itemid; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $jconfig = new jconfig(); $my = & JFactory::getUser(); // sql search filters $where = ' WHERE a.published = 1'; $where .= ' AND a.approved = "yes"'; if (!$my->id) { $where .= ' AND a.public_private = "public"'; } // get videos $query = 'SELECT a.*' . ' FROM #__hwdvidsvideos AS a' . $where . ' ORDER BY a.date_uploaded DESC' . ' LIMIT 0, 50' ; $db->SetQuery($query); $rows = $db->loadObjectList(); $link_rss = JURI::root().'index.php?option=com_hwdvideoshare&task=rss&feed=recent'; $link_rss = str_replace("&", "&", $link_rss); echo '<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>'.$jconfig->sitename.'</title> <link>'.JURI::root().'</link> <description>Recent Videos</description> <category>Video</category> <atom:link href="'.$link_rss.'" rel="self" type="application/rss+xml" /> '; for ($i=0, $n=count($rows); $i < $n; $i++) { $row = $rows[$i]; $title = stripslashes($row->title); $description = stripslashes($row->description); $category = html_entity_decode(hwd_vs_tools::generateCategory($row->category_id)); $link_video = JURI::root()."index.php?option=com_hwdvideoshare&task=viewvideo&Itemid=".$Itemid."&video_id=".$row->id; $link_video = 'http://'.$_SERVER['HTTP_HOST'].JRoute::_("index.php?option=com_hwdvideoshare&task=viewvideo&Itemid=$Itemid&video_id=$row->id"); $thumbnailURL = hwd_vs_tools::generateThumbnailURL( $row->id, $row->video_id, $row->video_type, $row->thumbnail ); if ($row->video_type == 'local') { $thumbnailURL = 'http://'.$_SERVER['HTTP_HOST'].$thumbnailURL; } else { $pos = strpos($thumbnailURL, "http"); if ($pos === false) { $thumbnailURL = 'http://'.$_SERVER['HTTP_HOST'].$thumbnailURL; } else { $thumbnailURL = $thumbnailURL; } } $thumbnailURL = str_replace("&", "&", $thumbnailURL); $downloadURL = $thumbnailURL; $downloadSIZE = "999"; date_default_timezone_set('GMT'); echo '<item> <title><![CDATA['.stripslashes($title).']]></title> <link><![CDATA['.$link_video.']]></link> <description><![CDATA[<img src="'.$thumbnailURL.'" style="float:right;padding:10px;" width="120" height="90" /> '.stripslashes($description).']]></description> <category><![CDATA['.stripslashes($category).']]></category> <pubDate>'.date('D, d M Y H:i:s e', strtotime($row->date_uploaded)).'</pubDate> <guid>'.$link_video.'</guid> <enclosure url="'.$downloadURL.'" length="'.$downloadSIZE.'" type="image/jpeg" /> </item> '; } echo ' </channel> </rss>'; exit; // <enclosure url="'.$downloadURL.'" length="'.$downloadSIZE.'" type="image/jpeg" /> // <enclosure url="'.$downloadURL.'" length="'.$downloadSIZE.'" type="video/x-flv" /> }
/** * Generates the video player * * @param array $row the video sql data * @param int $width(optional) the video player width * @param int $height(optional) the video player width * @return $code */ function generateVideoPlayer( $row, $width=null, $height=null, $autostart=null, $quality="hd", $embedcode=false ) { global $hwdvsItemid, $mainframe, $option, $task, $smartyvs, $show_video_ad, $pre_url, $post_url, $j15, $j16; $c = hwd_vs_Config::get_instance(); $db =& JFactory::getDBO(); if (!isset($row->age_check)) { $row->age_check = "-1"; } if (($c->age_check > 0 && $row->age_check == "-1") || $row->age_check > 0) { $age_response = hwd_vs_tools::generateAgeCheck($row); if ($age_response !== true) { if ($embedcode == true) { } else { if ($age_response !== true) { return $age_response; } } } } if ($j16) { $vp_plugin_path = JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS.$c->hwdvids_videoplayer_file.DS.$c->hwdvids_videoplayer_file.".view.php"; } else { $vp_plugin_path = JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS.$c->hwdvids_videoplayer_file.".view.php"; } if (file_exists($vp_plugin_path)) { require_once($vp_plugin_path); } else if (file_exists(JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS."flow.view.php")) { require_once(JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS."flow.view.php"); } else if (file_exists(JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS."flow".DS."flow.view.php")) { require_once(JPATH_SITE.DS."plugins".DS."hwdvs-videoplayer".DS."flow".DS."flow.view.php"); } else { return "This video can not be displayed because there are no video players installed."; } $player = new hwd_vs_videoplayer(); $flv_url = null; $flv_path = null; $thumb_url = null; $use_xMoovphp = false; $code = null; $location = hwd_vs_tools::generateVideoLocations($row, $quality); $thumb_url = hwd_vs_tools::generateThumbnailURL($row->id, @$row->video_id, $row->video_type, @$row->thumbnail, "large"); if ($row->video_type == "local" || $row->video_type == "mp4" || $row->video_type == "swf") { // temporary html5 player fix if ($c->hwdvids_videoplayer_file == "jwflv_html5") { $c->use_protection = 0; } if ($c->storagetype !== "0") { $flv_url = $location['url']; $flv_path = $location['path']; $use_xMoovphp = $location['use_xMoovphp']; $dlink = $location['url']; } else if ($c->use_protection == 0) { $flv_url = $location['url']; $flv_path = $location['path']; $use_xMoovphp = $location['use_xMoovphp']; $dlink = $location['url']; } else { $flv_url = $location['url']; $flv_path = $location['path']; $use_xMoovphp = $location['use_xMoovphp']; $dlink = hwd_vs_tools::generateAntileechExpiration($row->id, $row->video_type, 'player', $quality); $dlink = urlencode($dlink); } if ($use_xMoovphp) { $pluginPlayer =& JPluginHelper::getPlugin("hwdvs-videoplayer", "$c->hwdvids_videoplayer_file"); $pluginPlayerParams = new JParameter( $pluginPlayer->params ); $pluginPlayerStreamer = $pluginPlayerParams->get('pseudostreaming', 0); if ($pluginPlayerStreamer == "1" && ($c->hwdvids_videoplayer_file == "jwflv" || $c->hwdvids_videoplayer_file == "jwflv_v5")) { $dlink = $row->video_id.".flv"; } } if ( $row->video_type == "swf" && $c->standaloneswf == 1 ) { $width = $c->flvplay_width; $height = $width*$c->var_fb; $smartyvs->assign("player_width", $width); $code.= "<div style=\"text-align: inherit;width:".$width."px!important;height:".$height."px!important;\">"; $code.= "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"".$width."\" height=\"".$height."\" codebase=\"http://active.macromedia.com/flash7/cabs/ swflash.cab#version=9,0,0,0\"> <param name=\"movie\" value=\"".$flv_url."\"> <param name=\"play\" value=\"true\"> <param name=\"loop\" value=\"true\"> <param name=\"width\" value=\"".$width."\"> <param name=\"height\" value=\"".$height."\"> <param name=\"quality\" value=\"high\"> <param name=\"allowscale\" value=\"true\"> <param name=\"scale\" value=\"showall\"> <embed src=\"".$flv_url."\" width=\"".$width."\" height=\"".$height."\" play=\"true\" scale=\"showall\" loop=\"true\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" swLiveConnect=\"true\"> </embed> </object>"; return $code; } if ($show_video_ad == 1 && !$embedcode) { if ($c->hwdvids_videoplayer_file == "flow") { $flv_tracks = array(); $flv_tracks[0] = $pre_url; $flv_tracks[1] = $dlink; $flv_tracks[2] = $post_url; $code.= $player->prepareEmbeddedPlayer($flv_tracks, $width, $height, rand(100, 999), "playlist", $flv_path, null, $autostart); return $code; } else { $xspf_playlist = JPATH_SITE.DS."components".DS."com_hwdvideoshare".DS."xml".DS."xspf".DS.$row->id.".xml"; @unlink($xspf_playlist); require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_hwdrevenuemanager".DS."redrawplaylist.class.php"); hwd_rm_playlist::writeFile($row, $dlink, $pre_url, $post_url, $thumb_url, $use_xMoovphp); if (file_exists($xspf_playlist)) { $flv_url = JURI::root(true).'/components/com_hwdvideoshare/xml/xspf/'.$row->id.'.xml'; $flv_path = JPATH_SITE.DS."components".DS."com_hwdvideoshare".DS."xml".DS."xspf".DS.$row->id.".xml"; if ($c->loadswfobject == "on" && $task !=="grabjomsocialplayer") { $code.= $player->prepareplayer($flv_url, $width, $height, rand(100, 999), "playlist", $flv_path, null, $autostart, $row->id); } else { $code.= $player->prepareEmbeddedPlayer($flv_url, $width, $height, rand(100, 999), "playlist", $flv_path, null, $autostart, $row->id); } } } } else { if ($c->loadswfobject == "on" && $task !=="grabjomsocialplayer" && !$embedcode) { $code.= $player->prepareplayer($dlink, $width, $height, rand(100, 999), "video", $flv_path, $thumb_url, $autostart, $row->id); } else if (!$embedcode) { $code.= $player->prepareEmbeddedPlayer($dlink, $width, $height, rand(100, 999), "video", $flv_path, $thumb_url, $autostart, $row->id); } else { $code.= $player->prepareEmbedCode($dlink, $width, $height, rand(100, 999), "video", $flv_path, $thumb_url, $autostart, $row->id); } } } else if ( $row->video_type == "playlist" ) { $flv_path = $row->playlist; if ($c->loadswfobject == "on") { $code.= $player->prepareplayer($flv_path, $width, $height, rand(100, 999), "playlist", null, null, $autostart, null); } else { $code.= $player->prepareEmbeddedPlayer($flv_path, $width, $height, rand(100, 999), "playlist", null, null, $autostart, null); } } else if ( $row->video_type == "direct" ) { $code.= $player->prepareEmbeddedPlayer($row->video_url, $width, $height, rand(100, 999), "video", $flv_path, $thumb_url, $autostart, $row->id); } else if ($row->video_type == "seyret") { if (@explode(",", $video_code)) { $data = explode(",", $row->video_id); } else { return; } if ($data[0] == "local") { $file->id = $row->id; $file->video_type = "remote"; if (!empty($data[2])) { $file->video_id = @$data[1].",".@$data[2]; } else { $file->video_id = @$data[1]; } $file->thumbnail = $row->thumbnail; $code.= hwd_vs_tools::generateVideoPlayer($file, $width, $height, $autostart, $quality, $embedcode); } else { $file->id = $row->id; $file->video_type = $data[0]; if (!empty($data[2])) { $file->video_id = @$data[1].",".@$data[2]; } else { $file->video_id = @$data[1]; } $file->thumbnail = $row->thumbnail; $code.= hwd_vs_tools::generateVideoPlayer($file, $width, $height, $autostart, $quality, $embedcode); } } else { $plugin = hwd_vs_tools::getPluginDetails($row->video_type); if (!$plugin) { if ($width==null) { $smartyvs->assign("player_width", $c->tpwidth); } else { $smartyvs->assign("player_width", $width); } $code.= _HWDVIDS_INFO_NOPLUGIN." "._HWDVIDS_WMIP_01.$row->video_type._HWDVIDS_WMIP_02; } else { if (!$embedcode) { $preparevid = preg_replace("/[^a-zA-Z0-9s_-]/", "", $row->video_type)."PrepareVideo"; $code.= $preparevid($row, $width, $height, $autostart); } else { $preparevid = preg_replace("/[^a-zA-Z0-9s_-]/", "", $row->video_type)."PrepareVideoEmbed"; $code.= $preparevid($row->video_id, $row->id, $hwdvsItemid, $row); } } } if (!$embedcode) { return "<div id=\"hwdvsplayer\">".$code."</div>"; } else { return $code; } }