verifyEmbedSecurity(); } require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'plugin/PlayLists/PlayListElement.php'; if (!User::isAdmin() && !PlayList::canSee($_GET['playlists_id'], User::getId())) { die('{"error":"' . __("Permission denied") . '"}'); } $playlist_index = intval(@$_REQUEST['playlist_index']); $pl = new PlayList($_GET['playlists_id']); $playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']); $playListData = array(); $collectionsList = PlayList::showPlayListSelector($playList); $videoStartSeconds = array(); $users_id = User::getId(); foreach ($playList as $key => $value) { $oldValue = $value; if (!User::isAdmin() && !Video::userGroupAndVideoGroupMatch($users_id, $value['videos_id'])) { unset($playList[$key]); continue; } if ($oldValue['type'] === 'serie' && !empty($oldValue['serie_playlists_id'])) { $subPlayList = PlayList::getVideosFromPlaylist($value['serie_playlists_id']); foreach ($subPlayList as $value) { $sources = getVideosURL($value['filename']); $images = Video::getImageFromFilename($value['filename'], $value['type']); $externalOptions = _json_decode($value['externalOptions']); $src = new stdClass(); $src->src = $images->thumbsJpg; $thumbnail = array(); $thumbnail[] = $src; $playListSources = array(); foreach ($sources as $value2) { if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { continue; } $playListSources[] = new playListSource($value2['url']); } if (empty($playListSources)) { continue; } if (User::isLogged()) { $videoStartSeconds = Video::getLastVideoTimePosition($value['videos_id']); } if (empty($videoStartSeconds)) { $videoStartSeconds = parseDurationToSeconds(@$externalOptions->videoStartSeconds); } $playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, $videoStartSeconds, $value['cre'], $value['likes'], $value['views_count'], $value['videos_id'], "embedPlayList subPlaylistCollection-{$oldValue['serie_playlists_id']}"); } } else { $sources = getVideosURL($value['filename']); $images = Video::getImageFromFilename($value['filename'], $value['type']); $externalOptions = _json_decode($value['externalOptions']); $src = new stdClass(); $src->src = $images->thumbsJpg; $thumbnail = array(); $thumbnail[] = $src; $playListSources = array(); foreach ($sources as $value2) { if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { continue; } $playListSources[] = new playListSource($value2['url']); } if (function_exists('getVTTTracks')) { $subtitleTracks = getVTTTracks($value['filename'], true); } if (empty($playListSources)) { continue; } if (User::isLogged()) { $videoStartSeconds = Video::getLastVideoTimePosition($value['videos_id']); } if (empty($videoStartSeconds)) { $videoStartSeconds = parseDurationToSeconds(@$externalOptions->videoStartSeconds); } $playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, $videoStartSeconds, $value['cre'], $value['likes'], $value['views_count'], $value['videos_id'], "embedPlayList ", $subtitleTracks); } } if (empty($playListData)) { forbiddenPage(__("The program is empty")); } $url = PlayLists::getLink($pl->getId()); $title = $pl->getName(); if ($serie = PlayLists::isPlayListASerie($pl->getId())) { setVideos_id($serie['id']); } else if (!empty($playList[$playlist_index])) { setVideos_id($playList[$playlist_index]['id']); } //var_dump($playListData);exit; ?> <?php echo $config->getWebSiteTitle(); ?>