1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Layout, online label and caller improvements

This commit is contained in:
DanieL 2022-05-16 12:23:57 -03:00
parent b040a7ecba
commit 786ada3d73
34 changed files with 5545 additions and 4158 deletions

View file

@ -0,0 +1,7 @@
<?php
$cmd = 'ps aux | grep YPTSocket';
exec($cmd);
$cmd = 'cat /proc/56529/limits | grep open';
exec($cmd);

View file

@ -0,0 +1,162 @@
<?php
$svgClass = '';
$svgStyle = '';
if ($startActive) {
$svgClass .= ' active';
}
if ($invert) {
if(preg_match('/style=["\']/', $parameters)){
$parameters = str_replace(array('style="','style=\''), array('style="transform: scale(-1,1);', 'style=\'transform: scale(-1,1);'));
}else{
$parameters .= 'style="transform: scale(-1,1);"';
}
}
?>
<button type="button" id="<?php echo $id; ?>" <?php echo $parameters; ?>>
<?php
switch ($type) {
case '1':
?>
<svg class="ham hamRotate ham1 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 30,33 h 40 c 0,0 9.044436,-0.654587 9.044436,-8.508902 0,-7.854315 -8.024349,-11.958003 -14.89975,-10.85914 -6.875401,1.098863 -13.637059,4.171617 -13.637059,16.368042 v 40" />
<path
class="line middle"
d="m 30,50 h 40" />
<path
class="line bottom"
d="m 30,67 h 40 c 12.796276,0 15.357889,-11.717785 15.357889,-26.851538 0,-15.133752 -4.786586,-27.274118 -16.667516,-27.274118 -11.88093,0 -18.499247,6.994427 -18.435284,17.125656 l 0.252538,40" />
</svg>
<?php
break;
case '2':
?>
<svg class="ham ham2 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 70,33 h -40 c -6.5909,0 -7.763966,-4.501509 -7.763966,-7.511428 0,-4.721448 3.376452,-9.583771 13.876919,-9.583771 14.786182,0 11.409257,14.896182 9.596449,21.970818 -1.812808,7.074636 -15.709402,12.124381 -15.709402,12.124381" />
<path
class="line middle"
d="m 30,50 h 40" />
<path
class="line bottom"
d="m 70,67 h -40 c -6.5909,0 -7.763966,4.501509 -7.763966,7.511428 0,4.721448 3.376452,9.583771 13.876919,9.583771 14.786182,0 11.409257,-14.896182 9.596449,-21.970818 -1.812808,-7.074636 -15.709402,-12.124381 -15.709402,-12.124381" />
</svg>
<?php
break;
case '3':
?>
<svg class="ham ham3 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 70,33 h -40 c -11.092231,0 11.883874,13.496726 -3.420361,12.956839 -0.962502,-2.089471 -2.222071,-3.282996 -4.545687,-3.282996 -2.323616,0 -5.113897,2.622752 -5.113897,7.071068 0,4.448316 2.080609,7.007933 5.555839,7.007933 2.401943,0 2.96769,-1.283974 4.166879,-3.282995 2.209342,0.273823 4.031294,1.642466 5.857227,-0.252538 v -13.005715 16.288404 h 7.653568" />
<path
class="line middle"
d="m 70,50 h -40 c -5.6862,0 -8.534259,5.373483 -8.534259,11.551069 0,7.187738 3.499166,10.922274 13.131984,10.922274 11.021777,0 7.022787,-15.773343 15.531095,-15.773343 3.268142,0 5.177031,-2.159429 5.177031,-6.7 0,-4.540571 -1.766442,-7.33533 -5.087851,-7.326157 -3.321409,0.0092 -5.771288,2.789632 -5.771288,7.326157 0,4.536525 2.478983,6.805271 5.771288,6.7" />
<path
class="line bottom"
d="m 70,67 h -40 c 0,0 -3.680675,0.737051 -3.660714,-3.517857 0.02541,-5.415597 3.391687,-10.357143 10.982142,-10.357143 4.048418,0 17.88928,0.178572 23.482143,0.178572 0,2.563604 2.451177,3.403635 4.642857,3.392857 2.19168,-0.01078 4.373905,-1.369814 4.375,-3.392857 0.0011,-2.023043 -1.924401,-2.589191 -4.553571,-4.107143 -2.62917,-1.517952 -4.196429,-1.799562 -4.196429,-3.660714 0,-1.861153 2.442181,-3.118811 4.196429,-3.035715 1.754248,0.0831 4.375,0.890841 4.375,3.125 2.628634,0 6.160714,0.267857 6.160714,0.267857 l -0.178571,-2.946428 10.178571,0 -10.178571,0 v 6.696428 l 8.928571,0 -8.928571,0 v 7.142858 l 10.178571,0 -10.178571,0" />
</svg>
<?php
break;
case '4':
?>
<svg class="ham hamRotate ham4 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 70,33 h -40 c 0,0 -8.5,-0.149796 -8.5,8.5 0,8.649796 8.5,8.5 8.5,8.5 h 20 v -20" />
<path
class="line middle"
d="m 70,50 h -40" />
<path
class="line bottom"
d="m 30,67 h 40 c 0,0 8.5,0.149796 8.5,-8.5 0,-8.649796 -8.5,-8.5 -8.5,-8.5 h -20 v 20" />
</svg>
<?php
break;
case '5':
?>
<svg class="ham hamRotate180 ham5 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 30,33 h 40 c 0,0 8.5,-0.68551 8.5,10.375 0,8.292653 -6.122707,9.002293 -8.5,6.625 l -11.071429,-11.071429" />
<path
class="line middle"
d="m 70,50 h -40" />
<path
class="line bottom"
d="m 30,67 h 40 c 0,0 8.5,0.68551 8.5,-10.375 0,-8.292653 -6.122707,-9.002293 -8.5,-6.625 l -11.071429,11.071429" />
</svg>
<?php
break;
case '6':
?>
<svg class="ham ham6 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 30,33 h 40 c 13.100415,0 14.380204,31.80258 6.899646,33.421777 -24.612039,5.327373 9.016154,-52.337577 -12.75751,-30.563913 l -28.284272,28.284272" />
<path
class="line middle"
d="m 70,50 c 0,0 -32.213436,0 -40,0 -7.786564,0 -6.428571,-4.640244 -6.428571,-8.571429 0,-5.895471 6.073743,-11.783399 12.286435,-5.570707 6.212692,6.212692 28.284272,28.284272 28.284272,28.284272" />
<path
class="line bottom"
d="m 69.575405,67.073826 h -40 c -13.100415,0 -14.380204,-31.80258 -6.899646,-33.421777 24.612039,-5.327373 -9.016154,52.337577 12.75751,30.563913 l 28.284272,-28.284272" />
</svg>
<?php
break;
case '7':
?>
<svg class="ham hamRotate ham7 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 70,33 h -40 c 0,0 -6,1.368796 -6,8.5 0,7.131204 6,8.5013 6,8.5013 l 20,-0.0013" />
<path
class="line middle"
d="m 70,50 h -40" />
<path
class="line bottom"
d="m 69.575405,67.073826 h -40 c -5.592752,0 -6.873604,-9.348582 1.371031,-9.348582 8.244634,0 19.053564,21.797129 19.053564,12.274756 l 0,-40" />
</svg>
<?php
break;
case '8':
?>
<svg class="ham hamRotate ham8 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 30,33 h 40 c 3.722839,0 7.5,3.126468 7.5,8.578427 0,5.451959 -2.727029,8.421573 -7.5,8.421573 h -20" />
<path
class="line middle"
d="m 30,50 h 40" />
<path
class="line bottom"
d="m 70,67 h -40 c 0,0 -7.5,-0.802118 -7.5,-8.365747 0,-7.563629 7.5,-8.634253 7.5,-8.634253 h 20" />
</svg>
<?php
break;
default:
?>
<svg class="ham hamRotate ham1 <?php echo $svgClass; ?>" style="<?php echo $svgStyle; ?>" viewBox="0 0 100 100" width="32" onclick="this.classList.toggle('active')">
<path
class="line top"
d="m 30,33 h 40 c 0,0 9.044436,-0.654587 9.044436,-8.508902 0,-7.854315 -8.024349,-11.958003 -14.89975,-10.85914 -6.875401,1.098863 -13.637059,4.171617 -13.637059,16.368042 v 40" />
<path
class="line middle"
d="m 30,50 h 40" />
<path
class="line bottom"
d="m 30,67 h 40 c 12.796276,0 15.357889,-11.717785 15.357889,-26.851538 0,-15.133752 -4.786586,-27.274118 -16.667516,-27.274118 -11.88093,0 -18.499247,6.994427 -18.435284,17.125656 l 0.252538,40" />
</svg>
<?php
break;
}
?>
</button>

View file

@ -545,7 +545,7 @@ function partition(array $list, $totalItens) {
return $partition;
}
function sendSiteEmail($to, $subject, $message, $fromEmail='', $fromName='') {
function sendSiteEmail($to, $subject, $message, $fromEmail = '', $fromName = '') {
global $advancedCustom;
$resp = false;
if (empty($to)) {
@ -565,10 +565,10 @@ function sendSiteEmail($to, $subject, $message, $fromEmail='', $fromName='') {
_error_log("sendSiteEmail [" . count($to) . "] {$subject}");
global $config, $global;
//require_once $global['systemRootPath'] . 'objects/include_phpmailer.php';
if(empty($fromEmail)){
if (empty($fromEmail)) {
$fromEmail = $config->getContactEmail();
}
if(empty($fromName)){
if (empty($fromName)) {
$fromName = $config->getWebSiteTitle();
}
$webSiteTitle = $config->getWebSiteTitle();
@ -8188,14 +8188,13 @@ function pluginsRequired($arrayPluginName, $featureName = '') {
return $obj;
}
function _strtotime($datetime){
if(is_int($datetime)){
function _strtotime($datetime) {
if (is_int($datetime)) {
return $datetime;
}
return strtotime($datetime);
}
function _isSocketPresentOnCrontab() {
foreach (getValidCrontabLines() as $line) {
if (!empty($line) && preg_match('/plugin\/YPTSocket\/server.php/', $line)) {
@ -8214,11 +8213,9 @@ function _isSchedulerPresentOnCrontab() {
return false;
}
function getValidCrontabLines(){
function getValidCrontabLines() {
global $_validCrontabLines;
if(empty($validCrontabLines)){
if (empty($validCrontabLines)) {
$crontab = shell_exec('crontab -l');
$crontabLines = preg_split("/\r\n|\n|\r/", $crontab);
$_validCrontabLines = array();
@ -8238,16 +8235,16 @@ function getValidCrontabLines(){
* @param type $strOrArray
* @return type return an array with the valid emails.
*/
function is_email($strOrArray){
if(empty($strOrArray)){
function is_email($strOrArray) {
if (empty($strOrArray)) {
return array();
}
if(!is_array($strOrArray)){
if (!is_array($strOrArray)) {
$strOrArray = array($strOrArray);
}
$valid_emails = array();
foreach ($strOrArray as $email) {
if(is_numeric($email)){
if (is_numeric($email)) {
$email = User::getEmailDb($email);
}
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
@ -8255,4 +8252,40 @@ function is_email($strOrArray){
}
}
return $valid_emails;
}
/**
* https://codepen.io/ainalem/pen/LJYRxz
* @global type $global
* @param type $id
* @param type $type 1 to 8 [1=x, 2=<-, 3=close, 4=x, 5=<-, 6=x, 7=x, 8=x]
* @param type $parameters
* @return type
*/
function getHamburgerButton($id = '', $type = 0, $parameters = 'class="btn btn-default hamburger"', $startActive = false, $invert = false) {
global $global;
if ($type === 'x') {
$XOptions = array(1, 4, 6, 7, 8);
$type = $XOptions[rand(0, 4)];
}else if($type === '<-'){
$XOptions = array(2, 5);
$type = $XOptions[rand(0, 1)];
}
$type = intval($type);
if (empty($type) || ($type < 1 && $type > 8)) {
$type = rand(1, 8);
}
if (empty($id)) {
$id = uniqid();
}
$filePath = $global['systemRootPath'] . 'objects/functionGetHamburgerButton.php';
return getIncludeFileContent($filePath, array('type' => $type, 'id' => $id, 'parameters' => $parameters, 'startActive' => $startActive, 'invert' => $invert));
}
function getUserOnlineLabel($users_id, $class='', $style=''){
if(AVideoPlugin::isEnabledByName('YPTSocket')){
return YPTSocket::getUserOnlineLabel($users_id, $class, $style);
}else{
return '';
}
}

File diff suppressed because it is too large Load diff

View file

@ -160,9 +160,14 @@ a.h6{
top: 5px;
z-index: 1025;
display: none;
}
.galleryVideo .galleryVideoButtons button{
opacity: 0.5;
display: inline-grid;
padding: 2px;
justify-content: center;
width: 24px;
}
.galleryVideo:hover .galleryVideoButtons{
display: block !important;

View file

@ -1,306 +1,306 @@
<?php
if (empty($crc)) {
$crc = uniqid();
}
if ($obj->BigVideo && empty($_GET['showOnly'])) {
if (!empty($obj->useSuggestedVideosAsCarouselInBigVideo)) {
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//$videoRows = Video::getAllVideosLight("viewable", !$obj->hidePrivateVideos, false, true);
$_REQUEST['rowCount'] = 20;
$_REQUEST['current'] = 1;
$videoRows = Video::getAllVideos("viewable", false, !$obj->hidePrivateVideos, array(), false, false, true, true);
}
if (empty($videoRows)) {
$videoRows = array($video);
}
$class = '';
$classInner = '';
if (count($videoRows) > 1) {
$class = 'carousel slide';
$classInner = 'carousel-inner';
}
?>
<style>
#bigVideoCarousel .carousel-indicators .active {
border-color: #777 !important;
}
</style>
<div class="clearfix" style="margin: 10px 0;">
<div id="bigVideoCarousel" class="<?php echo $class; ?> " data-ride="carousel">
<?php
if (count($videoRows) > 1) {
?>
<!-- Indicators -->
<ol class="carousel-indicators" style="bottom: -25px;">
<?php
for ($i = 0; $i < count($videoRows); $i++) {
?><li data-target="#bigVideoCarousel" data-slide-to="<?php echo $i; ?>" class="<?php echo $i === 0 ? "active" : ""; ?>" style="border-color: #DDD;"></li><?php
}
?>
</ol>
<?php
}
?>
<!-- Wrapper for slides -->
<div class="<?php echo $classInner; ?>">
<?php
$count = 0;
$program = AVideoPlugin::loadPluginIfEnabled('PlayLists');
foreach ($videoRows as $videoRow) {
$count++;
$category = new Category($videoRow['categories_id']);
$videoRow['category'] = $category->getName();
$videoRow['clean_category'] = $category->getClean_name();
$videoRow['iconClass'] = $category->getIconClass();
$videoRow['videoCreation'] = $videoRow['created'];
$name = User::getNameIdentificationById($videoRow['users_id']);
if (empty($get)) {
$get = array();
}
$bigVideoAd = getAdsLeaderBoardBigVideo();
$colClass1 = "col-sm-5";
$colClass2 = "col-sm-7";
$colClass3 = "";
if (!empty($bigVideoAd)) {
$colClass1 = "col-sm-4";
$colClass2 = "col-sm-8";
$colClass3 = "col-sm-6";
}
$isserie = Video::isSerie($videoRow['id']);
$isserieClass = "";
if ($isserie) {
$isserieClass = "isserie";
}
?>
<div class="item <?php echo $count === 1 ? "active" : ""; ?>">
<div class="clear clearfix">
<div class="row thumbsImage">
<div class="<?php echo $colClass1; ?> galleryVideo">
<a class="galleryLink <?php echo $isserieClass; ?>" videos_id="<?php echo $videoRow['id']; ?>"
href="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], false, $get); ?>"
embed="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], true, $get); ?>"
title="<?php echo $videoRow['title']; ?>" style="">
<?php
$images = Video::getImageFromFilename($videoRow['filename'], $videoRow['type']);
$imgGif = $images->thumbsGif;
$poster = isMobile() ? $images->thumbsJpg : $images->poster;
?>
<div class="aspectRatio16_9">
<img src="<?php echo $images->thumbsJpgSmall; ?>" data-src="<?php echo $poster; ?>" alt="<?php echo $videoRow['title']; ?>" class="thumbsJPG img img-responsive <?php echo ($poster != $images->thumbsJpgSmall && !empty($advancedCustom->usePreloadLowResolutionImages)) ? "blur" : ""; ?>" style="height: auto; width: 100%;" id="thumbsJPG<?php echo $videoRow['id']; ?>" />
<?php if (!empty($obj->GifOnBigVideo) && !empty($imgGif)) { ?>
<img src="<?php echo getCDN(); ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $videoRow['title']; ?>" id="thumbsGIF<?php echo $videoRow['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $videoRow['rotation']; ?>" height="130" />
<?php } ?>
</div>
<?php
if (isToShowDuration($videoRow['type'])) {
?>
<span class="duration"><?php echo Video::getCleanDuration($videoRow['duration']); ?></span>
<div class="progress" style="height: 3px; margin-bottom: 2px;">
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $videoRow['progress']['percent'] ?>%;" aria-valuenow="<?php echo $videoRow['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<?php
}
if (!empty($program) && $videoRow['type'] == 'serie' && !empty($videoRow['serie_playlists_id'])) {
?>
<div class="gallerySerieOverlay">
<div class="gallerySerieOverlayTotal">
<?php
$plids = PlayList::getVideosIDFromPlaylistLight($videoRow['serie_playlists_id']);
echo count($plids);
?>
<br><i class="fas fa-list"></i>
</div>
<i class="fas fa-play"></i>
<?php
echo __("Play All");
?>
</div>
<?php
} else
if (User::isLogged() && !empty($program)) {
?>
<div class="galleryVideoButtons" style="margin-right: 20px;">
<?php
//var_dump($value['isWatchLater'], $value['isFavorite']);
if ($videoRow['isWatchLater']) {
$watchLaterBtnAddedStyle = "";
$watchLaterBtnStyle = "display: none;";
} else {
$watchLaterBtnAddedStyle = "display: none;";
$watchLaterBtnStyle = "";
}
if ($videoRow['isFavorite']) {
$favoriteBtnAddedStyle = "";
$favoriteBtnStyle = "display: none;";
} else {
$favoriteBtnAddedStyle = "display: none;";
$favoriteBtnStyle = "";
}
?>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, false, <?php echo $videoRow['watchLaterId']; ?>);return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded<?php echo $videoRow['id']; ?>" title="<?php echo __("Added On Watch Later"); ?>" style="color: #4285f4;<?php echo $watchLaterBtnAddedStyle; ?>" ><i class="fas fa-check"></i></button>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, true, <?php echo $videoRow['watchLaterId']; ?>);return false;" class="btn btn-dark btn-xs watchLaterBtn watchLaterBtn<?php echo $videoRow['id']; ?>" title="<?php echo __("Watch Later"); ?>" style="<?php echo $watchLaterBtnStyle; ?>" ><i class="fas fa-clock"></i></button>
<br>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, false, <?php echo $videoRow['favoriteId']; ?>);return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded<?php echo $videoRow['id']; ?>" title="<?php echo __("Added On Favorite"); ?>" style="color: #4285f4; <?php echo $favoriteBtnAddedStyle; ?>"><i class="fas fa-check"></i></button>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, true, <?php echo $videoRow['favoriteId']; ?>);return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn<?php echo $videoRow['id']; ?> faa-parent animated-hover" title="<?php echo __("Favorite"); ?>" style="<?php echo $favoriteBtnStyle; ?>" ><i class="fas fa-heart faa-pulse faa-fast" ></i></button>
</div>
<?php
}
?>
</a>
</div>
<div class="<?php echo $colClass2; ?>">
<div class="<?php echo $colClass3; ?>">
<a class="h6 galleryLink <?php echo $isserieClass; ?>" videos_id="<?php echo $videoRow['id']; ?>"
href="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], false, $get); ?>"
embed="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], true, $get); ?>"
title="<?php echo $videoRow['title']; ?>">
<strong><?php echo $videoRow['title']; ?></strong>
</a>
<div class="descriptionArea">
<div class="descriptionAreaPreContent">
<div class="descriptionAreaContent">
<?php
echo Video::htmlDescription($videoRow['description']);
?>
</div>
</div>
<button onclick="$(this).closest('.descriptionArea').toggleClass('expanded');" class="btn btn-xs btn-default descriptionAreaShowMoreBtn" style="display: none; ">
<span class="showMore"><i class="fas fa-caret-down"></i> <?php echo __("Show More"); ?></span>
<span class="showLess"><i class="fas fa-caret-up"></i> <?php echo __("Show Less"); ?></span>
</button>
</div>
<div class="galeryDetails">
<div class="galleryTags">
<?php
if (empty($_GET['catName']) && !empty($obj->showCategoryTag)) {
?>
<a class="label label-default" href="<?php echo "{$global['webSiteRootURL']}cat/{$videoRow['clean_category']}"; ?>" data-toggle="tooltip" title="<?php echo $videoRow['category']; ?>">
<?php
if (!empty($videoRow['iconClass'])) {
?>
<i class="<?php echo $videoRow['iconClass']; ?>"></i>
<?php
}
?>
<?php echo $videoRow['category']; ?>
</a>
<?php } ?>
<?php
if (!empty($obj->showTags)) {
$videoRow['tags'] = Video::getTags($videoRow['id']);
if (!empty($videoRow['tags'])) {
foreach ($videoRow['tags'] as $value2) {
if (!empty($value2->label) && $value2->label === __("Group")) {
?><span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span><?php
}
}
}
}
?>
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
if (AVideoPlugin::isEnabledByName('LiveUsers')) {
echo getLiveUsersLabelVideo($videoRow['id'], $videoRow['views_count'], "", "");
} else {
?>
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($videoRow['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php
}
}
?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($videoRow['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<a href="<?php echo User::getChannelLink($videoRow['users_id']); ?>">
<i class="fa fa-user"></i>
<?php echo $name; ?>
</a>
</div>
<?php if (Video::canEdit($videoRow['id'])) { ?>
<div>
<a href="#" onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $videoRow['id']; ?>');return false;"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
<?php } ?>
<?php if (!empty($videoRow['trailer1'])) { ?>
<div>
<span onclick="showTrailer('<?php echo parseVideos($videoRow['trailer1'], 1); ?>'); return false;" class="cursorPointer" >
<i class="fa fa-video"></i> <?php echo __("Trailer"); ?>
</span>
</div>
<?php }
?>
<?php
echo AVideoPlugin::getGalleryActionButton($videoRow['id']);
?>
<?php
if (CustomizeUser::canDownloadVideosFromVideo($videoRow['id'])) {
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
$files = getVideosURL($videoRow['filename']);
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (!empty($files['mp4']) || !empty($files['mp3'])) {
?>
<div style="position: relative; overflow: visible;">
<button type="button" class="btn btn-default btn-sm btn-xs" data-toggle="dropdown">
<i class="fa fa-download"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? $advancedCustom->uploadButtonDropdownText : ""; ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php
//var_dump($files);exit;
foreach ($files as $key => $theLink) {
if ($theLink['type'] !== 'video' && $theLink['type'] !== 'audio' || $key == "m3u8") {
continue;
}
$path_parts = pathinfo($theLink['filename']);
?>
<li>
<a href="<?php echo $theLink['url']; ?>?download=1&title=<?php echo urlencode($videoRow['title'] . "_{$key}_.{$path_parts['extension']}"); ?>">
<?php echo __("Download"); ?> <?php echo $key; ?>
</a>
</li>
<?php }
?>
</ul>
</div>
<?php
}
}
?>
</div>
</div>
<div class="<?php echo $colClass3; ?>">
<?php echo $bigVideoAd; ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
} else if (!empty($_GET['showOnly'])) {
?>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<?php
}
<?php
if (empty($crc)) {
$crc = uniqid();
}
if ($obj->BigVideo && empty($_GET['showOnly'])) {
if (!empty($obj->useSuggestedVideosAsCarouselInBigVideo)) {
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//$videoRows = Video::getAllVideosLight("viewable", !$obj->hidePrivateVideos, false, true);
$_REQUEST['rowCount'] = 20;
$_REQUEST['current'] = 1;
$videoRows = Video::getAllVideos("viewable", false, !$obj->hidePrivateVideos, array(), false, false, true, true);
}
if (empty($videoRows)) {
$videoRows = array($video);
}
$class = '';
$classInner = '';
if (count($videoRows) > 1) {
$class = 'carousel slide';
$classInner = 'carousel-inner';
}
?>
<style>
#bigVideoCarousel .carousel-indicators .active {
border-color: #777 !important;
}
</style>
<div class="clearfix" style="margin: 10px 0;">
<div id="bigVideoCarousel" class="<?php echo $class; ?> " data-ride="carousel">
<?php
if (count($videoRows) > 1) {
?>
<!-- Indicators -->
<ol class="carousel-indicators" style="bottom: -25px;">
<?php
for ($i = 0; $i < count($videoRows); $i++) {
?><li data-target="#bigVideoCarousel" data-slide-to="<?php echo $i; ?>" class="<?php echo $i === 0 ? "active" : ""; ?>" style="border-color: #DDD;"></li><?php
}
?>
</ol>
<?php
}
?>
<!-- Wrapper for slides -->
<div class="<?php echo $classInner; ?>">
<?php
$count = 0;
$program = AVideoPlugin::loadPluginIfEnabled('PlayLists');
foreach ($videoRows as $videoRow) {
$count++;
$category = new Category($videoRow['categories_id']);
$videoRow['category'] = $category->getName();
$videoRow['clean_category'] = $category->getClean_name();
$videoRow['iconClass'] = $category->getIconClass();
$videoRow['videoCreation'] = $videoRow['created'];
$name = User::getNameIdentificationById($videoRow['users_id']);
if (empty($get)) {
$get = array();
}
$bigVideoAd = getAdsLeaderBoardBigVideo();
$colClass1 = "col-sm-5";
$colClass2 = "col-sm-7";
$colClass3 = "";
if (!empty($bigVideoAd)) {
$colClass1 = "col-sm-4";
$colClass2 = "col-sm-8";
$colClass3 = "col-sm-6";
}
$isserie = Video::isSerie($videoRow['id']);
$isserieClass = "";
if ($isserie) {
$isserieClass = "isserie";
}
?>
<div class="item <?php echo $count === 1 ? "active" : ""; ?>">
<div class="clear clearfix">
<div class="row thumbsImage">
<div class="<?php echo $colClass1; ?> galleryVideo">
<a class="galleryLink <?php echo $isserieClass; ?>" videos_id="<?php echo $videoRow['id']; ?>"
href="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], false, $get); ?>"
embed="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], true, $get); ?>"
title="<?php echo $videoRow['title']; ?>" style="">
<?php
$images = Video::getImageFromFilename($videoRow['filename'], $videoRow['type']);
$imgGif = $images->thumbsGif;
$poster = isMobile() ? $images->thumbsJpg : $images->poster;
?>
<div class="aspectRatio16_9">
<img src="<?php echo $images->thumbsJpgSmall; ?>" data-src="<?php echo $poster; ?>" alt="<?php echo $videoRow['title']; ?>" class="thumbsJPG img img-responsive <?php echo ($poster != $images->thumbsJpgSmall && !empty($advancedCustom->usePreloadLowResolutionImages)) ? "blur" : ""; ?>" style="height: auto; width: 100%;" id="thumbsJPG<?php echo $videoRow['id']; ?>" />
<?php if (!empty($obj->GifOnBigVideo) && !empty($imgGif)) { ?>
<img src="<?php echo getCDN(); ?>view/img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $videoRow['title']; ?>" id="thumbsGIF<?php echo $videoRow['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $videoRow['rotation']; ?>" height="130" />
<?php } ?>
</div>
<?php
if (isToShowDuration($videoRow['type'])) {
?>
<span class="duration"><?php echo Video::getCleanDuration($videoRow['duration']); ?></span>
<div class="progress" style="height: 3px; margin-bottom: 2px;">
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $videoRow['progress']['percent'] ?>%;" aria-valuenow="<?php echo $videoRow['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<?php
}
if (!empty($program) && $videoRow['type'] == 'serie' && !empty($videoRow['serie_playlists_id'])) {
?>
<div class="gallerySerieOverlay">
<div class="gallerySerieOverlayTotal">
<?php
$plids = PlayList::getVideosIDFromPlaylistLight($videoRow['serie_playlists_id']);
echo count($plids);
?>
<br><i class="fas fa-list"></i>
</div>
<i class="fas fa-play"></i>
<?php
echo __("Play All");
?>
</div>
<?php
} else
if (User::isLogged() && !empty($program)) {
?>
<div class="galleryVideoButtons" style="margin-right: 20px;">
<?php
//var_dump($value['isWatchLater'], $value['isFavorite']);
if ($videoRow['isWatchLater']) {
$watchLaterBtnAddedStyle = "";
$watchLaterBtnStyle = "display: none;";
} else {
$watchLaterBtnAddedStyle = "display: none;";
$watchLaterBtnStyle = "";
}
if ($videoRow['isFavorite']) {
$favoriteBtnAddedStyle = "";
$favoriteBtnStyle = "display: none;";
} else {
$favoriteBtnAddedStyle = "display: none;";
$favoriteBtnStyle = "";
}
?>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, false, <?php echo $videoRow['watchLaterId']; ?>);return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded<?php echo $videoRow['id']; ?>" title="<?php echo __("Added On Watch Later"); ?>" style="color: #4285f4;<?php echo $watchLaterBtnAddedStyle; ?>" ><i class="fas fa-check"></i></button>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, true, <?php echo $videoRow['watchLaterId']; ?>);return false;" class="btn btn-dark btn-xs watchLaterBtn watchLaterBtn<?php echo $videoRow['id']; ?>" title="<?php echo __("Watch Later"); ?>" style="<?php echo $watchLaterBtnStyle; ?>" ><i class="fas fa-clock"></i></button>
<br>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, false, <?php echo $videoRow['favoriteId']; ?>);return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded<?php echo $videoRow['id']; ?>" title="<?php echo __("Added On Favorite"); ?>" style="color: #4285f4; <?php echo $favoriteBtnAddedStyle; ?>"><i class="fas fa-check"></i></button>
<button onclick="addVideoToPlayList(<?php echo $videoRow['id']; ?>, true, <?php echo $videoRow['favoriteId']; ?>);return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn<?php echo $videoRow['id']; ?> faa-parent animated-hover" title="<?php echo __("Favorite"); ?>" style="<?php echo $favoriteBtnStyle; ?>" ><i class="fas fa-heart faa-pulse faa-fast" ></i></button>
</div>
<?php
}
?>
</a>
</div>
<div class="<?php echo $colClass2; ?>">
<div class="<?php echo $colClass3; ?>">
<a class="h6 galleryLink <?php echo $isserieClass; ?>" videos_id="<?php echo $videoRow['id']; ?>"
href="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], false, $get); ?>"
embed="<?php echo Video::getLink($videoRow['id'], $videoRow['clean_title'], true, $get); ?>"
title="<?php echo $videoRow['title']; ?>">
<strong><?php echo $videoRow['title']; ?></strong>
</a>
<div class="descriptionArea">
<div class="descriptionAreaPreContent">
<div class="descriptionAreaContent">
<?php
echo Video::htmlDescription($videoRow['description']);
?>
</div>
</div>
<button onclick="$(this).closest('.descriptionArea').toggleClass('expanded');" class="btn btn-xs btn-default descriptionAreaShowMoreBtn" style="display: none; ">
<span class="showMore"><i class="fas fa-caret-down"></i> <?php echo __("Show More"); ?></span>
<span class="showLess"><i class="fas fa-caret-up"></i> <?php echo __("Show Less"); ?></span>
</button>
</div>
<div class="galeryDetails">
<div class="galleryTags">
<?php
if (empty($_GET['catName']) && !empty($obj->showCategoryTag)) {
?>
<a class="label label-default" href="<?php echo "{$global['webSiteRootURL']}cat/{$videoRow['clean_category']}"; ?>" data-toggle="tooltip" title="<?php echo $videoRow['category']; ?>">
<?php
if (!empty($videoRow['iconClass'])) {
?>
<i class="<?php echo $videoRow['iconClass']; ?>"></i>
<?php
}
?>
<?php echo $videoRow['category']; ?>
</a>
<?php } ?>
<?php
if (!empty($obj->showTags)) {
$videoRow['tags'] = Video::getTags($videoRow['id']);
if (!empty($videoRow['tags'])) {
foreach ($videoRow['tags'] as $value2) {
if (!empty($value2->label) && $value2->label === __("Group")) {
?><span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span><?php
}
}
}
}
?>
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
if (AVideoPlugin::isEnabledByName('LiveUsers')) {
echo getLiveUsersLabelVideo($videoRow['id'], $videoRow['views_count'], "", "");
} else {
?>
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($videoRow['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php
}
}
?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($videoRow['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<a href="<?php echo User::getChannelLink($videoRow['users_id']); ?>">
<i class="fa fa-user"></i>
<?php echo $name; ?>
</a>
</div>
<?php if (Video::canEdit($videoRow['id'])) { ?>
<div>
<a href="#" onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $videoRow['id']; ?>');return false;"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
<?php } ?>
<?php if (!empty($videoRow['trailer1'])) { ?>
<div>
<span onclick="showTrailer('<?php echo parseVideos($videoRow['trailer1'], 1); ?>'); return false;" class="cursorPointer" >
<i class="fa fa-video"></i> <?php echo __("Trailer"); ?>
</span>
</div>
<?php }
?>
<?php
echo AVideoPlugin::getGalleryActionButton($videoRow['id']);
?>
<?php
if (CustomizeUser::canDownloadVideosFromVideo($videoRow['id'])) {
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
$files = getVideosURL($videoRow['filename']);
@$timesG[__LINE__] += microtime(true) - $startG;
$startG = microtime(true);
if (!empty($files['mp4']) || !empty($files['mp3'])) {
?>
<div style="position: relative; overflow: visible;">
<button type="button" class="btn btn-default btn-sm btn-xs" data-toggle="dropdown">
<i class="fa fa-download"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? $advancedCustom->uploadButtonDropdownText : ""; ?> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php
//var_dump($files);exit;
foreach ($files as $key => $theLink) {
if ($theLink['type'] !== 'video' && $theLink['type'] !== 'audio' || $key == "m3u8") {
continue;
}
$path_parts = pathinfo($theLink['filename']);
?>
<li>
<a href="<?php echo $theLink['url']; ?>?download=1&title=<?php echo urlencode($videoRow['title'] . "_{$key}_.{$path_parts['extension']}"); ?>">
<?php echo __("Download"); ?> <?php echo $key; ?>
</a>
</li>
<?php }
?>
</ul>
</div>
<?php
}
}
?>
</div>
</div>
<div class="<?php echo $colClass3; ?>">
<?php echo $bigVideoAd; ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
} else if (!empty($_GET['showOnly'])) {
?>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<?php
}

View file

@ -2,6 +2,7 @@
namespace Socket;
use React\EventLoop\Loop;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
@ -12,14 +13,20 @@ class Message implements MessageComponentInterface {
protected $clients;
protected $clientsWatchinLive;
protected $clientsWatchVideosId;
protected $clientsUsersId;
protected $clientsChatRoom;
public function __construct() {
//$this->clients = new \SplObjectStorage;
$this->clients = [];
$this->clientsWatchinLive = [];
$this->clientsWatchVideosId = [];
$this->clientsUsersId = [];
$this->clientsChatRoom = [];
//$this->loop->ad
_log_message("Construct");
}
public function onOpen(ConnectionInterface $conn) {
@ -178,7 +185,7 @@ class Message implements MessageComponentInterface {
}
if (!empty($client['users_id'])) {
unset($this->clientsUsersId[$client['users_id']]['resourceId'][$conn->resourceId]);
if(empty($this->clientsUsersId[$client['users_id']]['resourceId'])){
if (empty($this->clientsUsersId[$client['users_id']]['resourceId'])) {
unset($this->clientsUsersId[$client['users_id']]);
}
}
@ -248,7 +255,7 @@ class Message implements MessageComponentInterface {
$this->msgToSelfURI($json, $msgObj->send_to_uri_pattern);
} else if (!empty($json['resourceId'])) {
$this->msgToResourceId($json, $json['resourceId']);
}else if (!empty($json['to_users_id'])) {
} else if (!empty($json['to_users_id'])) {
$this->msgToUsers_id($json, $json['to_users_id']);
} else {
$this->msgToAll($from, $json);
@ -361,12 +368,12 @@ class Message implements MessageComponentInterface {
}
try {
$count = 0;
if(!is_array($users_id)){
if (!is_array($users_id)) {
$users_id = array($users_id);
}
foreach ($users_id as $user_id) {
$user_id = intval($user_id);
if(empty($user_id)){
if (empty($user_id)) {
continue;
}
if ($this->isUserLive($user_id)) {
@ -376,13 +383,12 @@ class Message implements MessageComponentInterface {
}
}
}
} catch (Exception $exc) {
echo $exc->getTraceAsString();
var_dump($users_id, $this->clientsUsersId);
}
_log_message("msgToUsers_id: sent to ($count) clients users_id=". json_encode($users_id));
_log_message("msgToUsers_id: sent to ($count) clients users_id=" . json_encode($users_id));
}
public function msgToSelfURI($msg, $pattern, $type = "") {
@ -572,12 +578,10 @@ class Message implements MessageComponentInterface {
public function getTags() {
return array('free', 'live');
}
public function isUserLive($users_id) {
return !empty($this->clientsUsersId[$users_id]) && !empty($this->clientsUsersId[$users_id]['resourceId']);
}
}

View file

@ -0,0 +1,592 @@
<?php
namespace Socket;
require_once dirname(__FILE__) . '/../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/YPTSocket/functions.php';
class Message2 {
protected $clients;
protected $clientsWatchinLive;
protected $clientsWatchinVideosId;
protected $clientsUsersId;
public function __construct() {
//$this->clients = new \SplObjectStorage;
$this->clients = [];
$this->clientsWatchinLive = [];
$this->clientsWatchVideosId = [];
$this->clientsUsersId = [];
_log_message("Construct");
}
public function onOpen(ConnectionInterface $conn) {
global $onMessageSentTo, $SocketGetTotals;
$SocketGetTotals = null;
$onMessageSentTo = array();
$query = $conn->httpRequest->getUri()->getQuery();
parse_str($query, $wsocketGetVars);
foreach ($wsocketGetVars as $key => $value) {
$wsocketGetVars[$key] = urldecode($value);
}
if (empty($wsocketGetVars['webSocketToken'])) {
_log_message("Empty websocket token ");
return false;
}
$json = getDecryptedInfo($wsocketGetVars['webSocketToken']);
if (empty($json)) {
_log_message("Invalid websocket token ");
return false;
}
// Store the new connection to send messages to later
//$this->clients->attach($conn);
$client = array();
$client['conn'] = $conn;
$client['resourceId'] = $conn->resourceId;
$client['users_id'] = $json->from_users_id;
$client['isAdmin'] = $json->isAdmin;
$client['user_name'] = $json->user_name;
$client['browser'] = $json->browser;
$client['yptDeviceId'] = $json->yptDeviceId;
$client['client'] = deviceIdToObject($json->yptDeviceId);
if (!empty($wsocketGetVars['webSocketSelfURI'])) {
$client['selfURI'] = $wsocketGetVars['webSocketSelfURI'];
} else {
$client['selfURI'] = $json->selfURI;
}
$client['isCommandLine'] = @$wsocketGetVars['isCommandLine'];
$client['page_title'] = @utf8_encode(@$wsocketGetVars['page_title']);
$client['videos_id'] = $json->videos_id;
$client['live_key'] = object_to_array(@$json->live_key);
$client['ip'] = $json->ip;
$client['location'] = $json->location;
if (!empty($client['live_key']['key'])) {
$this->clientsWatchinLive[$client['live_key']['key']][$client['resourceId']] = $client['users_id'];
} else
if (!empty($client['live_key']['liveLink'])) {
$this->clientsWatchinLive[$client['live_key']['liveLink']][$client['resourceId']] = $client['users_id'];
} else
if (!empty($client['videos_id'])) {
$this->clientsWatchVideosId[$client['videos_id']][$client['resourceId']] = $client['users_id'];
}
if (!empty($client['users_id'])) {
if (!isset($this->clientsUsersId[$client['users_id']])) {
$this->clientsUsersId[$client['users_id']] = array(
"users_id" => $client['users_id'],
"isAdmin" => $client['isAdmin'],
"user_name" => $client['user_name']
);
$this->clientsUsersId[$client['users_id']]['resourceId'] = array();
}
if (!in_array($client['resourceId'], $this->clientsUsersId[$client['users_id']]['resourceId'])) {
$this->clientsUsersId[$client['users_id']]['resourceId'][$client['resourceId']] = $client['resourceId'];
}
}
_log_message("New connection ($conn->resourceId) {$json->yptDeviceId} {$client['selfURI']} {$client['browser']}");
$this->clients[$conn->resourceId] = $client;
/*
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$limit = 250;
} else {
$limit = 900;
}
//$limit = 99999;
if(count($this->clients)>$limit){
$resourceId = array_key_first($this->clients);
_log_message("\e[1;32;40m*** Closing connection {$resourceId} ***\e[0m");
//$this->clients[$resourceId]->close();
//$this->clients->detach($this->clients[$resourceId]['conn']);
$this->clients[$resourceId]['conn']->close();
unset($resourceId);
}
*/
if ($client['browser'] == \SocketMessageType::TESTING) {
_log_message("Test detected and received from ($conn->resourceId) " . PHP_EOL . "\e[1;32;40m*** SUCCESS TEST CONNECION {$json->test_msg} ***\e[0m");
$this->msgToResourceId($json, $conn->resourceId, \SocketMessageType::TESTING);
} else if ($this->shouldPropagateInfo($client)) {
//_log_message("shouldPropagateInfo {$json->yptDeviceId}");
$this->msgToAll($conn, array('users_id' => $client['users_id'], 'user_name' => $client['user_name'], 'yptDeviceId' => $client['yptDeviceId']), \SocketMessageType::NEW_CONNECTION, true);
} else {
//_log_message("NOT shouldPropagateInfo ");
}
if (!empty($json->videos_id)) {
//_log_message("msgToAllSameVideo ");
$this->msgToAllSameVideo($json->videos_id, "");
} else {
//_log_message("NOT msgToAllSameVideo ");
}
if (!empty($json->live_key)) {
//_log_message("msgToAllSameLive ");
if (\AVideoPlugin::isEnabledByName('LiveUsers')) {
$live_key = object_to_array($json->live_key);
if (!empty($live_key['key'])) {
\_mysql_connect();
$lt = \LiveTransmitionHistory::getLatest($live_key['key']);
if (!empty($lt['id'])) {
$l = new \LiveTransmitionHistory($lt['id']);
$total_viewers = \LiveUsers::getTotalUsers($lt['key'], $lt['live_servers_id']);
$max_viewers_sametime = $l->getMax_viewers_sametime();
if (!empty($live_key['key'])) {
$viewers_now = count($this->clientsWatchinLive[$live_key['key']]);
} else if (!empty($live_key['liveLink'])) {
$viewers_now = count($this->clientsWatchinLive[$live_key['liveLink']]);
}
if ($viewers_now > $max_viewers_sametime) {
$l->setMax_viewers_sametime($viewers_now);
}
$l->setTotal_viewers($total_viewers);
_log_message("onOpen Connection viewers_now = {$viewers_now} => total_viewers = {$total_viewers}");
$l->save();
}
\_mysql_close();
}
}
$this->msgToAllSameLive($json->live_key, "");
} else {
//_log_message("NOT msgToAllSameLive ");
}
}
public function onClose(ConnectionInterface $conn) {
global $onMessageSentTo, $SocketGetTotals;
$SocketGetTotals = null;
$onMessageSentTo = array();
unset($getStatsLive);
unset($_getStats);
// The connection is closed, remove it, as we can no longer send it messages
//$this->clients->detach($conn);
if (empty($this->clients[$conn->resourceId])) {
_log_message("onClose Connection {$conn->resourceId} not found");
return false;
}
$client = $this->clients[$conn->resourceId];
if (!empty($client['live_key'])) {
if (!empty($client['live_key']['key'])) {
unset($this->clientsWatchinLive[$client['live_key']['key']][$conn->resourceId]);
}
if (!empty($client['live_key']['liveLink'])) {
unset($this->clientsWatchinLive[$client['live_key']['liveLink']][$conn->resourceId]);
}
}
if (!empty($client['users_id'])) {
unset($this->clientsUsersId[$client['users_id']]['resourceId'][$conn->resourceId]);
if(empty($this->clientsUsersId[$client['users_id']]['resourceId'])){
unset($this->clientsUsersId[$client['users_id']]);
}
}
unset($this->clients[$conn->resourceId]);
$users_id = $client['users_id'];
$videos_id = $client['videos_id'];
$live_key = $client['live_key'];
if ($this->shouldPropagateInfo($client)) {
$this->msgToAll($conn, array('users_id' => $client['users_id']), \SocketMessageType::NEW_DISCONNECTION);
//\AVideoPlugin::onUserSocketDisconnect($users_id, $this->clients[$conn->resourceId]);
if (!empty($videos_id)) {
$this->msgToAllSameVideo($videos_id, "");
}
if (!empty($live_key)) {
$this->msgToAllSameLive($live_key, "");
}
}
_log_message("Connection {$conn->resourceId} has disconnected");
}
public function onMessage(ConnectionInterface $from, $msg) {
global $onMessageSentTo, $SocketGetTotals;
$SocketGetTotals = null;
$onMessageSentTo = array();
//_log_message("onMessage: {$msg}");
$json = _json_decode($msg);
if (empty($json)) {
_log_message("onMessage ERROR: JSON is empty ");
return false;
}
if (empty($json->webSocketToken)) {
_log_message("onMessage ERROR: webSocketToken is empty ");
return false;
}
if (!$msgObj = getDecryptedInfo($json->webSocketToken)) {
_log_message("onMessage ERROR: could not decrypt webSocketToken");
return false;
}
switch ($json->msg) {
case "webSocketToken":
if (empty($this->clients[$from->resourceId]['users_id'])) {
_log_message("onMessage:webSocketToken");
$this->clients[$from->resourceId]['users_id'] = $msgObj->from_users_id;
$this->clients[$from->resourceId]['yptDeviceId'] = $msgObj->yptDeviceId;
}
break;
case "getClientsList":
if (empty($this->clientsUsersId)) {
return false;
}
//var_dump($this->clientsUsersId);
//var_dump($msgObj->from_users_id);
//var_dump($json);
//var_dump($msgObj);
$this->msgToResourceId(array('json' => $this->clientsUsersId, 'callback' => 'loadCallerPanel'), $from->resourceId);
break;
case \SocketMessageType::TESTING:
$this->msgToResourceId($json, $from->resourceId, \SocketMessageType::TESTING);
break;
default:
$this->msgToArray($json);
//_log_message("onMessage:msgObj: " . json_encode($json));
if (!empty($msgObj->send_to_uri_pattern)) {
$this->msgToSelfURI($json, $msgObj->send_to_uri_pattern);
} else if (!empty($json['resourceId'])) {
$this->msgToResourceId($json, $json['resourceId']);
}else if (!empty($json['to_users_id'])) {
$this->msgToUsers_id($json, $json['to_users_id']);
} else {
$this->msgToAll($from, $json);
}
break;
}
}
private function shouldPropagateInfo($client) {
if (preg_match('/^unknowDevice.*/', $client['yptDeviceId'])) {
return false;
}
if (!empty($client['isCommandLine'])) {
return false;
}
return true;
}
public function msgToResourceId($msg, $resourceId, $type = "") {
global $onMessageSentTo, $SocketDataObj;
if (in_array($resourceId, $onMessageSentTo)) {
return false;
}
if (empty($this->clients[$resourceId]) || empty($this->clients[$resourceId]['conn'])) {
_log_message("msgToResourceId: we wil NOT send the message to resourceId=({$resourceId}) {$type} because it does not exists anymore");
return false;
}
// do not sent duplicated messages
$onMessageSentTo[] = $resourceId;
if (!$this->shouldPropagateInfo($this->clients[$resourceId])) {
_log_message("msgToResourceId: we wil NOT send the message to resourceId=({$resourceId}) {$type}");
}
if (!is_array($msg)) {
$this->msgToArray($msg);
}
if (!empty($msg['webSocketToken'])) {
unset($msg['webSocketToken']);
}
if (empty($type)) {
$type = \SocketMessageType::DEFAULT_MESSAGE;
}
$videos_id = $this->clients[$resourceId]['videos_id'];
$users_id = $this->clients[$resourceId]['users_id'];
$live_key = $this->clients[$resourceId]['live_key'];
$obj = array();
$obj['ResourceId'] = $resourceId;
$obj['type'] = $type;
if (isset($msg['callback'])) {
$obj['callback'] = $msg['callback'];
unset($msg['callback']);
} else {
$obj['callback'] = "";
}
if (!empty($msg['json'])) {
$obj['msg'] = $msg['json'];
} else if (!empty($msg['msg'])) {
$obj['msg'] = $msg['msg'];
} else {
$obj['msg'] = $msg;
}
$obj['uniqid'] = uniqid();
$obj['users_id'] = $users_id;
$obj['videos_id'] = $videos_id;
$obj['live_key'] = $live_key;
$obj['webSocketServerVersion'] = $SocketDataObj->serverVersion;
$obj['isAdmin'] = $this->clients[$resourceId]['isAdmin'];
$return = $this->getTotals($this->clients[$resourceId]);
$totals = array(
'webSocketServerVersion' => $SocketDataObj->serverVersion,
'socket_users_id' => $users_id,
'socket_resourceId' => $resourceId,
'total_devices_online' => count($return['users_id']),
'total_users_online' => count($return['devices'])
);
$obj['autoUpdateOnHTML'] = array_merge($totals, $return['class_to_update']);
$obj['users_uri'] = $return['users_uri'];
$obj['resourceId'] = $resourceId;
$obj['users_id_online'] = $this->clientsUsersId;
$msgToSend = json_encode($obj);
_log_message("msgToResourceId: resourceId=({$resourceId}) {$type}");
$this->clients[$resourceId]['conn']->send($msgToSend);
}
public function onError(ConnectionInterface $conn, \Exception $e) {
if (!preg_match('/protocol is shutdown/i', $e->getMessage())) { // this may be the iframe that reloads the page
$debug = $this->clients[$conn->resourceId];
unset($debug['conn']);
var_dump($debug);
_log_message("ERROR: ($conn->resourceId) {$e->getMessage()} ", \AVideoLog::$ERROR);
}
$conn->close();
}
public function msgToUsers_id($msg, $users_id, $type = "") {
if (empty($users_id) || empty($this->clientsUsersId)) {
return false;
}
try {
$count = 0;
if(!is_array($users_id)){
$users_id = array($users_id);
}
foreach ($users_id as $user_id) {
$user_id = intval($user_id);
if(empty($user_id)){
continue;
}
if ($this->isUserLive($user_id)) {
foreach ($this->clientsUsersId[$user_id]['resourceId'] as $resourceId) {
$count++;
$this->msgToResourceId($msg, $resourceId, $type);
}
}
}
} catch (Exception $exc) {
echo $exc->getTraceAsString();
var_dump($users_id, $this->clientsUsersId);
}
_log_message("msgToUsers_id: sent to ($count) clients users_id=". json_encode($users_id));
}
public function msgToSelfURI($msg, $pattern, $type = "") {
if (empty($pattern)) {
return false;
}
$count = 0;
foreach ($this->clients as $resourceId => $value) {
if (empty($value['selfURI'])) {
continue;
}
if (preg_match($pattern, $value['selfURI'])) {
$count++;
$this->msgToResourceId($msg, $resourceId, $type);
}
}
_log_message("msgToSelfURI: sent to ($count) clients pattern={$pattern} {$type}");
}
public function getTotals($_client) {
$isAdmin = $_client['isAdmin'];
$selfURI = $_client['selfURI'];
$videos_id = $_client['videos_id'];
$users_id = $_client['users_id'];
$live_key = object_to_array($_client['live_key']);
global $SocketDataObj, $SocketGetTotals;
if (!$isAdmin && isset($SocketGetTotals)) {
return $SocketGetTotals;
}
$return = array(
'users_id' => array(),
'devices' => array(),
'class_to_update' => array(),
'users_uri' => array()
);
$users_id_array = $devices = $list = array();
foreach ($this->clients as $key => $client) {
if (empty($client['yptDeviceId'])) {
continue;
_log_message("getTotals: yptDeviceId is empty ");
}
unset($client['conn']);
if ($isAdmin) {
$index = md5($client['selfURI']);
if (!isset($return['users_uri'][$index])) {
$return['users_uri'][$index] = array();
}
if (!isset($return['users_uri'][$index][$client['yptDeviceId']])) {
$return['users_uri'][$index][$client['yptDeviceId']] = array();
}
if (empty($client['users_id'])) {
$return['users_uri'][$index][$client['yptDeviceId']][uniqid()] = $client;
} else
if (!isset($return['users_uri'][$index][$client['yptDeviceId']][$client['users_id']])) {
$return['users_uri'][$index][$client['yptDeviceId']][$client['users_id']] = $client;
}
}
//total_devices_online
if (!in_array($client['yptDeviceId'], $return['devices'])) {
$return['devices'][] = $client['yptDeviceId'];
}
//total_users_online
if (!empty($client['users_id']) && !in_array($client['users_id'], $return['users_id'])) {
if ($this->shouldPropagateInfo($client)) {
$return['users_id'][] = $client['users_id'];
}
}
$keyName = "";
if (!empty($SocketDataObj->showTotalOnlineUsersPerVideo) && !empty($client['videos_id'])) {
$keyName = getSocketVideoClassName($client['videos_id']);
} else if (!empty($SocketDataObj->showTotalOnlineUsersPerLive) && !empty($client['live_key']['key'])) {
$keyName = getSocketLiveClassName($client['live_key']['key'], $client['live_key']['live_servers_id']);
} else if (!empty($SocketDataObj->showTotalOnlineUsersPerLiveLink) && !empty($client['live_key']['liveLink'])) {
$keyName = getSocketLiveLinksClassName($client['live_key']['liveLink']);
}
if (!empty($keyName)) {
if (!isset($return['class_to_update'][$keyName])) {
$return['class_to_update'][$keyName] = 1;
} else {
$return['class_to_update'][$keyName]++;
}
}
}
if (!$isAdmin) {
$SocketGetTotals = $return;
}
return $return;
}
public function msgToDevice_id($msg, $yptDeviceId) {
if (empty($yptDeviceId)) {
return false;
}
$count = 0;
foreach ($this->clients as $resourceId => $value) {
if ($value['yptDeviceId'] == $yptDeviceId) {
$count++;
$this->msgToResourceId($msg, $resourceId);
}
}
_log_message("msgToDevice_id: sent to ($count) clients yptDeviceId={$yptDeviceId} ");
}
public function msgToAll(ConnectionInterface $from, $msg, $type = "", $includeMe = false) {
_log_message("msgToAll FROM ({$from->resourceId}) {$type} Total Clients: " . count($this->clients));
foreach ($this->clients as $key => $client) {
if (!empty($includeMe) || $from !== $client['conn']) {
//_log_message("msgToAll FROM ({$from->resourceId}) TO {$key} {$type}");
$this->msgToResourceId($msg, $key, $type);
}
}
}
public function msgToAllSameVideo($videos_id, $msg) {
if (empty($videos_id)) {
return false;
}
if (!is_array($msg)) {
$this->msgToArray($msg);
}
_log_message("msgToAllSameVideo: {$videos_id}");
foreach ($this->clients as $key => $client) {
if (empty($client['videos_id'])) {
continue;
}
if ($client['videos_id'] == $videos_id) {
$this->msgToResourceId($msg, $key, \SocketMessageType::ON_VIDEO_MSG);
}
}
}
public function msgToAllSameLive($live_key, $msg) {
if (empty($live_key)) {
return false;
}
$live_key = object_to_array($live_key);
if (!is_array($msg)) {
$this->msgToArray($msg);
}
_mysql_connect();
$msg['is_live'] = \Live::isLiveAndIsReadyFromKey($live_key['key'], $live_key['live_servers_id'], true);
_mysql_close();
_log_message("msgToAllSameLive: key={$live_key['key']} live_servers_id={$live_key['live_servers_id']} liveLink={$live_key['liveLink']}");
foreach ($this->clients as $key => $client) {
if (empty($client['live_key']) || (empty($client['live_key']['key']) && empty($client['live_key']['liveLink']))) {
continue;
}
if ($client['live_key']['key'] == $live_key['key'] && $client['live_key']['live_servers_id'] == $live_key['live_servers_id']) {
$this->msgToResourceId($msg, $key, \SocketMessageType::ON_LIVE_MSG);
} else if ($client['live_key']['liveLink'] == $live_key['liveLink']) {
$this->msgToResourceId($msg, $key, \SocketMessageType::ON_LIVE_MSG);
}
}
}
private function msgToArray(&$json) {
$json = $this->makeSureIsArray($json);
return true;
}
private function makeSureIsArray($msg) {
if (empty($msg)) {
return array();
}
if (is_string($msg)) {
$decoded = _json_decode($msg);
} else {
$decoded = object_to_array($msg);
}
if (is_string($msg) && !$decoded) {
return array($msg);
} else if (is_string($msg)) {
return object_to_array($decoded);
}
return object_to_array($msg);
}
public function getTags() {
return array('free', 'live');
}
public function isUserLive($users_id) {
return !empty($this->clientsUsersId[$users_id]) && !empty($this->clientsUsersId[$users_id]['resourceId']);
}
}
function _log_message($msg, $type = "") {
global $SocketDataObj;
if (!empty($SocketDataObj->debugAllUsersSocket) || !empty($SocketDataObj->debugSocket)) {
//_error_log($msg, \AVideoLog::$SOCKET);
echo date('Y-m-d H:i:s') . ' ' . $msg . PHP_EOL;
} else if ($type == \AVideoLog::$ERROR) {
_error_log($msg, \AVideoLog::$SOCKET);
echo "\e[1;31;40m" . date('Y-m-d H:i:s') . ' ' . $msg . "\e[0m" . PHP_EOL;
}
}

View file

@ -193,6 +193,7 @@ class YPTSocket extends PluginAbstract {
if (!empty($obj->enableCalls)) {
echo 'callerNewConnection(response);';
}
echo 'socketNewConnection(response);';
return '';
}
@ -201,7 +202,38 @@ class YPTSocket extends PluginAbstract {
if (!empty($obj->enableCalls)) {
echo 'callerDisconnection(response);';
}
echo 'socketDisconnection(response);';
return '';
}
public static function getUserOnlineLabel($users_id, $class='', $style='') {
global $global;
$users_id = intval($users_id);
$varsArray = array('users_id' => $users_id, 'class'=>$class, 'style'=>$style);
$filePath = $global['systemRootPath'] . 'plugin/YPTSocket/userOnlineLabel.php';
return getIncludeFileContent($filePath, $varsArray);
}
public static function shouldShowCaller() {
global $_YPTSocketshouldShowCaller;
if(!isset($_YPTSocketshouldShowCaller)){
$obj = new stdClass();
$obj->show = false;
$obj->reason = '';
if (!User::isLogged()) {
$obj->reason = 'Not logged';
} else {
$objSocket = AVideoPlugin::getDataObjectIfEnabled('YPTSocket');
if (empty($objSocket->enableCalls)) {
$obj->reason = 'YPTSocket enableCalls = false';
}else{
$obj->show = true;
}
}
$_YPTSocketshouldShowCaller = $obj;
}
return $_YPTSocketshouldShowCaller;
}
}

View file

@ -41,6 +41,12 @@ function callNow(to_users_id, to_identification) {
//incomeCall(json);
}
function callUserNow(to_users_id) {
avideoModalIframeFull(webSiteRootURL + 'plugin/YPTSocket/callUser.php?users_id='+to_users_id);
return false;
}
function isJsonReceivingCall(json) {
if (json.from_users_id != my_users_id) {
// is receiving a call

View file

@ -1,21 +1,21 @@
<?php
require_once dirname(__FILE__) . '/../../videos/configuration.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->webSocketToken = "";
$obj->webSocketURL = "";
if(!AVideoPlugin::isEnabledByName("YPTSocket")){
$obj->msg = "Socket plugin not enabled";
die(json_encode($obj));
}
$obj->error = false;
$obj->webSocketToken = getEncryptedInfo(0);
$obj->webSocketURL = YPTSocket::getWebSocketURL();
<?php
require_once dirname(__FILE__) . '/../../videos/configuration.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->webSocketToken = "";
$obj->webSocketURL = "";
if(!AVideoPlugin::isEnabledByName("YPTSocket")){
$obj->msg = "Socket plugin not enabled";
die(json_encode($obj));
}
$obj->error = false;
$obj->webSocketToken = getEncryptedInfo(0);
$obj->webSocketURL = YPTSocket::getWebSocketURL();
die(json_encode($obj));

View file

@ -0,0 +1,49 @@
-----BEGIN CERTIFICATE-----
MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBZMRIwEAYDVQQDDAkxMjcu
MC4wLjExCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQK
DBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMTYxMjMwMTQ1OTA2WhcNMjYx
MjI4MTQ1OTA2WjBZMRIwEAYDVQQDDAkxMjcuMC4wLjExCzAJBgNVBAYTAkFVMRMw
EQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0
eSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8SZWNS+Ktg0Py
W8dx5uXZ+ZUawd3wnzLMHW7EhoUpIrIdp3kDU9NezF68dOhPMJY/Kh+6btRCxWXN
2OVTqS5Xi826j3TSE07iF83JRLeveW0PcodjUBd+RzdwCWWo2pfMJz4v7x1wu1c9
zNi6JxxpDAXTFSB4GiWsI4tFu2XmMRhfm6LRK4WPfsZIJKokdiG5fKSPDn7nrVj0
UUXr2eBsEAzdwL14U9+mwbLdaAkz3qK3fqi8sEC09lEWm95gKMOhkQf5qvXODtT4
wdVrrKDTyehLv0xaItnUDnXzrkMBU5QS9TQzzqSW6ZaBsSxtONEFUiXiN9dtyXsY
YCUE54G/AgMBAAGjUDBOMB0GA1UdDgQWBBQ2GRz3QsQzdXaTMnPVCKfpigA10DAf
BgNVHSMEGDAWgBQ2GRz3QsQzdXaTMnPVCKfpigA10DAMBgNVHRMEBTADAQH/MA0G
CSqGSIb3DQEBBQUAA4IBAQA77iZ4KrpPY18Ezjt0mngYAuAxunKddXYdLZ2khywN
0uI/VzYnkFVtrsC7y2jLHSxlmE2/viPPGZDUplENV2acN6JNW+tlt7/bsrQHDQw3
7VCF27EWiDxHsaghhLkqC+kcop5YR5c0oDQTdEWEKSbow2zayUXDYbRRs76SClTe
824Yul+Ts8Mka+AX2PXDg47iZ84fJRN/nKavcJUTJ2iS1uYw0GNnFMge/uwsfMR3
V47qN0X5emky8fcq99FlMCbcy0gHAeSWAjClgr2dd2i0LDatUbj7YmdmFcskOgII
IwGfvuWR2yPevYGAE0QgFeLHniN3RW8zmpnX/XtrJ4a7
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8SZWNS+Ktg0Py
W8dx5uXZ+ZUawd3wnzLMHW7EhoUpIrIdp3kDU9NezF68dOhPMJY/Kh+6btRCxWXN
2OVTqS5Xi826j3TSE07iF83JRLeveW0PcodjUBd+RzdwCWWo2pfMJz4v7x1wu1c9
zNi6JxxpDAXTFSB4GiWsI4tFu2XmMRhfm6LRK4WPfsZIJKokdiG5fKSPDn7nrVj0
UUXr2eBsEAzdwL14U9+mwbLdaAkz3qK3fqi8sEC09lEWm95gKMOhkQf5qvXODtT4
wdVrrKDTyehLv0xaItnUDnXzrkMBU5QS9TQzzqSW6ZaBsSxtONEFUiXiN9dtyXsY
YCUE54G/AgMBAAECggEBAKiO/3FE1CMddkCLZVtUp8ShqJgRokx9WI5ecwFApAkV
ZHsjqDQQYRNmxhDUX/w0tOzLGyhde2xjJyZG29YviKsbHwu6zYwbeOzy/mkGOaK/
g6DmmMmRs9Z6juifoQCu4GIFZ6il2adIL2vF7OeJh+eKudQj/7NFRSB7mXzNrQWK
tZY3eux5zXWmio7pgZrx1HFZQiiL9NVLwT9J7oBnaoO3fREiu5J2xBpljG9Cr0j1
LLiVLhukWJYRlHDtGt1CzI9w8iKo44PCRzpKyxpbsOrQxeSyEWUYQRv9VHA59LC7
tVAJTbnTX1BNHkGZkOkoOpoZLwBaM2XbbDtcOGCAZMECgYEA+mTURFQ85/pxawvk
9ndqZ+5He1u/bMLYIJDp0hdB/vgD+vw3gb2UyRwp0I6Wc6Si4FEEnbY7L0pzWsiR
43CpLs+cyLfnD9NycuIasxs5fKb/1s1nGTkRAp7x9x/ZTtEf8v4YTmmMXFHzdo7V
pv+czO89ppEDkxEtMf/b5SifhO8CgYEAwIDIUvXLduGhL+RPDwjc2SKdydXGV6om
OEdt/V8oS801Z7k8l3gHXFm7zL/MpHmh9cag+F9dHK42kw2RSjDGsBlXXiAO1Z0I
2A34OdPw/kow8fmIKWTMu3+28Kca+3RmUqeyaq0vazQ/bWMO9px+Ud3YfLo1Tn5I
li0MecAx8DECgYEAvsLceKYYtL83c09fg2oc1ctSCCgw4WJcGAtvJ9DyRZacKbXH
b/+H/+OF8879zmKqd+0hcCnqUzAMTCisBLPLIM+o6b45ufPkqKObpcJi/JWaKgLY
vf2c+Psw6o4IF6T5Cz4MNIjzF06UBknxecYZpoPJ20F1kLCwVvxPgfl99l8CgYAb
XfOcv67WTstgiJ+oroTfJamy+P5ClkDqvVTosW+EHz9ZaJ8xlXHOcj9do2LPey9I
Rp250azmF+pQS5x9JKQKgv/FtN8HBVUtigbhCb14GUoODICMCfWFLmnumoMefnTR
iV+3BLn6Dqp5vZxx+NuIffZ5/Or5JsDhALSGVomC8QKBgAi3Z/dNQrDHfkXMNn/L
+EAoLuAbFgLs76r9VGgNaRQ/q5gex2bZEGoBj4Sxvs95NUIcfD9wKT7FF8HdxARv
y3o6Bfc8Xp9So9SlFXrje+gkdEJ0rQR67d+XBuJZh86bXJHVrMwpoNL+ahLGdVSe
81oh1uCH1YPLM29hPyaohxL8
-----END PRIVATE KEY-----

View file

@ -250,6 +250,38 @@ function parseSocketResponse() {
}
}
function socketNewConnection(json) {
setUserOnlineStatus(json.msg.users_id);
}
function socketDisconnection(json) {
setUserOnlineStatus(json.msg.users_id);
}
function setInitialOnlineStatus() {
if(!isReadyToCheckIfIsOnline()){
setTimeout(function(){setInitialOnlineStatus();},1000);
return false;
}
for (var users_id in users_id_online) {
setUserOnlineStatus(users_id);
}
return true;
}
function setUserOnlineStatus(users_id){
if(isUserOnline(users_id)){
$('.users_id_'+users_id).removeClass('offline');
$('.users_id_'+users_id).addClass('online');
}else{
$('.users_id_'+users_id).removeClass('online');
$('.users_id_'+users_id).addClass('offline');
}
}
$(function () {
//console.log('Getting webSocketToken ...');
var getWebSocket = webSiteRootURL + 'plugin/YPTSocket/getWebSocket.json.php';
@ -275,4 +307,5 @@ $(function () {
if (inIframe()) {
$('#socket_info_container').hide();
}
setInitialOnlineStatus();
});

View file

@ -1,87 +1,84 @@
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Socket\Message;
//use React\Socket\Server as Reactor;
require_once dirname(__FILE__) . '/../../videos/configuration.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once $global['systemRootPath'] . 'plugin/YPTSocket/Message.php';
require_once $global['systemRootPath'] . 'objects/autoload.php';
if (!isCommandLineInterface()) {
die("Command line only");
}
$SocketDataObj = AVideoPlugin::getDataObject("YPTSocket");
$SocketDataObj->serverVersion = YPTSocket::getServerVersion();
ob_end_flush();
_mysql_close();
session_write_close();
exec('ulimit -n 20480'); // to handle over 1 k connections
$SocketDataObj->port = intval($SocketDataObj->port);
_error_log("Starting Socket server at port {$SocketDataObj->port}");
//killProcessOnPort();
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
echo "Starting AVideo Socket server version {$SocketDataObj->serverVersion} on port {$SocketDataObj->port}" . PHP_EOL;
if (strtolower($scheme) !== 'https' || !empty($SocketDataObj->forceNonSecure)) {
echo "Your socket server does NOT use a secure connection" . PHP_EOL;
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Message()
)
),
$SocketDataObj->port
);
$server->run();
} else {
if (!file_exists($SocketDataObj->server_crt_file) || !is_readable($SocketDataObj->server_crt_file)) {
echo "SSL ERROR, we could not access the CRT file {$SocketDataObj->server_crt_file}, try to run this command as root or use sudo " . PHP_EOL;
}
if (!file_exists($SocketDataObj->server_key_file) || !is_readable($SocketDataObj->server_key_file)) {
echo "SSL ERROR, we could not access the KEY file {$SocketDataObj->server_key_file}, try to run this command as root or use sudo " . PHP_EOL;
}
echo "Your socket server uses a secure connection" . PHP_EOL;
$parameters = [
'local_cert' => $SocketDataObj->server_crt_file,
'local_pk' => $SocketDataObj->server_key_file,
'allow_self_signed' => $SocketDataObj->allow_self_signed, // Allow self signed certs (should be false in production)
'verify_peer' => false,
'verify_peer_name' => false,
'security_level' => 0
];
foreach ($parameters as $key => $value) {
echo "Parameter [{$key}]: $value " . PHP_EOL;
}
$loop = React\EventLoop\Factory::create();
// Set up our WebSocket server for clients wanting real-time updates
$webSock = new React\Socket\Server($SocketDataObj->uri . ':' . $SocketDataObj->port, $loop);
$webSock = new React\Socket\SecureServer($webSock, $loop, $parameters);
$webServer = new Ratchet\Server\IoServer(
new HttpServer(
new WsServer(
new Message()
)
),
$webSock
);
//$socket = new Reactor($webServer->loop);
//$socket->listen(8082, '0.0.0.0'); //Port 2
//$socket->on('connection', [$webServer, 'handleConnect']);
//$webServer->run();
$loop->run();
<?php
use React\EventLoop\Loop;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Socket\Message;
//use React\Socket\Server as Reactor;
require_once dirname(__FILE__) . '/../../videos/configuration.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once $global['systemRootPath'] . 'plugin/YPTSocket/Message.php';
require_once $global['systemRootPath'] . 'objects/autoload.php';
if (!isCommandLineInterface()) {
die("Command line only");
}
$SocketDataObj = AVideoPlugin::getDataObject("YPTSocket");
$SocketDataObj->serverVersion = YPTSocket::getServerVersion();
ob_end_flush();
_mysql_close();
session_write_close();
exec('ulimit -n 20480'); // to handle over 1 k connections
$SocketDataObj->port = intval($SocketDataObj->port);
_error_log("Starting Socket server at port {$SocketDataObj->port}");
//killProcessOnPort();
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
echo "Starting AVideo Socket server version {$SocketDataObj->serverVersion} on port {$SocketDataObj->port}" . PHP_EOL;
if (strtolower($scheme) !== 'https' || !empty($SocketDataObj->forceNonSecure)) {
echo "Your socket server does NOT use a secure connection" . PHP_EOL;
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Message()
)
),
$SocketDataObj->port
);
$server->run();
} else {
if (!file_exists($SocketDataObj->server_crt_file) || !is_readable($SocketDataObj->server_crt_file)) {
echo "SSL ERROR, we could not access the CRT file {$SocketDataObj->server_crt_file}, try to run this command as root or use sudo " . PHP_EOL;
}
if (!file_exists($SocketDataObj->server_key_file) || !is_readable($SocketDataObj->server_key_file)) {
echo "SSL ERROR, we could not access the KEY file {$SocketDataObj->server_key_file}, try to run this command as root or use sudo " . PHP_EOL;
}
echo "Your socket server uses a secure connection" . PHP_EOL;
$parameters = [
'local_cert' => $SocketDataObj->server_crt_file,
'local_pk' => $SocketDataObj->server_key_file,
'allow_self_signed' => $SocketDataObj->allow_self_signed, // Allow self signed certs (should be false in production)
'verify_peer' => false,
'verify_peer_name' => false,
'security_level' => 0
];
foreach ($parameters as $key => $value) {
echo "Parameter [{$key}]: $value " . PHP_EOL;
}
$loop = React\EventLoop\Loop::get();
$webSock = new React\Socket\Server($SocketDataObj->uri . ':' . $SocketDataObj->port, $loop);
$webSock = new React\Socket\SecureServer($webSock, $loop, $parameters);
$webServer = new Ratchet\Server\IoServer(
new HttpServer(
new WsServer(
new Message()
)
),
$webSock
);
$loop->run();
}

View file

@ -0,0 +1,119 @@
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Socket\Message2;
//use React\Socket\Server as Reactor;
require_once dirname(__FILE__) . '/../../videos/configuration.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once $global['systemRootPath'] . 'plugin/YPTSocket/Message2.php';
require_once $global['systemRootPath'] . 'objects/autoload.php';
if (!isCommandLineInterface()) {
die("Command line only");
}
$SocketDataObj = AVideoPlugin::getDataObject("YPTSocket");
$SocketDataObj->serverVersion = YPTSocket::getServerVersion();
ob_end_flush();
_mysql_close();
session_write_close();
exec('ulimit -n 20480'); // to handle over 1 k connections
$SocketDataObj->port = intval($SocketDataObj->port);
_error_log("Starting Socket server at port {$SocketDataObj->port}");
//killProcessOnPort();
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
echo "Starting AVideo Socket server version {$SocketDataObj->serverVersion} on port {$SocketDataObj->port}" . PHP_EOL;
if (strtolower($scheme) !== 'https' || !empty($SocketDataObj->forceNonSecure)) {
$context = array('tls' => array(
'local_cert' => $global['systemRootPath'] . 'plugin/YPTSocket/localhost.pem',
'allow_self_signed' => true, // Allow self signed certs (should be false in production)
'verify_peer' => false,
'verify_peer_name' => false,
'security_level' => 0
));
} else {
$context = array('tls' => array(
'local_cert' => $SocketDataObj->server_crt_file,
'local_pk' => $SocketDataObj->server_key_file,
'allow_self_signed' => $SocketDataObj->allow_self_signed, // Allow self signed certs (should be false in production)
'verify_peer' => false,
'verify_peer_name' => false,
'security_level' => 0
));
}
$message = new Message2();
$socket = new React\Socket\SocketServer($SocketDataObj->uri . ':' . $SocketDataObj->port, $context);
$socket = new React\Socket\LimitingServer($socket, null);
$socket->on('connection', function (React\Socket\ConnectionInterface $connection) use ($socket) {
echo '[' . $connection->getRemoteAddress() . ' connected] ' . PHP_EOL;
$connection->write('hello there!' . PHP_EOL);
// whenever a new message comes in
$connection->on('data', function ($data) use ($connection, $socket) {
// remove any non-word characters (just for the demo)
//$data = trim(preg_replace('/[^\w\d \.\,\-\!\?]/u', '', $data));
$parts = explode('?', $data);
// ignore empty messages
if (empty($parts[1])) {
echo ("Empty parts " . json_encode($data));
return;
}
parse_str($parts[1], $wsocketGetVars);
foreach ($wsocketGetVars as $key => $value) {
$wsocketGetVars[$key] = urldecode($value);
}
if (empty($wsocketGetVars['webSocketToken'])) {
echo ("Empty websocket token " . json_encode($wsocketGetVars));
return false;
}
$json = getDecryptedInfo($wsocketGetVars['webSocketToken']);
if (empty($json)) {
echo ("Invalid websocket token ");
return false;
}
echo 'websocket token [' .
json_encode($connection->getLocalAddress()) .
', ' .
json_encode($connection->getRemoteAddress()) . ']' . PHP_EOL;
//echo ("websocket token ". json_encode($json));
// prefix with client IP and broadcast to all connected clients
$data = trim(parse_url($connection->getRemoteAddress(), PHP_URL_HOST), '[]') . ': ' . $data . PHP_EOL;
foreach ($socket->getConnections() as $connection) {
$connection->write($data);
}
});
$connection->on('close', function () use ($connection) {
echo '[' . $connection->getRemoteAddress() . ' disconnected]' . PHP_EOL;
});
$connection->on('end', function () {
echo 'ended'. PHP_EOL;
});
$connection->on('error', function (Exception $e) {
echo 'error: ' . $e->getMessage(). PHP_EOL;
});
});
$socket->on('error', function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
echo 'Listening on ' . $socket->getAddress() . PHP_EOL;

View file

@ -0,0 +1,20 @@
<div class="users_id_online_label users_id_<?php echo $users_id; ?> <?php echo $class; ?>" style="<?php echo $style; ?>">
<span class="label label-danger"><?php echo __('Offline'); ?></span>
<span class="label label-success"><?php echo __('Online'); ?></span>
<?php
if(User::isLogged() && $users_id !== User::getId()){
$shouldShowCaller = YPTSocket::shouldShowCaller();
if ($shouldShowCaller->show) {
?>
<button class="btn btn-default btn-xs callerButton" type="button"
onclick="event.preventDefault(); return callUserNow(<?php echo $users_id; ?>);"
data-toggle="tooltip" data-placement="bottom" title="<?php echo __('Call'); ?>">
<i class="fas fa-phone"></i>
</button>
<?php
} else {
echo "<!-- shouldShowCaller {$shouldShowCaller->reason} -->";
}
}
?>
</div>

File diff suppressed because it is too large Load diff

View file

@ -24,10 +24,10 @@ $current = $_POST['current'];
$rowCount = 25;
$_REQUEST['rowCount'] = $rowCount;
if(empty($channelPassword) && !$isMyChannel){
if (empty($channelPassword) && !$isMyChannel) {
$status = 'a';
$showUnlisted = false;
}else{
} else {
$status = 'viewable';
$showUnlisted = true;
}
@ -103,17 +103,17 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
</div>
<?php
if (empty($advancedCustomUser->doNotShowTopBannerOnChannel)) {
if(isMobile()){
if (isMobile()) {
$relativePath = $user->getBackgroundURL(User::$channel_artDesktopMin);
}else{
} else {
$relativePath = $user->getBackgroundURL(User::$channel_artDesktopMax);
}
?>
<div class="clearfix" style="clear: both;"></div>
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo getURL($relativePath); ?>') no-repeat 50% 50%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;">
<div class="clearfix" style="clear: both;"></div>
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo getURL($relativePath); ?>') no-repeat 50% 50%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;">
<img src="<?php echo User::getPhoto($user_id); ?>" alt="<?php echo $user->_getName(); ?>" class="img img-responsive img-thumbnail" style="max-width: 100px;"/>
</div>
<?php
@ -129,6 +129,9 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
echo User::getEmailVerifiedIcon($user_id)
?></h2>
<span class="pull-right">
<?php
echo getUserOnlineLabel($value['users_id'], 'pull-right', 'padding: 0 5px;');
?>
<?php
echo User::getAddChannelToGalleryButton($user_id);
echo User::getBlockUserButton($user_id);
@ -167,83 +170,91 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
<ul class="nav nav-tabs">
<?php
$active = "active";
if ($advancedCustomUser->showChannelHomeTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = '';
} ?>
if ($advancedCustomUser->showChannelHomeTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = '';
}
?>
<li class="nav-item <?php echo $active; ?>">
<a class="nav-link " href="#channelHome" data-toggle="tab" aria-expanded="false">
<?php echo strtoupper(__("Home")); ?>
<?php echo strtoupper(__("Home")); ?>
</a>
</li>
<?php
$active = '';
}
if ($advancedCustomUser->showChannelVideosTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = "active";
} ?>
}
if ($advancedCustomUser->showChannelVideosTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = "active";
}
?>
<li class="nav-item <?php echo $active; ?>">
<a class="nav-link " href="#channelVideos" data-toggle="tab" aria-expanded="false">
<?php echo strtoupper(__("Videos")); ?> <span class="badge"><?php echo $uploadedTotalVideos; ?></span>
<?php echo strtoupper(__("Videos")); ?> <span class="badge"><?php echo $uploadedTotalVideos; ?></span>
</a>
</li>
<?php
$active = '';
}
if ($advancedCustomUser->showChannelProgramsTab && !empty($palyListsObj)) {
$totalPrograms = PlayList::getAllFromUserLight($user_id, true, false, 0, true, true);
if ($totalPrograms) {
?>
}
if ($advancedCustomUser->showChannelProgramsTab && !empty($palyListsObj)) {
$totalPrograms = PlayList::getAllFromUserLight($user_id, true, false, 0, true, true);
if ($totalPrograms) {
?>
<li class="nav-item <?php echo $active; ?>" id="channelPlayListsLi">
<a class="nav-link " href="#channelPlayLists" data-toggle="tab" aria-expanded="true">
<?php echo strtoupper(__($palyListsObj->name)); ?> <span class="badge"><?php echo count($totalPrograms); ?></span>
<?php echo strtoupper(__($palyListsObj->name)); ?> <span class="badge"><?php echo count($totalPrograms); ?></span>
</a>
</li>
<?php
$active = '';
}
} ?>
}
}
?>
</ul>
<div class="tab-content clearfix">
<?php
$active = "active fade in";
if ($advancedCustomUser->showChannelHomeTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = '';
}
$obj = AVideoPlugin::getObjectData("YouPHPFlix2"); ?>
<style>#bigVideo{top: 0 !important;}</style>
if ($advancedCustomUser->showChannelHomeTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = '';
}
$obj = AVideoPlugin::getObjectData("YouPHPFlix2");
?>
<style>#bigVideo{
top: 0 !important;
}</style>
<div class="tab-pane <?php echo $active; ?>" id="channelHome" >
<?php
$obj->BigVideo = true;
$obj->PlayList = false;
$obj->Channels = false;
$obj->Trending = false;
$obj->pageDots = false;
$obj->TrendingAutoPlay = false;
$obj->maxVideos = 12;
$obj->Suggested = false;
$obj->paidOnlyLabelOverPoster = false;
$obj->DateAdded = true;
$obj->DateAddedAutoPlay = true;
$obj->MostPopular = false;
$obj->MostWatched = false;
$obj->SortByName = false;
$obj->Categories = false;
$obj->playVideoOnFullscreen = false;
$obj->titleLabel = true;
$obj->RemoveBigVideoDescription = true;
$obj->PlayList = false;
$obj->Channels = false;
$obj->Trending = false;
$obj->pageDots = false;
$obj->TrendingAutoPlay = false;
$obj->maxVideos = 12;
$obj->Suggested = false;
$obj->paidOnlyLabelOverPoster = false;
$obj->DateAdded = true;
$obj->DateAddedAutoPlay = true;
$obj->MostPopular = false;
$obj->MostWatched = false;
$obj->SortByName = false;
$obj->Categories = false;
$obj->playVideoOnFullscreen = false;
$obj->titleLabel = true;
$obj->RemoveBigVideoDescription = true;
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/modeFlixBody.php'; ?>
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/modeFlixBody.php';
?>
</div>
<?php
$active = "fade";
}
if ($advancedCustomUser->showChannelVideosTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = "active fade in";
} ?>
}
if ($advancedCustomUser->showChannelVideosTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = "active fade in";
}
?>
<div class="tab-pane <?php echo $active; ?>" id="channelVideos">
@ -255,13 +266,14 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos" class="btn btn-success ">
<span class="glyphicon glyphicon-film"></span>
<span class="glyphicon glyphicon-headphones"></span>
<?php echo __("My videos"); ?>
<?php echo __("My videos"); ?>
</a>
<?php
} else {
echo __("My videos");
}
echo AVideoPlugin::getChannelButton(); ?>
echo AVideoPlugin::getChannelButton();
?>
</div>
<div class="panel-body">
<?php
@ -272,26 +284,27 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
$obj->Description = false;
include $global['systemRootPath'] . 'plugin/Gallery/view/BigVideo.php';
unset($uploadedVideos[0]);
} ?>
}
?>
<div class="row">
<?php
TimeLogEnd($timeLog, __LINE__);
createGallerySection($uploadedVideos, "", $get);
TimeLogEnd($timeLog, __LINE__); ?>
createGallerySection($uploadedVideos, "", $get);
TimeLogEnd($timeLog, __LINE__);
?>
</div>
</div>
<div class="panel-footer">
<?php
echo getPagination($totalPages, $current, "{$global['webSiteRootURL']}channel/{$_GET['channelName']}?current={page}"); ?>
<?php echo getPagination($totalPages, $current, "{$global['webSiteRootURL']}channel/{$_GET['channelName']}?current={page}"); ?>
</div>
</div>
</div>
<?php
$active = "fade";
}
if (!empty($totalPrograms)) {
?>
}
if (!empty($totalPrograms)) {
?>
<div class="tab-pane <?php echo $active; ?>" id="channelPlayLists" style="min-height: 800px;">
<div class="panel panel-default">
<div class="panel-heading text-right">
@ -301,12 +314,11 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
<a class="btn btn-default btn-xs " href="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/managerPlaylists.php">
<i class="fas fa-edit"></i> <?php echo __('Organize') . ' ' . __($palyListsObj->name); ?>
</a>
<?php
} ?>
<?php }
?>
</div>
<div class="panel-body">
<?php
include $global['systemRootPath'] . 'view/channelPlaylist.php'; ?>
<?php include $global['systemRootPath'] . 'view/channelPlaylist.php'; ?>
</div>
<div class="panel-footer">
@ -316,7 +328,8 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
</div>
<?php
$active = "fade";
} ?>
}
?>
</div>
</div>
</div>

View file

@ -582,9 +582,6 @@ nav ul.items-container li:first-child ul.left-side {
ul.left-side {
height: 50px;
}
nav ul.items-container li:last-child {
margin-right: 20px;
}
nav ul.items-container li ul.right-menus {
display: flex;
flex-direction: row;
@ -741,9 +738,6 @@ img.blur{
.rightProfile li a{
text-align: left;
}
#mainNavBar ul.items-container li:last-child {
margin-right: 0 !important;
}
.ima-controls-div{
pointer-events: none !important;
@ -1121,6 +1115,9 @@ li.dropdown-submenu > ul > li > a{
#avideoModalIframeDiv{
padding-inline-start: 5px;
}
button.hamburger{
display: flex !important;
}
}
@ -1265,4 +1262,188 @@ a:hover{
width: 100%;
height: 100%;
z-index: 1;
}
/* hamburger menu styles*/
button.hamburger{
outline: none !important;
display: flex;
margin: 0 5px;
padding: 0 4px;
}
button.btn-sm.hamburger{
margin: -2px 5px;
padding: 0;
}
button.btn-sm.hamburger svg{
width: 24px;
}
.ham {
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 400ms;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.hamRotate.active {
transform: rotate(45deg);
}
.hamRotate180.active {
transform: rotate(180deg);
}
.line {
fill:none;
transition: stroke-dasharray 400ms, stroke-dashoffset 400ms;
stroke:#000;
stroke-width:5.5;
stroke-linecap:round;
}
.ham1 .top {
stroke-dasharray: 40 139;
}
.ham1 .bottom {
stroke-dasharray: 40 180;
}
.ham1.active .top {
stroke-dashoffset: -98px;
}
.ham1.active .bottom {
stroke-dashoffset: -138px;
}
.ham2 .top {
stroke-dasharray: 40 121;
}
.ham2 .bottom {
stroke-dasharray: 40 121;
}
.ham2.active .top {
stroke-dashoffset: -102px;
}
.ham2.active .bottom {
stroke-dashoffset: -102px;
}
.ham3 .top {
stroke-dasharray: 40 130;
}
.ham3 .middle {
stroke-dasharray: 40 140;
}
.ham3 .bottom {
stroke-dasharray: 40 205;
}
.ham3.active .top {
stroke-dasharray: 75 130;
stroke-dashoffset: -63px;
}
.ham3.active .middle {
stroke-dashoffset: -102px;
}
.ham3.active .bottom {
stroke-dasharray: 110 205;
stroke-dashoffset: -86px;
}
.ham4 .top {
stroke-dasharray: 40 121;
}
.ham4 .bottom {
stroke-dasharray: 40 121;
}
.ham4.active .top {
stroke-dashoffset: -68px;
}
.ham4.active .bottom {
stroke-dashoffset: -68px;
}
.ham5 .top {
stroke-dasharray: 40 82;
}
.ham5 .bottom {
stroke-dasharray: 40 82;
}
.ham5.active .top {
stroke-dasharray: 14 82;
stroke-dashoffset: -72px;
}
.ham5.active .bottom {
stroke-dasharray: 14 82;
stroke-dashoffset: -72px;
}
.ham6 .top {
stroke-dasharray: 40 172;
}
.ham6 .middle {
stroke-dasharray: 40 111;
}
.ham6 .bottom {
stroke-dasharray: 40 172;
}
.ham6.active .top {
stroke-dashoffset: -132px;
}
.ham6.active .middle {
stroke-dashoffset: -71px;
}
.ham6.active .bottom {
stroke-dashoffset: -132px;
}
.ham7 .top {
stroke-dasharray: 40 82;
}
.ham7 .middle {
stroke-dasharray: 40 111;
}
.ham7 .bottom {
stroke-dasharray: 40 161;
}
.ham7.active .top {
stroke-dasharray: 17 82;
stroke-dashoffset: -62px;
}
.ham7.active .middle {
stroke-dashoffset: 23px;
}
.ham7.active .bottom {
stroke-dashoffset: -83px;
}
.ham8 .top {
stroke-dasharray: 40 160;
}
.ham8 .middle {
stroke-dasharray: 40 142;
transform-origin: 50%;
transition: transform 400ms;
}
.ham8 .bottom {
stroke-dasharray: 40 85;
transform-origin: 50%;
transition: transform 400ms, stroke-dashoffset 400ms;
}
.ham8.active .top {
stroke-dashoffset: -64px;
}
.ham8.active .middle {
transform: rotate(90deg);
}
.ham8.active .bottom {
stroke-dashoffset: -64px;
}
.users_id_online_label .label{
padding: 5px;
border-radius: 5px !important;
}
.users_id_online_label .label-success,
.users_id_online_label .callerButton{
display: none;
}
.users_id_online_label .label-success:hover{
animation: glowBox 1s infinite alternate;
}
.users_id_online_label.online .label-success,
.users_id_online_label.online .callerButton{
display: inline;
}
.users_id_online_label.online .label-danger{
display: none;
}

215
view/css/navbar.css Normal file
View file

@ -0,0 +1,215 @@
/* if it is IE */
@media all and (-ms-high-contrast:none){
nav ul.items-container li:first-child {
display: block;
flex: 0 1 auto; /* Default */
}
}
#buttonMyNavbar{
display: none;
}
#mysearch.in,
#mysearch.collapsing {
display: block!important;
}
#myNavbar{
display: block;
}
#myNavbar.in,
#myNavbar.collapsing {
display: block!important;
}
#searchForm {
width: 100%;
margin-left: 5px;
white-space: nowrap;
}
#searchForm .btn {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left-width: 0;
}
#searchForm input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-right-width: 0;
}
#rightProfileButton{
padding: 0;
margin: 5px;
border: 0;
background: none;
background-color: transparent;
}
#rightLoginButton{
margin-left: 5px;
margin-right: 40px;
}
#navbarRegularButtons{
max-width: 70%;
/* remove the scroll because the dropsown menus does not work */
/*overflow-x: auto;*/
/*overflow-y: hidden;*/
}
#navbarRegularButtons span.hidden-mdx{
max-width: 15vw;
display: inline-block;
}
#navbarRegularButtons .btn{
overflow: hidden;
}
#navbarRegularButtons::-webkit-scrollbar {
height: 4px;
}
#lastItemOnMenu{
padding-right: 40px;
}
#mysearch{
height: auto !important;
}
#searchNavItem, #lastItemOnMenu{
display: flex;
justify-content: center;
align-items: center;
}
#lastItemOnMenu ul{
padding: 0;
}
@media (max-width : 992px) {
#searchForm input{
width: 100px;
}
}
@media (max-width : 767px) {
#searchForm {
padding-left: 10px;
}
#rightLoginButton, #rightProfileButton{
margin-right: 5px;
margin-left: 0;
}
#searchForm > div{
width: 100%;
}
.mobilesecondnav {
position: absolute;
left: 40%;
right: 5px;
}
#buttonMyNavbar, #searchNavItem{
display: block;
}
#mysearch{
/* width: 100%; */
display: none;
position: absolute;
right: 0;
left: 0;
padding-left: 0px;
padding-right: 0px;
background-color: #FFF;
}
#myNavbar{
display: none;
position: absolute;
right: 0;
top: 50px;
background-color: #FFF;
padding: 4px;
width: 50%;
}
#mainNavBar .navbar-brand{
width: 100% !important;
text-align: center;
}
#mainNavBar .navbar-brand>img {
display: unset;
}
#myNavbar ul.right-menus{
display: block;
}
#myNavbar ul.right-menus li{
margin: 0;
padding: 0;
}
#myNavbar ul.right-menus .btn, #myNavbar ul.right-menus .btn-group{
margin: 2px;
width: 100%;
}
#myNavbar ul.right-menus .btn-group{
margin: 0;
}
nav ul.items-container li:first-child {
display: list-item;
}
#navbarRegularButtons span.hidden-mdx {
max-width: 100vw;
}
.globalsearchfield {
width: 90% !important;
}
.searchli {
width: 100%;
margin-right: 0;
margin-left: 0;
}
.searchdiv {
}
.navbar-toggle {
margin-right: 5px !important;
}
#navbarRegularButtons, #lastItemOnMenu, .left-side {
padding: 0 5px;
}
.searchul{
padding-left: 0px;
}
}
li.navsub-toggle .badge {
float: right;
}
li.navsub-toggle a + ul {
padding-left: 15px;
}
.navbar-lang-btn .select2-container{
margin: 8px 0;
}
.navbar-lang-btn .select2-selection{
border-color: #00000077 !important;
}
@media screen and (min-width: 992px) {
body.youtube>div.container-fluid{
margin-left: 300px;
}
body.youtube div.container-fluid .col-sm-10.col-sm-offset-1.list-group-item{
margin-left: 0;
margin-right: 0;
width: 100%;
}
}

View file

@ -179,6 +179,8 @@ if (isRTL()) {
var _serverTimeString = "<?php echo date('Y-m-d H:i:s'); ?>";
var _serverDBTimeString = "<?php echo date('Y-m-d H:i:s', getDatabaseTime()); ?>";
var _serverTimezone = "<?php echo date_default_timezone_get(); ?>";
var avideoModalIframeFullScreenCloseButton = <?php echo json_encode(getHamburgerButton('avideoModalIframeFullScreenCloseButton', 2, 'class="btn btn-default pull-left hamburger " onclick="avideoModalIframeFullScreenClose();"', true)); ?>;
var avideoModalIframeFullScreenCloseButtonSmall = <?php echo json_encode(getHamburgerButton('avideoModalIframeFullScreenCloseButton', 4, 'class="btn btn-default btn-sm pull-left hamburger " onclick="avideoModalIframeFullScreenClose();"', true)); ?>;
var PHPSESSID = "<?php echo session_id(); ?>";
</script>
<?php

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
<nav class="navbar navbar-default navbar-fixed-top navbar-expand-lg navbar-light bg-light" id="mainNavBar">
<div class="pull-right">
<a id="buttonMyNavbar" class=" btn btn-default navbar-btn" style="padding: 6px 12px; margin-right: 40px;" href="<?php echo $advancedCustomUser->userMustBeLoggedInCloseButtonURL; ?>">
<i class="fas fa-times"></i>
</a>
</div>
</nav>

View file

@ -1,70 +1,71 @@
<?php
if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($config->getEncoderURL())) {
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
?>
<li>
<form id="formEncoderN" method="post" action="<?php echo $advancedCustom->encoderNetwork; ?>" target="encoder" autocomplete="off">
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
<input type="hidden" name="user" value="<?php echo User::getUserName(); ?>" autocomplete="off" />
<input type="hidden" name="pass" value="<?php echo User::getUserPass(); ?>" autocomplete="off" />
</form>
<a href="#" onclick="$('#formEncoderN').submit();
return false;" data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowEncoderButton)) {
if (!empty($config->getEncoderURL())) {
?>
<li>
<form id="formEncoder" method="post" action="<?php echo $config->getEncoderURL(); ?>" target="encoder" autocomplete="off" >
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
<input type="hidden" name="user" value="<?php echo User::getUserName(); ?>" autocomplete="off" />
<input type="hidden" name="pass" value="<?php echo User::getUserPass(); ?>" autocomplete="off" />
</form>
<a href="#" onclick="$('#formEncoder').submit();
return false;" data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left"
class="faa-parent animated-hover" >
<span class="fas fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
</a>
</li>
<?php
} else {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'siteConfigurations');return false;" ><span class="fa fa-cogs"></span> <?php echo __("Configure an Encoder URL"); ?></a>
</li>
<?php
}
}
} else {
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'i/network');return false;" data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowEncoderButton)) {
if (!empty($config->getEncoderURL())) {
?>
<li>
<a class="faa-parent animated-hover" href="#" onclick="avideoModalIframeFull(webSiteRootURL+'i/upload');return false;" data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
</a>
</li>
<?php
} else {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'siteConfigurations');return false;"><span class="fa fa-cogs"></span> <?php echo __("Configure an Encoder URL"); ?></a>
</li>
<?php
}
}
}
<?php
global $config,$advancedCustom;
if (empty($advancedCustom->openEncoderInIFrame) || !isSameDomainAsMyAVideo($config->getEncoderURL())) {
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
?>
<li>
<form id="formEncoderN" method="post" action="<?php echo $advancedCustom->encoderNetwork; ?>" target="encoder" autocomplete="off">
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
<input type="hidden" name="user" value="<?php echo User::getUserName(); ?>" autocomplete="off" />
<input type="hidden" name="pass" value="<?php echo User::getUserPass(); ?>" autocomplete="off" />
</form>
<a href="#" onclick="$('#formEncoderN').submit();
return false;" data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowEncoderButton)) {
if (!empty($config->getEncoderURL())) {
?>
<li>
<form id="formEncoder" method="post" action="<?php echo $config->getEncoderURL(); ?>" target="encoder" autocomplete="off" >
<input type="hidden" name="webSiteRootURL" value="<?php echo $global['webSiteRootURL']; ?>" autocomplete="off" />
<input type="hidden" name="user" value="<?php echo User::getUserName(); ?>" autocomplete="off" />
<input type="hidden" name="pass" value="<?php echo User::getUserPass(); ?>" autocomplete="off" />
</form>
<a href="#" onclick="$('#formEncoder').submit();
return false;" data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left"
class="faa-parent animated-hover" >
<span class="fas fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
</a>
</li>
<?php
} else {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'siteConfigurations');return false;" ><span class="fa fa-cogs"></span> <?php echo __("Configure an Encoder URL"); ?></a>
</li>
<?php
}
}
} else {
if (!empty($advancedCustom->encoderNetwork) && empty($advancedCustom->doNotShowEncoderNetwork)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'i/network');return false;" data-toggle="tooltip" title="<?php echo __("Choose one of our encoders to upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cogs"></span> <?php echo empty($advancedCustom->encoderNetworkLabel) ? __("Encoder Network") : __($advancedCustom->encoderNetworkLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowEncoderButton)) {
if (!empty($config->getEncoderURL())) {
?>
<li>
<a class="faa-parent animated-hover" href="#" onclick="avideoModalIframeFull(webSiteRootURL+'i/upload');return false;" data-toggle="tooltip" title="<?php echo __("Upload a file or download it from the Internet"); ?>" data-placement="left" >
<span class="fa fa-cog faa-spin"></span> <?php echo empty($advancedCustom->encoderButtonLabel) ? __("Encode video and audio") : __($advancedCustom->encoderButtonLabel); ?>
</a>
</li>
<?php
} else {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'siteConfigurations');return false;"><span class="fa fa-cogs"></span> <?php echo __("Configure an Encoder URL"); ?></a>
</li>
<?php
}
}
}
?>

View file

@ -0,0 +1,20 @@
<li>
<div class="navbar-lang-btn">
<?php
if ($lang == 'en') {
$lang = 'en_US';
}
echo Layout::getLangsSelect('navBarFlag', $lang, 'navBarFlag', '', true);
//var_dump($lang);exit;
?>
</div>
</li>
<script>
$(function () {
$("#navBarFlag").change(function () {
var selfURI = "<?php echo getSelfURI(); ?>";
window.location.href = addGetParam(selfURI, 'lang', $(this).val());
});
});
</script>

View file

@ -0,0 +1,40 @@
<li>
<ul class="left-side">
<li style="max-width: 40px;">
<?php
echo getHamburgerButton('buttonMenu', 'x', 'class="btn btn-default pull-left hamburger" data-toggle="tooltip" title="' . __("Main Menu") . '" data-placement="right"');
?>
<?php
if ($advancedCustom->disableNavBarInsideIframe) {
?>
<script>
$(document).ready(function () {
YPTHidenavbar();
});
</script>
<?php
}
?>
</li>
<li style="width: 100%; text-align: center;">
<a class="navbar-brand" id="mainNavbarLogo" href="<?php echo empty($advancedCustom->logoMenuBarURL) ? $global['webSiteRootURL'] : $advancedCustom->logoMenuBarURL; ?>" >
<img src="<?php echo getCDN(), $config->getLogo(true); ?>" alt="<?php echo $config->getWebSiteTitle(); ?>" class="img-responsive ">
</a>
</li>
<?php
if (!empty($advancedCustomUser->keepViewerOnChannel) && !empty($_SESSION['channelName'])) {
$user = User::getChannelOwner($_SESSION['channelName']);
?>
<li>
<a class="navbar-brand" href="#" onclick="avideoModalIframeFull('<?php echo User::getChannelLinkFromChannelName($_SESSION['channelName']); ?>');
return false;" >
<img src="<?php echo User::getPhoto($user['id']); ?>" alt="<?php echo User::getNameIdentificationById($user['id']); ?>"
class="img img-circle " style="height: 33px; width: 33px; margin-right: 15px;">
</a>
</li>
<?php
}
?>
</ul>
</li>

View file

@ -0,0 +1,25 @@
<?php
$output = _ob_get_clean();
_ob_start();
echo AVideoPlugin::getUploadMenuButton();
$getUploadMenuButton = _ob_get_clean();
_ob_start();
if (!empty($getUploadMenuButton)) {
?>
<li>
<div data-toggle="tooltip" title="<?php echo __("Submit your videos"); ?>" data-placement="left" class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle navbar-btn pull-left faa-parent animated-hover" data-toggle="dropdown">
<i class="<?php echo $advancedCustom->uploadButtonDropdownIcon ?? "fas fa-video"; ?>"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? __($advancedCustom->uploadButtonDropdownText) : ""; ?> <span class="caret"></span>
</button>
<?php echo '<!-- navbar line ' . __LINE__ . '-->'; ?>
<ul class="dropdown-menu dropdown-menu-right" role="menu" id="uploadMenu">
<?php echo $getUploadMenuButton; ?>
</ul>
</div>
</li>
<?php
$getUploadMenuButton = _ob_get_clean();
_ob_start();
}
echo $output . $getUploadMenuButton;
?>

View file

@ -0,0 +1,169 @@
<?php
if (empty($advancedCustomUser->doNotShowRightProfile) && (User::isLogged() || empty($advancedCustomUser->signInOnRight))) {
$tooltip = '';
if (User::isLogged()) {
$tooltip = 'data-toggle="tooltip" data-html="true" title="' . User::getNameIdentification() . ":: " . User::getMail() . '" data-placement="left"';
} else {
$tooltip = 'data-toggle="tooltip" data-html="true" title="' . __("Login") . '" data-placement="left"';
}
?>
<div class="navbar-header pull-right" id="navbarRightProfile" <?php echo $tooltip; ?> >
<ul >
<li class="rightProfile" >
<div class="btn-group" id="rightProfileBtnGroup" >
<?php
if (User::isLogged()) {
?>
<button type="button" class="btn btn-default dropdown-toggle navbar-btn pull-left btn-circle" id="rightProfileButton" style="padding:0;" onclick="toogleRightProfile();">
<img src="<?php echo User::getPhoto(); ?>"
style="width: 32px; height: 32px; max-width: 32px;"
class="img img-responsive img-circle" alt="User Photo"
/>
</button>
<script>
function toogleRightProfile() {
if ($('#rightProfileBtnGroup').hasClass('open')) {
$('#rightProfileButton').removeClass('glowBox');
$('#rightProfileBtnGroup .dropdown-menu').removeClass('animate__bounceInRight');
$('#rightProfileBtnGroup .dropdown-menu').addClass('animate__bounceOutRight');
setTimeout(function () {
$('#rightProfileBtnGroup').removeClass('open');
$('#rightProfileButton').attr('aria-expanded', false);
}, 500);
} else {
$('#rightProfileButton').addClass('glowBox');
$('#rightProfileBtnGroup .dropdown-menu').removeClass('animate__bounceOutRight');
$('#rightProfileBtnGroup .dropdown-menu').addClass('animate__bounceInRight');
$('#rightProfileBtnGroup').addClass('open');
$('#rightProfileButton').attr('aria-expanded', true).focus();
}
}
</script>
<?php echo '<!-- navbar line ' . __LINE__ . '-->'; ?>
<ul class="dropdown-menu dropdown-menu-right <?php echo getCSSAnimationClassAndStyle('animate__bounceInRight', 'rightProfileButton', 0); ?>" >
<li style="padding: 10px 20px;" class="clearfix">
<div class="pull-left ">
<img src="<?php echo User::getPhoto(); ?>" style="max-width: 50px;" class="img img-responsive img-circle" alt="User Photo"/>
</div>
<div class="pull-left" >
<h2><?php echo User::getNameIdentification(); ?></h2>
<div style="white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; margin: 0 5px;"><small><?php echo User::getMail(); ?></small></div>
</div>
</li>
<?php
if (!$advancedCustomUser->disableSignOutButton) {
?>
<li>
<a href="<?php echo $global['webSiteRootURL']; ?>logoff" >
<?php
if (!empty($_COOKIE['user']) && !empty($_COOKIE['pass'])) {
?>
<i class="fas fa-lock text-muted" style="opacity: 0.2;"></i>
<?php
} else {
?>
<i class="fas fa-lock-open text-muted" style="opacity: 0.2;"></i>
<?php }
?>
<i class="fas fa-sign-out-alt"></i> <?php echo __("Sign out"); ?>
</a>
</li>
<?php }
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'user');return false;" style="border-radius: 4px 4px 0 0;">
<span class="fa fa-user-circle"></span>
<?php echo __("My Account"); ?>
</a>
</li>
<?php
if (User::canUpload(true)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'mvideos');
return false;">
<span class="glyphicon glyphicon-film"></span>
<span class="glyphicon glyphicon-headphones"></span>
<?php echo __("My videos"); ?>
</a>
</li>
<?php }
?>
<li>
<a href="#" onclick="avideoModalIframeFull('<?php echo User::getChannelLink(); ?>');
return false;" >
<span class="fas fa-play-circle"></span>
<?php echo __($advancedCustomUser->MyChannelLabel); ?>
</a>
</li>
<?php
print AVideoPlugin::navBarProfileButtons();
if ((($config->getAuthCanViewChart() == 0) && (User::canUpload())) || (($config->getAuthCanViewChart() == 1) && (User::canViewChart()))) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'charts');
return false;">
<span class="fas fa-tachometer-alt"></span>
<?php echo __("Dashboard"); ?>
</a>
</li>
<?php
}
if (User::canUpload()) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'subscribes');
return false;">
<span class="fa fa-check"></span>
<?php echo __("My Subscribers"); ?>
</a>
</li>
<?php
if (Category::canCreateCategory()) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'categories');
return false;">
<span class="glyphicon glyphicon-list"></span>
<?php echo __($advancedCustom->CategoryLabel); ?>
</a>
</li>
<?php }
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'comments');return false;">
<span class="fa fa-comment"></span>
<?php echo __("Comments"); ?>
</a>
</li>
<?php }
?>
</ul>
<?php
} else if (empty($advancedCustomUser->signInOnRight)) {
?>
<a class="btn btn-default navbar-btn line_<?php echo __LINE__; ?>" href="<?php echo $global['webSiteRootURL']; ?>user"
id="rightLoginButton" style="min-height:34px; padding: 6px 12px; border-width: 1px;"
data-html="true" title="<?php echo __("Login"); ?>" data-placement="left">
<i class="fas fa-sign-in-alt"></i>
</a>
<?php }
?>
</div>
</li>
</ul>
</div>
<?php }
?>

View file

@ -0,0 +1,33 @@
<?php
if (!empty($advancedCustomUser->signInOnRight)) {
if (User::isLogged()) {
if (!$advancedCustomUser->disableSignOutButton) {
?>
<li>
<a class="btn navbar-btn btn-default" href="<?php echo $global['webSiteRootURL']; ?>logoff">
<?php
if (!empty($_COOKIE['user']) && !empty($_COOKIE['pass'])) {
?>
<i class="fas fa-lock text-muted" style="opacity: 0.2;"></i>
<?php
} else {
?>
<i class="fas fa-lock-open text-muted" style="opacity: 0.2;"></i>
<?php }
?>
<i class="fas fa-sign-out-alt"></i> <span class="hidden-md hidden-sm"><?php echo __("Sign Out"); ?></span>
</a>
</li>
<?php
}
} else {
?>
<li>
<a class="btn navbar-btn btn-default line_<?php echo __LINE__; ?>" href="<?php echo $global['webSiteRootURL']; ?>user" >
<i class="fas fa-sign-in-alt"></i> <?php echo __("Login"); ?>
</a>
</li>
<?php
}
}
?>

View file

@ -0,0 +1,21 @@
<li class="nav-item" style="margin-right: 0px; " id="searchNavItem">
<div class="navbar-header">
<button type="button" id="buttonSearch" class="visible-xs navbar-toggle btn btn-default navbar-btn faa-parent animated-hover animate__animated animate__bounceIn" data-toggle="collapse" data-target="#mysearch" style="padding: 6px 12px;">
<span class="fa fa-search faa-shake"></span>
</button>
</div>
<div class="input-group" id="mysearch">
<form class="navbar-form form-inline input-group" role="search" id="searchForm" action="<?php echo $global['webSiteRootURL']; ?>" style="padding: 0;">
<input class="form-control globalsearchfield" type="text" value="<?php
if (!empty($_GET['search'])) {
echo htmlentities($_GET['search']);
}
?>" name="search" placeholder="<?php echo __("Search"); ?>" id="searchFormInput">
<span class="input-group-append">
<button class="btn btn-default btn-outline-secondary border-left-0 border py-2 faa-parent animated-hover" type="submit">
<i class="fas fa-search faa-shake"></i>
</button>
</span>
</form>
</div>
</li>

View file

@ -0,0 +1,581 @@
<div id="sidebar" class="list-group-item" style="<?php echo $sidebarStyle; ?>">
<div id="sideBarContainer">
<ul class="nav navbar btn-group-vertical" style="width:100%;">
<?php
if (empty($advancedCustom->doNotShowLeftHomeButton)) {
?>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-primary btn-block " style="border-radius: 4px 4px 0 0;">
<span class="fa fa-home"></span>
<?php echo __("Home"); ?>
</a>
</div>
</li>
<?php
}
if (AVideoPlugin::isEnabledByName("PlayLists") && PlayLists::showTVFeatures()) {
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'epg');return false;" class="btn btn-primary btn-block " style="border-radius: 0 0 0 0;">
<i class="fas fa-stream"></i>
<?php echo __("EPG"); ?>
</a>
</div>
</li>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'tv');return false;" class="btn btn-primary btn-block " style="border-radius: 0 0 0 0;">
<i class="fas fa-tv"></i>
<?php echo __("TV"); ?>
</a>
</div>
</li>
<?php
}
if (empty($advancedCustom->doNotShowLeftTrendingButton)) {
?>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>trending" class="btn btn-primary btn-block " style="border-radius: 0 0 4px 4px;">
<i class="fas fa-fire"></i>
<?php echo __("Trending"); ?>
</a>
</div>
</li>
<?php
}
if (empty($advancedCustomUser->doNotShowLeftProfile)) {
if (User::isLogged()) {
?>
<li>
<hr>
</li>
<li>
<h2 class="text-danger"><?php echo __("My Menu"); ?></h2>
<?php
if (!$advancedCustomUser->disableSignOutButton) {
?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>logoff" class="btn btn-default btn-block" >
<?php
if (!empty($_COOKIE['user']) && !empty($_COOKIE['pass'])) {
?>
<i class="fas fa-lock text-muted" style="opacity: 0.2;"></i>
<?php
} else {
?>
<i class="fas fa-lock-open text-muted" style="opacity: 0.2;"></i>
<?php }
?>
<i class="fas fa-sign-out-alt"></i> <?php echo __("Sign out"); ?>
</a>
</div>
<?php }
?>
</li>
<li style="min-height: 60px;">
<div class="pull-left" style="margin-left: 10px;">
<img src="<?php echo User::getPhoto(); ?>" style="max-width: 55px;" class="img img-thumbnail img-responsive img-circle"/>
</div>
<div style="margin-left: 80px;">
<h2><?php echo User::getName(); ?></h2>
<div><small><?php echo User::getMail(); ?></small></div>
</div>
</li>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>user" class="btn btn-primary btn-block" style="border-radius: 4px 4px 0 0;">
<span class="fa fa-user-circle"></span>
<?php echo __("My Account"); ?>
</a>
</div>
</li>
<?php
if (User::canUpload()) {
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'mvideos');
return false;" class="btn btn-success btn-block" style="border-radius: 0;">
<span class="glyphicon glyphicon-film"></span>
<span class="glyphicon glyphicon-headphones"></span>
<?php echo __("My videos"); ?>
</a>
</div>
</li>
<?php }
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull('<?php echo User::getChannelLink(); ?>');
return false;" class="btn btn-danger btn-block" style="border-radius: 0;">
<span class="fas fa-play-circle"></span>
<?php echo __($advancedCustomUser->MyChannelLabel); ?>
</a>
</div>
</li>
<?php
print AVideoPlugin::navBarButtons();
if ((($config->getAuthCanViewChart() == 0) && (User::canUpload())) || (($config->getAuthCanViewChart() == 1) && (User::canViewChart()))) {
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'charts');
return false;" class="btn btn-default btn-block" style="border-radius: 0;">
<span class="fas fa-tachometer-alt"></span>
<?php echo __("Dashboard"); ?>
</a>
</div>
</li>
<?php
}
if (User::canUpload()) {
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'subscribes');
return false;" class="btn btn-default btn-block" style="border-radius: 0">
<span class="fa fa-check"></span>
<?php echo __("My Subscribers"); ?>
</a>
</div>
</li>
<?php
if (Category::canCreateCategory()) {
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'categories');
return false;" class="btn btn-default btn-block" style="border-radius: 0;">
<span class="glyphicon glyphicon-list"></span>
<?php echo __($advancedCustom->CategoryLabel); ?>
</a>
</div>
</li>
<?php }
?>
<li>
<div>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'comments');
return false;" class="btn btn-default btn-block" style="border-radius: 0 0 4px 4px;">
<span class="fa fa-comment"></span>
<?php echo __("Comments"); ?>
</a>
</div>
</li>
<?php }
?>
<?php
} else {
?>
<li>
<hr>
</li>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>user" class="btn btn-success btn-block line_<?php echo __LINE__; ?>">
<i class="fas fa-sign-in-alt"></i>
<?php echo __("Login"); ?>
</a>
</div>
</li>
<?php
}
}
if (User::isAdmin()) {
?>
<li>
<hr>
</li>
<li>
<h2 class="text-danger"><?php echo __("Admin Menu"); ?></h2>
<ul class="nav navbar" style="margin-bottom: 10px;">
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'admin/');
return false;">
<i class="fas fa-star"></i>
<?php echo __("Admin Panel"); ?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'users');
return false;">
<span class="glyphicon glyphicon-user"></span>
<?php echo __("Users"); ?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'usersGroups');
return false;">
<span class="fa fa-users"></span>
<?php echo __("Users Groups"); ?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'categories');
return false;">
<span class="glyphicon glyphicon-list"></span>
<?php echo __($advancedCustom->CategoryLabel); ?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'update');
return false;">
<span class="glyphicon glyphicon-refresh"></span>
<?php echo __("Update version"); ?>
<?php
if (!empty($updateFiles)) {
?><span class="label label-danger"><?php echo count($updateFiles); ?></span><?php }
?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'siteConfigurations');
return false;">
<span class="glyphicon glyphicon-cog"></span>
<?php echo __("Site Configurations"); ?>
</a>
</li>
<!--
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+'locale');return false;">
<span class="glyphicon glyphicon-flag"></span>
<?php echo __("Create more translations"); ?>
</a>
</li>
-->
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'plugins');
return false;">
<i class="fas fa-puzzle-piece"></i>
<?php echo __("Plugins"); ?>
</a>
</li>
<li>
<a href="#" class="clearCacheFirstPageButton">
<i class="fa fa-trash"></i> <?php echo __("Clear First Page Cache"); ?>
</a>
</li>
<li>
<a href="#" class="clearCacheButton">
<i class="fa fa-trash"></i> <?php echo __("Clear Cache Directory"); ?>
</a>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'i/log');
return false;" class="">
<i class="fas fa-clipboard-list"></i> <?php echo __("Log file"); ?>
</a>
</li>
<li>
<a href="#" class="generateSiteMapButton">
<i class="fa fa-sitemap"></i> <?php echo __("Generate Sitemap"); ?>
</a>
</li>
</ul>
</li>
<?php
} else {
$menus = [];
if (Permissions::canAdminUsers()) {
$menus[] = '
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+\'users\');return false;">
<span class="glyphicon glyphicon-user"></span>
<?php echo __("Users"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canAdminUserGroups()) {
$menus[] = '?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+\'usersGroups\');return false;">
<span class="fa fa-users"></span>
<?php echo __("Users Groups"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canClearCache()) {
$menus[] = '?>
<li>
<a href="#" class="clearCacheFirstPageButton">
<i class="fa fa-trash"></i> <?php echo __("Clear First Page Cache"); ?>
</a>
</li>
<li>
<a href="#" class="clearCacheButton">
<i class="fa fa-trash"></i> <?php echo __("Clear Cache Directory"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canSeeLogs()) {
$menus[] = ' ?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL+\'i/log\');return false;" class="">
<i class="fas fa-clipboard-list"></i> <?php echo __("Log file"); ?>
</a>
</li>
<?php
';
}
if (Permissions::canGenerateSiteMap()) {
$menus[] = '?>
<li>
<a href="#" class="generateSiteMapButton">
<i class="fa fa-sitemap"></i> <?php echo __("Generate Sitemap"); ?>
</a>
</li>
<?php
';
}
if (count($menus)) {
?>
<hr>
<h2 class="text-danger"><?php echo __("Extra Permissions"); ?></h2>
<ul class="nav navbar" style="margin-bottom: 10px;">
<?php eval(implode(" ", $menus)); ?>
</ul>
<?php
}
}
?>
<?php echo AVideoPlugin::getHTMLMenuLeft(); ?>
<?php
if (empty($advancedCustom->doNotShowLeftMenuAudioAndVideoButtons)) {
?>
<li>
<hr>
</li>
<li class="nav-item <?php echo empty($_SESSION['type']) ? "active" : ""; ?>">
<a class="nav-link " href="<?php echo $global['webSiteRootURL']; ?>?type=all">
<span class="glyphicon glyphicon-star"></span>
<?php echo __("Audio and Video"); ?>
</a>
</li>
<li class="nav-item <?php echo (!empty($_SESSION['type']) && $_SESSION['type'] == 'video' && empty($_GET['catName'])) ? "active" : ""; ?>">
<a class="nav-link " href="<?php echo $global['webSiteRootURL']; ?>videoOnly">
<span class="glyphicon glyphicon-facetime-video"></span>
<?php echo __("Videos"); ?>
</a>
</li>
<li class="nav-item <?php echo (!empty($_SESSION['type']) && $_SESSION['type'] == 'audio' && empty($_GET['catName'])) ? "active" : ""; ?>">
<a class="nav-link" href="<?php echo $global['webSiteRootURL']; ?>audioOnly">
<span class="glyphicon glyphicon-headphones"></span>
<?php echo __("Audio"); ?>
</a>
</li>
<?php }
?>
<?php
if (empty($advancedCustom->removeBrowserChannelLinkFromMenu)) {
?>
<!-- Channels -->
<li>
<hr>
</li>
<li>
<h3 class="text-danger"><?php echo __("Channels"); ?></h3>
</li>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'channels');
return false;">
<i class="fa fa-search"></i>
<?php echo __("Browse Channels"); ?>
</a>
</li>
<?php }
?>
<li>
<hr>
</li>
<!-- categories -->
<li>
<h3>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'listCategories');
return false;" class="text-danger">
<?php echo __($advancedCustom->CategoryLabel); ?>
</a>
</h3>
</li>
<?php
$_rowCount = getRowCount();
$_REQUEST['rowCount'] = 1000;
$parsed_cats = [];
if (!function_exists('mkSub')) {
function mkSub($catId) {
global $global, $parsed_cats;
unset($_GET['parentsOnly']);
$subcats = Category::getChildCategories($catId);
if (!empty($subcats)) {
echo "<ul class=\"nav\" style='margin-bottom: 0px; list-style-type: none;'>";
foreach ($subcats as $subcat) {
if ($subcat['parentId'] != $catId) {
continue;
}
if (empty($subcat['total'])) {
continue;
}
if (is_array($parsed_cats) && in_array($subcat['id'], $parsed_cats)) {
continue;
}
//$parsed_cats[] = $subcat['id'];
echo '<li class="navsub-toggle ' . ($subcat['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . $global['webSiteRootURL'] . 'cat/' . $subcat['clean_name'] . '" >'
. '<span class="' . (empty($subcat['iconClass']) ? "fa fa-folder" : $subcat['iconClass']) . '"></span> ' . __($subcat['name']) . ' <span class="badge">' . $subcat['total'] . '</span>';
echo '</a>';
mkSub($subcat['id']);
echo '</li>';
}
echo "</ul>";
}
}
}
if (empty($advancedCustom->doNotDisplayCategoryLeftMenu)) {
$post = $_POST;
$get = $_GET;
unset($_GET);
unset($_POST);
$_GET['current'] = $_POST['current'] = 1;
$_GET['parentsOnly'] = 1;
$sameUserGroupAsMe = true;
if (User::isAdmin()) {
$sameUserGroupAsMe = false;
} else if (User::isLogged()) {
$sameUserGroupAsMe = User::getId();
}
$categories = Category::getAllCategories(false, false, false, $sameUserGroupAsMe);
foreach ($categories as $value) {
if ($value['parentId']) {
continue;
}
if ($advancedCustom->ShowAllVideosOnCategory) {
$total = $value['fullTotal'];
} else {
$total = $value['total'];
}
if (empty($total)) {
continue;
}
if (in_array($value['id'], $parsed_cats)) {
continue;
}
//$parsed_cats[] = $value['id'];
echo '<li class="navsub-toggle ' . ($value['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . Category::getCategoryLinkFromName($value['clean_name']) . '" >';
echo '<span class="' . (empty($value['iconClass']) ? "fa fa-folder" : $value['iconClass']) . '"></span> ' . __($value['name']);
if (empty($advancedCustom->hideCategoryVideosCount)) {
echo ' <span class="badge">' . $total . '</span>';
}
echo '</a>';
mkSub($value['id']);
echo '</li>';
}
$_POST = $post;
$_GET = $get;
}
$_REQUEST['rowCount'] = $_rowCount;
?>
<!-- categories END -->
<li>
<hr>
</li>
<?php
if (empty($advancedCustom->disableInstallPWAButton)) {
?>
<li class="nav-item A2HSInstall" style="display: none;">
<a class="nav-link" href="#" onclick="A2HSInstall();
return false;">
<i class="fas fa-arrow-alt-circle-down"></i>
<?php echo __("Install"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disablePlayLink)) {
?>
<li class="nav-item">
<a class="nav-link" href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'playLink');
return false;">
<i class="fas fa-play-circle"></i>
<?php echo __("Play a Link"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableHelpLeftMenu)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'help');
return false;">
<span class="glyphicon glyphicon-question-sign"></span>
<?php echo __("Help"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableAboutLeftMenu)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'about');
return false;">
<span class="glyphicon glyphicon-info-sign"></span>
<?php echo __("About"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableContactLeftMenu)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'contact');
return false;">
<span class="glyphicon glyphicon-comment"></span>
<?php echo __("Contact"); ?>
</a>
</li>
<?php }
?>
</ul>
</div>
</div>

View file

@ -0,0 +1,71 @@
<li>
<div data-toggle="tooltip" title="<?php echo __("Submit your videos"); ?>" data-placement="left" class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle navbar-btn pull-left faa-parent animated-hover" data-toggle="dropdown">
<i class="<?php echo $advancedCustom->uploadButtonDropdownIcon ?? "fas fa-video"; ?>"></i> <?php echo!empty($advancedCustom->uploadButtonDropdownText) ? __($advancedCustom->uploadButtonDropdownText) : ""; ?> <span class="caret"></span>
</button>
<?php
if ((isset($advancedCustomUser->onlyVerifiedEmailCanUpload) && $advancedCustomUser->onlyVerifiedEmailCanUpload && User::isVerified()) || (isset($advancedCustomUser->onlyVerifiedEmailCanUpload) && !$advancedCustomUser->onlyVerifiedEmailCanUpload) || !isset($advancedCustomUser->onlyVerifiedEmailCanUpload)) {
echo '<!-- navbar line ' . __LINE__ . '-->';
?>
<ul class="dropdown-menu dropdown-menu-right" role="menu" id="uploadMenu">
<?php
include $global['systemRootPath'] . 'view/include/navbarEncoder.php';
if (empty($advancedCustom->doNotShowUploadMP4Button)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'mvideos?upload=1');return false;" data-toggle="tooltip" title="<?php echo __("Upload files without encode"); ?>"
data-placement="left" class="faa-parent animated-hover" >
<span class="fas fa-upload faa-bounce"></span> <?php echo empty($advancedCustom->uploadMP4ButtonLabel) ? __("Direct upload") : __($advancedCustom->uploadMP4ButtonLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowImportMP4Button)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'view/import.php');return false;" data-toggle="tooltip" title="<?php echo __("Search for videos in your local disk"); ?>" data-placement="left" class="faa-parent animated-hover" >
<span class="fas fa-hdd faa-ring"></span> <?php echo empty($advancedCustom->importMP4ButtonLabel) ? __("Direct Import Local Videos") : __($advancedCustom->importMP4ButtonLabel); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->doNotShowEmbedButton)) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'mvideos?link=1');return false;" data-toggle="tooltip" title="<?php echo __("Embed videos/files in your site"); ?>" data-placement="left" class="faa-parent animated-hover" >
<span class="fa fa-link faa-burst"></span> <?php echo empty($advancedCustom->embedButtonLabel) ? __("Embed a video link") : __($advancedCustom->embedButtonLabel); ?>
</a>
</li>
<?php
}
if (AVideoPlugin::isEnabledByName("Articles")) {
?>
<li>
<a href="#" onclick="avideoModalIframeFull(webSiteRootURL + 'mvideos?article=1');return false;" data-toggle="tooltip" title="<?php echo __("Write an article"); ?>" data-placement="left" class="faa-parent animated-hover">
<i class="far fa-newspaper faa-horizontal"></i> <?php echo __("Add Article"); ?>
</a>
</li>
<?php
}
echo AVideoPlugin::getUploadMenuButton();
?>
</ul>
<?php
} else {
echo '<!-- navbar line ' . __LINE__ . '-->';
?>
<ul class="dropdown-menu dropdown-menu-right" role="menu" id="uploadMenu">
<li>
<a href="" >
<span class="fa fa-exclamation faa-flash animated"></span> <?php echo __("Only verified users can upload"); ?>
</a>
</li>
<?php echo AVideoPlugin::getUploadMenuButton(); ?>
</ul>
<?php }
?>
</div>
</li>

244
view/js/navbarLogged.js Normal file
View file

@ -0,0 +1,244 @@
var seachFormIsRunning = 0;
$(document).ready(function () {
setTimeout(function () {
$('.nav li.navsub-toggle a:not(.selected) + ul').hide();
var navsub_toggle_selected = $('.nav li.navsub-toggle a.selected');
navsub_toggle_selected.next().show();
navsub_toggle_selected = navsub_toggle_selected.parent();
var navsub_toggle_selected_stop = 24;
while (navsub_toggle_selected.length) {
if ($.inArray(navsub_toggle_selected.prop('localName'), ['li', 'ul']) == -1)
break;
if (navsub_toggle_selected.prop('localName') == 'ul') {
navsub_toggle_selected.show().prev().addClass('selected');
}
navsub_toggle_selected = navsub_toggle_selected.parent();
navsub_toggle_selected_stop--;
if (navsub_toggle_selected_stop < 0)
break;
}
}, 500);
$('.nav').on('click', 'li.navsub-toggle a:not(.selected)', function (e) {
var a = $(this),
b = a.next();
if (b.length) {
e.preventDefault();
a.addClass('selected');
b.slideDown();
var c = a.closest('.nav').find('li.navsub-toggle a.selected').not(a).removeClass('selected').next();
if (c.length)
c.slideUp();
}
});
$('#searchForm').submit(function (event) {
if (seachFormIsRunning) {
event.preventDefault();
return false;
}
seachFormIsRunning = 1;
var str = $('#searchFormInput').val();
if (isMediaSiteURL(str)) {
event.preventDefault();
console.log("searchForm is URL " + str);
seachFormPlayURL(str);
return false;
} else {
console.log("searchForm submit " + str);
document.location = webSiteRootURL + "?search=" + str;
}
});
$('#buttonMenu').on("click.sidebar", function (event) {
event.stopPropagation();
YPTSidebarToggle();
});
$("#sidebar").on("click", function (event) {
event.stopPropagation();
});
$("#buttonSearch").click(function (event) {
event.stopPropagation();
if (isSearchOpen()) {
closeSearchMenu();
} else {
openSearchMenu();
}
});
$("#buttonMyNavbar").click(function (event) {
event.stopPropagation();
if (isMyNMavbarOpen()) {
closeRightMenu();
} else {
openRightMenu();
}
});
var wasMobile = true;
$(window).resize(function () {
if ($(window).width() > 767) {
// Window is bigger than 767 pixels wide - show search again, if autohide by mobile.
if (wasMobile) {
wasMobile = false;
}
}
if ($(window).width() < 767) {
// Window is smaller 767 pixels wide - show search again, if autohide by mobile.
if (wasMobile == false) {
wasMobile = true;
}
}
});
$(window).resize(function () {
if (!isScreeWidthCollapseSize()) {
$("#myNavbar").css({display:''});
$("#myNavbar").removeClass('animate__bounceOutRight');
var selector = '#buttonMyNavbar svg';
$(selector).removeClass('active');
$(selector).attr('aria-expanded', 'false');
$("#mysearch").css({display:''});
$("#mysearch").removeClass('animate__bounceOutUp');
}
});
});
function isScreeWidthCollapseSize() {
return $('body').width() <= 767;
}
function closeLeftMenu() {
var selector = '#buttonMenu svg';
$(selector).removeClass('active');
YPTSidebarClose();
}
function openLeftMenu() {
if (isScreeWidthCollapseSize()) {
closeRightMenu();
closeSearchMenu();
}
var selector = '#buttonMenu svg';
$(selector).addClass('active');
YPTSidebarOpen();
}
function closeRightMenu() {
var selector = '#buttonMyNavbar svg';
$(selector).removeClass('active');
$("#myNavbar").removeClass('animate__bounceInRight');
$("#myNavbar").addClass('animate__bounceOutRight');
setTimeout(function () {
$("#myNavbar").hide();
}, 500);
}
function openRightMenu() {
if (isScreeWidthCollapseSize()) {
closeLeftMenu();
closeSearchMenu();
}
var selector = '#buttonMyNavbar svg';
$(selector).addClass('active');
$("#myNavbar").removeClass('animate__bounceOutRight');
$("#myNavbar").show();
$("#myNavbar").addClass('animate__animated animate__bounceInRight');
}
function closeSearchMenu() {
$("#mysearch").removeClass('animate__bounceInDown');
$("#mysearch").addClass('animate__bounceOutUp');
setTimeout(function () {
$("#mysearch").hide();
}, 500);
}
function openSearchMenu() {
if (isScreeWidthCollapseSize()) {
closeLeftMenu();
closeRightMenu();
}
$("#mysearch").removeClass('animate__bounceOutUp');
$("#mysearch").show();
$("#mysearch").addClass('animate__animated animate__bounceInDown');
}
function seachFormPlayURL(url) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'view/url2Embed.json.php',
method: 'POST',
data: {
'url': url
},
success: function (response) {
seachFormIsRunning = 0;
if (response.error) {
modal.hidePleaseWait();
avideoToast(response.msg);
} else {
if (typeof linksToEmbed === 'function') {
document.location = response.playEmbedLink;
} else
if (typeof flixFullScreen == 'function') {
flixFullScreen(response.playEmbedLink, response.playLink);
modal.hidePleaseWait();
} else {
document.location = response.playLink;
}
}
}
});
}
function isSearchOpen() {
return $('#mysearch').hasClass('animate__bounceInDown');
}
function isMyNMavbarOpen() {
return $('#myNavbar').hasClass('animate__bounceInRight');
}
function YPTSidebarToggle() {
if (YPTSidebarIsOpen()) {
closeLeftMenu()
} else {
openLeftMenu();
}
}
function YPTSidebarIsOpen() {
return $('body').hasClass('youtube');
}
function YPTSidebarOpen() {
$("#sidebar").removeClass('animate__bounceOutLeft');
$("#sidebar").show();
$("#sidebar").addClass('animate__animated animate__bounceInLeft');
setTimeout(function () {
$('body').addClass('youtube');
}, 500);
youTubeMenuIsOpened = true;
}
function YPTSidebarClose() {
$("#sidebar").removeClass('animate__bounceInLeft');
$("#sidebar").addClass('animate__bounceOutLeft');
setTimeout(function () {
$('body').removeClass('youtube');
$("#sidebar").hide();
}, 500);
youTubeMenuIsOpened = false;
}
function YPTHidenavbar() {
if (typeof inIframe == 'undefined') {
setTimeout(function () {
YPTHidenavbar()
}, 500);
} else {
if (inIframe()) {
$("#mainNavBar").hide();
$("body").css("padding-top", "0");
}
}
}

View file

@ -1380,6 +1380,12 @@ function avideoModalIframeFullScreenClose() {
if (typeof swal === 'function') {
$('.swal-overlay iframe').attr('src', 'about:blank');
try {
/*
$('.swal-overlay').slideUp();
setTimeout(function(){
swal.close();
},500);
*/
swal.close();
} catch (e) {
@ -1449,18 +1455,19 @@ function avideoModalIframeWithClassName(url, className, updateURL) {
}
url = addGetParam(url, 'avideoIframe', 1);
console.log('avideoModalIframeWithClassName', url, className, updateURL);
var _inIframe = '';
if(inIframe()){
_inIframe = 'inIframe';
}
var html = '';
html += '<div id="avideoModalIframeDiv" class="clearfix popover-title '+_inIframe+'">';
html += '<button class="btn btn-default pull-left" onclick="avideoModalIframeFullScreenClose();">';
html += '<i class="fas fa-chevron-left"></i>';
html += '</button><img src="' + webSiteRootURL + 'videos/userPhoto/logo.png" class="img img-responsive " style="max-height:34px;"></div>';
html += '<div id="avideoModalIframeDiv" class="clearfix popover-title">';
if(inIframe()){
html += avideoModalIframeFullScreenCloseButtonSmall;
}else{
html += avideoModalIframeFullScreenCloseButton;
html += '<img src="' + webSiteRootURL + 'videos/userPhoto/logo.png" class="img img-responsive " style="max-height:34px;">';
}
html += '</div>';
html += '<iframe id="avideoModalIframe" frameBorder="0" class="animate__animated animate__bounceInDown" src="' + url + '" allow="camera *;microphone *" ></iframe>';
var span = document.createElement("span");
span.innerHTML = html;
$('.swal-overlay').show();
swal({
content: span,
closeModal: true,