1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
Daniel Neto 2023-03-20 10:01:23 -03:00
parent 18f51e2dc1
commit 484ae5af64
14 changed files with 42 additions and 23 deletions

View file

@ -86,6 +86,7 @@ Options All -Indexes
#VideoHLS for DRM
RewriteRule ^id/? view/id.php [NC,L,QSA]
RewriteRule ^logo.png view/logo.png.php [NC,L,QSA]
RewriteRule glyphicons-halflings-regular(.+)$ view/bootstrap/fonts/glyphicons-halflings-regular$1 [NC,L]
RedirectMatch 404 /\.git

View file

@ -2830,7 +2830,6 @@ function getImageTagIfExists($relativePath, $title = '', $id = '', $style = '',
$file = createWebPIfNotExists($file);
}
$url = getURL(getRelativePath($file));
$wh = '';
$image_info = getimagesize($file);
if(!empty($image_info)){
$wh = $image_info[3];

View file

@ -1039,7 +1039,7 @@ if (typeof gtag !== \"function\") {
_session_regenerate_id();
session_write_close();
_error_log('User:login finish ' . json_encode($_SESSION['user']['id']));
_error_log('User:login finish users_id=' . json_encode($_SESSION['user']['id']) );
return self::USER_LOGGED;
} else {
unset($_SESSION['user']);
@ -2640,6 +2640,13 @@ if (typeof gtag !== \"function\") {
}
}
public static function loginFromRequestIfNotLogged() {
if(User::isLogged()){
return self::USER_LOGGED;
}
return self::loginFromRequest();
}
public static function loginFromRequest() {
inputToRequest();
if (!empty($_REQUEST['do_not_login'])) {

View file

@ -3,7 +3,7 @@ global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
User::loginFromRequest();
User::loginFromRequestIfNotLogged();
session_write_close();
header('Content-Type: application/json');
$start = microtime(true);

View file

@ -475,7 +475,7 @@ class API extends PluginAbstract {
$cacheParameters = array('noRelated','APIName', 'catName', 'rowCount', 'APISecret', 'sort', 'searchPhrase', 'current', 'tags_id', 'channelName', 'videoType', 'is_serie', 'user', 'videos_id', 'playlist');
$cacheVars = array();
$cacheVars = array('users_id'=>User::getId());
foreach ($cacheParameters as $value) {
$cacheVars[$value] = @$_REQUEST[$value];
}
@ -1798,6 +1798,7 @@ class ApiObject {
public $response;
public $msg;
public $users_id;
public $session_id;
public function __construct($message = "api not started or not found", $error = true, $response = []) {
$response = cleanUpRowFromDatabase($response);
@ -1807,6 +1808,7 @@ class ApiObject {
$this->message = $message;
$this->response = $response;
$this->users_id = User::getId();
$this->session_id = session_id();
}
}
@ -1835,11 +1837,19 @@ class SectionFirstPage {
$this->rowCount = $rowCount;
$endpointURL = addQueryStringParameter($endpoint, 'rowCount', $rowCount);
if(User::isLogged()){
$endpointURL = addQueryStringParameter($endpointURL, 'user', User::getUserName());
$endpointURL = addQueryStringParameter($endpointURL, 'pass', User::getUserPass());
$endpointURL = addQueryStringParameter($endpointURL, 'webSiteRootURL', $global['webSiteRootURL']);
//$endpointURL = addQueryStringParameter($endpointURL, 'PHPSESSID', session_id());
}
$response = json_decode(url_get_contents($endpointURL));
$response = json_decode(url_get_contents($endpointURL, '', 2, false, true));
/*
if(User::isLogged()){
session_id($response->session_id);
}
*/
$this->endpointResponse = $response->response;
$this->totalRows = $this->endpointResponse->totalRows;
$this->childs = $childs;

View file

@ -416,7 +416,7 @@ class Gallery extends PluginAbstract
foreach ($channels as $value2) {
$title = $value2['channelName'];
$rowCount = $obj->SubscribedChannelsRowCount;
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&channelName={$title}";
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&channelName={$title}&sort[created]=desc";
$section = new SectionFirstPage($value['name'], $title, $endpoint, $rowCount);
$countVideos += $section->totalRows;
$response->sections[] = $section;
@ -429,7 +429,7 @@ class Gallery extends PluginAbstract
foreach ($tags as $value2) {
$title = $value2['name'];
$rowCount = $obj->SubscribedTagsRowCount;
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&tags_id={$value2['id']}";
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&tags_id={$value2['id']}&sort[created]=desc";
$section = new SectionFirstPage($value['name'], $title, $endpoint, $rowCount);
$countVideos += $section->totalRows;
$response->sections[] = $section;
@ -444,7 +444,7 @@ class Gallery extends PluginAbstract
foreach ($categories as $value2) {
$title = $value2['name'];
$rowCount = $obj->CategoriesRowCount;
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&catName={$value2['clean_name']}";
$endpoint = "{$global['webSiteRootURL']}plugin/API/get.json.php?APIName=video&catName={$value2['clean_name']}&sort[created]=desc";
$section = new SectionFirstPage($value['name'], $title, $endpoint, $rowCount);
$countVideos += $section->totalRows;
$response->sections[] = $section;

View file

@ -12,7 +12,7 @@ require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_schedule.php'
$getStatsObject = [];
$_getStats = [];
User::loginFromRequest();
User::loginFromRequestIfNotLogged();
class Live extends PluginAbstract {

View file

@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/Meet/Objects/Meet_schedule.php';
require_once $global['systemRootPath'] . 'plugin/Meet/Objects/Meet_schedule_has_users_groups.php';
require_once $global['systemRootPath'] . 'plugin/Meet/Objects/Meet_join_log.php';
User::loginFromRequest();
User::loginFromRequestIfNotLogged();
//require_once $global['systemRootPath'] . 'objects/firebase/php-jwt/src/JWT.php';
//use \Firebase\JWT\JWT;

View file

@ -22,9 +22,7 @@ if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
User::loginFromRequestIfNotLogged();
if (User::isLogged()) {
if (!empty($_REQUEST['key'])) {
$key = $_REQUEST['key'];

View file

@ -15,9 +15,7 @@ if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
User::loginFromRequestIfNotLogged();
if (User::isLogged()) {
$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/MobileManager/userButtons.php');
} else {

View file

@ -24,9 +24,7 @@ if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
User::loginFromRequestIfNotLogged();
if (User::isLogged()) {
if (!empty($_REQUEST['key'])) {
$key = $_REQUEST['key'];

View file

@ -15,9 +15,7 @@ if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
User::loginFromRequestIfNotLogged();
if (User::isLogged()) {
//$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/MobileYPT/userButtons.php');
} else {

10
view/logo.png.php Normal file
View file

@ -0,0 +1,10 @@
<?php
header('Content-Type: image/png');
$logo1 = '../videos/userPhoto/logo.png';
$logo2 = '../view/img/logo.png';
//var_dump(file_exists($logo1), file_exists($logo2));exit;
if(file_exists($logo1)){
readfile($logo1);
exit;
}
readfile($logo2);

View file

@ -6,7 +6,7 @@ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
$global['bypassSameDomainCheck'] = 1;
User::loginFromRequest();
User::loginFromRequestIfNotLogged();
if (!empty($_GET['evideo'])) {
$v = Video::decodeEvideo();
$evideo = $v['evideo'];