diff --git a/plugin/Gallery/view/mainArea.php b/plugin/Gallery/view/mainArea.php
index 66c945b68..401552b00 100644
--- a/plugin/Gallery/view/mainArea.php
+++ b/plugin/Gallery/view/mainArea.php
@@ -1,131 +1,125 @@
searchOnChannels && !empty($_GET['search'])) {
$channels = User::getAllUsers(true);
//cleanSearchVar();
foreach ($channels as $value) {
$contentSearchFound = true;
createChannelItem($value['id'], $value['photoURL'], $value['identification']);
}
//reloadSearchVar();
}
if (!empty($video)) {
$contentSearchFound = true;
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
if (empty($_GET['search'])) {
include $global['systemRootPath'] . 'plugin/Gallery/view/BigVideo.php';
}
echo '
' . getAdsLeaderBoardTop2() . '';
if (empty($_GET['catName'])) {
+ $objLive = AVideoPlugin::getDataObject('Live');
?>
-
+
+
+
live_schedule_label); ?>
+
+
function afterExtraVideos($liveLi) {return false;}';
}
echo AVideoPlugin::getGallerySection();
$sections = Gallery::getSectionsOrder();
$countSections = 0;
if (!empty($_GET['catName'])) {
$currentCat = Category::getCategoryByName($_GET['catName']);
//createGallery($category['name'], 'created', $obj->CategoriesRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, $category['iconClass'], true);
include $global['systemRootPath'] . 'plugin/Gallery/view/mainAreaCategory.php';
} else {
foreach ($sections as $value) {
if (empty($value['active'])) {
continue;
}
$countSections++;
if ($value['name'] == 'Suggested') {
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star");
} else
if ($value['name'] == 'Trending') {
createGallery(!empty($obj->TrendingCustomTitle) ? $obj->TrendingCustomTitle : __("Trending"), 'trending', $obj->TrendingRowCount, 'TrendingOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-chart-line");
} else
if ($value['name'] == 'SortByName') {
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font");
} else
if ($value['name'] == 'DateAdded' && empty($_GET['catName'])) {
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt");
} else
if ($value['name'] == 'MostWatched') {
createGallery(!empty($obj->MostWatchedCustomTitle) ? $obj->MostWatchedCustomTitle : __("Most watched"), 'views_count', $obj->MostWatchedRowCount, 'mostWatchedOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-eye");
} else
if ($value['name'] == 'MostPopular') {
createGallery(!empty($obj->MostPopularCustomTitle) ? $obj->MostPopularCustomTitle : __("Most popular"), 'likes', $obj->MostPopularRowCount, 'mostPopularOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "fas fa-fire");
} else
if ($value['name'] == 'SubscribedChannels' && User::isLogged() && empty($_GET['showOnly'])) {
include $global['systemRootPath'] . 'plugin/Gallery/view/mainAreaChannels.php';
} else
if ($value['name'] == 'Categories' && empty($_GET['showOnly'])) {
if(empty($currentCat) && !empty(getSearchVar())){
$onlySuggested = $obj->CategoriesShowOnlySuggested;
cleanSearchVar();
$categories = Category::getAllCategories(false, true, $onlySuggested);
reloadSearchVar();
foreach ($categories as $value) {
$currentCat = $value['clean_name'];
include $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryCategory.php';
}
}else{
include $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryCategory.php';
}
}
}
if (empty($countSections) && !empty($_GET['catName'])) {
$category = Category::getCategoryByName($_GET['catName']);
createGallery($category['name'], 'created', $obj->CategoriesRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, $category['iconClass'], true);
}
}
} else {
include $global['systemRootPath'] . 'plugin/Gallery/view/modeGalleryCategoryLive.php';
$ob = ob_get_clean();
ob_start();
echo AVideoPlugin::getGallerySection();
$ob2 = ob_get_clean();
echo $ob;
if (empty($contentSearchFound) && empty($ob2)) {
$contentSearchFound = false;
} else {
$contentSearchFound = true;
}
}
if (!$contentSearchFound) {
_session_start();
unset($_SESSION['type']);
?>
!
.
\ No newline at end of file
diff --git a/plugin/Live/Live.php b/plugin/Live/Live.php
index f0e6302ef..6d106a167 100644
--- a/plugin/Live/Live.php
+++ b/plugin/Live/Live.php
@@ -1,2787 +1,2791 @@
and receive HLS streaming from servers";
$lu = AVideoPlugin::loadPlugin("LiveUsers");
if (!empty($lu)) {
if (version_compare($lu->getPluginVersion(), "2.0") < 0) {
$desc .= "";
$btn .= self::getButton("record_start", $key, $live_servers_id, $iconsOnly);
$btn .= self::getButton("record_stop", $key, $live_servers_id, $iconsOnly);
$btn .= "
";
return $btn;
}
static function getAllControlls($key, $live_servers_id = 0, $iconsOnly = false, $btnClass = '') {
if (!Live::canManageLiveFromLiveKey($key, User::getId())) {
return '';
}
$btn = "";
//$btn .= self::getButton("drop_publisher", $live_transmition_id, $live_servers_id);
$btn .= self::getButton("save_dvr", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= self::getButton("drop_publisher_reset_key", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= self::getButton("record_start", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= self::getButton("record_stop", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= "
";
$btn .= "";
return $btn;
}
static function getRestreamer($live_servers_id = -1) {
$obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj->useLiveServers)) {
if ($live_servers_id < 0) {
$live_servers_id = self::getCurrentLiveServersId();
}
$ls = new Live_servers($live_servers_id);
if (!empty($ls->getRestreamerURL())) {
return $ls->getRestreamerURL();
}
}
return $obj->restreamerURL;
}
static function getControl($live_servers_id = -1) {
$obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj->useLiveServers) && !empty($live_servers_id)) {
if ($live_servers_id < 0) {
$live_servers_id = self::getCurrentLiveServersId();
}
$ls = new Live_servers($live_servers_id);
if (!empty($ls->getControlURL())) {
return $ls->getControlURL();
}
}
return $obj->controlURL;
}
static function getRTMPLink($users_id, $forceIndex = false) {
$key = self::getKeyFromUser($users_id);
return self::getRTMPLinkFromKey($key, $forceIndex);
}
static function getRTMPLinkFromKey($key, $forceIndex = false) {
$lso = new LiveStreamObject($key);
return $lso->getRTMPLink($forceIndex);
}
static function getRTMPLinkWithOutKey($users_id) {
$lso = new LiveStreamObject(self::getKeyFromUser($users_id));
return $lso->getRTMPLinkWithOutKey();
}
static function getRTMPLinkWithOutKeyFromKey($key) {
$lso = new LiveStreamObject($key);
return $lso->getRTMPLinkWithOutKey();
}
static function getKeyFromUser($users_id) {
if (!User::isLogged() || ($users_id !== User::getId() && !User::isAdmin())) {
return false;
}
$user = new User($users_id);
$trasnmition = LiveTransmition::createTransmitionIfNeed($users_id);
return $trasnmition['key'];
}
static function getDynamicKey($key) {
$objLive = AVideoPlugin::getDataObject("Live");
if ($objLive->allowMultipleLivesPerUser) {
$key .= '-' . date('His');
}
return $key;
}
static function getPlayerServer() {
$obj = AVideoPlugin::getObjectData("Live");
$url = $obj->playerServer;
$url = getCDNOrURL($url, 'CDN_Live');
if (!empty($obj->useLiveServers)) {
$ls = new Live_servers(self::getLiveServersIdRequest());
if (!empty($ls->getPlayerServer())) {
$url = $ls->getPlayerServer();
$url = getCDNOrURL($url, 'CDN_LiveServers', $ls->getId());
}
}
//$url = str_replace("encoder.gdrive.local", "192.168.1.18", $url);
return $url;
}
static function getUseAadaptiveMode() {
$obj = AVideoPlugin::getObjectData("Live");
if(empty($obj->server_type->value)){
return true;
}
if (!empty($obj->useLiveServers)) {
$ls = new Live_servers(self::getCurrentLiveServersId());
return $ls->getUseAadaptiveMode();
}
return $obj->useAadaptiveMode;
}
static function getRemoteFile() {
return self::getRemoteFileFromLiveServersID(self::getCurrentLiveServersId());
}
static function getRemoteFileFromLiveServersID($live_servers_id) {
global $global;
$obj = AVideoPlugin::getObjectData("Live");
if (empty($live_servers_id) || !empty($obj->useLiveServers)) {
$ls = new Live_servers($live_servers_id);
$url = $ls->getGetRemoteFile();
if (IsValidURL($url)) {
return $url;
}
}
return "{$global['webSiteRootURL']}plugin/Live/standAloneFiles/getRecordedFile.php";
}
static function getRemoteFileFromRTMPHost($rtmpHostURI) {
$live_servers_id = Live_servers::getServerIdFromRTMPHost($rtmpHostURI);
return self::getRemoteFileFromLiveServersID($live_servers_id);
}
static function getLiveServersIdRequest() {
if (empty($_REQUEST['live_servers_id'])) {
return 0;
}
return intval($_REQUEST['live_servers_id']);
}
static function getM3U8File($uuid, $doNotProtect = false) {
$live_servers_id = self::getLiveServersIdRequest();
$lso = new LiveStreamObject($uuid, $live_servers_id, false, false);
return $lso->getM3U8($doNotProtect);
}
public function getDisableGifThumbs() {
$o = $this->getDataObject();
return $o->disableGifThumbs;
}
public function getStatsURL($live_servers_id = 0) {
global $global;
$o = $this->getDataObject();
if (!empty($live_servers_id)) {
$liveServer = new Live_servers($live_servers_id);
if ($liveServer->getStats_url()) {
return $liveServer->getStats_url();
}
}
return $o->stats;
}
public function getChat($uuid) {
global $global;
//check if LiveChat Plugin is available
$filename = $global['systemRootPath'] . 'plugin/LiveChat/LiveChat.php';
if (file_exists($filename)) {
require_once $filename;
LiveChat::includeChatPanel($uuid);
}
}
function getStatsObject($live_servers_id = 0, $force_recreate = false, $tries = 0) {
if (!function_exists('simplexml_load_file')) {
_error_log("Live::getStatsObject: You need to install the simplexml_load_file function to be able to see the Live stats", AVideoLog::$ERROR);
return false;
}
$name = "getStats" . DIRECTORY_SEPARATOR . "live_servers_id_{$live_servers_id}" . DIRECTORY_SEPARATOR . "getStatsObject";
global $getStatsObject;
if (!isset($getStatsObject)) {
$getStatsObject = array();
}
if (empty($force_recreate)) {
//_error_log("Live::getStatsObject[$live_servers_id] 1: searching for cache");
if (isset($getStatsObject[$live_servers_id])) {
_error_log("Live::getStatsObject[$live_servers_id] 2: return cached result");
return $getStatsObject[$live_servers_id];
}
$result = ObjectYPT::getCache($name, maxLifetime() + 60, true);
if (!empty($result)) {
_error_log("Live::getStatsObject[$live_servers_id] 3: return cached result $name [lifetime=" . (maxLifetime() + 60) . "]");
return _json_decode($result);
}
_error_log("Live::getStatsObject[$live_servers_id] 4: cache not found");
} else {
_error_log("Live::getStatsObject[$live_servers_id] 5: forced to be recreated");
}
$o = $this->getDataObject();
if ($o->doNotProcessNotifications) {
_error_log("Live::getStatsObject[$live_servers_id]: will not show notifications because you select the option doNotProcessNotifications on the live plugin ");
$xml = new stdClass();
$xml->server = new stdClass();
$xml->server->application = array();
$getStatsObject[$live_servers_id] = $xml;
ObjectYPT::setCache($name, json_encode($xml));
return $xml;
}
if (empty($o->requestStatsTimout)) {
$o->requestStatsTimout = 2;
}
ini_set('allow_url_fopen ', 'ON');
$url = $this->getStatsURL($live_servers_id);
if (!empty($_SESSION['getStatsObjectRequestStatsTimout'][$url])) {
_error_log("Live::getStatsObject[$live_servers_id] RTMP Server ($url) is NOT responding we will wait less from now on => live_servers_id = ($live_servers_id) ");
// if the server already fail, do not wait mutch for it next time, just wait 0.5 seconds
$o->requestStatsTimout = $_SESSION['getStatsObjectRequestStatsTimout'][$url];
}
//_error_log_debug("Live::getStatsObject ($url) ({$o->requestStatsTimout}) ");
$waitFile = getTmpDir() . md5($name);
if (file_exists($waitFile) && filemtime($waitFile) > time() - 10 && $tries < 10) {
_error_log("Live::getStatsObject[$live_servers_id]: there is a request in progeress, please wait {$waitFile}");
sleep(1);
return self::getStatsObject($live_servers_id, $force_recreate, $tries + 1);
}
_error_log("Live::getStatsObject[$live_servers_id]: Creating a waitfile {$waitFile}");
file_put_contents($waitFile, time());
$data = $this->get_data($url, $o->requestStatsTimout);
unlink($waitFile);
if (empty($data)) {
_session_start();
if (empty($_SESSION['getStatsObjectRequestStatsTimout'])) {
$_SESSION['getStatsObjectRequestStatsTimout'] = array();
}
$_SESSION['getStatsObjectRequestStatsTimout'][$url] = $o->requestStatsTimout - 1;
if ($_SESSION['getStatsObjectRequestStatsTimout'][$url] < 1) {
$_SESSION['getStatsObjectRequestStatsTimout'][$url] = 2;
}
_error_log("Live::getStatsObject RTMP Server ($url) is OFFLINE, timeout=({$o->requestStatsTimout}) we could not connect on it => live_servers_id = ($live_servers_id) ", AVideoLog::$ERROR);
$data = '