1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Daniel Neto 2024-01-12 16:11:53 -03:00
parent 204822fd0e
commit d24e45fb58
11 changed files with 61 additions and 31 deletions

View file

@ -386,7 +386,11 @@ class Category
}
if ($onlyWithVideos) {
$sql .= " AND ((SELECT count(*) FROM videos v where v.categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id AND id != c.id)) > 0 ";
$sql .= " AND ((SELECT count(*) FROM videos v where 1=1 ";
if(isForKidsSet()){
$sql .= " AND v.made_for_kids = 1 ";
}
$sql .= " AND v.categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id AND id != c.id)) > 0 ";
if (AVideoPlugin::isEnabledByName("Live")) {
$sql .= " OR "
. " ("
@ -404,6 +408,7 @@ class Category
}
$sql .= ")";
}
if ($sameUserGroupAsMe) {
//_error_log('getAllCategories getUserGroups');
$users_groups = UserGroups::getUserGroups($sameUserGroupAsMe);
@ -941,7 +946,11 @@ class Category
$sql .= "AND parentId = 0 OR parentId = -1 ";
}
if ($onlyWithVideos) {
$sql .= " AND ((SELECT count(*) FROM videos v where v.categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id AND id != c.id)) > 0 ";
$sql .= " AND ((SELECT count(*) FROM videos v where 1=1 ";
if(isForKidsSet()){
$sql .= " AND v.made_for_kids = 1 ";
}
$sql .= " AND v.categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id AND id != c.id) ) > 0 ";
if (AVideoPlugin::isEnabledByName("Live")) {
$sql .= " OR "
. " ("

View file

@ -213,6 +213,12 @@ if ($resp === User::USER_NOT_VERIFIED) {
die(json_encode($object));
}
if ($resp === User::SYSTEM_ERROR) {
_error_log("login.json.php System error", AVideoLog::$ERROR);
$object->error = __("System error, check your logs");
die(json_encode($object));
}
if ($resp === User::CAPTCHA_ERROR) {
_error_log("login.json.php invalid captcha");
$object->error = __("Invalid Captcha");

View file

@ -105,7 +105,7 @@ class sqlDAL
// make sure it does not store autid transactions
if(strpos($preparedStatement, 'CachesInDB')===false){
$debug = debug_backtrace();
if (empty($debug[2]['class']) || $debug[2]['class'] !== "AuditTable") {
if (empty($debug[2]['class']) || $debug[2]['class'] !== "AuditTable" && class_exists('AVideoPlugin')) {
$audit = AVideoPlugin::loadPluginIfEnabled('Audit');
if (!empty($audit)) {
try {

View file

@ -325,6 +325,10 @@ class PlayList extends ObjectYPT
$sql .= " LEFT JOIN videos v ON pl.id = serie_playlists_id ";
}
$sql .= " LEFT JOIN users u ON u.id = pl.users_id WHERE 1=1 ";
if($includeSeries && isForKidsSet()){
$sql .= " AND v.made_for_kids = 1 ";
}
if (!empty($playlists_id)) {
$sql .= " AND pl.id = '{$playlists_id}' ";
}

View file

@ -131,9 +131,9 @@ class User
function setBirth_date($birth_date): void
{
if(_empty($birth_date)){
if (_empty($birth_date)) {
$this->birth_date = 'NULL';
}else{
} else {
$time = strtotime($birth_date);
$this->birth_date = date('Y/m/d', $time);
}
@ -817,7 +817,7 @@ if (typeof gtag !== \"function\") {
}
if (!_empty($this->birth_date)) {
$values[] = $this->birth_date;
}else{
} else {
$values[] = null;
}
$formats .= "s";
@ -1125,9 +1125,14 @@ if (typeof gtag !== \"function\") {
public const USER_NOT_FOUND = 2;
public const CAPTCHA_ERROR = 3;
public const REQUIRE2FA = 4;
public const SYSTEM_ERROR = 5;
public function login($noPass = false, $encodedPass = false, $ignoreEmailVerification = false)
{
if (!class_exists('AVideoPlugin')) {
_error_log("ERROR login($noPass, $encodedPass, $ignoreEmailVerification) " . json_encode(debug_backtrace()));
return self::SYSTEM_ERROR;
}
if (User::isLogged()) {
//_error_log('User:login is already logged '.json_encode($_SESSION['user']['id']));
return self::USER_LOGGED;
@ -1371,12 +1376,12 @@ if (typeof gtag !== \"function\") {
$user = new User($users_id);
$birth_date = $user->getBirth_date();
} else {
if(empty($_SESSION['user']['birth_date'])){
if (empty($_SESSION['user']['birth_date'])) {
self::recreateLoginFromCookie();
}
if(!empty($_SESSION['user']['birth_date'])){
if (!empty($_SESSION['user']['birth_date'])) {
$birth_date = $_SESSION['user']['birth_date'];
}else{
} else {
$user = new User(User::getId());
$birth_date = $_SESSION['user']['birth_date'] = $user->getBirth_date();
}
@ -1393,7 +1398,7 @@ if (typeof gtag !== \"function\") {
$birth_date = new DateTime($birth_date);
$current_date = new DateTime('now');
$age = $current_date->diff($birth_date)->y;
if($age<0){
if ($age < 0) {
return 0;
}
return $age;
@ -3028,6 +3033,9 @@ if (typeof gtag !== \"function\") {
case self::REQUIRE2FA:
_error_log("loginFromRequest REQUIRE2FA {$_REQUEST['user']}");
break;
case self::SYSTEM_ERROR:
_error_log("loginFromRequest SYSTEM_ERROR {$_REQUEST['user']}");
break;
default:
_error_log("loginFromRequest UNDEFINED {$_REQUEST['user']}");
break;

View file

@ -1472,7 +1472,7 @@ if (!class_exists('Video')) {
$sql .= " UNION ";
$sql .= "SELECT * FROM videos v WHERE v.id != {$videos_id} AND v.status='a' ";
$sql .= "SELECT * FROM videos v WHERE v.id != {$videos_id} AND v.status='".Video::$statusActive."' ";
if(isForKidsSet()){
$sql .= " AND made_for_kids = 1 ";

View file

@ -1052,7 +1052,7 @@ class CDNStorage
$totalTime = time() - $modified;
if ($totalTime > 300) {
if ($totalTime > 10000) {
unlink($file);
@unlink($file);
return false;
} else {
// if is laonger than 5 min say it is not moving
@ -1071,7 +1071,7 @@ class CDNStorage
$extension = strtolower($path_parts['extension']);
if ($extension == 'ts') {
unlink($file_path);
@unlink($file_path);
} elseif (in_array($extension, CDNStorage::$allowedFiles)) {
file_put_contents($file_path, 'Dummy File');
} else {
@ -1301,7 +1301,7 @@ class CDNStorage
if (empty($file_exists)) {
$file_exists = CDNStorage::file_exists_on_cdn($relativeFilename);
if (!$file_exists && isDummyFile($localFile)) {
unlink($localFile);
@unlink($localFile);
} else if ($file_exists && !isDummyFile($localFile)) {
self::createDummy($localFile);
}
@ -1318,7 +1318,7 @@ class CDNStorage
} else {
$filesize = filesize($localFile);
if (empty($filesize) || isDummyFile($localFile)) {
unlink($localFile);
@unlink($localFile);
} else if (!isDummyFile($localFile)) {
_error_log('convertCDNHLSVideoToDownlaod: Upload file to CDN ' . $localFile);
$client = CDNStorage::getStorageClient();

View file

@ -17,6 +17,9 @@ if(empty($_GET['tagsid']) && !empty($_REQUEST['tags_id'])){
$onlySuggested = $obj->CategoriesShowOnlySuggested;
if(!empty(getSearchVar())){
$onlySuggested = false;
echo '<!-- modeGalleryCategory start -->';
}else{
echo '<!-- modeGalleryCategory onlySuggested start -->';
}
$sort = @$_POST['sort'];
unset($_POST['sort']);
@ -34,7 +37,6 @@ if (empty($categories)) {
unsetCurrentPage();
$_REQUEST['rowCount'] = $obj->CategoriesRowCount;
?>
<!-- modeGalleryCategory start -->
<div class="categoriesContainerItem">
<?php
//var_dump($categories);exit;

View file

@ -1,9 +1,8 @@
<style>
.row-label {
display: flex;
/* Enables Flexbox */
align-items: center;
/* Centers items vertically */
justify-content: space-between;
}
.colorful-text {

View file

@ -40,15 +40,6 @@
</li>
<?php
}
if (Video::videoMadeForKidsExists()) {
?>
<li style="width: 100%;">
<?php
include $global['systemRootPath'] . 'view/include/forKids.php';
?>
</li>
<?php
}
?>
</ul>
</li>

View file

@ -9,18 +9,15 @@ global $avideoLayout;
if (empty($advancedCustom->doNotShowLeftHomeButton)) {
?>
<li>
<div>
<a href="<?php echo getHomePageURL(); ?>" class="btn btn-primary btn-block " style="border-radius: 4px 4px 0 0;">
<span class="fa fa-home"></span>
<?php echo __("Home"); ?>
</a>
</div>
</li>
<?php
}
if (AVideoPlugin::isEnabledByName("PlayLists") && PlayLists::showTVFeatures()) {
?>
<li>
@ -66,6 +63,20 @@ global $avideoLayout;
</li>
<?php
}
if (Video::videoMadeForKidsExists()) {
?>
<li>
<hr>
</li>
<li>
<div>
<?php
include $global['systemRootPath'] . 'view/include/forKids.php';
?>
</div>
</li>
<?php
}
if (empty($advancedCustomUser->doNotShowLeftProfile)) {
if (User::isLogged()) {
?>
@ -256,7 +267,7 @@ global $avideoLayout;
<?php
if (!empty($updateFiles)) {
?><span class="label label-danger"><?php echo count($updateFiles); ?></span><?php }
?>
?>
</a>
</li>
<li>