diff --git a/view/modeYoutube.php b/view/modeYoutube.php
index 4b7243a1a..2d4ca63a8 100644
--- a/view/modeYoutube.php
+++ b/view/modeYoutube.php
@@ -1,500 +1,503 @@
forceCategory) && $advancedCustom->forceCategory === false)) {
$_GET['catName'] = "";
}
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, true, true);
}
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, false, true);
}
if (empty($video)) {
$video = YouPHPTubePlugin::getVideo();
}
// allow users to count a view again in case it is refreshed
Video::unsetAddView($video['id']);
// add this because if you change the video category the video was not loading anymore
$_GET['catName'] = $catName;
$_GET['isMediaPlaySite'] = $video['id'];
$obj = new Video("", "", $video['id']);
/*
if (empty($_SESSION['type'])) {
$_SESSION['type'] = $video['type'];
}
*
*/
// $resp = $obj->addView();
$get = array('channelName' => @$_GET['channelName'], 'catName' => @$_GET['catName']);
if (!empty($_GET['playlist_id'])) {
$playlist_id = $_GET['playlist_id'];
if (!empty($_GET['playlist_index'])) {
$playlist_index = $_GET['playlist_index'];
} else {
$playlist_index = 0;
}
$videosArrayId = PlayList::getVideosIdFromPlaylist($_GET['playlist_id']);
$videosPlayList = Video::getAllVideos("viewable",false, false, $videosArrayId, false, true);
$videosPlayList = PlayList::sortVideos($videosPlayList, $videosArrayId);
$video = Video::getVideo($videosPlayList[$playlist_index]['id'], "viewable", false, false, false, true);
if (!empty($videosPlayList[$playlist_index + 1])) {
$autoPlayVideo = Video::getVideo($videosPlayList[$playlist_index + 1]['id'], "viewable", false, false, false, true);
$autoPlayVideo['url'] = $global['webSiteRootURL'] . "playlist/{$playlist_id}/" . ($playlist_index + 1);
} else if (!empty($videosPlayList[0])) {
$autoPlayVideo = Video::getVideo($videosPlayList[0]['id'], "viewable", false, false, false, true);
$autoPlayVideo['url'] = $global['webSiteRootURL'] . "playlist/{$playlist_id}/0";
}
unset($_GET['playlist_id']);
} else {
if (!empty($video['next_videos_id'])) {
$autoPlayVideo = Video::getVideo($video['next_videos_id']);
} else {
if ($video['category_order'] == 1) {
unset($_POST['sort']);
$category = Category::getAllCategories();
$_POST['sort']['title'] = "ASC";
// maybe there's a more slim method?
$videos = Video::getAllVideos();
$videoFound = false;
$autoPlayVideo;
foreach ($videos as $value) {
if ($videoFound) {
$autoPlayVideo = $value;
break;
}
if ($value['id'] == $video['id']) {
// if the video is found, make another round to have the next video properly.
$videoFound = true;
}
}
} else {
$autoPlayVideo = Video::getRandom($video['id']);
}
}
if (!empty($autoPlayVideo)) {
$name2 = User::getNameIdentificationById($autoPlayVideo['users_id']).' '. User::getEmailVerifiedIcon($autoPlayVideo['users_id']);
$autoPlayVideo['creator'] = '
 . ')
';
$autoPlayVideo['tags'] = Video::getTags($autoPlayVideo['id']);
//$autoPlayVideo['url'] = $global['webSiteRootURL'] . $catLink . "video/" . $autoPlayVideo['clean_title'];
$autoPlayVideo['url'] = Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], false, $get);
}
}
if (!empty($video)) {
$name = User::getNameIdentificationById($video['users_id']);
$name = "{$name} " . User::getEmailVerifiedIcon($video['users_id'])."";
$subscribe = Subscribe::getButton($video['users_id']);
$video['creator'] = '';
$obj = new Video("", "", $video['id']);
// dont need because have one embeded video on this page
// $resp = $obj->addView();
}
if ($video['type'] == "video") {
$poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg";
} else {
$poster = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
}
if (!empty($video)) {
$source = Video::getSourceFile($video['filename']);
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
$img = $source['url'];
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else if ($video['type'] == "audio") {
$img = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
}
$type = 'video';
if ($video['type'] === 'pdf') {
$type = 'pdf';
}
if ($video['type'] === 'article') {
$type = 'article';
}
$images = Video::getImageFromFilename($video['filename'], $type);
$poster = $images->poster;
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') {
$img = $images->posterPortrait;
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else {
$img = $images->poster;
}
} else {
$poster = "{$global['webSiteRootURL']}view/img/notfound.jpg";
}
$objSecure = YouPHPTubePlugin::getObjectDataIfEnabled('SecureVideosDirectory');
if (!empty($autoPlayVideo)) {
$autoPlaySources = getSources($autoPlayVideo['filename'], true);
$autoPlayURL = $autoPlayVideo['url'];
$autoPlayPoster = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.jpg";
$autoPlayThumbsSprit = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}_thumbsSprit.jpg";
} else {
$autoPlaySources = array();
$autoPlayURL = '';
$autoPlayPoster = '';
$autoPlayThumbsSprit = "";
}
if (empty($_GET['videoName'])) {
$_GET['videoName'] = $video['clean_title'];
}
$v = Video::getVideoFromCleanTitle($_GET['videoName']);
YouPHPTubePlugin::getModeYouTube($v['id']);
?>
- getWebSiteTitle(); ?>
showChannelBannerOnModeYoutube)) {
?>
! videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
disableYoutubePlayerIntegration;
} else {
$disableYoutubeIntegration = false;
}
if ((isset($_GET['isEmbedded'])) && ($disableYoutubeIntegration == false)) {
if ($_GET['isEmbedded'] == "y") {
$videoJSArray[] = "view/js/videojs-youtube/Youtube.js";
} else if ($_GET['isEmbedded'] == "v") {
$videoJSArray[] = "view/js/videojs-vimeo/videojs-vimeo.js";
}
}
$jsURL = combineFiles($videoJSArray, "js");
?>