Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_cdn1/include/ |
Upload File : |
<?php
require_once __DIR__ . '/class.media-source.php';
require_once __DIR__ . '/RangeHeader.php';
// require_once __DIR__ . '/class.captions.php';
require_once __DIR__ . '/vtt_class.php';
$payload = empty($_GET['auth']) ? '' : $_GET['auth'];
$filename = empty($_GET['file']) ? '' : $_GET['file'];
$query = $_SERVER['REQUEST_URI'];
if (($p = strpos($query, '?')) !== FALSE) {
$query = substr($query, $p + 1);
parse_str($query, $res);
} else {
$res = [];
}
$source = new MediaSource;
$param = $source->decodeAuth($payload);
if (!$param->valid) {
header('Content-type: text/plain');
die("Invalid Link");
}
if ($param->expired) {
header('Content-type: text/plain');
die("Expired Link");
}
if ($param->ext == 'htm') $param->ext = 'html';
$sourcefile = dirname(__DIR__) . '/' . substr($param->id, 0, 1) . '/' . $param->id . '.' . $param->ext;
if (!file_exists($sourcefile)) {
header('Content-type: text/plain');
die("File not Found");
}
while (ob_get_level())
ob_end_clean();
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS');
header('Access-Control-Allow-Headers: token, Content-Type');
header('Access-Control-Max-Age: 86400');
header('Content-Length: 0');
header('Content-Type: text/plain');
die();
}
header('Access-Control-Allow-Origin: *');
switch($param->ext) {
case 'vtt':
$mimetype = 'text/vtt';
break;
case 'mp3':
$mimetype = 'audio/mp3';
break;
case 'mp4':
$mimetype = 'video/mp4';
break;
case 'xml':
$mimetype = 'application/xml';
break;
case 'jpg':
$mimetype = 'video/jpeg';
break;
case 'png':
$mimetype = 'video/png';
break;
case 'html':
$mimetype = 'text/html';
break;
case 'zip':
header('Content-type: text/plain');
list($entry, $name) = explode('/', $filename . '//');
_downloadZipItem($sourcefile, $entry, $name);
exit;
default:
$mimetype = 'text/plain';
break;
}
$short = empty($res['short']) ? 0 : (int) $res['short'];
if ($param->ext == 'vtt' && $short) {
if ($short == 2) header('Content-type: text/plain');
$content = _generateShortVTTfile($sourcefile, $short);
echo $content;
exit;
}
try {
$text = get_request_header('Range');
$rangeHeader = RangeHeader::createFromHeaderString($text); // regexp has been changed in this function
(new PartialFileServlet($rangeHeader))->sendFile($sourcefile, $mimetype, $filename);
} catch (InvalidRangeHeaderException $e) {
header("HTTP/1.1 400 Bad Request");
} catch (UnsatisfiableRangeException $e) {
header("HTTP/1.1 416 Range Not Satisfiable");
} catch (NonExistentFileException $e) {
header("HTTP/1.1 404 Not Found");
} catch (UnreadableFileException $e) {
header("HTTP/1.1 500 Internal Server Error");
}
function _generateShortVTTfile($sourcefile, $short) {
$vtt = new vtt_class;
$vtt->Pauses(TRUE)
->Filename($sourcefile);
$vttdata = $vtt->getEntries();
if (!count($vttdata)) return ''; // no transcript available
$output = '';
if ($short == 2) {
return $vtt->AsText();
}
return $vtt->AsWebVtt();
}
// inline content disposition
function _downloadZipItem($sourcefile, $entry, $name) {
$zip = new ZipArchive;
$zip->Open($sourcefile);
$content = $zip->getFromIndex($entry);
$filename_temp = tempnam(sys_get_temp_dir(), 'itm');
file_put_contents($filename_temp, $content);
$zip->Close();
$mime = mime_content_type($filename_temp);
header("Content-Disposition: inline; filename=\"$name\"");
header('Content-type: ' . $mime);
readfile($filename_temp);
unlink($filename_temp);
}