1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00
DanielnetoDotCom 2020-09-10 15:40:09 -03:00
parent 8468ec06d3
commit af4585e40c
5 changed files with 23 additions and 1 deletions

View file

@ -124,6 +124,18 @@ class Subscribe {
return $subscribe;
}
static function isSubscribed($subscribed_to_user_id, $user_id=0) {
if(empty($user_id)){
if(User::isLogged()){
$user_id = User::getId();
}else{
return false;
}
}
$s = self::getSubscribeFromID($subscribed_to_user_id, $user_id);
return !empty($s['users_id']);
}
/**
* return all subscribers that has subscribe to an user channel
* @global type $global

View file

@ -1969,6 +1969,9 @@ if (typeof gtag !== \"function\") {
}
}
}
if(!empty($_REQUEST['do_not_login'])){
return false;
}
if(!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])){
$user = new User(0, $_REQUEST['user'], $_REQUEST['pass']);
$user->login(false, !empty($_REQUEST['encodedPass']));

View file

@ -3,6 +3,7 @@ header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = '../';
}
$_REQUEST["do_not_login"]=1;
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {

View file

@ -274,6 +274,11 @@ class API extends PluginAbstract {
$rows[$key]['pageUrl'] = Video::getLink($rows[$key]['id'], $rows[$key]['clean_title'], false);
$rows[$key]['embedUrl'] = Video::getLink($rows[$key]['id'], $rows[$key]['clean_title'], true);
$rows[$key]['UserPhoto'] = User::getPhoto($rows[$key]['users_id']);
$rows[$key]['isSubscribed'] = false;
if(User::isLogged()){
require_once $global['systemRootPath'] . 'objects/subscribe.php';
$rows[$key]['isSubscribed'] = Subscribe::isSubscribed($rows[$key]['users_id']);
}
if ($SubtitleSwitcher) {
$rows[$key]['subtitles'] = getVTTTracks($value['filename'], true);

View file

@ -508,7 +508,8 @@ print AVideoPlugin::updateUserFormJS();
"canCreateMeet": $('#canCreateMeet').is(':checked'),
"status": $('#status').is(':checked') ? 'a' : 'i',
"isEmailVerified": $('#isEmailVerified').is(':checked'),
"userGroups": selectedUserGroups
"userGroups": selectedUserGroups,
"do_not_login": 1
},
type: 'post',
success: function (response) {