mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
parent
813fea282c
commit
1ad8b7277b
7 changed files with 183 additions and 129 deletions
|
@ -24,6 +24,20 @@ class API extends PluginAbstract {
|
|||
return "1apicbec-91db-4357-bb10-ee08b0913778";
|
||||
}
|
||||
|
||||
private static function addRowInfo($obj){
|
||||
if(!isset($obj->current)){
|
||||
$obj->current = getCurrentPage();
|
||||
}
|
||||
$obj->hasMore = true;
|
||||
if(count($obj->rows) < $obj->rowCount){
|
||||
$obj->hasMore = false;
|
||||
}
|
||||
if($obj->current*$obj->rowCount >= $obj->totalRows){
|
||||
$obj->hasMore = false;
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function getEmptyDataObject() {
|
||||
global $global;
|
||||
$obj = new stdClass();
|
||||
|
@ -468,6 +482,7 @@ class API extends PluginAbstract {
|
|||
}
|
||||
$obj->totalRows = $totalRows;
|
||||
$obj->rows = $rows;
|
||||
$obj = self::addRowInfo($obj);
|
||||
//var_dump($obj->rows );exit;
|
||||
ObjectYPT::setCache($cacheName, $obj);
|
||||
return new ApiObject("", false, $obj);
|
||||
|
|
|
@ -632,8 +632,7 @@ class AVideoPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public static function getEnd()
|
||||
{
|
||||
public static function getEnd(){
|
||||
$plugins = Plugin::getAllEnabled();
|
||||
usort($plugins, function ($a, $b) {
|
||||
if ($a['name'] == 'Cache') {
|
||||
|
@ -651,7 +650,9 @@ class AVideoPlugin
|
|||
self::YPTstart();
|
||||
$p = static::loadPlugin($value['dirName']);
|
||||
if (is_object($p)) {
|
||||
//_error_log("{$value['dirName']}::" . __FUNCTION__);
|
||||
$func = "{$value['dirName']}::" . __FUNCTION__;
|
||||
//echo $func.PHP_EOL;
|
||||
//_error_log($func);
|
||||
if(!empty($_REQUEST['debug'])){
|
||||
echo "<!-- {$value['dirName']} getEnd -->".PHP_EOL;
|
||||
}
|
||||
|
|
|
@ -527,6 +527,7 @@ class Layout extends PluginAbstract {
|
|||
//$html = preg_replace('/<script.*><\/script>/i', '', $html);
|
||||
//return $html;
|
||||
//var_dump(self::$tags['script']);exit;
|
||||
//var_dump(self::$tags['tagscript']);exit;
|
||||
if (!empty(self::$tags['tagcss'])) {
|
||||
self::$tags['tagcss'] = self::removeDuplicated(self::$tags['tagcss']);
|
||||
$html = str_replace('</head>', PHP_EOL.implode(PHP_EOL, array_unique(self::$tags['tagcss'])) . '</head>', $html);
|
||||
|
|
|
@ -139,6 +139,7 @@ if ($isMyChannel) {
|
|||
?>" data-toggle="tooltip" title="<?php echo __('This playlist is unlisted, click to make it private'); ?>" ></span>
|
||||
</button>
|
||||
<?php
|
||||
include_once $global['systemRootPath'] . 'plugin/PlayLists/addVideoModal.php';
|
||||
}
|
||||
if ($showMore) {
|
||||
?>
|
||||
|
|
156
plugin/PlayLists/addVideoModal.php
Normal file
156
plugin/PlayLists/addVideoModal.php
Normal file
|
@ -0,0 +1,156 @@
|
|||
|
||||
<style>
|
||||
.PLLoadMore{
|
||||
display: none;
|
||||
}
|
||||
.hasMore .PLLoadMore{
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<div class="modal fade" id="videoSearchModal" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="panel panle-default">
|
||||
<div class="panel-heading">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#addSeries"><i class="fas fa-list"></i> <?php echo __('Series'); ?></a></li>
|
||||
<li><a data-toggle="tab" href="#addVideos"><i class="fas fa-video"></i> <?php echo __('Videos'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="tab-content">
|
||||
<div id="addSeries" class="tab-pane fade in active">
|
||||
<form id="serieSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
|
||||
<div id="custom-search-input">
|
||||
<div class="input-group col-md-12">
|
||||
<input type="search" name="searchPhrase" id="serieSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Serie'); ?>" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-info btn-lg" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div id="searchSerieResult" class="">
|
||||
|
||||
</div>
|
||||
<button class="btn btn-xs btn-primary btn-block PLLoadMore" onclick="videoSearchLoadMore();"><?php echo __('Load More'); ?>...</button>
|
||||
</div>
|
||||
<div id="addVideos" class="tab-pane fade">
|
||||
<form id="videoSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
|
||||
<div id="custom-search-input">
|
||||
<div class="input-group col-md-12">
|
||||
<input type="search" name="searchPhrase" id="videoSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Videos'); ?>" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-info btn-lg" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div id="searchVideoResult">
|
||||
|
||||
</div>
|
||||
<button class="btn btn-xs btn-primary btn-block PLLoadMore" onclick="videoSearchLoadMore();"><?php echo __('Load More'); ?>...</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var currentSerieVideos_id = 0;
|
||||
var videoWasAdded = false;
|
||||
var current_is_serie;
|
||||
var current_current;
|
||||
|
||||
function openVideoSearch(videos_id) {
|
||||
currentSerieVideos_id = videos_id;
|
||||
$('#videoSearchModal').modal();
|
||||
}
|
||||
|
||||
function videoSearchLoadMore() {
|
||||
videoSearch(current_is_serie, current_current + 1);
|
||||
}
|
||||
|
||||
function videoSearch(is_serie, current) {
|
||||
modal.showPleaseWait();
|
||||
current_is_serie = is_serie;
|
||||
current_current = current;
|
||||
var searchPhrase = $('#videoSearch-input').val();
|
||||
if (is_serie) {
|
||||
searchPhrase = $('#serieSearch-input').val();
|
||||
}
|
||||
var url = webSiteRootURL + 'plugin/API/get.json.php';
|
||||
url = addQueryStringParameter(url, 'APIName', 'video');
|
||||
url = addQueryStringParameter(url, 'rowCount', 10);
|
||||
url = addQueryStringParameter(url, 'current', current);
|
||||
url = addQueryStringParameter(url, 'is_serie', is_serie);
|
||||
url = addQueryStringParameter(url, 'searchPhrase', searchPhrase);
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
var resultId = '#searchVideoResult';
|
||||
if (is_serie) {
|
||||
resultId = '#searchSerieResult';
|
||||
}
|
||||
if (current <= 1) {
|
||||
$(resultId).empty();
|
||||
}
|
||||
var rows = response.response.rows;
|
||||
if(response.response.hasMore){
|
||||
$(resultId).parent().addClass('hasMore');
|
||||
}else{
|
||||
$(resultId).parent().removeClass('hasMore');
|
||||
}
|
||||
for (var i in rows) {
|
||||
if (typeof rows[i] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
if (rows[i].id == currentSerieVideos_id) {
|
||||
continue;
|
||||
}
|
||||
var html = '<button type="button" class="btn btn-default btn-block" data-toggle="tooltip" title="<?php echo __('Add To Serie'); ?>" onclick="addToSerie(<?php echo $program['id']; ?>, ' + rows[i].id + ');" id="videos_id_' + rows[i].id + '_playlists_id_<?php echo $program['id']; ?>" ><i class="fas fa-plus"></i> ' + rows[i].title + '</button>';
|
||||
$(resultId).append(html);
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addToSerie(playlists_id, videos_id) {
|
||||
addVideoToPlayList(videos_id, true, playlists_id);
|
||||
$('#videos_id_' + videos_id + '_playlists_id_' + playlists_id).fadeOut();
|
||||
videoWasAdded = true;
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#videoSearch-form').submit(function (event) {
|
||||
event.preventDefault();
|
||||
videoSearch(0, 1);
|
||||
});
|
||||
|
||||
$('#serieSearch-form').submit(function (event) {
|
||||
event.preventDefault();
|
||||
videoSearch(1, 1);
|
||||
});
|
||||
|
||||
$('#videoSearchModal').on('hidden.bs.modal', function () {
|
||||
if (videoWasAdded) {
|
||||
modal.showPleaseWait();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
|
@ -117,12 +117,14 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
|
|||
<div id="sortable<?php echo $program['id']; ?>" style="list-style: none;">
|
||||
<?php
|
||||
$count = 0;
|
||||
$realCount = 0;
|
||||
foreach ($videosP as $value) {
|
||||
$episodeLink = "{$global['webSiteRootURL']}program/{$program['id']}/{$count}";
|
||||
$count++;
|
||||
if (empty($value['created'])) {
|
||||
continue;
|
||||
}
|
||||
$realCount++;
|
||||
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : "";
|
||||
$name = User::getNameIdentificationById($value['users_id']);
|
||||
|
||||
|
@ -210,13 +212,13 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
|
|||
</div>
|
||||
</li>
|
||||
<?php
|
||||
if ($count % 6 === 0) {
|
||||
if ($realCount % 6 === 0) {
|
||||
echo '<div class="clearfix hidden-md hidden-sm hidden-xs"></div>';
|
||||
}
|
||||
if ($count % 3 === 0) {
|
||||
if ($realCount % 3 === 0) {
|
||||
echo '<div class="clearfix hidden-lg hidden-xs"></div>';
|
||||
}
|
||||
if ($count % 2 === 0) {
|
||||
if ($realCount % 2 === 0) {
|
||||
echo '<div class="clearfix hidden-md hidden-sm hidden-lg"></div>';
|
||||
}
|
||||
}
|
||||
|
@ -250,59 +252,6 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
|
|||
$_GET['channelName'] = $channelName;
|
||||
?>
|
||||
|
||||
<div class="modal fade" id="videoSearchModal" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="panel panle-default">
|
||||
<div class="panel-heading">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#addSeries"><i class="fas fa-list"></i> <?php echo __('Series'); ?></a></li>
|
||||
<li><a data-toggle="tab" href="#addVideos"><i class="fas fa-video"></i> <?php echo __('Videos'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="tab-content">
|
||||
<div id="addSeries" class="tab-pane fade in active">
|
||||
<form id="serieSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
|
||||
<div id="custom-search-input">
|
||||
<div class="input-group col-md-12">
|
||||
<input type="search" name="searchPhrase" id="serieSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Serie'); ?>" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-info btn-lg" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div id="searchSerieResult"></div>
|
||||
</div>
|
||||
<div id="addVideos" class="tab-pane fade">
|
||||
<form id="videoSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
|
||||
<div id="custom-search-input">
|
||||
<div class="input-group col-md-12">
|
||||
<input type="search" name="searchPhrase" id="videoSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Videos'); ?>" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-info btn-lg" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div id="searchVideoResult"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var timoutembed;
|
||||
|
@ -535,74 +484,5 @@ if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
|
|||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
|
||||
<script>
|
||||
var currentSerieVideos_id = 0;
|
||||
var videoWasAdded = false;
|
||||
|
||||
function openVideoSearch(videos_id) {
|
||||
currentSerieVideos_id = videos_id;
|
||||
$('#videoSearchModal').modal();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#videoSearch-form').submit(function (event) {
|
||||
event.preventDefault();
|
||||
videoSearch(0);
|
||||
});
|
||||
|
||||
$('#serieSearch-form').submit(function (event) {
|
||||
event.preventDefault();
|
||||
videoSearch(1);
|
||||
});
|
||||
|
||||
$('#videoSearchModal').on('hidden.bs.modal', function () {
|
||||
if (videoWasAdded) {
|
||||
modal.showPleaseWait();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function videoSearch(is_serie) {
|
||||
modal.showPleaseWait();
|
||||
var searchPhrase = $('#videoSearch-input').val();
|
||||
if (is_serie) {
|
||||
searchPhrase = $('#serieSearch-input').val();
|
||||
}
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'plugin/API/get.json.php?APIName=video&rowCount=10&is_serie=' + is_serie + '&searchPhrase=' + searchPhrase,
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
var resultId = '#searchVideoResult';
|
||||
if (is_serie) {
|
||||
resultId = '#searchSerieResult';
|
||||
}
|
||||
$(resultId).empty();
|
||||
var rows = response.response.rows;
|
||||
for (var i in rows) {
|
||||
if (typeof rows[i] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
if (rows[i].id == currentSerieVideos_id) {
|
||||
continue;
|
||||
}
|
||||
var html = '<button type="button" class="btn btn-default btn-block" data-toggle="tooltip" title="<?php echo __('Add To Serie'); ?>" onclick="addToSerie(<?php echo $program['id']; ?>, ' + rows[i].id + ');" id="videos_id_' + rows[i].id + '_playlists_id_<?php echo $program['id']; ?>" ><i class="fas fa-plus"></i> ' + rows[i].title + '</button>';
|
||||
$(resultId).append(html);
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addToSerie(playlists_id, videos_id) {
|
||||
addVideoToPlayList(videos_id, true, playlists_id);
|
||||
$('#videos_id_' + videos_id + '_playlists_id_' + playlists_id).fadeOut();
|
||||
videoWasAdded = true;
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -119,7 +119,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$obj->filename = $filename;
|
||||
$obj->duration = $duration;
|
||||
$obj->videos_id = $id;
|
||||
|
||||
//var_dump($obj->videos_id);exit;
|
||||
if ($extension !== "jpg" && $video->getType() == "image") {
|
||||
sleep(1); // to make sure the file will be available
|
||||
$file = $video->getFilename();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue