1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

Wrong download button

This commit is contained in:
DanieL 2022-04-26 14:26:57 -03:00
parent 6d2883076b
commit c3ecb22e78

View file

@ -174,11 +174,14 @@ if (User::hasBlockedUser($video['users_id'])) {
$videoHLSObj = AVideoPlugin::getDataObjectIfEnabled('VideoHLS'); $videoHLSObj = AVideoPlugin::getDataObjectIfEnabled('VideoHLS');
if (!empty($videoHLSObj)) { if (!empty($videoHLSObj)) {
if (!empty($videoHLSObj->saveMP4CopyOnCDNStorageToAllowDownload)) { $cdnObj = AVideoPlugin::getDataObjectIfEnabled('CDN');
$filesToDownload[] = VideoHLS::getCDNDownloadLink($video['id'], 'mp4'); if(!empty($cdnObj) && $cdnObj->enable_storage){
} if (!empty($videoHLSObj->saveMP4CopyOnCDNStorageToAllowDownload)) {
if (!empty($videoHLSObj->saveMP3CopyOnCDNStorageToAllowDownload)) { $filesToDownload[] = VideoHLS::getCDNDownloadLink($video['id'], 'mp4');
$filesToDownload[] = VideoHLS::getCDNDownloadLink($video['id'], 'mp3'); }
if (!empty($videoHLSObj->saveMP3CopyOnCDNStorageToAllowDownload)) {
$filesToDownload[] = VideoHLS::getCDNDownloadLink($video['id'], 'mp3');
}
} }
} }
@ -258,6 +261,9 @@ if (User::hasBlockedUser($video['users_id'])) {
<div class="list-group list-group-horizontal"> <div class="list-group list-group-horizontal">
<?php <?php
foreach ($filesToDownload as $theLink) { foreach ($filesToDownload as $theLink) {
if(empty($theLink)){
continue;
}
if (preg_match('/\.json/i', $theLink['url'])) { if (preg_match('/\.json/i', $theLink['url'])) {
?> ?>
<button type="button" onclick="downloadURLOrAlertError('<?php echo $theLink['url']; ?>', {}, '<?php echo $video['clean_title']; ?>.<?php echo strtolower($theLink['name']); ?>');" <button type="button" onclick="downloadURLOrAlertError('<?php echo $theLink['url']; ?>', {}, '<?php echo $video['clean_title']; ?>.<?php echo strtolower($theLink['name']); ?>');"