1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Add PDF opening functionality and improve playlist handling

- Added translation for "Open PDF" in Portuguese locale.
- Updated Video::getURL to support embedding.
- Implemented automatic redirection to the current video in the playlist if available.
- Enhanced row and row_info views to handle video type and display appropriate buttons.
- Introduced deep-linking functionality for mobile app integration in open-in-app-button.php.
This commit is contained in:
Daniel Neto 2025-07-08 13:57:55 -03:00
parent 22407c9e24
commit 64b57d1b99
8 changed files with 240 additions and 187 deletions

View file

@ -347,6 +347,7 @@ $t['Only direct mp4-files - if you download it with the link, it should be a mov
$t['Only verified users can upload'] = 'Somente usuários verificados podem fazer upload';
$t['Only you can see this, because you are an admin.'] = 'Só você pode ver isso, porque você é um administrador.';
$t['Open pop-up Login window'] = 'Abrir janela pop-up para login';
$t['Open PDF'] = 'Abrir PDF';
$t['Order'] = 'Ordem';
$t['Organize'] = 'Organizar';
$t['Other Files'] = 'Outros arquivos';

View file

@ -5647,7 +5647,7 @@ if (!class_exists('Video')) {
public static function getURL($videos_id)
{
return self::getLink($videos_id, '', isIframe());
return self::getLink($videos_id, '', isIframe() || isEmbed());
}
public static function getLink($videos_id, $clean_title, $embed = false, $get = [])

View file

@ -0,0 +1,29 @@
<?php
$videos_id = getVideos_id();
?>
<button class="btn btn-primary">
<span class="glyphicon glyphicon-phone"></span> <?php echo __('Open in the app'); ?>
</button>
<script>
/* Attempt deep-link first, fallback keeps user on the web page.
Works on iOS & Android mobile browsers that allow custom-scheme redirect. */
$('#open-in-app').on('click', function (e) {
e.preventDefault(); // stop immediate navigation
var webURL = this.href; // original link
var deepLink = 'ypt://video?videos_id=<?php echo $videos_id; ?>'; // build dynamically if preciso
var timeout = 1200; // ms to decide fallback
/* Create hidden iframe (Android < 5) or set window.location (iOS/modern) */
var clickedAt = +new Date();
window.location = deepLink;
/* If after timeout the page hasn't switched, assume failure and stay */
setTimeout(function () {
if (+new Date() - clickedAt < timeout + 100) {
window.location = webURL; // graceful fallback
}
}, timeout);
});
</script>

View file

@ -153,6 +153,15 @@ $playListData_videos_id = getPlayListDataVideosId();
TimeLogEnd($timelogname, __LINE__);
if (empty($playListData)) {
$plp = new PlayListPlayer(@$_GET['playlists_id'], @$_GET['playlists_tags_id']);
$video = $plp->getCurrentVideo();
if (!empty($video)) {
$url = Video::getURL($video['id']);;
if (!empty($url)) {
header('Location: ' . $url);
exit;
}
}
forbiddenPage(__("The program is empty"));
}

View file

@ -80,6 +80,7 @@ $uidFlickirty = uniqid();
startModeFlix('#<?php echo $uidFlickirty; ?>-Flickirty ');
</script>
<?php
$rowLinkType = '';
$rowlink = false;
$rowlinkEmbed = false;
//}

View file

@ -85,7 +85,8 @@ TimeLogStart($timeLog3);
}
if (!empty($obj->titleLabel)) {
?>
<h4 style="<?php if (!empty($obj->titleLabelOverPoster)) { ?>margin-top: -27px;<?php } echo $obj->titleLabelCSS; ?> "><?php echo $value['title']; ?></h4>
<h4 style="<?php if (!empty($obj->titleLabelOverPoster)) { ?>margin-top: -27px;<?php }
echo $obj->titleLabelCSS; ?> "><?php echo $value['title']; ?></h4>
<?php
}
?>
@ -141,6 +142,7 @@ foreach ($videos as $_index => $value) {
}
TimeLogEnd($timeLog5, __LINE__, $timeLog5Limit);
$rowLinkType = $value['type'];
if (!empty($rowPlayListLink)) {
$rowLink = addQueryStringParameter($rowPlayListLink, 'playlist_index', $_index);
$rowLinkEmbed = addQueryStringParameter($rowPlayListLinkEmbed, 'playlist_index', $_index);
@ -157,7 +159,6 @@ foreach ($videos as $_index => $value) {
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row_serie.php';
TimeLogEnd($timeLog5, __LINE__, $timeLog5Limit);
}
}
TimeLogEnd($timeLog3, __LINE__);

View file

@ -2,6 +2,7 @@
$timeLog6Limit = 0.4;
$timeLog6 = "row_info.php {$value['clean_title']}";
TimeLogStart($timeLog6);
//var_dump(debug_backtrace());
?>
<!-- row_info start -->
<div class="infoDetails">
@ -139,6 +140,15 @@ TimeLogStart($timeLog6);
}
TimeLogEnd($timeLog6, __LINE__, $timeLog6Limit);
$_GET = $get;
if($rowLinkType === Video::$videoTypePdf){
?>
<button class="btn btn-danger playBtn <?php echo $canWatchPlayButton; ?>"
onclick="avideoModalIframe('<?php echo $rowLinkEmbed; ?>');return false;">
<i class="fas fa-file-pdf"></i>
<span class="hidden-xs"><?php echo __("Open PDF"); ?></span>
</button>
<?php
}else{
?>
<a class="btn btn-danger playBtn <?php echo $canWatchPlayButton; ?>"
href="<?php echo $rowLink; ?>"
@ -147,6 +157,7 @@ TimeLogStart($timeLog6);
<span class="hidden-xs"><?php echo __("Play"); ?></span>
</a>
<?php
}
if (!empty($value['trailer1'])) {
?>
<a href="#" class="btn btn-warning" onclick="flixFullScreen('<?php echo parseVideos($value['trailer1'], 1, 0, 0, 0, 1); ?>', '');return false;">

View file

@ -19,6 +19,7 @@
?>
<h2 class="infoTitle">
<?php
$rowLinkType = $value['type'];
$rowLink = $link = PlayLists::getLink($value['serie_playlists_id']);
$rowLinkEmbed = $linkEmbed = PlayLists::getLink($value['serie_playlists_id'], true);
$canWatchPlayButton = "";