mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
This commit is contained in:
parent
8468ec06d3
commit
af4585e40c
5 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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']));
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue