1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
Daniel Neto 2023-11-13 11:09:18 -03:00
parent 714a9a1820
commit bd3db04ab2
6 changed files with 37 additions and 44 deletions

View file

@ -10109,7 +10109,7 @@ function optimizeJS($html)
function mysqlBeginTransaction() function mysqlBeginTransaction()
{ {
global $global; global $global;
_error_log('Begin transaction ' . getSelfURI()); //_error_log('Begin transaction ' . getSelfURI());
/** /**
* *
* @var array $global * @var array $global
@ -10134,7 +10134,7 @@ function mysqlRollback()
function mysqlCommit() function mysqlCommit()
{ {
global $global; global $global;
_error_log('Commit transaction ' . getSelfURI()); //_error_log('Commit transaction ' . getSelfURI());
/** /**
* *
* @var array $global * @var array $global

View file

@ -1519,11 +1519,13 @@ if (typeof gtag !== \"function\") {
} }
if ($pass !== false) { if ($pass !== false) {
if (!$encodedPass || $encodedPass === 'false') { if (!$encodedPass || $encodedPass === 'false') {
_error_log("Password check Old not encoded pass");
$passEncoded = md5($pass); $passEncoded = md5($pass);
_error_log("Password check Old not encoded pass");
//_error_log("Password check Old not encoded pass passEncoded={$passEncoded}");
} else { } else {
_error_log("Password check Old encoded pass");
$passEncoded = $pass; $passEncoded = $pass;
_error_log("Password check Old encoded pass");
//_error_log("Password check Old encoded pass passEncoded={$passEncoded}");
} }
$sql .= " AND password = ? "; $sql .= " AND password = ? ";
$formats .= "s"; $formats .= "s";

View file

@ -1482,40 +1482,6 @@ if (!class_exists('Video')) {
return $rows; return $rows;
} }
private static function startTransaction()
{
global $global, $_video_startTransaction_started;
if (!empty($_video_startTransaction_started)) {
return false;
}
$_video_startTransaction_started = 1;
/**
*
* @var array $global
* @var object $global['mysqli']
*/
$global['mysqli']->begin_transaction();
return true;
}
private static function commitTransaction()
{
global $global, $_video_startTransaction_started;
if (empty($_video_startTransaction_started)) {
return false;
}
$_video_startTransaction_started = 0;
/**
*
* @var array $global
* @var object $global['mysqli']
*/
$global['mysqli']->commit();
return true;
}
/** /**
* *
* @global array $global * @global array $global
@ -1860,7 +1826,7 @@ if (!class_exists('Video')) {
* @var array $global * @var array $global
* @var object $global['mysqli'] * @var object $global['mysqli']
*/ */
self::startTransaction(); mysqlBeginTransaction();
foreach ($fullData as $index => $row) { foreach ($fullData as $index => $row) {
if (is_null($row['likes'])) { if (is_null($row['likes'])) {
_error_log("Video::updateLikesDislikes: id={$row['id']}"); _error_log("Video::updateLikesDislikes: id={$row['id']}");
@ -1872,7 +1838,6 @@ if (!class_exists('Video')) {
} }
if (empty($row['duration_in_seconds']) && in_array($row['type'], $allowedDurationTypes)) { if (empty($row['duration_in_seconds']) && in_array($row['type'], $allowedDurationTypes)) {
self::startTransaction();
_error_log("Video::duration_in_seconds: id={$row['id']} {$row['duration']} {$row['type']}"); _error_log("Video::duration_in_seconds: id={$row['id']} {$row['duration']} {$row['type']}");
$row['duration_in_seconds'] = self::updateDurationInSeconds($row['id'], $row['duration']); $row['duration_in_seconds'] = self::updateDurationInSeconds($row['id'], $row['duration']);
if (empty($row['duration_in_seconds'])) { if (empty($row['duration_in_seconds'])) {
@ -1901,7 +1866,7 @@ if (!class_exists('Video')) {
$videos[] = $row; $videos[] = $row;
} }
TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance); TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance);
self::commitTransaction(); mysqlCommit();
TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance); TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance);
$rowCount = getRowCount(); $rowCount = getRowCount();
$tolerance = $rowCount / 100; $tolerance = $rowCount / 100;

View file

@ -8,8 +8,13 @@ function closeFloatVideo() {
clearTimeout(FloatVideoTimeout); clearTimeout(FloatVideoTimeout);
setTimeout(function () { setTimeout(function () {
$('#videoCol').css('height', ''); $('#videoCol').css('height', '');
$('#videoContainer').removeClass('animate__animated');
$('#videoContainer').removeClass('animate__bounceInDown'); $('#videoContainer').removeClass('animate__bounceInDown');
$('#videoContainer').removeClass('animate__bounceInLeft');
if(windowIsfXs()){
$('#videoContainer').removeClass('animate__animated');
}else{
$('#videoContainer').addClass('animate__bounceIn');
}
$('body').removeClass('floatVideo'); $('body').removeClass('floatVideo');
}, 100); }, 100);
} }
@ -26,7 +31,11 @@ function setFloatVideo() {
var videoContainerHeight = $('#videoContainer').height(); var videoContainerHeight = $('#videoContainer').height();
$('#videoCol').height(videoContainerHeight); $('#videoCol').height(videoContainerHeight);
$('#videoContainer').addClass('animate__animated'); $('#videoContainer').addClass('animate__animated');
$('#videoContainer').addClass('animate__bounceInDown'); if(windowIsfXs()){
$('#videoContainer').addClass('animate__bounceInDown');
}else{
$('#videoContainer').addClass('animate__bounceInLeft');
}
$('body').addClass('floatVideo'); $('body').addClass('floatVideo');
}, 100); }, 100);
} }

View file

@ -4088,3 +4088,12 @@ function preloadVmapAndUpdateAdTag(adTagUrl) {
console.error("Error preloading and updating adTagUrl:", error); console.error("Error preloading and updating adTagUrl:", error);
}); });
} }
function windowIsfXs() {
var screenWidth = $(window).width();
if (screenWidth < 768) {
return true;
} else {
return false;
}
}

View file

@ -192,14 +192,21 @@ if (!$searchForVideosNow) {
var loadVideosListPagerowCount = 'loadVideosListPagerowCount<?php User::getId(); ?>'; var loadVideosListPagerowCount = 'loadVideosListPagerowCount<?php User::getId(); ?>';
var loadVideosListPagesortBy = 'loadVideosListPagesortBy<?php User::getId(); ?>'; var loadVideosListPagesortBy = 'loadVideosListPagesortBy<?php User::getId(); ?>';
var loadVideosListPageTimeout;
var loadVideosListPageIsLoading = false;
function loadVideosListPage(page) { function loadVideosListPage(page) {
clearTimeout(loadVideosListPageTimeout);
if (typeof modal === 'undefined') { if (typeof modal === 'undefined') {
setTimeout(function () { setTimeout(function () {
loadVideosListPage(page); loadVideosListPageTimeout = loadVideosListPage(page);
}, 500); }, 500);
return false; return false;
} }
if(loadVideosListPageIsLoading){
return false;
}
loadVideosListPageIsLoading = true;
var url = '<?php echo $link; ?>'; var url = '<?php echo $link; ?>';
var rowCount = $('#rowCount').val(); var rowCount = $('#rowCount').val();
@ -219,6 +226,7 @@ if (!$searchForVideosNow) {
url = addQueryStringParameter(url, 'current', page); url = addQueryStringParameter(url, 'current', page);
$.get(url, function (response) { $.get(url, function (response) {
var videosList = $($.parseHTML(response)).filter("#videosListItems").html(); var videosList = $($.parseHTML(response)).filter("#videosListItems").html();
loadVideosListPageIsLoading = false;
$('#videosListItems').html(videosList); $('#videosListItems').html(videosList);
//animateChilds('#videosListItems', 'animate__flipInX', 0.2); //animateChilds('#videosListItems', 'animate__flipInX', 0.2);
lazyImage(); lazyImage();