mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
parent
aec0b57ddd
commit
3c969b4a52
6 changed files with 349 additions and 109 deletions
|
@ -1,15 +1,17 @@
|
|||
<?php
|
||||
|
||||
if (empty($config)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// filter some security here
|
||||
if (!empty($_GET['lang'])) {
|
||||
$_GET['lang'] = str_replace(["'", '"', """, "'"], ['', '', '', ''], xss_esc($_GET['lang']));
|
||||
}
|
||||
|
||||
@include_once "{$global['systemRootPath']}locale/{$_SESSION['language']}.php";
|
||||
includeLangFile();
|
||||
|
||||
function includeLangFile(){
|
||||
global $t;
|
||||
setSiteLang();
|
||||
@include_once "{$global['systemRootPath']}locale/{$_SESSION['language']}.php";
|
||||
}
|
||||
|
||||
function __($str, $allowHTML = false)
|
||||
{
|
||||
|
@ -120,8 +122,15 @@ function flag2Lang($flagCode)
|
|||
|
||||
function setSiteLang()
|
||||
{
|
||||
global $config;
|
||||
global $config, $global;
|
||||
|
||||
if(empty($config)){
|
||||
if(!class_exists('Configuration')){
|
||||
require $global['systemRootPath'] . 'objects/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
|
||||
$config = new Configuration();
|
||||
}
|
||||
$userLocation = false;
|
||||
$obj = AVideoPlugin::getDataObjectIfEnabled('User_Location');
|
||||
$userLocation = !empty($obj) && !empty($obj->autoChangeLanguage);
|
||||
|
|
|
@ -28,7 +28,7 @@ if (!PlayLists::canAddVideoOnPlaylist($_POST['videos_id'])) {
|
|||
}
|
||||
|
||||
$playList = new PlayList($_POST['playlists_id']);
|
||||
if (empty($playList || User::getId() !== $playList->getUsers_id()) || empty($_POST['videos_id'])) {
|
||||
if (empty($playList) || User::getId() !== $playList->getUsers_id() || empty($_POST['videos_id'])) {
|
||||
$obj->msg = __("Permission denied");
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
|
|
@ -85,11 +85,20 @@ class PlayList extends ObjectYPT {
|
|||
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
|
||||
$videosP = PlayList::sortVideos($videosP, $videosArrayId);
|
||||
foreach ($videosP as $key => $value2) {
|
||||
if(empty($videosP[$key]['type'])){
|
||||
unset($videosP[$key]);
|
||||
continue;
|
||||
}
|
||||
if (!empty($value2['serie_playlists_id'])) {
|
||||
$videosP[$key]['icon'] = '<i class=\'fas fa-layer-group\'></i>';
|
||||
} else {
|
||||
$videosP[$key]['icon'] = '<i class=\'fas fa-film\'></i>';
|
||||
}
|
||||
$images = Video::getImageFromFilename($videosP[$key]['filename'], $videosP[$key]['type']);
|
||||
$videosP[$key]['images'] = $images;
|
||||
if ($videosP[$key]['type'] !== 'linkVideo') {
|
||||
$videosP[$key]['videos'] = Video::getVideosPaths($videosP[$key]['filename'], true);
|
||||
}
|
||||
}
|
||||
|
||||
return $videosP;
|
||||
|
@ -262,9 +271,8 @@ class PlayList extends ObjectYPT {
|
|||
if ($res !== false) {
|
||||
foreach ($fullData as $row) {
|
||||
$row = cleanUpRowFromDatabase($row);
|
||||
$row['videos'] = [];
|
||||
if ($onlyWithVideos) {
|
||||
$row['videos'] = self::getVideosIDFromPlaylistLight($row['id']);
|
||||
if ($onlyWithVideos) {
|
||||
if (empty($row['videos'])) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4660,7 +4660,7 @@ if (!class_exists('Video')) {
|
|||
if (empty($clean_title)) {
|
||||
$clean_title = $video->getClean_title();
|
||||
}
|
||||
$clean_title = urlencode($clean_title);
|
||||
$clean_title = @urlencode($clean_title);
|
||||
$subDir = "video";
|
||||
$subEmbedDir = "videoEmbed";
|
||||
if ($video->getType() == 'article') {
|
||||
|
|
|
@ -3,28 +3,34 @@
|
|||
global $global;
|
||||
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
||||
|
||||
class API extends PluginAbstract {
|
||||
class API extends PluginAbstract
|
||||
{
|
||||
|
||||
public function getTags() {
|
||||
public function getTags()
|
||||
{
|
||||
return [
|
||||
PluginTags::$FREE,
|
||||
PluginTags::$MOBILE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
public function getDescription()
|
||||
{
|
||||
return "Handle APIs for third party Applications";
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return "API";
|
||||
}
|
||||
|
||||
public function getUUID() {
|
||||
public function getUUID()
|
||||
{
|
||||
return "1apicbec-91db-4357-bb10-ee08b0913778";
|
||||
}
|
||||
|
||||
private static function addRowInfo($obj) {
|
||||
private static function addRowInfo($obj)
|
||||
{
|
||||
if (!isset($obj->current)) {
|
||||
$obj->current = getCurrentPage();
|
||||
}
|
||||
|
@ -48,20 +54,23 @@ class API extends PluginAbstract {
|
|||
return $obj;
|
||||
}
|
||||
|
||||
public function getEmptyDataObject() {
|
||||
public function getEmptyDataObject()
|
||||
{
|
||||
global $global;
|
||||
$obj = new stdClass();
|
||||
$obj->APISecret = md5($global['salt'] . $global['systemRootPath'] . 'API');
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function getPluginMenu() {
|
||||
public function getPluginMenu()
|
||||
{
|
||||
global $global;
|
||||
$fileAPIName = $global['systemRootPath'] . 'plugin/API/pluginMenu.html';
|
||||
return file_get_contents($fileAPIName);
|
||||
}
|
||||
|
||||
public function set($parameters) {
|
||||
public function set($parameters)
|
||||
{
|
||||
if (empty($parameters['APIName'])) {
|
||||
$object = new ApiObject("Parameter APIName can not be empty (set)");
|
||||
} else {
|
||||
|
@ -81,9 +90,11 @@ class API extends PluginAbstract {
|
|||
eval($str);
|
||||
} else {
|
||||
$method = "API_set_{$parameters['APIName']}";
|
||||
if (!empty($parameters['APIPlugin']) &&
|
||||
if (
|
||||
!empty($parameters['APIPlugin']) &&
|
||||
AVideoPlugin::isEnabledByName($parameters['APIPlugin']) &&
|
||||
method_exists($parameters['APIPlugin'], $method)) {
|
||||
method_exists($parameters['APIPlugin'], $method)
|
||||
) {
|
||||
$str = "\$object = {$parameters['APIPlugin']}::{$method}(\$parameters);";
|
||||
eval($str);
|
||||
} else {
|
||||
|
@ -94,7 +105,8 @@ class API extends PluginAbstract {
|
|||
return $object;
|
||||
}
|
||||
|
||||
public function get($parameters) {
|
||||
public function get($parameters)
|
||||
{
|
||||
if (empty($parameters['APIName'])) {
|
||||
$object = new ApiObject("Parameter APIName can not be empty (get)");
|
||||
} else {
|
||||
|
@ -114,9 +126,11 @@ class API extends PluginAbstract {
|
|||
eval($str);
|
||||
} else {
|
||||
$method = "API_get_{$parameters['APIName']}";
|
||||
if (!empty($parameters['APIPlugin']) &&
|
||||
if (
|
||||
!empty($parameters['APIPlugin']) &&
|
||||
AVideoPlugin::isEnabledByName($parameters['APIPlugin']) &&
|
||||
method_exists($parameters['APIPlugin'], $method)) {
|
||||
method_exists($parameters['APIPlugin'], $method)
|
||||
) {
|
||||
$str = "\$object = {$parameters['APIPlugin']}::{$method}(\$parameters);";
|
||||
eval($str);
|
||||
} else {
|
||||
|
@ -127,7 +141,8 @@ class API extends PluginAbstract {
|
|||
return $object;
|
||||
}
|
||||
|
||||
private function startResponseObject($parameters) {
|
||||
private function startResponseObject($parameters)
|
||||
{
|
||||
$obj = new stdClass();
|
||||
if (empty($parameters['sort']) && !empty($parameters['order'][0]['dir'])) {
|
||||
$index = intval($parameters['order'][0]['column']);
|
||||
|
@ -144,7 +159,8 @@ class API extends PluginAbstract {
|
|||
return $obj;
|
||||
}
|
||||
|
||||
private function getToPost() {
|
||||
private function getToPost()
|
||||
{
|
||||
foreach ($_GET as $key => $value) {
|
||||
$_POST[$key] = $value;
|
||||
}
|
||||
|
@ -157,7 +173,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&rowCount=3&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_plugin_parameters($parameters) {
|
||||
public function get_api_plugin_parameters($parameters)
|
||||
{
|
||||
global $global;
|
||||
$name = "get_api_plugin_parameters" . json_encode($parameters);
|
||||
$obj = ObjectYPT::getCache($name, 3600);
|
||||
|
@ -183,7 +200,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_id($parameters) {
|
||||
public function get_api_id($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
$obj->id = getPlatformId();
|
||||
|
@ -200,7 +218,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F89.0.4389.82+Safari%2F537.36
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_is_mobile($parameters) {
|
||||
public function get_api_is_mobile($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
if (!empty($_REQUEST['httpHeaders'])) {
|
||||
|
@ -228,7 +247,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&rowCount=3¤t=1&sort[created]=DESC
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_category($parameters) {
|
||||
public function get_api_category($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -288,7 +308,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=1&index=2&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_video_from_program($parameters) {
|
||||
public function get_api_video_from_program($parameters)
|
||||
{
|
||||
global $global;
|
||||
$playlists = AVideoPlugin::loadPlugin("PlayLists");
|
||||
if (empty($parameters['playlists_id'])) {
|
||||
|
@ -341,7 +362,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=1&index=2&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_audio_from_program($parameters) {
|
||||
public function get_api_audio_from_program($parameters)
|
||||
{
|
||||
$parameters['audioOnly'] = 1;
|
||||
return $this->get_api_video_from_program($parameters);
|
||||
}
|
||||
|
@ -351,7 +373,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_suggested_programs($parameters) {
|
||||
public function get_api_suggested_programs($parameters)
|
||||
{
|
||||
global $global;
|
||||
$playlists = AVideoPlugin::loadPlugin("PlayLists");
|
||||
//var_dump($videos);exit;
|
||||
|
@ -394,7 +417,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_tags($parameters) {
|
||||
public function get_api_tags($parameters)
|
||||
{
|
||||
global $global;
|
||||
$vtags = AVideoPlugin::loadPluginIfEnabled("VideoTags");
|
||||
|
||||
|
@ -429,7 +453,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_video_file($parameters) {
|
||||
public function get_api_video_file($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
$obj->videos_id = $parameters['videos_id'];
|
||||
|
@ -470,7 +495,8 @@ class API extends PluginAbstract {
|
|||
* @example MostWatched ----> {webSiteRootURL}plugin/API/get.json.php?APIName={APIName}&rowCount=10&sort[views_count]=desc
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_video($parameters) {
|
||||
public function get_api_video($parameters)
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
$cacheParameters = array('noRelated', 'APIName', 'catName', 'rowCount', 'APISecret', 'sort', 'searchPhrase', 'current', 'tags_id', 'channelName', 'videoType', 'is_serie', 'user', 'videos_id', 'playlist');
|
||||
|
@ -517,11 +543,13 @@ class API extends PluginAbstract {
|
|||
if (!empty($_REQUEST['catName']) && empty($parameters['videos_id'])) {
|
||||
$currentCat = Category::getCategoryByName($_REQUEST['catName']);
|
||||
if (!empty($currentCat)) {
|
||||
if (empty($parameters['videoType'])) {
|
||||
$liveVideos = getLiveVideosFromCategory($currentCat['id']);
|
||||
if (!empty($liveVideos)) {
|
||||
$rows = array_merge($liveVideos, $rows);
|
||||
$totalRows += count($liveVideos);
|
||||
}
|
||||
}
|
||||
|
||||
$fullTotals = Category::getTotalFromCategory($currentCat['id'], false, true, true);
|
||||
$totals = Category::getTotalFromCategory($currentCat['id']);
|
||||
|
@ -577,7 +605,8 @@ class API extends PluginAbstract {
|
|||
)
|
||||
);
|
||||
} else if ($extension == 'm3u8') {
|
||||
$rows[$key]['videos'] = array('m3u8' => array(
|
||||
$rows[$key]['videos'] = array(
|
||||
'm3u8' => array(
|
||||
'url' => $rows[$key]['videoLink'],
|
||||
'url_noCDN' => $rows[$key]['videoLink'],
|
||||
'type' => 'video',
|
||||
|
@ -604,8 +633,7 @@ class API extends PluginAbstract {
|
|||
$rows[$key]['mp3'] = convertVideoToMP3FileIfNotExists($value['id']);
|
||||
$rows[$key]['category_name'] = $value['category'];
|
||||
$rows[$key]['category'] = array('name' => $rows[$key]['category_name']);
|
||||
$rows[$key]['channel_name'] = User::_getChannelName($rows[$key]['users_id']);
|
||||
;
|
||||
$rows[$key]['channel_name'] = User::_getChannelName($rows[$key]['users_id']);;
|
||||
}
|
||||
|
||||
if (User::isLogged()) {
|
||||
|
@ -685,7 +713,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_videosCount($parameters) {
|
||||
public function get_api_videosCount($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -709,7 +738,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_video_delete($parameters) {
|
||||
public function get_api_video_delete($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -742,7 +772,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_comment($parameters) {
|
||||
public function set_api_comment($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
if (!empty($parameters['videos_id'])) {
|
||||
|
@ -784,7 +815,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_comment($parameters) {
|
||||
public function get_api_comment($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
if (!empty($parameters['videos_id'])) {
|
||||
|
@ -817,7 +849,8 @@ class API extends PluginAbstract {
|
|||
* 'pass' password of the user that will like the video
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_live_schedule($parameters) {
|
||||
public function get_api_live_schedule($parameters)
|
||||
{
|
||||
if (!User::canStream()) {
|
||||
return new ApiObject("You cannot stream");
|
||||
} else {
|
||||
|
@ -845,7 +878,8 @@ class API extends PluginAbstract {
|
|||
* 'pass' password of the user that will like the video
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_live_schedule_delete($parameters) {
|
||||
public function set_api_live_schedule_delete($parameters)
|
||||
{
|
||||
if (!User::canStream()) {
|
||||
return new ApiObject("You cannot stream");
|
||||
} else {
|
||||
|
@ -881,7 +915,8 @@ class API extends PluginAbstract {
|
|||
* 'pass' password of the user that will like the video
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_live_schedule($parameters) {
|
||||
public function set_api_live_schedule($parameters)
|
||||
{
|
||||
$live_schedule_id = 0;
|
||||
$obj = new stdClass();
|
||||
if (!User::canStream()) {
|
||||
|
@ -962,7 +997,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_video_save($parameters) {
|
||||
public function set_api_video_save($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -996,7 +1032,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_livestreams($parameters) {
|
||||
public function get_api_livestreams($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/stats.json.php';
|
||||
exit;
|
||||
|
@ -1014,7 +1051,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&users_id=1
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_livestream_save($parameters) {
|
||||
public function set_api_livestream_save($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -1060,7 +1098,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&users_id=1
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_user($parameters) {
|
||||
public function get_api_user($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -1135,7 +1174,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&status=a&rowCount=3&searchPhrase=test
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_users_list($parameters) {
|
||||
public function get_api_users_list($parameters)
|
||||
{
|
||||
global $global;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
if (self::isAPISecretValid()) {
|
||||
|
@ -1171,7 +1211,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_videosViewsCount($parameters) {
|
||||
public function get_api_videosViewsCount($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
@ -1207,7 +1248,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_channels($parameters) {
|
||||
public function get_api_channels($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/Channel.php';
|
||||
$channels = Channel::getChannels();
|
||||
|
@ -1225,43 +1267,68 @@ class API extends PluginAbstract {
|
|||
return new ApiObject("", false, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Return a single Program (Playlists) on this site
|
||||
* 'playlists_id'
|
||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=12
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_program($parameters)
|
||||
{
|
||||
global $global;
|
||||
if(empty($parameters['playlists_id'])){
|
||||
return new ApiObject("playlists_id is required");
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
$obj = new PlayList($parameters['playlists_id']);
|
||||
if(empty($obj)){
|
||||
forbiddenPage();
|
||||
}
|
||||
if(!empty($obj->getUsers_id())){
|
||||
forbidIfItIsNotMyUsersId($obj->getUsers_id());
|
||||
}
|
||||
$obj = new stdClass();
|
||||
$obj->videos = PlayList::getAllFromPlaylistsID($parameters['playlists_id']);
|
||||
|
||||
return new ApiObject("", false, $obj);
|
||||
}
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Return all Programs (Playlists) on this site
|
||||
* ['onlyWithVideos' can be 0 or 1 return only programs that contain videos, the default is 1]
|
||||
* ['returnFavoriteAndWatchLater' can be 0 or 1, the default is 0]
|
||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_programs($parameters) {
|
||||
public function get_api_programs($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
|
||||
$config = new Configuration();
|
||||
$users_id = User::getId();
|
||||
$list = [];
|
||||
$obj = new stdClass();
|
||||
$obj->id = 0;
|
||||
$obj->photo = $config->getFavicon(true);
|
||||
$obj->channelLink = $global['webSiteRootURL'];
|
||||
$obj->username = $config->getWebSiteTitle();
|
||||
$obj->name = __('Date added');
|
||||
$obj->link = $global['webSiteRootURL'];
|
||||
$_POST['sort']['created'] = 'DESC';
|
||||
$obj->videos = PlayList::getVideosIDFromPlaylistLight(0);
|
||||
$list[] = $obj;
|
||||
if (!empty($users_id)) {
|
||||
//getAllFromUserLight($userId, $publicOnly = true, $status = false, $playlists_id = 0, $onlyWithVideos = false, $includeSeries = false)
|
||||
$playlists = PlayList::getAllFromUserLight($users_id, false, false, 0, true, true);
|
||||
$playlists = PlayList::getAllFromUserLight($users_id, false, false, 0, _empty($parameters['onlyWithVideos']) ? 0 : 1, true);
|
||||
foreach ($playlists as $value) {
|
||||
$videosArrayId = PlayList::getVideosIdFromPlaylist($value['id']);
|
||||
if (empty($videosArrayId) || $value['status'] == "favorite" || $value['status'] == "watch_later") {
|
||||
if (!_empty($parameters['onlyWithVideos']) && empty($videosArrayId)) {
|
||||
continue;
|
||||
}
|
||||
if (_empty($parameters['returnFavoriteAndWatchLater'])) {
|
||||
if ($value['status'] == "favorite" || $value['status'] == "watch_later") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$obj = new stdClass();
|
||||
$obj->id = $value['id'];
|
||||
$obj->photo = User::getPhoto($value['users_id']);
|
||||
$obj->channelLink = User::getChannelLink($value['users_id']);
|
||||
$obj->username = User::getNameIdentificationById($value['users_id']);
|
||||
$obj->name = $value['name'];
|
||||
$obj->status = $value['status'];
|
||||
$obj->link = PlayLists::getLink($value['id']);
|
||||
$obj->videos = $value['videos'];
|
||||
$list[] = $obj;
|
||||
|
@ -1270,6 +1337,130 @@ class API extends PluginAbstract {
|
|||
return new ApiObject("", false, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Create new programs
|
||||
* 'name' the new program name
|
||||
* 'status' the new program status ['public', 'private', 'unlisted', 'favorite', 'watch_later']
|
||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&name=NewPL&status=unlisted
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_create_programs($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
$users_id = User::getId();
|
||||
if (empty($users_id)) {
|
||||
return new ApiObject("You must login first");
|
||||
}
|
||||
$array = array('name');
|
||||
foreach ($array as $value) {
|
||||
if (empty($parameters[$value])) {
|
||||
return new ApiObject("{$value} cannot be empty");
|
||||
}
|
||||
}
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
return new ApiObject("Plugin not enabled");
|
||||
}
|
||||
|
||||
$playList = new PlayList(0);
|
||||
$playList->setName($parameters['name']);
|
||||
$playList->setStatus(@$parameters['status']);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = empty($playList->save());
|
||||
|
||||
return new ApiObject("", false, $obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Delete programs
|
||||
* 'playlists_id' the id of the program you want to delete
|
||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=12
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_delete_programs($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
$users_id = User::getId();
|
||||
if (empty($users_id)) {
|
||||
return new ApiObject("You must login first");
|
||||
}
|
||||
$array = array('playlists_id');
|
||||
foreach ($array as $value) {
|
||||
if (empty($parameters[$value])) {
|
||||
return new ApiObject("{$value} cannot be empty");
|
||||
}
|
||||
}
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
return new ApiObject("Plugin not enabled");
|
||||
}
|
||||
|
||||
$playList = new PlayList($parameters['playlists_id']);
|
||||
if (empty($playList) || User::getId() !== $playList->getUsers_id()) {
|
||||
return new ApiObject("Permission denied");
|
||||
}
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = empty($playList->delete());
|
||||
|
||||
return new ApiObject("", false, $obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Return all Programs (Playlists) on this site
|
||||
* 'videos_id'
|
||||
* 'playlists_id' ,
|
||||
* 'add' 1 = will add, 0 = will remove,
|
||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=11&playlists_id=10&add=1
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_programs($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
$users_id = User::getId();
|
||||
if (empty($users_id)) {
|
||||
return new ApiObject("You must login first");
|
||||
}
|
||||
$array = array('videos_id', 'playlists_id');
|
||||
foreach ($array as $value) {
|
||||
if (empty($parameters[$value])) {
|
||||
return new ApiObject("{$value} cannot be empty");
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->status = 0;
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
return new ApiObject("Plugin not enabled");
|
||||
}
|
||||
|
||||
if (!PlayLists::canAddVideoOnPlaylist($parameters['videos_id'])) {
|
||||
return new ApiObject("You can not add this video on playlist");
|
||||
}
|
||||
|
||||
$playList = new PlayList($parameters['playlists_id']);
|
||||
if (empty($playList) || User::getId() !== $playList->getUsers_id() || empty($parameters['videos_id'])) {
|
||||
return new ApiObject("Permission denied");
|
||||
}
|
||||
|
||||
$obj->error = false;
|
||||
$obj->status = $playList->addVideo($parameters['videos_id'], $parameters['add']);
|
||||
|
||||
return new ApiObject("", false, $obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameters
|
||||
* Return all Subscribers from an user
|
||||
|
@ -1277,7 +1468,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?users_id=1&APIName={APIName}&APISecret={APISecret}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_subscribers($parameters) {
|
||||
public function get_api_subscribers($parameters)
|
||||
{
|
||||
global $global;
|
||||
|
||||
$name = "get_api_subscribers" . json_encode($parameters);
|
||||
|
@ -1303,7 +1495,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_categories($parameters) {
|
||||
public function get_api_categories($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||
$categories = Category::getAllCategories();
|
||||
|
@ -1328,7 +1521,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function get_api_likes($parameters) {
|
||||
public function get_api_likes($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/like.php';
|
||||
if (empty($parameters['videos_id'])) {
|
||||
|
@ -1345,7 +1539,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_like($parameters) {
|
||||
public function set_api_like($parameters)
|
||||
{
|
||||
return $this->like($parameters, 1);
|
||||
}
|
||||
|
||||
|
@ -1357,7 +1552,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_dislike($parameters) {
|
||||
public function set_api_dislike($parameters)
|
||||
{
|
||||
return $this->like($parameters, -1);
|
||||
}
|
||||
|
||||
|
@ -1369,7 +1565,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&user=admin&pass=123
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_removelike($parameters) {
|
||||
public function set_api_removelike($parameters)
|
||||
{
|
||||
return $this->like($parameters, 0);
|
||||
}
|
||||
|
||||
|
@ -1382,7 +1579,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_signIn($parameters) {
|
||||
public function get_api_signIn($parameters)
|
||||
{
|
||||
global $global;
|
||||
$this->getToPost();
|
||||
require_once $global['systemRootPath'] . 'objects/login.json.php';
|
||||
|
@ -1404,7 +1602,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&user=admin&pass=123&email=me@mysite.com&name=Yeshua
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_signUp($parameters) {
|
||||
public function set_api_signUp($parameters)
|
||||
{
|
||||
global $global;
|
||||
$this->getToPost();
|
||||
$obj = $this->getDataObject();
|
||||
|
@ -1428,7 +1627,8 @@ class API extends PluginAbstract {
|
|||
exit;
|
||||
}
|
||||
|
||||
private function like($parameters, $like) {
|
||||
private function like($parameters, $like)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/like.php';
|
||||
if (empty($parameters['videos_id'])) {
|
||||
|
@ -1453,7 +1653,8 @@ class API extends PluginAbstract {
|
|||
* @example for JSON response: {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true&optionalAdTagUrl=2&json=1
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_vmap($parameters) {
|
||||
public function get_api_vmap($parameters)
|
||||
{
|
||||
global $global;
|
||||
$this->getToPost();
|
||||
require_once $global['systemRootPath'] . 'plugin/GoogleAds_IMA/VMAP.php';
|
||||
|
@ -1471,7 +1672,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true&optionalAdTagUrl=2
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_vast($parameters) {
|
||||
public function get_api_vast($parameters)
|
||||
{
|
||||
global $global;
|
||||
$this->getToPost();
|
||||
$vastOnly = 1;
|
||||
|
@ -1487,7 +1689,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&ip=2.20.147.123
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_IP2Location($parameters) {
|
||||
public function get_api_IP2Location($parameters)
|
||||
{
|
||||
global $global;
|
||||
$this->getToPost();
|
||||
$obj = $this->getDataObject();
|
||||
|
@ -1513,7 +1716,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_favorite($parameters) {
|
||||
public function get_api_favorite($parameters)
|
||||
{
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
return new ApiObject("Plugin disabled");
|
||||
|
@ -1547,7 +1751,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_favorite($parameters) {
|
||||
public function set_api_favorite($parameters)
|
||||
{
|
||||
$this->favorite($parameters, true);
|
||||
}
|
||||
|
||||
|
@ -1560,11 +1765,13 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_removeFavorite($parameters) {
|
||||
public function set_api_removeFavorite($parameters)
|
||||
{
|
||||
$this->favorite($parameters, false);
|
||||
}
|
||||
|
||||
private function favorite($parameters, $add) {
|
||||
private function favorite($parameters, $add)
|
||||
{
|
||||
global $global;
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
|
@ -1589,7 +1796,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_watch_later($parameters) {
|
||||
public function get_api_watch_later($parameters)
|
||||
{
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
return new ApiObject("Plugin disabled");
|
||||
|
@ -1628,7 +1836,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_watch_later($parameters) {
|
||||
public function set_api_watch_later($parameters)
|
||||
{
|
||||
$this->watch_later($parameters, true);
|
||||
}
|
||||
|
||||
|
@ -1641,11 +1850,13 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=3&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_removeWatch_later($parameters) {
|
||||
public function set_api_removeWatch_later($parameters)
|
||||
{
|
||||
$this->watch_later($parameters, false);
|
||||
}
|
||||
|
||||
private function watch_later($parameters, $add) {
|
||||
private function watch_later($parameters, $add)
|
||||
{
|
||||
global $global;
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
|
||||
if (empty($plugin)) {
|
||||
|
@ -1674,7 +1885,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&message=HelloWorld&users_id=2&room_users_id=4&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_chat2_message($parameters) {
|
||||
public function set_api_chat2_message($parameters)
|
||||
{
|
||||
global $global;
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
|
||||
if (empty($plugin)) {
|
||||
|
@ -1704,7 +1916,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&greater_then_id=88&lower_then_id=98&to_users_id=2&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_chat2_chat($parameters) {
|
||||
public function get_api_chat2_chat($parameters)
|
||||
{
|
||||
global $global;
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
|
||||
if (empty($plugin)) {
|
||||
|
@ -1744,7 +1957,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&greater_then_id=88&lower_then_id=98&room_users_id=2&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_chat2_room($parameters) {
|
||||
public function get_api_chat2_room($parameters)
|
||||
{
|
||||
global $global;
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
|
||||
if (empty($plugin)) {
|
||||
|
@ -1770,7 +1984,8 @@ class API extends PluginAbstract {
|
|||
exit;
|
||||
}
|
||||
|
||||
public static function getAPISecret() {
|
||||
public static function getAPISecret()
|
||||
{
|
||||
$obj = AVideoPlugin::getDataObject("API");
|
||||
return $obj->APISecret;
|
||||
}
|
||||
|
@ -1781,7 +1996,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_locales($parameters) {
|
||||
public function get_api_locales($parameters)
|
||||
{
|
||||
global $global, $config;
|
||||
$langs = new stdClass();
|
||||
$langs->default = $config->getLanguage();
|
||||
|
@ -1797,7 +2013,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&language=cn
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_locale($parameters) {
|
||||
public function get_api_locale($parameters)
|
||||
{
|
||||
global $global, $config;
|
||||
$obj = $this->startResponseObject($parameters);
|
||||
|
||||
|
@ -1826,7 +2043,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}&user=admin
|
||||
* @return \ApiObject
|
||||
*/
|
||||
public function set_api_userImages($parameters) {
|
||||
public function set_api_userImages($parameters)
|
||||
{
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
if (self::isAPISecretValid()) {
|
||||
|
@ -1854,7 +2072,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
|
||||
* @return string
|
||||
*/
|
||||
public function get_api_meet($parameters) {
|
||||
public function get_api_meet($parameters)
|
||||
{
|
||||
global $global;
|
||||
$meet = AVideoPlugin::loadPluginIfEnabled('Meet');
|
||||
if ($meet) {
|
||||
|
@ -1904,7 +2123,8 @@ class API extends PluginAbstract {
|
|||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true&RoomTopic=APITestMeet
|
||||
* @return string
|
||||
*/
|
||||
public function set_api_meet($parameters) {
|
||||
public function set_api_meet($parameters)
|
||||
{
|
||||
global $global;
|
||||
$meet = AVideoPlugin::loadPluginIfEnabled('Meet');
|
||||
if ($meet) {
|
||||
|
@ -1920,7 +2140,8 @@ class API extends PluginAbstract {
|
|||
exit;
|
||||
}
|
||||
|
||||
public static function isAPISecretValid() {
|
||||
public static function isAPISecretValid()
|
||||
{
|
||||
global $global;
|
||||
if (!empty($_REQUEST['APISecret'])) {
|
||||
$dataObj = AVideoPlugin::getDataObject('API');
|
||||
|
@ -1931,10 +2152,10 @@ class API extends PluginAbstract {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ApiObject {
|
||||
class ApiObject
|
||||
{
|
||||
|
||||
public $error;
|
||||
public $message;
|
||||
|
@ -1943,7 +2164,8 @@ class ApiObject {
|
|||
public $users_id;
|
||||
public $session_id;
|
||||
|
||||
public function __construct($message = "api not started or not found", $error = true, $response = []) {
|
||||
public function __construct($message = "api not started or not found", $error = true, $response = [])
|
||||
{
|
||||
$response = cleanUpRowFromDatabase($response);
|
||||
|
||||
$this->error = $error;
|
||||
|
@ -1953,10 +2175,10 @@ class ApiObject {
|
|||
$this->users_id = User::getId();
|
||||
$this->session_id = session_id();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SectionFirstPage {
|
||||
class SectionFirstPage
|
||||
{
|
||||
|
||||
public $type;
|
||||
public $title;
|
||||
|
@ -1968,7 +2190,8 @@ class SectionFirstPage {
|
|||
public $childs;
|
||||
|
||||
// Add constructor, getter, and setter here
|
||||
public function __construct($type, $title, $endpoint, $rowCount, $childs = array()) {
|
||||
public function __construct($type, $title, $endpoint, $rowCount, $childs = array())
|
||||
{
|
||||
global $global;
|
||||
$endpoint = addQueryStringParameter($endpoint, 'current', 1);
|
||||
$endpoint = addQueryStringParameter($endpoint, 'videoType', 'audio_and_video');
|
||||
|
@ -1997,5 +2220,4 @@ class SectionFirstPage {
|
|||
$this->totalRows = $this->endpointResponse->totalRows;
|
||||
$this->childs = $childs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1359,6 +1359,7 @@ Click <a href=\"{link}\">here</a> to join our live.";
|
|||
$live_servers_id = self::getLiveServersIdRequest();
|
||||
$lso = new LiveStreamObject($uuid, $live_servers_id, false, false);
|
||||
$parts = self::getLiveParametersFromKey($uuid);
|
||||
$allowOnlineIndex= false;
|
||||
if (!empty($parts['live_index'])) {
|
||||
$allowOnlineIndex = $parts['live_index'];
|
||||
} elseif (!empty($_REQUEST['live_index'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue