mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
3c9114119f
commit
757504314e
29 changed files with 377 additions and 163 deletions
|
@ -309,7 +309,7 @@ Options All -Indexes
|
|||
RewriteRule ^vast.xml/?([0-9]+)?$ plugin/AD_Server/VAST.php?campaign_has_videos_id=$1 [NC,L]
|
||||
|
||||
<IfModule mod_xsendfile.c>
|
||||
RewriteRule ^videos/([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ view/xsendfile.php?file=$1 [QSA]
|
||||
RewriteRule ^videos/([_A-Za-z0-9.-]+/)?([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ view/xsendfile.php?file=$2 [QSA]
|
||||
</IfModule>
|
||||
|
||||
# if image do not exists
|
||||
|
|
|
@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$installationVersion = "10.8";
|
||||
$installationVersion = "11.0";
|
||||
|
||||
error_log("Installation: ".__LINE__." ". json_encode($_POST));
|
||||
header('Content-Type: application/json');
|
||||
|
|
|
@ -7,69 +7,48 @@ if (!isCommandLineInterface()) {
|
|||
return die('Command Line only');
|
||||
}
|
||||
|
||||
$fileExtensions = array('jpg', 'gif', 'mp4', 'webm');
|
||||
|
||||
|
||||
$files = array();
|
||||
|
||||
//foreach (glob("../videos/*.{" . implode(",", $fileExtensions) . "}", GLOB_BRACE) as $filename) {
|
||||
foreach (glob("../videos/*", GLOB_BRACE) as $filename) {
|
||||
$base = basename($filename);
|
||||
if (is_dir($filename)) {
|
||||
if (strpos($base, "_YPTuniqid_") !== false) {
|
||||
$files[$base] = array($base, $filename);
|
||||
}
|
||||
} else {
|
||||
|
||||
$baseName = explode("_portrait", $base);
|
||||
if (!empty($baseName[1])) {
|
||||
$files[$base] = array($baseName[0], $filename);
|
||||
} else {
|
||||
$baseName = explode("_thumbs", $base);
|
||||
if (!empty($baseName[1])) {
|
||||
$files[$base] = array($baseName[0], $filename);
|
||||
} else {
|
||||
$types = array('_HD', '_Low', '_SD');
|
||||
$notFound = true;
|
||||
foreach ($types as $value) {
|
||||
$baseName = explode($value, $base);
|
||||
if (!empty($baseName[1])) {
|
||||
$files[$base] = array($baseName[0], $filename);
|
||||
$notFound = false;
|
||||
}
|
||||
}
|
||||
if ($notFound) {
|
||||
foreach ($fileExtensions as $value) {
|
||||
if (strpos($base, ".$value") === false) {
|
||||
continue;
|
||||
}
|
||||
$baseName = str_replace("." . $value, "", $base);
|
||||
if (!empty($baseName[1])) {
|
||||
if (!in_array($baseName, $files)) {
|
||||
$files[$base] = array($baseName, $filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$lockFilename = '.move_v1.lock';
|
||||
$path = getVideosDir();
|
||||
$files = array_diff(scandir($path), array('.', '..'));
|
||||
echo "*** Total filenames " . count($files) . "\n";
|
||||
foreach ($files as $key => $value) {
|
||||
$video = Video::getVideoFromFileName($value[0], true);
|
||||
$dir = "{$path}{$value}";
|
||||
if(!is_dir($dir)){
|
||||
unset($files[$key]);
|
||||
continue;
|
||||
}
|
||||
$file = "{$dir}".DIRECTORY_SEPARATOR."{$lockFilename}";
|
||||
if(file_exists($file)){
|
||||
$filename = Video::getCleanFilenameFromFile($dir);
|
||||
$video = Video::getVideoFromFileName($filename, true);
|
||||
if (!empty($video)) {
|
||||
//echo "+++ Video FOUND for filename {$filename} ".PHP_EOL;
|
||||
unset($files[$key]);
|
||||
}else{
|
||||
$files[$key] = array($value, $dir);
|
||||
//echo "*** Video NOT found for filename {$filename} ".PHP_EOL;
|
||||
}
|
||||
}else{
|
||||
//echo "*** Lock file does not exists {$file} ".PHP_EOL;
|
||||
unset($files[$key]);
|
||||
}
|
||||
}
|
||||
echo "*** Total filenames " . count($files) . " Will be deleted\n";
|
||||
|
||||
$total = count($files) ;
|
||||
echo "*** Total filenames " . $total . " Will be deleted\n";
|
||||
|
||||
if(empty($total)){
|
||||
exit;
|
||||
}
|
||||
|
||||
$totalSize = 0;
|
||||
foreach ($files as $key => $value) {
|
||||
$size = filesize($value[1]);
|
||||
$size = getDirSize($value[1]);
|
||||
$totalSize += $size;
|
||||
echo "{$value[0]} => $value[1] " . (humanFileSize($size)) . " \n";
|
||||
}
|
||||
echo "*** Confirm Delete Them (" . humanFileSize($totalSize) . ")? y/n: ";
|
||||
|
||||
ob_flush();
|
||||
$confirm = trim(readline(""));
|
||||
if (!empty($confirm) && strtolower($confirm) === 'y') {
|
||||
|
|
|
@ -21,7 +21,7 @@ foreach ($videos as $value) {
|
|||
echo "\nStart: " . $value['title'];
|
||||
ob_flush();
|
||||
$videoFileName = $value['filename'];
|
||||
$destination = Video::getStoragePath()."{$videoFileName}.webp";
|
||||
$destination = Video::getPathToFile("{$videoFileName}.webp");
|
||||
if (!file_exists($destination)) {
|
||||
echo "\nGet webp";
|
||||
ob_flush();
|
||||
|
|
40
install/moveFilesToFolder.php
Normal file
40
install/moveFilesToFolder.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
//streamer config
|
||||
require_once '../videos/configuration.php';
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
}
|
||||
$path = getVideosDir();
|
||||
$total = Video::getTotalVideos("", false, true, true, false, false);
|
||||
$videos = Video::getAllVideosLight("", false, true, false);
|
||||
$count = 0;
|
||||
foreach ($videos as $value) {
|
||||
$count++;
|
||||
|
||||
$basename = "{$path}{$value['filename']}";
|
||||
$glob = glob("{$basename}*");
|
||||
$dirname = $basename.DIRECTORY_SEPARATOR;
|
||||
foreach ($glob as $file) {
|
||||
if (is_dir($file)) {
|
||||
//echo $file.PHP_EOL;
|
||||
$move = Video::updateDirectoryFilename($file);
|
||||
echo "-->".PHP_EOL." {$count}/{$total} move directory {$move['oldDir']} to {$move['newDir']} ".PHP_EOL."<--" . PHP_EOL . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
$filename = basename($file);
|
||||
$newname = Video::getPathToFile($filename);
|
||||
rename($file, $newname);
|
||||
echo "{$count}/{$total} move $filename to $newname" . PHP_EOL;
|
||||
}
|
||||
ob_flush();
|
||||
}
|
||||
echo PHP_EOL." Deleting cache ... ";
|
||||
ObjectYPT::deleteALLCache();
|
||||
echo PHP_EOL." Done! ";
|
||||
die();
|
||||
|
||||
|
||||
|
||||
|
|
@ -8,8 +8,6 @@ global $global, $config;
|
|||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
|
||||
if (empty($_POST)) {
|
||||
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
|
||||
|
@ -21,9 +19,10 @@ if (empty($_POST['format']) || !in_array($_POST['format'], $global['allowedExten
|
|||
_error_log("aVideoEncoder.json: Extension not allowed File " . __FILE__ . ": " . json_encode($_POST));
|
||||
die();
|
||||
}
|
||||
// pass admin user and pass
|
||||
$user = new User("", @$_POST['user'], @$_POST['password']);
|
||||
$user->login(false, true);
|
||||
if(!isset($_REQUEST['encodedPass'])){
|
||||
$_REQUEST['encodedPass'] = 1;
|
||||
}
|
||||
useVideoHashOrLogin();
|
||||
if (!User::canUpload()) {
|
||||
_error_log("aVideoEncoder.json: Permission denied to receive a file: " . json_encode($_POST));
|
||||
$obj->msg = __("Permission denied to receive a file: ") . json_encode($_POST);
|
||||
|
@ -84,12 +83,13 @@ if (preg_match("/(mp3|wav|ogg)$/i", $_POST['format'])) {
|
|||
|
||||
$videoFileName = $video->getFilename();
|
||||
if (empty($videoFileName)) {
|
||||
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($title));
|
||||
$videoFileName = uniqid($mainName . "_YPTuniqid_", true);
|
||||
$video->setFilename($videoFileName);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$videoFileName = $video->setFilename($videoFileName);
|
||||
}
|
||||
|
||||
$destination_local = Video::getStoragePath()."{$videoFileName}";
|
||||
$paths = Video::getPaths($videoFilename);
|
||||
$destination_local = "{$paths['path']}{$videoFileName}";
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
_error_log("aVideoEncoder.json: Files " . json_encode($_FILES));
|
||||
|
@ -176,6 +176,10 @@ if (!empty($_POST['usergroups_id'])) {
|
|||
|
||||
$obj->error = false;
|
||||
$obj->video_id = $video_id;
|
||||
|
||||
$v = new Video('', '', $video_id);
|
||||
$obj->video_id_hash = $v->getVideoIdHash();
|
||||
|
||||
_error_log("aVideoEncoder.json: Files Received for video {$video_id}: " . $video->getTitle());
|
||||
die(json_encode($obj));
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ if (empty($_POST)) {
|
|||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
// pass admin user and pass
|
||||
$user = new User("", @$_POST['user'], @$_POST['password']);
|
||||
$user->login(false, true);
|
||||
useVideoHashOrLogin();
|
||||
if (!User::canUpload()) {
|
||||
$obj->msg = __("Permission denied to Notify Done: ") . print_r($_POST, true);
|
||||
_error_log($obj->msg);
|
||||
|
|
|
@ -9,8 +9,6 @@ global $global, $config;
|
|||
if(!isset($global['systemRootPath'])){
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
|
||||
if (empty($_POST)) {
|
||||
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
|
||||
|
@ -18,9 +16,7 @@ if (empty($_POST)) {
|
|||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
// pass admin user and pass
|
||||
$user = new User("", @$_POST['user'], @$_POST['password']);
|
||||
$user->login(false, true);
|
||||
useVideoHashOrLogin();
|
||||
if (!User::canUpload()) {
|
||||
$obj->msg = __("Permission denied to receive a file: " . json_encode($_POST));
|
||||
_error_log("ReceiveImage: ".$obj->msg);
|
||||
|
@ -32,17 +28,16 @@ if(!Video::canEdit($_POST['videos_id'])){
|
|||
_error_log("ReceiveImage: ".$obj->msg);
|
||||
die(json_encode($obj));
|
||||
}
|
||||
_error_log("ReceiveImage: "."Start receiving image ". json_encode($_FILES)."". json_encode($_POST));
|
||||
_error_log("ReceiveImage: Start receiving image ". json_encode($_FILES)."". json_encode($_POST));
|
||||
// check if there is en video id if yes update if is not create a new one
|
||||
$video = new Video("", "", $_POST['videos_id']);
|
||||
$obj->video_id = $_POST['videos_id'];
|
||||
|
||||
_error_log("ReceiveImage: "."Encoder receiving post ". json_encode($_FILES));
|
||||
//_error_log("ReceiveImage: ".json_encode($_POST));
|
||||
|
||||
$videoFileName = $video->getFilename();
|
||||
$paths = Video::getPaths($videoFileName);
|
||||
$destination_local = "{$paths['path']}{$videoFileName}";
|
||||
|
||||
$destination_local = Video::getStoragePath()."{$videoFileName}";
|
||||
_error_log("ReceiveImage: videoFilename = [$videoFileName] destination_local = {$destination_local} Encoder receiving post ". json_encode($_FILES));
|
||||
|
||||
$obj->jpgDest = "{$destination_local}.jpg";
|
||||
if (!empty($_FILES['image']['tmp_name']) && ( !empty($_REQUEST['update_video_id']) || !file_exists($obj->jpgDest) || filesize($obj->jpgDest)===42342)) {
|
||||
|
@ -143,7 +138,7 @@ $obj->error = false;
|
|||
$obj->video_id = $videos_id;
|
||||
|
||||
$json = json_encode($obj);
|
||||
_error_log("ReceiveImage: "."Files Received for video {$videos_id}: " . $video->getTitle()." {$json}");
|
||||
_error_log("ReceiveImage: Files Received for video {$videos_id}: " . $video->getTitle()." {$json}");
|
||||
die($json);
|
||||
|
||||
/*
|
||||
|
|
|
@ -75,7 +75,8 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
}
|
||||
|
||||
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($path_parts['filename']));
|
||||
$filename = uniqid($mainName . "_YPTuniqid_", true);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$originalFilePath = Video::getStoragePath()."original_" . $filename;
|
||||
|
||||
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId']);
|
||||
|
|
|
@ -444,9 +444,13 @@ $global['langs_codes'] = array(
|
|||
);
|
||||
|
||||
$global['bcp47'] = array();
|
||||
$global['langs_codes_values'] = array();
|
||||
$global['langs_codes_values_withdot'] = array();
|
||||
|
||||
foreach ($global['langs_codes'] as $value) {
|
||||
$global['bcp47'][$value['value']] = $value;
|
||||
$global['langs_codes_values'][] = $value['value'];
|
||||
$global['langs_codes_values_withdot'][] = '.'.$value['value'];
|
||||
}
|
||||
|
||||
$global['js_availableLangs'] = 'var availableLangs = ' . json_encode($global['langs_codes']) . ';';
|
||||
|
|
|
@ -1100,12 +1100,11 @@ function getVideosURLAudio($fileName, $fileNameisThePath = false) {
|
|||
$time = $time[1] + $time[0];
|
||||
$start = $time;
|
||||
if ($fileNameisThePath) {
|
||||
$filename = str_replace(getVideosDir(), '', $fileName);
|
||||
$url = getCDN() . "videos/{$filename}";
|
||||
$filename = basename($fileName);
|
||||
$files["mp3"] = array(
|
||||
'filename' => $filename,
|
||||
'path' => $fileName,
|
||||
'url' => $url,
|
||||
'path' => Video::getPathToFile($filename),
|
||||
'url' => Video::getURLToFile($filename),
|
||||
'type' => 'audio',
|
||||
);
|
||||
} else {
|
||||
|
@ -1213,8 +1212,10 @@ function getVideosURL_V2($fileName, $recreateCache = false) {
|
|||
return $getVideosURL_V2Array[$cleanfilename];
|
||||
}
|
||||
|
||||
$pdf = getVideosDir() . "{$cleanfilename}.pdf";
|
||||
$mp3 = getVideosDir() . "{$cleanfilename}.mp3";
|
||||
$paths = Video::getPaths($cleanfilename);
|
||||
|
||||
$pdf = $paths['path'] . "{$cleanfilename}.pdf";
|
||||
$mp3 = $paths['path'] . "{$cleanfilename}.mp3";
|
||||
if (file_exists($pdf)) {
|
||||
return getVideosURLPDF($fileName);
|
||||
} elseif (file_exists($mp3)) {
|
||||
|
@ -1275,23 +1276,24 @@ function getVideosURL_V2($fileName, $recreateCache = false) {
|
|||
$filesInDir = globVideosDir($cleanfilename, true);
|
||||
TimeLogEnd($timeName, __LINE__);
|
||||
|
||||
|
||||
$timeName = "getVideosURL_V2::foreach";
|
||||
TimeLogStart($timeName);
|
||||
foreach ($filesInDir as $file) {
|
||||
$parts = pathinfo($file);
|
||||
|
||||
if ($parts['filename'] == 'index') {
|
||||
$parts['filename'] = str_replace(getVideosDir(), '', $parts['dirname']);
|
||||
$parts['filename'] = str_replace(Video::getPathToFile($parts['dirname']), '', $parts['dirname']);
|
||||
}
|
||||
|
||||
$timeName2 = "getVideosURL_V2::Video::getSourceFile({$parts['filename']}, .{$parts['extension']})";
|
||||
TimeLogStart($timeName2);
|
||||
$source = Video::getSourceFile($parts['filename'], ".{$parts['extension']}");
|
||||
TimeLogEnd($timeName2, __LINE__);
|
||||
//$timeName2 = "getVideosURL_V2::Video::getSourceFile({$parts['filename']}, .{$parts['extension']})";
|
||||
//TimeLogStart($timeName2);
|
||||
$source = Video::getSourceFile($parts['filename'], ".{$parts['extension']}");//var_dump($file, $parts, $source);
|
||||
//TimeLogEnd($timeName2, __LINE__);
|
||||
if (empty($source)) {
|
||||
continue;
|
||||
}
|
||||
if (filesize($file) < 20000 && !preg_match("/Dummy File/i", file_get_contents($file))) {
|
||||
if (filesize($file) < 1000 && !preg_match("/Dummy File/i", file_get_contents($file))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1325,7 +1327,7 @@ function getVideosURL_V2($fileName, $recreateCache = false) {
|
|||
// sort by resolution
|
||||
uasort($files, "sortVideosURL");
|
||||
}
|
||||
|
||||
//var_dump($files);exit;
|
||||
$getVideosURL_V2Array[$cleanfilename] = $files;
|
||||
return $getVideosURL_V2Array[$cleanfilename];
|
||||
}
|
||||
|
@ -1764,12 +1766,15 @@ function decideMoveUploadedToVideos($tmp_name, $filename, $type = "video") {
|
|||
$aws_s3 = AVideoPlugin::loadPluginIfEnabled('AWS_S3');
|
||||
$bb_b2 = AVideoPlugin::loadPluginIfEnabled('Blackblaze_B2');
|
||||
$ftp = AVideoPlugin::loadPluginIfEnabled('FTP_Storage');
|
||||
$destinationFile = getVideosDir() . "{$filename}";
|
||||
$paths = Video::getPaths($filename);
|
||||
$destinationFile = "{$paths['path']}{$filename}";
|
||||
//$destinationFile = getVideosDir() . "{$filename}";
|
||||
_error_log("decideMoveUploadedToVideos: {$filename}");
|
||||
$path_info = pathinfo($filename);
|
||||
if ($type !== "zip" && $path_info['extension'] === 'zip') {
|
||||
_error_log("decideMoveUploadedToVideos: ZIp file {$filename}");
|
||||
$dir = getVideosDir() . "{$path_info['filename']}";
|
||||
$paths = Video::getPaths($path_info['filename']);
|
||||
$dir = $paths['path'];
|
||||
unzipDirectory($tmp_name, $dir); // unzip it
|
||||
cleanDirectory($dir);
|
||||
if (!empty($aws_s3)) {
|
||||
|
@ -1899,7 +1904,8 @@ function decideFile_put_contentsToVideos($tmp_name, $filename) {
|
|||
} elseif (!empty($ftp)) {
|
||||
$ftp->move_uploaded_file($tmp_name, $filename);
|
||||
} else {
|
||||
if (!move_uploaded_file($tmp_name, getVideosDir() . "{$filename}")) {
|
||||
$path = Video::getPathToFile($filename);
|
||||
if (!move_uploaded_file($tmp_name, $path)) {
|
||||
$obj->msg = "Error on move_uploaded_file({$tmp_name}, {$filename})";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
@ -3631,7 +3637,8 @@ function getUsageFromFilename($filename, $dir = "") {
|
|||
}
|
||||
|
||||
if (empty($dir)) {
|
||||
$dir = getVideosDir() . "";
|
||||
$paths = Video::getPaths($filename);
|
||||
$dir = $paths['path'];
|
||||
}
|
||||
$pos = strrpos($dir, '/');
|
||||
$dir .= (($pos === false) ? "/" : "");
|
||||
|
@ -4134,7 +4141,7 @@ function isHLS() {
|
|||
global $video, $global;
|
||||
if (isLive()) {
|
||||
return true;
|
||||
} elseif (!empty($video) && $video['type'] == 'video' && file_exists(getVideosDir() . "{$video['filename']}/index.m3u8")) {
|
||||
} elseif (!empty($video) && $video['type'] == 'video' && file_exists(Video::getPathToFile("{$video['filename']}/index.m3u8"))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -5539,7 +5546,8 @@ function globVideosDir($filename, $filesOnly = false) {
|
|||
return array();
|
||||
}
|
||||
$cleanfilename = Video::getCleanFilenameFromFile($filename);
|
||||
$dir = getVideosDir();
|
||||
$paths = Video::getPaths($filename);;
|
||||
$dir = $paths['path'];
|
||||
|
||||
if (is_dir($dir . $filename)) {
|
||||
$dir = $dir . $filename;
|
||||
|
@ -5552,7 +5560,7 @@ function globVideosDir($filename, $filesOnly = false) {
|
|||
$pattern .= ".(" . implode("|", $formats) . ")";
|
||||
}
|
||||
$pattern .= "/";
|
||||
|
||||
//var_dump($dir, $pattern);
|
||||
return _glob($dir, $pattern);
|
||||
}
|
||||
|
||||
|
@ -5876,7 +5884,9 @@ function pathToRemoteURL($filename, $forceHTTP = false) {
|
|||
}
|
||||
if (empty($url)) {
|
||||
if ($forceHTTP) {
|
||||
$url = str_replace(getVideosDir(), getCDN() . "videos/", $filename);
|
||||
$paths = Video::getPaths($filename);
|
||||
//$url = str_replace(getVideosDir(), getCDN() . "videos/", $filename);
|
||||
$url = getCDN()."{$paths['relative']}";
|
||||
} else {
|
||||
$url = $filename;
|
||||
}
|
||||
|
@ -5890,9 +5900,7 @@ function pathToRemoteURL($filename, $forceHTTP = false) {
|
|||
|
||||
function getFilenameFromPath($path) {
|
||||
global $global;
|
||||
$fileName = str_replace(getVideosDir() . "", "", $path);
|
||||
$fileName = Video::getCleanFilenameFromFile($fileName);
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
|
@ -6592,3 +6600,17 @@ function inputToRequest(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function useVideoHashOrLogin(){
|
||||
|
||||
if(!empty($_REQUEST['video_id_hash'])){
|
||||
$videos_id = Video::getVideoIdFromHash($_REQUEST['video_id_hash']);
|
||||
if(!empty($videos_id)){
|
||||
$users_id = Video::getOwner($videos_id);
|
||||
$user = new User($users_id);
|
||||
_error_log("useVideoHashOrLogin: $users_id, $videos_id");
|
||||
return $user->login(true);
|
||||
}
|
||||
}
|
||||
return User::loginFromRequest();
|
||||
}
|
|
@ -2164,9 +2164,13 @@ if (typeof gtag !== \"function\") {
|
|||
if (!empty($_REQUEST['do_not_login'])) {
|
||||
return false;
|
||||
}
|
||||
if(empty($_REQUEST['pass']) && !empty($_REQUEST['password'])){
|
||||
$_REQUEST['pass'] = $_REQUEST['password'];
|
||||
}
|
||||
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
|
||||
$user = new User(0, $_REQUEST['user'], $_REQUEST['pass']);
|
||||
$user->login(false, !empty($_REQUEST['encodedPass']));
|
||||
$_REQUEST['do_not_login'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,12 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
|
||||
if (empty($this->filename)) {
|
||||
$this->filename = $this->type . "_" . uniqid();
|
||||
$prefix = $this->type;
|
||||
if(empty($prefix)){
|
||||
$prefix = 'v';
|
||||
}
|
||||
$paths = self::getNewVideoFilename($prefix);
|
||||
$this->filename = $paths['filename'];
|
||||
}
|
||||
|
||||
$this->can_download = intval($this->can_download);
|
||||
|
@ -853,7 +858,7 @@ if (!class_exists('Video')) {
|
|||
return false;
|
||||
}
|
||||
$sql = "SELECT * FROM videos WHERE filename = ? LIMIT 1";
|
||||
|
||||
//var_dump($sql, $fileName);
|
||||
$res = sqlDAL::readSql($sql, "s", array($fileName), true);
|
||||
if ($res != false) {
|
||||
$video = sqlDAL::fetchAssoc($res);
|
||||
|
@ -2708,6 +2713,9 @@ if (!class_exists('Video')) {
|
|||
//return array();
|
||||
//}
|
||||
|
||||
self::_moveSourceFilesToDir($filename);
|
||||
$paths = self::getPaths($filename);
|
||||
|
||||
if ($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)) {
|
||||
return array('path' => $global['systemRootPath'] . 'view/img/loading-gif.png', 'url' => getCDN() . 'view/img/loading-gif.png');
|
||||
}
|
||||
|
@ -2721,7 +2729,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
// check if there is a webp image
|
||||
if ($type === '.gif' && (empty($_SERVER['HTTP_USER_AGENT']) || get_browser_name($_SERVER['HTTP_USER_AGENT']) !== 'Safari')) {
|
||||
$path = self::getStoragePath() . "{$filename}.webp";
|
||||
$path = "{$paths['path']}{$filename}.webp";
|
||||
if (file_exists($path)) {
|
||||
$type = ".webp";
|
||||
}
|
||||
|
@ -2754,8 +2762,12 @@ if (!class_exists('Video')) {
|
|||
$token = "?" . implode("&", $vars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$paths = self::getPaths($filename);
|
||||
|
||||
$source = array();
|
||||
$source['path'] = self::getStoragePath() . "{$filename}{$type}";
|
||||
$source['path'] = $paths['path']."{$filename}{$type}";
|
||||
|
||||
if ($type == ".m3u8") {
|
||||
$source['path'] = self::getStoragePath() . "{$filename}/index{$type}";
|
||||
|
@ -2772,18 +2784,18 @@ if (!class_exists('Video')) {
|
|||
if (!empty($video['sites_id']) && (preg_match("/.*\\.mp3$/", $type) || preg_match("/.*\\.mp4$/", $type) || preg_match("/.*\\.webm$/", $type) || $type == ".m3u8" || $type == ".pdf" || $type == ".zip") && @filesize($source['path']) < 20) {
|
||||
$site = new Sites($video['sites_id']);
|
||||
$siteURL = getCDNOrURL($site->getUrl(), 'CDN_YPTStorage', $video['sites_id']);
|
||||
$source['url'] = "{$siteURL}videos/{$filename}{$type}{$token}";
|
||||
$source['url'] = "{$siteURL}{$paths['relative']}{$filename}{$type}{$token}";
|
||||
if ($type == ".m3u8") {
|
||||
$source['url'] = "{$siteURL}videos/{$filename}/index{$type}{$token}";
|
||||
}
|
||||
} elseif (!empty($advancedCustom->videosCDN) && $canUseCDN) {
|
||||
$advancedCustom->videosCDN = rtrim($advancedCustom->videosCDN, '/') . '/';
|
||||
$source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}{$type}{$token}";
|
||||
$source['url'] = "{$advancedCustom->videosCDN}{$paths['relative']}{$filename}{$type}{$token}";
|
||||
if ($type == ".m3u8") {
|
||||
$source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}/index{$type}{$token}";
|
||||
}
|
||||
} else {
|
||||
$source['url'] = getCDN() . "videos/{$filename}{$type}{$token}";
|
||||
$source['url'] = getCDN() . "{$paths['relative']}{$filename}{$type}{$token}";
|
||||
if ($type == ".m3u8") {
|
||||
$source['url'] = getCDN() . "videos/{$filename}/index{$type}{$token}";
|
||||
}
|
||||
|
@ -2803,6 +2815,7 @@ if (!class_exists('Video')) {
|
|||
if (!file_exists($source['path']) || ($type !== ".m3u8" && !is_dir($source['path']) && (filesize($source['path']) < 1000 && filesize($source['path']) != 10))) {
|
||||
if ($type != "_thumbsV2.jpg" && $type != "_thumbsSmallV2.jpg" && $type != "_portrait_thumbsV2.jpg" && $type != "_portrait_thumbsSmallV2.jpg") {
|
||||
$VideoGetSourceFile[$cacheName] = array('path' => false, 'url' => false);
|
||||
//echo PHP_EOL.'---'.PHP_EOL;var_dump($source, $type, !file_exists($source['path']), ($type !== ".m3u8" && !is_dir($source['path']) && (filesize($source['path']) < 1000 && filesize($source['path']) != 10)));echo PHP_EOL.'+++'.PHP_EOL;
|
||||
return $VideoGetSourceFile[$cacheName];
|
||||
}
|
||||
}
|
||||
|
@ -2825,14 +2838,166 @@ if (!class_exists('Video')) {
|
|||
return $VideoGetSourceFile[$cacheName];
|
||||
}
|
||||
|
||||
private static function _moveSourceFilesToDir($videoFilename){
|
||||
$videoFilename = self::getCleanFilenameFromFile($videoFilename);
|
||||
if(preg_match('/^(hd|low|sd|(res[0-9]{3,4}))$/', $videoFilename)){
|
||||
return false;
|
||||
}
|
||||
$paths = self::getPaths($videoFilename);
|
||||
$lock = "{$paths['path']}.move_v1.lock";
|
||||
if(file_exists($lock)){
|
||||
return true;
|
||||
}
|
||||
$videosDir = self::getStoragePath();
|
||||
mkdir($paths['path'], 0755, true);
|
||||
$files = _glob($videosDir, '/'.$videoFilename.'[._][a-z0-9_]+/i');
|
||||
//var_dump($paths['path'], is_dir($paths['path']), $files);exit;
|
||||
foreach ($files as $oldname) {
|
||||
if(is_dir($oldname)){
|
||||
continue;
|
||||
}
|
||||
$newname = str_replace($videosDir, $paths['path'], $oldname);
|
||||
rename($oldname , $newname);
|
||||
}
|
||||
return file_put_contents($lock, time());
|
||||
}
|
||||
|
||||
public static function getPaths($videoFilename){
|
||||
global $global;
|
||||
$cleanVideoFilename = self::getCleanFilenameFromFile($videoFilename);
|
||||
$videosDir = self::getStoragePath();
|
||||
if(preg_match('/index\.m3u8$/', $videoFilename)){
|
||||
$path = "{$videosDir}";
|
||||
}else{
|
||||
$path = "{$videosDir}{$cleanVideoFilename}".DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$relative = "videos/{$cleanVideoFilename}/";
|
||||
$url = getCDN()."{$relative}";
|
||||
return array('filename'=>$cleanVideoFilename, 'path'=>$path, 'url'=>$url, 'relative'=>$relative);
|
||||
}
|
||||
|
||||
public static function getPathToFile($videoFilename){
|
||||
$paths = Video::getPaths($videoFilename);
|
||||
return "{$paths['path']}{$videoFilename}";
|
||||
}
|
||||
|
||||
public static function getURLToFile($videoFilename){
|
||||
$paths = Video::getPaths($videoFilename);
|
||||
return "{$paths['url']}{$videoFilename}";
|
||||
}
|
||||
|
||||
public static function getURLToFileIfExists($videoFilename){
|
||||
$paths = Video::getPaths($videoFilename);
|
||||
if(!file_exists("{$paths['path']}{$videoFilename}")){
|
||||
return false;
|
||||
}
|
||||
return "{$paths['url']}{$videoFilename}";
|
||||
}
|
||||
|
||||
public static function getNewVideoFilename($prefix='', $time=''){
|
||||
$uid = substr(uniqid(), -4);
|
||||
if(empty($time)){
|
||||
$time=time();
|
||||
}
|
||||
$prefix = preg_replace('/[^a-z0-9]/i', '', $prefix);
|
||||
if(empty($prefix)){
|
||||
$prefix='v';
|
||||
}
|
||||
$date = date('ymdHis', $time);
|
||||
$videoFilename = strtolower("{$prefix}_{$date}_{$uid}");
|
||||
return self::getPaths($videoFilename);
|
||||
}
|
||||
|
||||
public static function getNewVideoFilenameWithPrefixFromFilename($filename){
|
||||
$video = self::getVideoFromFileNameLight($filename);
|
||||
if(empty($video)){
|
||||
return self::getNewVideoFilename();
|
||||
}
|
||||
return self::getNewVideoFilename($video['type']);
|
||||
}
|
||||
|
||||
public static function updateDirectoryFilename($directory){
|
||||
if(!is_dir($directory)){
|
||||
_error_log('Video::updateDirectoryFilename directory not found '."[{$directory}]");
|
||||
return false;
|
||||
}
|
||||
$video = self::getVideoFromFileNameLight($directory);
|
||||
if(empty($video)){
|
||||
_error_log('Video::updateDirectoryFilename video not found for directory '."[{$directory}]");
|
||||
return false;
|
||||
}
|
||||
$newFilename = self::getNewVideoFilename($video['type'], strtotime($video['created']));
|
||||
$v = new Video('', '', $video['id']);
|
||||
$v->setFilename($newFilename['filename'], true);
|
||||
$id = $v->save(false, true);
|
||||
|
||||
if($id){
|
||||
$renamed = rename($directory, $newFilename['path']);
|
||||
if(empty($renamed)){ // rename dir fail rollback
|
||||
_error_log('Video::updateDirectoryFilename rename dir fail, we will rollback changes '."[olddir={$directory}] [newdir={$newFilename['path']}]");
|
||||
$v = new Video('', '', $video['id']);
|
||||
$v->setFilename($video['filename'], true);
|
||||
$id = $v->save(false, true);
|
||||
return false;
|
||||
}else{
|
||||
_error_log('Video::updateDirectoryFilename video folder renamed from '."[olddir={$directory}] [newdir={$newFilename['path']}]");
|
||||
self::updateFilesInDirectoryFilename($newFilename['path']);
|
||||
}
|
||||
}
|
||||
|
||||
return array('videos_id'=>$video['id'], 'filename'=>$newFilename['filename'], 'oldDir'=>$directory, 'newDir'=>$newFilename['path'] );
|
||||
}
|
||||
|
||||
public static function updateFilesInDirectoryFilename($directory){
|
||||
if(!is_dir($directory)){
|
||||
_error_log('Video::updateFilesInDirectoryFilename directory not found '."[{$directory}]");
|
||||
return false;
|
||||
}
|
||||
$video = self::getVideoFromFileNameLight($directory);
|
||||
if(empty($video)){
|
||||
_error_log('Video::updateFilesInDirectoryFilename video not found for directory '."[{$directory}]");
|
||||
return false;
|
||||
}
|
||||
$newFilename = $video['filename'];
|
||||
$files = glob("{$directory}*.{jpg,png,gif,webp,vtt,srt,mp4,webm,mp3,ogg,notfound}", GLOB_BRACE);
|
||||
_error_log('Video::updateFilesInDirectoryFilename total files found '.count($files));
|
||||
foreach ($files as $value) {
|
||||
$oldFilename = self::getCleanFilenameFromFile($value);
|
||||
$newFilenamePath = str_replace($oldFilename, $newFilename, $value);
|
||||
$renamed = rename($value, $newFilenamePath);
|
||||
if(empty($renamed)){ // rename dir fail rollback
|
||||
_error_log('Video::updateFilesInDirectoryFilename rename file fail '."[olddir={$value}] [newdir={$newFilenamePath}]");
|
||||
}else{
|
||||
_error_log('Video::updateFilesInDirectoryFilename video file renamed from '."[olddir={$value}] [newdir={$newFilenamePath}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getVideoIdHash(){
|
||||
$obj = new stdClass();
|
||||
$obj->videos_id = $this->id;
|
||||
return encryptString(json_encode($obj));
|
||||
}
|
||||
|
||||
public static function getVideoIdFromHash($hash){
|
||||
$string = decryptString($hash);
|
||||
if(!empty($string)){
|
||||
$json = json_decode($string);
|
||||
if(!empty($json) && !empty($json->videos_id)){
|
||||
return $json->videos_id;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getCleanFilenameFromFile($filename) {
|
||||
global $global;
|
||||
if (empty($filename)) {
|
||||
return "";
|
||||
}
|
||||
$filename = fixPath($filename);
|
||||
$search = array('_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2');
|
||||
$replace = array('', '', '', '', '', '', '', '', '', '');
|
||||
$filename = str_replace(getVideosDir(), '', $filename);
|
||||
$search = array('_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2', '_spectrum', '_tvg')+$global['langs_codes_values_withdot'];
|
||||
|
||||
if (empty($global['avideo_resolutions']) || !is_array($global['avideo_resolutions'])) {
|
||||
$global['avideo_resolutions'] = array(240, 360, 480, 540, 720, 1080, 1440, 2160);
|
||||
|
@ -2840,20 +3005,12 @@ if (!class_exists('Video')) {
|
|||
|
||||
foreach ($global['avideo_resolutions'] as $value) {
|
||||
$search[] = "_{$value}";
|
||||
$replace[] = '';
|
||||
|
||||
$search[] = "res{$value}";
|
||||
$replace[] = '';
|
||||
}
|
||||
|
||||
$cleanName = str_replace($search, $replace, $filename);
|
||||
$cleanName = str_replace($search, '', $filename);
|
||||
$path_parts = pathinfo($cleanName);
|
||||
if (!empty($path_parts["extension"]) && $path_parts["extension"] === "m3u8") {
|
||||
preg_match('/videos\/([^\/]+)/', $path_parts["dirname"], $matches);
|
||||
if (!empty($matches[1])) {
|
||||
$path_parts['filename'] = $matches[1];
|
||||
}
|
||||
}
|
||||
if (empty($path_parts['extension'])) {
|
||||
//_error_log("Video::getCleanFilenameFromFile could not find extension of ".$filename);
|
||||
if (!empty($path_parts['filename'])) {
|
||||
|
@ -2864,8 +3021,7 @@ if (!class_exists('Video')) {
|
|||
} else if (strlen($path_parts['extension']) > 4) {
|
||||
return $cleanName;
|
||||
} else if ($path_parts['filename'] == 'index' && $path_parts['extension'] == 'm3u8') {
|
||||
$clanFileName = str_replace(getVideosDir(), '', $path_parts['dirname']);
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $clanFileName);
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $cleanName);
|
||||
return $parts[0];
|
||||
} else {
|
||||
return $path_parts['filename'];
|
||||
|
@ -3592,7 +3748,8 @@ if (!class_exists('Video')) {
|
|||
return false;
|
||||
}
|
||||
global $global;
|
||||
$filePath = Video::getStoragePath() . "{$filename}";
|
||||
|
||||
$filePath = Video::getPathToFile($filename);
|
||||
// Streamlined for less coding space.
|
||||
$files = glob("{$filePath}*_thumbs*.jpg");
|
||||
foreach ($files as $file) {
|
||||
|
|
|
@ -42,7 +42,8 @@ if (!empty($_POST['videoLink'])) {
|
|||
if (empty($_POST['id']) && !(in_array($extension, $audioLinks) || in_array($extension, $videoLinks))) {
|
||||
$info = url_get_contents($config->getEncoderURL() . "getLinkInfo/" . base64_encode($_POST['videoLink']));
|
||||
$infoObj = _json_decode($info);
|
||||
$filename = uniqid("_YPTuniqid_", true);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$filename = $obj->setFilename($filename);
|
||||
$obj->setTitle($infoObj->title);
|
||||
$obj->setClean_title($infoObj->title);
|
||||
|
@ -51,7 +52,8 @@ if (!empty($_POST['videoLink'])) {
|
|||
file_put_contents($global['systemRootPath'] . "videos/{$filename}.jpg", base64_decode($infoObj->thumbs64));
|
||||
$_POST['videoLinkType'] = "embed";
|
||||
} else if (empty($_POST['id'])) {
|
||||
$filename = uniqid("_YPTuniqid_", true);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$filename = $obj->setFilename($filename);
|
||||
$obj->setTitle($path_parts["filename"]);
|
||||
$obj->setClean_title($path_parts["filename"]);
|
||||
|
@ -87,7 +89,8 @@ if (!empty($_POST['isArticle'])) {
|
|||
if (empty($_POST['id'])) {
|
||||
$obj->setStatus('a');
|
||||
}
|
||||
$filename = uniqid("_YPTuniqid_", true);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$filename = $obj->setFilename($filename);
|
||||
}
|
||||
TimeLogEnd(__FILE__, __LINE__);
|
||||
|
|
|
@ -72,14 +72,16 @@ if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
|||
}
|
||||
//$info = url_get_contents($config->getEncoderURL() . "getLinkInfo/" . base64_encode($value));
|
||||
//$infoObj = _json_decode($info);
|
||||
$filename = uniqid("_YPTuniqid_", true);
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
$videos = new Video();
|
||||
$videos->setFilename($filename);
|
||||
$videos->setTitle($value['title']);
|
||||
$videos->setDescription($value['description']);
|
||||
$videos->setClean_title($value['title']);
|
||||
$videos->setDuration(ISO8601ToDuration($value['duration']));
|
||||
file_put_contents($global['systemRootPath'] . "videos/{$filename}.jpg", url_get_contents($value['thumbs']));
|
||||
$poster = Video::getPathToFile("{$video['filename']}.jpg");
|
||||
file_put_contents($poster, url_get_contents($value['thumbs']));
|
||||
$videos->setVideoLink($value['link']);
|
||||
$videos->setType('embed');
|
||||
|
||||
|
|
|
@ -11,9 +11,10 @@ function getCloneFilesInfo($dir, $subdir = "", $extensionsToCopy = array('mp4',
|
|||
if (!in_array($path_info['extension'], $extensionsToCopy)) {
|
||||
continue;
|
||||
}
|
||||
$url = Video::getURLToFile("{$subdir}{$entry}");
|
||||
$f = new stdClass();
|
||||
$f->filename = $entry;
|
||||
$f->url = "{$global['webSiteRootURL']}videos/{$subdir}{$entry}";
|
||||
$f->url = $url;
|
||||
$f->filesize = filesize($dir . $entry);
|
||||
$f->filemtime = filemtime($dir . $entry);
|
||||
$files[] = $f;
|
||||
|
|
|
@ -155,7 +155,7 @@ a.h6{
|
|||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
z-index: 9999;
|
||||
z-index: 1025;
|
||||
display: none;
|
||||
}
|
||||
.galleryVideo .galleryVideoButtons button{
|
||||
|
|
|
@ -26,7 +26,8 @@ if ($oIMDB->isReady) {
|
|||
if (empty($_GET['what']) || $_GET['what'] == 1) {
|
||||
// get poster
|
||||
$poster = $oIMDB->getPoster('big', true);
|
||||
$filename = Video::getStoragePath()."{$videoFileName}_portrait.jpg";
|
||||
|
||||
$filename = Video::getPathToFile("{$videoFileName}_portrait.jpg");
|
||||
im_resizeV2($poster, $filename, $plugin->posterWidth, $plugin->posterHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ Best regards,
|
|||
return false;
|
||||
}
|
||||
if (empty($loginControlCreateLog)) {
|
||||
_error_log("LoginControl::createLog {$_SERVER['SCRIPT_NAME']} " . json_encode(debug_backtrace()));
|
||||
//_error_log("LoginControl::createLog {$_SERVER['SCRIPT_NAME']} " . json_encode(debug_backtrace()));
|
||||
$ulh = new logincontrol_history(0);
|
||||
$ulh->setIp(getRealIpAddr());
|
||||
$ulh->setStatus(self::is2FAConfirmed($users_id) ? logincontrol_history_status::$CONFIRMED : logincontrol_history_status::$WAITING_CONFIRMATION);
|
||||
|
|
|
@ -66,7 +66,9 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
}
|
||||
|
||||
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($_FILES['upl']['name']));
|
||||
$filename = uniqid($mainName . "_YPTuniqid_", true);
|
||||
|
||||
$paths = Video::getNewVideoFilename();
|
||||
$filename = $paths['filename'];
|
||||
|
||||
$video = new Video(preg_replace("/_+/", " ", $_FILES['upl']['name']), $filename, 0);
|
||||
$video->setDuration($duration);
|
||||
|
|
|
@ -417,15 +417,15 @@ class PlayLists extends PluginAbstract {
|
|||
|
||||
$serie = self::isPlayListASerie($playlists_id);
|
||||
if (!empty($serie)) {
|
||||
$tvg_logo = "videos/{$serie['filename']}_tvg.jpg";
|
||||
$tvg_logo_path = "{$global['systemRootPath']}{$tvg_logo}";
|
||||
$tvg_logo = "{$serie['filename']}_tvg.jpg";
|
||||
$tvg_logo_path = Video::getPathToFile($tvg_logo);
|
||||
if (!file_exists($tvg_logo_path)) {
|
||||
$images = Video::getSourceFile($serie['filename']);
|
||||
$img = $images["path"];
|
||||
im_resizeV2($img, $tvg_logo_path, 150, 150, 80);
|
||||
}
|
||||
|
||||
$tvg_logo_url = "{$global['webSiteRootURL']}{$tvg_logo}";
|
||||
$tvg_logo_url = Video::getURLToFile($tvg_logo);
|
||||
return $tvg_logo_url;
|
||||
} else {
|
||||
$pl = new PlayList($playlists_id);
|
||||
|
|
3
updatedb/updateDb.v11.0.sql
Normal file
3
updatedb/updateDb.v11.0.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
-- https://github.com/WWBN/AVideo/issues/5075
|
||||
|
||||
UPDATE configurations SET version = '11.0', modified = now() WHERE id = 1;
|
|
@ -18,7 +18,7 @@ if (empty($_GET['videoDirectory'])) {
|
|||
|
||||
$video = Video::getVideoFromFileName($_GET['videoDirectory'], true);
|
||||
|
||||
$filename = Video::getStoragePath() . "{$_GET['videoDirectory']}".DIRECTORY_SEPARATOR."index.m3u8";
|
||||
$filename = Video::getPathToFile("{$_GET['videoDirectory']}".DIRECTORY_SEPARATOR."index.m3u8");
|
||||
|
||||
if (empty($video) || !file_exists($filename)) {
|
||||
header("Content-Type: text/plain");
|
||||
|
@ -47,7 +47,7 @@ if (empty($video) || !file_exists($filename)) {
|
|||
}
|
||||
}
|
||||
|
||||
$_GET['file'] = Video::getStoragePath() . "{$_GET['videoDirectory']}".DIRECTORY_SEPARATOR."index.m3u8";
|
||||
$_GET['file'] = Video::getPathToFile("{$_GET['videoDirectory']}".DIRECTORY_SEPARATOR."index.m3u8");
|
||||
//var_dump($_GET['file']);exit;
|
||||
$cachedPath = explode(DIRECTORY_SEPARATOR, $_GET['videoDirectory']);
|
||||
if (empty($_SESSION['user']['sessionCache']['hls'][$cachedPath[0]]) && empty($_GET['download'])) {
|
||||
|
|
|
@ -14,7 +14,8 @@ if(!empty($_GET['image'])){
|
|||
}
|
||||
// if the thumb is not ready yet, try to find the default image
|
||||
if(preg_match('/videos\/(.*)_thumbs(V2)?.jpg/',$imageURL, $matches)){
|
||||
$jpg = Video::getStoragePath()."{$matches[1]}.jpg";
|
||||
|
||||
$jpg = Video::getPathToFile("{$matches[1]}.jpg");
|
||||
if(file_exists($jpg)){
|
||||
$file = $jpg;
|
||||
$type = 'image/jpg';
|
||||
|
|
|
@ -1924,14 +1924,14 @@ if (Permissions::canAdminVideos()) {
|
|||
var type, img, is_portrait;
|
||||
if (row.type === "audio") {
|
||||
type = "<i class='fa fa-headphones hidden-xs' style='font-size:14px;'></i> ";
|
||||
img = "<img class='img img-responsive img-thumbnail pull-left rotate" + row.rotation + "' src='<?php echo $global['webSiteRootURL']; ?>videos/" + row.filename + ".jpg?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
img = "<img class='img img-responsive img-thumbnail pull-left rotate" + row.rotation + "' src='<?php echo $global['webSiteRootURL']; ?>videos/" + row.filename + "/" + row.filename + ".jpg?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
if (row.videosURL && typeof row.videosURL !== 'undefined' && typeof row.videosURL.pjpg !== 'undefined' && row.videosURL.pjpg.url) {
|
||||
img = "<img class='img img-responsive img-thumbnail pull-left' src='" + row.videosURL.pjpg.url + "?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
} else if (row.videosURL && typeof row.videosURL !== 'undefined' && typeof row.videosURL.jpg !== 'undefined' && row.videosURL.jpg.url) {
|
||||
img = "<img class='img img-responsive img-thumbnail pull-left' src='" + row.videosURL.jpg.url + "?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
} else {
|
||||
is_portrait = (row.rotation === "90" || row.rotation === "270") ? "img-portrait" : "";
|
||||
img = "<img class='img img-responsive " + is_portrait + " img-thumbnail pull-left rotate" + row.rotation + "' src='<?php echo $global['webSiteRootURL']; ?>videos/" + row.filename + ".jpg?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
img = "<img class='img img-responsive " + is_portrait + " img-thumbnail pull-left rotate" + row.rotation + "' src='<?php echo $global['webSiteRootURL']; ?>videos/" + row.filename + "/" + row.filename + ".jpg?" + Math.random() + "' style='max-height:80px; margin-right: 5px;'> ";
|
||||
}
|
||||
} else {
|
||||
type = "<i class='fa fa-film hidden-xs' style='font-size:14px;'></i> ";
|
||||
|
|
|
@ -142,9 +142,11 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
|
||||
if ($extension !== "jpg" && $video->getType() == "image") {
|
||||
sleep(1); // to make sure the file will be available
|
||||
$file = Video::getStoragePath() . "" . $video->getFilename();
|
||||
$file = $video->getFilename();
|
||||
$jpgFrom = Video::getPathToFile("{$file}.{$extension}");
|
||||
$jpgTo = Video::getPathToFile("{$file}.jpg");
|
||||
try {
|
||||
convertImage("{$file}.{$extension}", "{$file}.jpg", 70);
|
||||
convertImage($jpgFrom, $jpgTo, 70);
|
||||
} catch (Exception $exc) {
|
||||
_error_log("We could not convert the image to JPG " . $exc->getMessage());
|
||||
}
|
||||
|
|
|
@ -50,22 +50,17 @@ if (!empty($playlist_id)) {
|
|||
<a href="<?php echo Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], "", $get); ?>" title="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="videoLink h6">
|
||||
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
|
||||
<?php
|
||||
$imgGif = "";
|
||||
if (file_exists(Video::getStoragePath()."{$autoPlayVideo['filename']}.gif")) {
|
||||
$imgGif = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.gif";
|
||||
}
|
||||
$imgGif = Video::getURLToFileIfExists("{$autoPlayVideo['filename']}.gif");
|
||||
if ($autoPlayVideo['type'] === "pdf") {
|
||||
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.png";
|
||||
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
|
||||
$imgGif = Video::getURLToFileIfExists("{$autoPlayVideo['filename']}.png");
|
||||
} else if (($autoPlayVideo['type'] !== "audio") && ($autoPlayVideo['type'] !== "linkAudio")) {
|
||||
$img = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.jpg";
|
||||
$img_portrait = ($autoPlayVideo['rotation'] === "90" || $autoPlayVideo['rotation'] === "270") ? "img-portrait" : "";
|
||||
$imgGif = Video::getURLToFileIfExists("{$autoPlayVideo['filename']}.jpg");
|
||||
} else {
|
||||
$img = "".getCDN()."view/img/audio_wave.jpg";
|
||||
$img = getCDN()."view/img/audio_wave.jpg";
|
||||
$img_portrait = "";
|
||||
}
|
||||
?>
|
||||
<img src="<?php echo $img; ?>" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" />
|
||||
<img src="<?php echo $img; ?>" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" class="img img-responsive " height="130" />
|
||||
<?php if (!empty($imgGif)) { ?>
|
||||
<img src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo str_replace('"', '', $autoPlayVideo['title']); ?>" id="thumbsGIF<?php echo $autoPlayVideo['id']; ?>" class="thumbsGIF img-responsive <?php echo $img_portrait; ?> rotate<?php echo $autoPlayVideo['rotation']; ?>" height="130" />
|
||||
<?php } ?>
|
||||
|
|
|
@ -403,7 +403,7 @@ if (User::hasBlockedUser($video['users_id'])) {
|
|||
});
|
||||
</script>
|
||||
<?php
|
||||
} else if ($video['type'] == "audio" && !file_exists(Video::getStoragePath() . "{$video['filename']}.mp4")) {
|
||||
} else if ($video['type'] == "audio" && !file_exists(Video::getPathToFile("{$video['filename']}.mp4"))) {
|
||||
$isAudio = 1;
|
||||
?>
|
||||
<!-- audio -->
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../videos/configuration.php';
|
||||
|
@ -16,7 +15,7 @@ if (empty($_GET['file'])) {
|
|||
|
||||
$path_parts = pathinfo($_GET['file']);
|
||||
$file = $path_parts['basename'];
|
||||
$path = Video::getStoragePath()."{$file}";
|
||||
|
||||
|
||||
if ($file == "X-Sendfile.mp4") {
|
||||
$path = "{$global['systemRootPath']}plugin/SecureVideosDirectory/test.json";
|
||||
|
@ -36,6 +35,7 @@ if ($file == "configuration.php") {
|
|||
forbiddenPage("Cant read this");
|
||||
}
|
||||
|
||||
$path = Video::getPathToFile($file);
|
||||
if (file_exists($path)) {
|
||||
if (!empty($_GET['download'])) {
|
||||
if(!CustomizeUser::canDownloadVideos()){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue