isTokenValid($_GET['token'], $fname, $_GET['videoDirectory']); } } elseif (!empty($_GET['globalToken'])) { $tokenIsValid = verifyToken($_GET['globalToken']); } $newContent = ''; // if is using a CDN I can not check if the user is logged if (isAVideoEncoderOnSameDomain() || $tokenIsValid || !empty($advancedCustom->videosCDN) || User::canWatchVideo($video['id']) || User::canWatchVideoWithAds($video['id']) || isCDN()) { if (!empty($_GET['download'])) { downloadHLS($_GET['file']); } elseif (!empty($_GET['playHLSasMP4'])) { playHLSasMP4($_GET['file']); } else { if (@filesize($_GET['file'])>20) { $filename = $_GET['file']; } else { $filename = pathToRemoteURL($filename); } $content = file_get_contents($filename); $newContent = str_replace('{$pathToVideo}', "{$global['webSiteRootURL']}videos/{$_GET['videoDirectory']}/../", $content); if (!empty($_GET['token'])) { $newContent = str_replace('/index.m3u8', "/index.m3u8?token={$_GET['token']}", $newContent); } elseif (!empty($_GET['globalToken'])) { $newContent = str_replace('/index.m3u8', "/index.m3u8?globalToken={$_GET['globalToken']}", $newContent); } } } else { $newContent = "HLS.php Can not see video [{$video['id']}] ({$_GET['videoDirectory']}) "; $newContent .= $tokenIsValid ? "" : " tokenInvalid"; $newContent .= User::canWatchVideo($video['id']) ? "" : " cannot watch ({$video['id']})"; $newContent .= " " . date("Y-m-d H:i:s"); } header("Content-Type: text/plain"); //header('Content-Type:'); echo $newContent;