1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Ability to have category pages populate separate from the homepage

PPV now works per usergroup

SecureDirectory now allow you only allow embeded whitelist pages, so im makes easier to youse as an OTT app
This commit is contained in:
DanielnetoDotCom 2020-11-09 14:52:35 -03:00
parent 2cc8612149
commit 4826a6ec2e
31 changed files with 684 additions and 321 deletions

View file

@ -30,6 +30,30 @@ abstract class ObjectYPT implements ObjectInterface {
return true; return true;
} }
static function getNowFromDB() {
global $global;
$sql = "SELECT NOW() as my_date_field";
$res = sqlDAL::readSql($sql);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
return $row;
}
static function setTimeZone() {
global $advancedCustom;
$row = self::getNowFromDB();
$dt = new DateTime($row['my_date_field']);
$timeZOnesOptions = object_to_array($advancedCustom->timeZone->type);
$dt->setTimezone(new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]));
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]);
return $dt;
}
static protected function getFromDb($id) { static protected function getFromDb($id) {
global $global; global $global;
$id = intval($id); $id = intval($id);

View file

@ -0,0 +1,22 @@
<div class="scroller-status$uid">
<div class="infinite-scroll-request loader-ellips text-center">
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<script src="$webSiteRootURLview/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script>
$(function () {
$container$uid = $('$infinityScrollAppendIntoSelector').infiniteScroll({
path: '.pagination__next$uid',
append: '$infinityScrollGetFromSelector',
status: '.scroller-status$uid',
hideNav: '.infiniteScrollPagination$uid',
prefill: false,
history: false
});
$container$uid.on('append.infiniteScroll', function (event, response, path, items) {
lazyImage();
});
});
</script>

View file

@ -2511,11 +2511,11 @@ function isAVideoStorage($user_agent = "") {
return false; return false;
} }
function get_domain($url) { function get_domain($url, $ifEmptyReturnSameString=false) {
$pieces = parse_url($url); $pieces = parse_url($url);
$domain = isset($pieces['host']) ? $pieces['host'] : ''; $domain = isset($pieces['host']) ? $pieces['host'] : '';
if(empty($domain)){ if(empty($domain)){
return false; return $ifEmptyReturnSameString?$url:false;
} }
if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) { if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
return $regs['domain']; return $regs['domain'];

View file

@ -24,17 +24,6 @@ if (!empty($global['mysqli_charset'])) {
$global['mysqli']->set_charset($global['mysqli_charset']); $global['mysqli']->set_charset($global['mysqli_charset']);
} }
if (empty($global['disableTimeFix'])) {
$now = new DateTime();
$mins = $now->getOffset() / 60;
$sgn = ($mins < 0 ? -1 : 1);
$mins = abs($mins);
$hrs = floor($mins / 60);
$mins -= $hrs * 60;
$offset = sprintf('%+d:%02d', $hrs * $sgn, $mins);
$global['mysqli']->query("SET time_zone='$offset';");
}
require_once $global['systemRootPath'] . 'objects/mysql_dal.php'; require_once $global['systemRootPath'] . 'objects/mysql_dal.php';
require_once $global['systemRootPath'] . 'objects/configuration.php'; require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/security.php'; require_once $global['systemRootPath'] . 'objects/security.php';
@ -132,6 +121,22 @@ if (empty($global['bodyClass'])) {
} }
$global['allowedExtension'] = array('gif', 'jpg', 'mp4', 'webm', 'mp3', 'm4a', 'ogg', 'zip', 'm3u8'); $global['allowedExtension'] = array('gif', 'jpg', 'mp4', 'webm', 'mp3', 'm4a', 'ogg', 'zip', 'm3u8');
$advancedCustom = AVideoPlugin::getObjectData("CustomizeAdvanced"); $advancedCustom = AVideoPlugin::getObjectData("CustomizeAdvanced");
if (empty($global['disableTimeFix'])) {
/*
$now = new DateTime();
$mins = $now->getOffset() / 60;
$sgn = ($mins < 0 ? -1 : 1);
$mins = abs($mins);
$hrs = floor($mins / 60);
$mins -= $hrs * 60;
$offset = sprintf('%+d:%02d', $hrs * $sgn, $mins);
$global['mysqli']->query("SET time_zone='$offset';");
*
*/
ObjectYPT::setTimeZone();
}
$advancedCustomUser = AVideoPlugin::getObjectData("CustomizeUser"); $advancedCustomUser = AVideoPlugin::getObjectData("CustomizeUser");
$customizePlugin = AVideoPlugin::getObjectData("Customize"); $customizePlugin = AVideoPlugin::getObjectData("Customize");
$permissionsPlugin = AVideoPlugin::getObjectData("Permissions"); $permissionsPlugin = AVideoPlugin::getObjectData("Permissions");

View file

@ -231,15 +231,14 @@ class PlayList extends ObjectYPT {
static function getVideosIDFromPlaylistLight($playlists_id) { static function getVideosIDFromPlaylistLight($playlists_id) {
global $global; global $global;
$sql = "SELECT * FROM playlists_has_videos p " $sql = "SELECT * FROM playlists_has_videos p WHERE playlists_id = ? ";
. " WHERE playlists_id = ? "; cleanSearchVar();
$sort = @$_POST['sort']; $sort = @$_POST['sort'];
$_POST['sort'] = array(); $_POST['sort'] = array();
$_POST['sort']['p.`order`'] = 'ASC';
$sql .= self::getSqlFromPost(); $sql .= self::getSqlFromPost();
$_POST['sort'] = $sort; $_POST['sort'] = $sort;
$res = sqlDAL::readSql($sql, "i", array($playlists_id)); $res = sqlDAL::readSql($sql, "i", array($playlists_id));
reloadSearchVar();
$fullData = sqlDAL::fetchAllAssoc($res); $fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res); sqlDAL::close($res);
$rows = array(); $rows = array();
@ -264,11 +263,12 @@ class PlayList extends ObjectYPT {
. " LEFT JOIN videos as v ON videos_id = v.id " . " LEFT JOIN videos as v ON videos_id = v.id "
. " LEFT JOIN users u ON u.id = v.users_id " . " LEFT JOIN users u ON u.id = v.users_id "
. " WHERE playlists_id = ? AND v.status != 'i' "; . " WHERE playlists_id = ? AND v.status != 'i' ";
cleanSearchVar();
$sort = @$_POST['sort']; $sort = @$_POST['sort'];
$_POST['sort'] = array(); $_POST['sort'] = array();
$_POST['sort']['p.`order`'] = 'ASC'; $_POST['sort']['p.`order`'] = 'ASC';
$sql .= self::getSqlFromPost(); $sql .= self::getSqlFromPost();
reloadSearchVar();
$_POST['sort'] = $sort; $_POST['sort'] = $sort;
$cacheName = "getVideosFromPlaylist{$playlists_id}".md5($sql); $cacheName = "getVideosFromPlaylist{$playlists_id}".md5($sql);
$rows = self::getCache($cacheName, 0); $rows = self::getCache($cacheName, 0);
@ -504,6 +504,10 @@ class PlayList extends ObjectYPT {
return $this->name; return $this->name;
} }
function getModified() {
return $this->modified;
}
function getUsers_id() { function getUsers_id() {
return $this->users_id; return $this->users_id;
} }

View file

@ -2616,7 +2616,7 @@ if (!class_exists('Video')) {
static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) { static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
global $global, $advancedCustom, $videosPaths, $VideoGetSourceFile; global $global, $advancedCustom, $videosPaths, $VideoGetSourceFile;
//if(!isValidFormats($type)){ //if(!isValidFormats($type)){
//return array(); //return array();
//} //}
$cacheName = md5($filename . $type . $includeS3); $cacheName = md5($filename . $type . $includeS3);
if (isset($VideoGetSourceFile[$cacheName])) { if (isset($VideoGetSourceFile[$cacheName])) {
@ -2765,8 +2765,8 @@ if (!class_exists('Video')) {
$name1 = "Video:::getHigestResolution::getVideosURL_V2($filename)"; $name1 = "Video:::getHigestResolution::getVideosURL_V2($filename)";
TimeLogStart($name1); TimeLogStart($name1);
$sources = getVideosURL_V2($filename); $sources = getVideosURL_V2($filename);
if(!is_array($sources)){ if (!is_array($sources)) {
_error_log("Video:::getHigestResolution::getVideosURL_V2($filename) does not return an array ". json_encode($sources)); _error_log("Video:::getHigestResolution::getVideosURL_V2($filename) does not return an array " . json_encode($sources));
return array(); return array();
} }
TimeLogEnd($name1, __LINE__); TimeLogEnd($name1, __LINE__);
@ -2811,27 +2811,44 @@ if (!class_exists('Video')) {
return false; return false;
} }
$paths = self::getVideosPathsFromID($videos_id); $paths = self::getVideosPathsFromID($videos_id);
$types = array(0, 'HD', 'SD', 'Low'); $types = array(0, 2160, 1330, 1080, 720, 'HD', 'SD', 'Low', 480, 360, 240);
if (!empty($paths['mp4'])) { if (!empty($paths['mp4'])) {
foreach ($types as $value) { foreach ($types as $value) {
if (!empty($paths['mp4'][$value])) { if (!empty($paths['mp4'][$value])) {
return $paths['mp4'][$value]["url"]; if (is_string($paths['mp4'][$value])) {
return $paths['mp4'][$value];
} else {
return $paths['mp4'][$value]["url"];
}
} }
} }
} }
if (!empty($paths['webm'])) { if (!empty($paths['webm'])) {
foreach ($types as $value) { foreach ($types as $value) {
if (!empty($paths['webm'][$value])) { if (!empty($paths['webm'][$value])) {
return $paths['webm'][$value]["url"]; if (is_string($paths['webm'][$value])) {
return $paths['webm'][$value];
} else {
return $paths['webm'][$value]["url"];
}
} }
} }
} }
if (!empty($paths['m3u8'])) { if (!empty($paths['m3u8'])) {
if (!empty($paths['m3u8'])) { if (!empty($paths['m3u8'])) {
return $paths['m3u8']["url"]; if (is_string($paths['m3u8']["url"])) {
return $paths['m3u8']["url"];
}else if (is_string($paths['m3u8'][$value])) {
return $paths['m3u8'][$value];
} else {
return $paths['m3u8'][$value]["url"];
}
} }
} }
if (!empty($paths['mp3'])) {
return $paths['mp3'];
}
return false; return false;
} }

View file

@ -194,9 +194,40 @@ class API extends PluginAbstract {
if (empty($videos[$parameters['nextIndex']])) { if (empty($videos[$parameters['nextIndex']])) {
$parameters['nextIndex'] = 0; $parameters['nextIndex'] = 0;
} }
$playlist = new PlayList($parameters['playlists_id']);
$user = new User($playlist->getUsers_id());
$videoPath = Video::getHigherVideoPathFromID($video['id']); $videoPath = Video::getHigherVideoPathFromID($video['id']);
$parameters['videos'] = $videos;
$parameters['playlist_name'] = $playlist->getName();
$parameters['modified'] = $playlist->getModified();
$parameters['modified_timestamp'] = strtotime($parameters['modified']);
$parameters['users_id'] = $playlist->getUsers_id();
$parameters['channel_name'] = $user->getChannelName();
$parameters['channel_photo'] = $user->getPhotoDB();
$parameters['channel_bg'] = $user->getBackground();
$parameters['channel_link'] = $user->getChannelLink();
$parameters['totalPlaylistDuration'] = 0;
$parameters['currentPlaylistTime'] = 0;
foreach ($parameters['videos'] as $key => $value) {
$parameters['videos'][$key]['path'] = Video::getHigherVideoPathFromID($value['id']);;
if($key && $key<=$parameters['index']){
$parameters['currentPlaylistTime'] += durationToSeconds($parameters['videos'][$key-1]['duration']);
}
$parameters['totalPlaylistDuration'] += durationToSeconds($parameters['videos'][$key]['duration']);
}
if(empty($parameters['totalPlaylistDuration'])){
$parameters['percentage_progress'] = 0;
}else{
$parameters['percentage_progress'] = ($parameters['currentPlaylistTime']/$parameters['totalPlaylistDuration'])*100;
}
$parameters['title'] = $video['title'];
$parameters['videos_id'] = $video['id']; $parameters['videos_id'] = $video['id'];
$parameters['path'] = $videoPath; $parameters['path'] = $videoPath;
$parameters['duration'] = $video['duration'];
$parameters['duration_seconds'] = durationToSeconds($parameters['duration']);
return new ApiObject("", false, $parameters); return new ApiObject("", false, $parameters);
} }

View file

@ -33,7 +33,7 @@ class CustomizeAdvanced extends PluginAbstract {
public function getEmptyDataObject() { public function getEmptyDataObject() {
global $global; global $global;
$obj = new stdClass(); $obj = new stdClass();
$obj->logoMenuBarURL = $global['webSiteRootURL']; $obj->logoMenuBarURL = "";
$obj->encoderNetwork = "https://network.avideo.com/"; $obj->encoderNetwork = "https://network.avideo.com/";
$obj->useEncoderNetworkRecomendation = false; $obj->useEncoderNetworkRecomendation = false;
$obj->doNotShowEncoderNetwork = true; $obj->doNotShowEncoderNetwork = true;
@ -185,6 +185,12 @@ class CustomizeAdvanced extends PluginAbstract {
$obj->footerStyle = "position: fixed;bottom: 0;width: 100%;"; $obj->footerStyle = "position: fixed;bottom: 0;width: 100%;";
$obj->disableVideoTags = false; $obj->disableVideoTags = false;
$o = new stdClass();
$o->type = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$o->value = 0;
$obj->timeZone = $o;
return $obj; return $obj;
} }

View file

@ -24,22 +24,34 @@
<center style="margin:5px;"> <center style="margin:5px;">
<?php echo getAdsLeaderBoardTop2(); ?> <?php echo getAdsLeaderBoardTop2(); ?>
</center> </center>
<!-- For Live Videos -->
<div id="liveVideos" class="row clear clearfix" style="display: none;">
<h3 class="galleryTitle text-danger"> <i class="fas fa-play-circle"></i> <?php echo __("Live"); ?></h3>
<div class="extraVideos"></div>
</div>
<script>
function afterExtraVideos($liveLi) {
$liveLi.removeClass('col-lg-12 col-sm-12 col-xs-12 bottom-border');
$liveLi.find('.thumbsImage').removeClass('col-lg-5 col-sm-5 col-xs-5');
$liveLi.find('.videosDetails').removeClass('col-lg-7 col-sm-7 col-xs-7');
$liveLi.addClass('col-lg-2 col-md-4 col-sm-4 col-xs-6 fixPadding');
$('#liveVideos').slideDown();
return $liveLi;
}
</script>
<?php <?php
if (empty($_GET['catName'])) {
?>
<!-- For Live Videos -->
<div id="liveVideos" class="row clear clearfix" style="display: none;">
<h3 class="galleryTitle text-danger"> <i class="fas fa-play-circle"></i> <?php echo __("Live"); ?></h3>
<div class="extraVideos"></div>
</div>
<script>
function afterExtraVideos($liveLi) {
$liveLi.removeClass('col-lg-12 col-sm-12 col-xs-12 bottom-border');
$liveLi.find('.thumbsImage').removeClass('col-lg-5 col-sm-5 col-xs-5');
$liveLi.find('.videosDetails').removeClass('col-lg-7 col-sm-7 col-xs-7');
$liveLi.addClass('col-lg-2 col-md-4 col-sm-4 col-xs-6 fixPadding');
$('#liveVideos').slideDown();
return $liveLi;
}
</script>
<?php
}else{
?>
<script>
function afterExtraVideos($liveLi) {
return false;
}
</script>
<?php
}
echo AVideoPlugin::getGallerySection(); echo AVideoPlugin::getGallerySection();
?> ?>
<!-- For Live Videos End --> <!-- For Live Videos End -->
@ -57,7 +69,7 @@
$countSections++; $countSections++;
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font"); createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font");
} }
if ($obj->DateAdded) { if ($obj->DateAdded && empty($_GET['catName'])) {
$countSections++; $countSections++;
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt"); createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt");
} }
@ -87,6 +99,7 @@
<i class="fas fa-spinner fa-pulse text-muted"></i> <i class="fas fa-spinner fa-pulse text-muted"></i>
</div> </div>
</div> </div>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$container = $('#categoriesContainer').infiniteScroll({ $container = $('#categoriesContainer').infiniteScroll({
@ -108,26 +121,11 @@
lazyImage(); lazyImage();
}, 500); }, 500);
}); });
function lazyImage() {
$('.thumbsJPG').lazy({
effect: 'fadeIn',
visibleOnly: true,
// called after an element was successfully handled
afterLoad: function (element) {
element.removeClass('blur');
element.parent().find('.thumbsGIF').lazy({
effect: 'fadeIn'
});
}
});
mouseEffect();
}
</script> </script>
<?php <?php
} }
// if there is no section display only the dateAdded row for the selected category // if there is no section display only the dateAdded row for the selected category
if (empty($countSections) && !empty($currentCat) && empty($_GET['showOnly'])) { if (!empty($currentCat) && empty($_GET['showOnly'])) {
if (empty($_GET['page'])) { if (empty($_GET['page'])) {
$_GET['page'] = 1; $_GET['page'] = 1;
} }
@ -141,15 +139,17 @@
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos); $videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
if (!empty($videos)) { if (!empty($videos)) {
?> ?>
<div class="row clear clearfix"> <div class="row clear clearfix" id="Div<?php echo $currentCat['clean_name']; ?>">
<h3 class="galleryTitle"> <h3 class="galleryTitle">
<a class="btn-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $currentCat['clean_name']; ?>"> <a class="btn-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $currentCat['clean_name']; ?>">
<i class="<?php echo $currentCat['iconClass']; ?>"></i> <?php echo $currentCat['name']; ?> <i class="<?php echo $currentCat['iconClass']; ?>"></i> <?php echo $currentCat['name'] ; ?>
</a> </a>
</h3> </h3>
<div class="Div<?php echo $currentCat['clean_name']; ?>Section">
<?php <?php
createGallerySection($videos, "", array(), true); createGallerySection($videos, "", array(), true);
?> ?>
</div>
</div> </div>
<?php <?php
$total = Video::getTotalVideos("viewable"); $total = Video::getTotalVideos("viewable");
@ -161,7 +161,8 @@
?> ?>
<div class="col-sm-12" style="z-index: 1;"> <div class="col-sm-12" style="z-index: 1;">
<?php <?php
echo getPagination($totalPages, $page, "{$url}{page}{$args}"); //getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector="", $infinityScrollAppendIntoSelector="")
echo getPagination($totalPages, $page, "{$url}{page}{$args}", 10, ".Div{$currentCat['clean_name']}Section","#Div{$currentCat['clean_name']}");
?> ?>
</div> </div>
<?php <?php

View file

@ -8,7 +8,6 @@ include $global['systemRootPath'] . 'plugin/Gallery/view/topLogic.php';
echo $siteTitle; echo $siteTitle;
?></title> ?></title>
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?> <?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
</head> </head>
<body class="<?php echo $global['bodyClass']; ?>"> <body class="<?php echo $global['bodyClass']; ?>">

View file

@ -49,5 +49,5 @@ foreach ($categories as $value) {
?> ?>
</div> </div>
<p class="pagination"> <p class="pagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tagsid']); ?>&current=<?php echo count($categories)?$_REQUEST['current'] + 1:$_REQUEST['current']; ?>&search=<?php echo getSearchVar(); ?>"></a> <a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tagsid']); ?>&search=<?php echo getSearchVar(); ?>&current=<?php echo count($categories)?$_REQUEST['current'] + 1:$_REQUEST['current']; ?>"></a>
</p> </p>

View file

@ -475,6 +475,9 @@ class Live extends PluginAbstract {
$o->protectLive = $liveServer->getProtectLive(); $o->protectLive = $liveServer->getProtectLive();
$o->useAadaptiveMode = $liveServer->getUseAadaptiveMode(); $o->useAadaptiveMode = $liveServer->getUseAadaptiveMode();
} }
$uuid = LiveTransmition::keyNameFix($uuid);
if ($o->protectLive && empty($doNotProtect)) { if ($o->protectLive && empty($doNotProtect)) {
return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$live_servers_id}&uuid=" . encryptString($uuid); return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$live_servers_id}&uuid=" . encryptString($uuid);
} else if ($o->useAadaptiveMode) { } else if ($o->useAadaptiveMode) {
@ -690,8 +693,12 @@ class Live extends PluginAbstract {
if (empty($channelName)) { if (empty($channelName)) {
return false; return false;
} }
$playlists_id_live = "";
if(!empty($_REQUEST['playlists_id_live'])){
$playlists_id_live = "?playlists_id_live=".$_REQUEST['playlists_id_live'];
}
//return "{$global['webSiteRootURL']}plugin/Live/?live_servers_id={$live_servers_id}&c=" . urlencode($channelName); //return "{$global['webSiteRootURL']}plugin/Live/?live_servers_id={$live_servers_id}&c=" . urlencode($channelName);
return "{$global['webSiteRootURL']}live/{$live_servers_id}/" . urlencode($channelName); return "{$global['webSiteRootURL']}live/{$live_servers_id}/" . urlencode($channelName).$playlists_id_live;
} }
static function getAvailableLiveServersId() { static function getAvailableLiveServersId() {
@ -945,11 +952,22 @@ class Live extends PluginAbstract {
$channelName = $u->getChannelName(); $channelName = $u->getChannelName();
$photo = $u->getPhotoDB(); $photo = $u->getPhotoDB();
$poster = $global['webSiteRootURL'] . $p->getPosterImage($row['users_id'], $live_servers_id); $poster = $global['webSiteRootURL'] . $p->getPosterImage($row['users_id'], $live_servers_id);
$playlists_id_live = 0;
if(preg_match("/.*_([0-9]+)/", $value->name, $matches)){
if(!empty($matches[1])){
$_REQUEST['playlists_id_live'] = intval($matches[1]);
$playlists_id_live = $_REQUEST['playlists_id_live'];
$pl = new PlayList($_REQUEST['playlists_id_live']);
$title = $pl->getName();
}
}
$link = Live::getLinkToLiveFromChannelNameAndLiveServer($u->getChannelName(), $live_servers_id); $link = Live::getLinkToLiveFromChannelNameAndLiveServer($u->getChannelName(), $live_servers_id);
// this variable is to keep it compatible for Mobile app // this variable is to keep it compatible for Mobile app
$UserPhoto = $photo; $UserPhoto = $photo;
$obj->applications[] = array( $obj->applications[] = array(
"key" => $value->name, "key" => LiveTransmition::keyNameFix($value->name),
"isPrivate" => self::isAPrivateLiveFromLiveKey($value->name), "isPrivate" => self::isAPrivateLiveFromLiveKey($value->name),
"users" => $users, "users" => $users,
"name" => $userName, "name" => $userName,
@ -959,7 +977,9 @@ class Live extends PluginAbstract {
"title" => $title, "title" => $title,
'channelName' => $channelName, 'channelName' => $channelName,
'poster' => $poster, 'poster' => $poster,
'link' => $link . (strpos($link, '?') !== false ? "&embed=1" : "?embed=1") 'link' => $link . (strpos($link, '?') !== false ? "&embed=1" : "?embed=1"),
'href' => $link,
'playlists_id_live' => $playlists_id_live
); );
if ($value->name === $obj->name) { if ($value->name === $obj->name) {
$obj->error = property_exists($value, 'publishing') ? false : true; $obj->error = property_exists($value, 'publishing') ? false : true;

View file

@ -170,6 +170,8 @@ class LiveTransmition extends ObjectYPT {
if (!is_string($key)) { if (!is_string($key)) {
return false; return false;
} }
$parts = explode("_", $key);
$key = $parts[0];
$key = preg_replace("/[^A-Za-z0-9]/", '', $key); $key = preg_replace("/[^A-Za-z0-9]/", '', $key);
$sql = "SELECT u.*, lt.* FROM " . static::getTableName() . " lt " $sql = "SELECT u.*, lt.* FROM " . static::getTableName() . " lt "
. " LEFT JOIN users u ON u.id = users_id AND u.status='a' WHERE `key` = '$key' LIMIT 1"; . " LEFT JOIN users u ON u.id = users_id AND u.status='a' WHERE `key` = '$key' LIMIT 1";
@ -277,4 +279,11 @@ class LiveTransmition extends ObjectYPT {
return $user; return $user;
} }
static function keyNameFix($key){
if(!empty($_REQUEST['playlists_id_live']) && !preg_match("/.*_([0-9]+)/", $key)){
$key .= "_{$_REQUEST['playlists_id_live']}";
}
return $key;
}
} }

View file

@ -44,17 +44,21 @@ if(Live::isLiveThumbsDisabled()){
$lt = new LiveTransmition($livet['id']); $lt = new LiveTransmition($livet['id']);
_error_log("Live:getImage start"); _error_log("Live:getImage start");
if($lt->userCanSeeTransmition()){ if($lt->userCanSeeTransmition()){
$uuid = $livet['key']; $uuid = LiveTransmition::keyNameFix($livet['key']);
$p = AVideoPlugin::loadPlugin("Live"); $p = AVideoPlugin::loadPlugin("Live");
$video = Live::getM3U8File($uuid); $video = Live::getM3U8File($uuid);
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}"; $url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
_error_log("Live:getImage $url"); _error_log("Live:getImage $url");
if(!empty($_SESSION[$url]['content']) && strlen($_SESSION[$url]['content']) === 70808){
_error_log("Live:getImage It is the default image, unset it ");
_session_start();
unset($_SESSION[$url]);
}
if (empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()) { if (empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()) {
$content = url_get_contents($url); $content = url_get_contents($url);
if (session_status() == PHP_SESSION_NONE) { _session_start();
session_start();
}
_error_log("Live:getImage Image Expired in ". date("d/m/Y H:i:s", @$_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); _error_log("Live:getImage Image Expired in ". date("d/m/Y H:i:s", @$_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s"));
$_SESSION[$url] = array('content' => $content, 'expire' => strtotime("+2 min")); $_SESSION[$url] = array('content' => $content, 'expire' => strtotime("+2 min"));
_error_log("Live:getImage New Image will Expired in ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); _error_log("Live:getImage New Image will Expired in ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s"));
@ -62,7 +66,7 @@ if($lt->userCanSeeTransmition()){
if(!empty($_SESSION[$url]['content'])){ if(!empty($_SESSION[$url]['content'])){
ob_end_clean(); ob_end_clean();
echo $_SESSION[$url]['content']; echo $_SESSION[$url]['content'];
_error_log("Live:getImage Cached Good until ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); _error_log("Live:getImage Cached Good until ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")." strlen: ". strlen($_SESSION[$url]['content']));
}else{ }else{
ob_end_clean(); ob_end_clean();
echo file_get_contents($filename); echo file_get_contents($filename);

View file

@ -99,8 +99,8 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
//$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg)'}); //$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg)'});
} }
$liveLi.removeClass("hidden").removeClass("liveModel"); $liveLi.removeClass("hidden").removeClass("liveModel");
if(isPrivate){ if (isPrivate) {
$liveLi.find('.fa-video').removeClass('fa-video').addClass('fa-lock'); $liveLi.find('.fa-video').removeClass('fa-video').addClass('fa-lock');
} }
$liveLi.find('a').attr("href", href); $liveLi.find('a').attr("href", href);
$liveLi.find('.liveTitle').text(title); $liveLi.find('.liveTitle').text(title);
@ -118,12 +118,18 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
var limitLiveOnVideosListCount = 0; var limitLiveOnVideosListCount = 0;
function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif, live_servers_id) { function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif, live_servers_id) {
limitLiveOnVideosListCount++; limitLiveOnVideosListCount++;
if(limitLiveOnVideosListCount><?php echo intval($obj->limitLiveOnVideosList); ?>){ if (limitLiveOnVideosListCount ><?php echo intval($obj->limitLiveOnVideosList); ?>) {
console.log("Max live videos on first page reached"); console.log("Max live videos on first page reached");
return false; return false;
} }
var id = 'extraVideo' + user + "_" + live_servers_id; var matches = key.match(/.*_([0-9]+)/);
var playlists_id_live = "";
if (matches && matches[1]) {
playlists_id_live = "&playlists_id_live=" + matches[1];
}
var id = 'extraVideo' + user + "_" + live_servers_id + "_" + key;
id = id.replace(/\W/g, ''); id = id.replace(/\W/g, '');
if ($(".extraVideos").length && $("#" + id).length == 0) { if ($(".extraVideos").length && $("#" + id).length == 0) {
var $liveLi = $('.extraVideosModel').clone(); var $liveLi = $('.extraVideosModel').clone();
@ -138,9 +144,9 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
$liveLi.find('.liveUsersViews').text(views); $liveLi.find('.liveUsersViews').text(views);
$liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + key); $liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + key);
$liveLi.find('.liveUsersViews').addClass("liveUsersViews_" + key); $liveLi.find('.liveUsersViews').addClass("liveUsersViews_" + key);
$liveLi.find('.thumbsJPG').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=jpg"); $liveLi.find('.thumbsJPG').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=jpg" + playlists_id_live+'&'+Math.random());
if (!disableGif) { if (!disableGif) {
$liveLi.find('.thumbsGIF').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=gif"); $liveLi.find('.thumbsGIF').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=gif" + playlists_id_live+'&'+Math.random());
} else { } else {
$liveLi.find('.thumbsGIF').remove(); $liveLi.find('.thumbsGIF').remove();
} }
@ -245,7 +251,7 @@ if (isLive()) {
$('#liveVideos').slideDown(); $('#liveVideos').slideDown();
} else { } else {
//href = "<?php echo $global['webSiteRootURL']; ?>plugin/Live/?live_servers_id=" + live_servers_id + "&c=" + application.channelName; //href = "<?php echo $global['webSiteRootURL']; ?>plugin/Live/?live_servers_id=" + live_servers_id + "&c=" + application.channelName;
href = "<?php echo $global['webSiteRootURL']; ?>live/" + live_servers_id + "/" + application.channelName; href = application.href;
title = application.title; title = application.title;
name = application.name; name = application.name;
user = application.user; user = application.user;

View file

@ -26,7 +26,7 @@ if(!$lt->userCanSeeTransmition()){
forbiddenPage("You are not allowed see this streaming"); forbiddenPage("You are not allowed see this streaming");
} }
$uuid = $livet['key']; $uuid = LiveTransmition::keyNameFix($livet['key']);
$u = new User(0, $_GET['u'], false); $u = new User(0, $_GET['u'], false);
$user_id = $u->getBdId(); $user_id = $u->getBdId();

View file

@ -14,7 +14,7 @@ if (!empty($_GET['c'])) {
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced'); $customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
$livet = LiveTransmition::getFromDbByUserName($_GET['u']); $livet = LiveTransmition::getFromDbByUserName($_GET['u']);
$uuid = $livet['key']; $uuid = LiveTransmition::keyNameFix($livet['key']);
$p = AVideoPlugin::loadPlugin("Live"); $p = AVideoPlugin::loadPlugin("Live");
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory'); $objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
if (!empty($objSecure)) { if (!empty($objSecure)) {

View file

@ -20,7 +20,7 @@ if (!empty($_GET['c'])) {
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced'); $customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
$livet = LiveTransmition::getFromDbByUserName($_GET['u']); $livet = LiveTransmition::getFromDbByUserName($_GET['u']);
$uuid = $livet['key']; $uuid = LiveTransmition::keyNameFix($livet['key']);
$p = AVideoPlugin::loadPlugin("Live"); $p = AVideoPlugin::loadPlugin("Live");
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory'); $objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');

View file

@ -297,6 +297,13 @@ class PlayLists extends PluginAbstract {
return "{$global['webSiteRootURL']}plugin/PlayLists/playProgramsLive.json.php?playlists_id=" . $playlists_id; return "{$global['webSiteRootURL']}plugin/PlayLists/playProgramsLive.json.php?playlists_id=" . $playlists_id;
} }
static function showPlayLiveButton(){
if(!$obj = AVideoPlugin::getDataObjectIfEnabled("PlayLists")){
return false;
}
return !empty($obj->showPlayLiveButton);
}
static function canPlayProgramsLive(){ static function canPlayProgramsLive(){
// can the user live? // can the user live?
if(!User::canStream()){ if(!User::canStream()){
@ -315,13 +322,14 @@ class PlayLists extends PluginAbstract {
. " LEFT JOIN videos v ON videos_id = v.id " . " LEFT JOIN videos v ON videos_id = v.id "
. " WHERE playlists_id = ? AND v.status IN ('" . implode("','", Video::getViewableStatus(true)) . "')" . " WHERE playlists_id = ? AND v.status IN ('" . implode("','", Video::getViewableStatus(true)) . "')"
. " AND (`type` = 'video' OR `type` = 'audio' ) ORDER BY p.`order` "; . " AND (`type` = 'video' OR `type` = 'audio' ) ORDER BY p.`order` ";
cleanSearchVar();
$sort = @$_POST['sort']; $sort = @$_POST['sort'];
$_POST['sort'] = array(); $_POST['sort'] = array();
$_POST['sort']['p.`order`'] = 'ASC'; $_POST['sort']['p.`order`'] = 'ASC';
$_POST['sort'] = $sort; $_POST['sort'] = $sort;
$res = sqlDAL::readSql($sql, "i", array($playlists_id)); $res = sqlDAL::readSql($sql, "i", array($playlists_id));
$fullData = sqlDAL::fetchAllAssoc($res); $fullData = sqlDAL::fetchAllAssoc($res);
reloadSearchVar();
sqlDAL::close($res); sqlDAL::close($res);
$rows = array(); $rows = array();
if ($res != false) { if ($res != false) {

View file

@ -0,0 +1,190 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* http://wiki.xmltv.org/index.php/XMLTVFormat
* https://en.f-player.ru/xmltv-format-description
*/
?><?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv source-info-url="http://www.schedulesdirect.org/" source-info-name="Schedules Direct" generator-info-name="XMLTV/$Id: tv_grab_na_dd.in,v 1.70 2008/03/03 15:21:41 rmeden Exp $" generator-info-url="http://www.xmltv.org/">
<channel id="I10436.labs.zap2it.com">
<display-name>13 KERA</display-name>
<display-name>13 KERA TX42822:-</display-name>
<display-name>13</display-name>
<display-name>13 KERA fcc</display-name>
<display-name>KERA</display-name>
<display-name>KERA</display-name>
<display-name>PBS Affiliate</display-name>
<icon src="file://C:\Perl\site/share/xmltv/icons/KERA.gif" />
</channel>
<channel id="I10759.labs.zap2it.com">
<display-name>11 KTVT</display-name>
<display-name>11 KTVT TX42822:-</display-name>
<display-name>11</display-name>
<display-name>11 KTVT fcc</display-name>
<display-name>KTVT</display-name>
<display-name>KTVT</display-name>
<display-name>CBS Affiliate</display-name>
<icon src="file://C:\Perl\site/share/xmltv/icons/KTVT.gif" />
</channel>
<programme start="20080715003000 -0600" stop="20080715010000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">NOW on PBS</title>
<desc lang="en">Jordan's Queen Rania has made job creation a priority to help curb the staggering unemployment rates among youths in the Middle East.</desc>
<date>20080711</date>
<category lang="en">Newsmagazine</category>
<category lang="en">Interview</category>
<category lang="en">Public affairs</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP01006886.0028</episode-num>
<episode-num system="onscreen">427</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20080711000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715010000 -0600" stop="20080715023000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Mystery!</title>
<sub-title lang="en">Foyle's War, Series IV: Bleak Midwinter</sub-title>
<desc lang="en">Foyle investigates an explosion at a munitions factory, which he comes to believe may have been premeditated.</desc>
<date>20070701</date>
<category lang="en">Anthology</category>
<category lang="en">Mystery</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003026.0665</episode-num>
<episode-num system="onscreen">2705</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070701000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715023000 -0600" stop="20080715040000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Mystery!</title>
<sub-title lang="en">Foyle's War, Series IV: Casualties of War</sub-title>
<desc lang="en">The murder of a prominent scientist may have been due to a gambling debt.</desc>
<date>20070708</date>
<category lang="en">Anthology</category>
<category lang="en">Mystery</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003026.0666</episode-num>
<episode-num system="onscreen">2706</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070708000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715040000 -0600" stop="20080715043000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">BBC World News</title>
<desc lang="en">International issues.</desc>
<category lang="en">News</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH00315789.0000</episode-num>
<previously-shown />
<subtitles type="teletext" />
</programme>
<programme start="20080715043000 -0600" stop="20080715050000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Sit and Be Fit</title>
<date>20070924</date>
<category lang="en">Exercise</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003847.0074</episode-num>
<episode-num system="onscreen">901</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070924000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715060000 -0600" stop="20080715080000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Early Show</title>
<desc lang="en">Republican candidate John McCain; premiere of the film "The Dark Knight."</desc>
<date>20080715</date>
<category lang="en">Talk</category>
<category lang="en">News</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00337003.2361</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
</programme>
<programme start="20080715080000 -0600" stop="20080715090000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">Rachael Ray</title>
<desc lang="en">Actresses Kim Raver, Brooke Shields and Lindsay Price ("Lipstick Jungle"); women in their 40s tell why they got breast implants; a 30-minute meal.</desc>
<credits>
<presenter>Rachael Ray</presenter>
</credits>
<date>20080306</date>
<category lang="en">Talk</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00847333.0303</episode-num>
<episode-num system="onscreen">2119</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20080306000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715090000 -0600" stop="20080715100000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Price Is Right</title>
<desc lang="en">Contestants bid for prizes then compete for fabulous showcases.</desc>
<credits>
<director>Bart Eskander</director>
<producer>Roger Dobkowitz</producer>
<presenter>Drew Carey</presenter>
</credits>
<category lang="en">Game show</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH00004372.0000</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-G</value>
</rating>
</programme>
<programme start="20080715100000 -0600" stop="20080715103000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">Jeopardy!</title>
<credits>
<presenter>Alex Trebek</presenter>
</credits>
<date>20080715</date>
<category lang="en">Game show</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00002348.1700</episode-num>
<episode-num system="onscreen">5507</episode-num>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-G</value>
</rating>
</programme>
<programme start="20080715103000 -0600" stop="20080715113000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Young and the Restless</title>
<sub-title lang="en">Sabrina Offers Victoria a Truce</sub-title>
<desc lang="en">Jeff thinks Kyon stole the face cream; Nikki asks Nick to give David a chance; Amber begs Adrian to go to Australia.</desc>
<credits>
<actor>Peter Bergman</actor>
<actor>Eric Braeden</actor>
<actor>Jeanne Cooper</actor>
<actor>Melody Thomas Scott</actor>
</credits>
<date>20080715</date>
<category lang="en">Soap</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00004422.1359</episode-num>
<episode-num system="onscreen">8937</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-14</value>
</rating>
</programme>
</tv>

View file

@ -2,7 +2,7 @@
var playListsAdding = false; var playListsAdding = false;
var playList = []; var playList = [];
function reloadPlayLists() { function reloadPlayLists() {
console.log('reloadPlayLists'); //console.log('reloadPlayLists');
$.ajax({ $.ajax({
url: webSiteRootURL + 'objects/playlists.json.php', url: webSiteRootURL + 'objects/playlists.json.php',
success: function (response) { success: function (response) {
@ -13,7 +13,7 @@
} }
function reloadPlayListButtons() { function reloadPlayListButtons() {
console.log('reloadPlayListButtons'); //console.log('reloadPlayListButtons');
$('.watchLaterBtnAdded').hide(); $('.watchLaterBtnAdded').hide();
$('.favoriteBtnAdded').hide(); $('.favoriteBtnAdded').hide();
$('.watchLaterBtn').show(); $('.watchLaterBtn').show();
@ -38,7 +38,7 @@
loadPlayListsResponseObject = {timestamp: 0, response: false}; loadPlayListsResponseObject = {timestamp: 0, response: false};
function loadPlayLists(videos_id, crc) { function loadPlayLists(videos_id, crc) {
console.log('loadPlayLists'); //console.log('loadPlayLists');
if (loadPlayListsResponseObject.timestamp + 5000 < Date.now()) { if (loadPlayListsResponseObject.timestamp + 5000 < Date.now()) {
loadPlayListsResponseObject.timestamp = Date.now(); loadPlayListsResponseObject.timestamp = Date.now();
loadPlayListsResponseObject.response = []; loadPlayListsResponseObject.response = [];
@ -66,8 +66,8 @@
} }
function loadPlayListsResponse(response, videos_id, crc) { function loadPlayListsResponse(response, videos_id, crc) {
console.log('loadPlayListsResponse'); //console.log('loadPlayListsResponse');
console.log(response, videos_id, crc); //console.log(response, videos_id, crc);
$('.searchlist' + videos_id + crc).html(''); $('.searchlist' + videos_id + crc).html('');
for (var i in response) { for (var i in response) {
@ -110,7 +110,7 @@
} }
function addVideoToPlayList(videos_id, isChecked, playlists_id) { function addVideoToPlayList(videos_id, isChecked, playlists_id) {
console.log('addVideoToPlayList'); //console.log('addVideoToPlayList');
modal.showPleaseWait(); modal.showPleaseWait();
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playListAddVideo.json.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/playListAddVideo.json.php',
@ -122,7 +122,7 @@
}, },
success: function (response) { success: function (response) {
reloadPlayLists(); reloadPlayLists();
console.log(".playListsIds_" + playlists_id + '_videos_id_' + videos_id); //console.log(".playListsIds_" + playlists_id + '_videos_id_' + videos_id);
$(".playListsIds_" + playlists_id + '_videos_id_' + videos_id).prop("checked", isChecked); $(".playListsIds_" + playlists_id + '_videos_id_' + videos_id).prop("checked", isChecked);
modal.hidePleaseWait(); modal.hidePleaseWait();
setTimeout(function () { setTimeout(function () {

View file

@ -71,12 +71,13 @@ if(empty($status->version) || version_compare($status->version, "3.2") < 0){
Live::stopLive($users_id); Live::stopLive($users_id);
$webSiteRootURL = urlencode($global['webSiteRootURL']); $webSiteRootURL = urlencode($global['webSiteRootURL']);
$videosListToLive = "{$encoder}videosListToLive?playlists_id={$playlists_id}&APISecret={$api->APISecret}&webSiteRootURL={$webSiteRootURL}&user=".User::getUserName()."&pass=".User::getUserPass()."&liveKey={$key}&rtmp=". urlencode($live->server); $live_servers_id = Live::getCurrentLiveServersId();
$videosListToLive = "{$encoder}videosListToLive?playlists_id={$playlists_id}&APISecret={$api->APISecret}&webSiteRootURL={$webSiteRootURL}&user=".User::getUserName()."&pass=".User::getUserPass()."&liveKey={$key}&rtmp=". urlencode(Live::getServer())."&live_servers_id={$live_servers_id}";
echo $videosListToLive;
$cmd = "wget -O/dev/null -q \"{$videosListToLive}\" > /dev/null 2>/dev/null &"; $cmd = "wget -O/dev/null -q \"{$videosListToLive}\" > /dev/null 2>/dev/null &";
_error_log("playProgramsLive:: {$cmd}"); _error_log("playProgramsLive:: {$cmd}");
//echo "** executing command {$cmd}\n"; //echo "** executing command {$cmd}\n";
exec($cmd); //exec($cmd);
$obj->videosListToLive = $videosListToLive; $obj->videosListToLive = $videosListToLive;
$obj->error = false; $obj->error = false;

View file

@ -60,21 +60,6 @@
} }
} }
function lazyImage() {
$('.thumbsJPG').lazy({
effect: 'fadeIn',
visibleOnly: true,
// called after an element was successfully handled
afterLoad: function (element) {
element.removeClass('blur');
element.parent().find('.thumbsGIF').lazy({
effect: 'fadeIn'
});
}
});
mouseEffect();
}
var currentObject; var currentObject;
$(function () { $(function () {

View file

@ -111,6 +111,14 @@
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?> <a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php <?php
} }
if ($isMyChannel && PlayLists::showPlayLiveButton()) {
$liveLink = PlayLists::getLiveLink($playlist['id']);
if (!empty($liveLink)) {
?>
<a href="<?php echo $liveLink; ?>" class="btn btn-xs btn-default playAll hrefLink" ><i class="fas fa-broadcast-tower"></i> <?php echo __("Play Live"); ?></a>
<?php
}
}
?> ?>
<div class="pull-right btn-group"> <div class="pull-right btn-group">
<?php <?php
@ -120,8 +128,8 @@
?> ?>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $playlist['id']; ?>').val()); setTextEmbedCopied();" ><span class="fa fa-copy"></span> <span id="btnEmbedText"><?php echo __("Copy embed code"); ?></span></button> <button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $playlist['id']; ?>').val()); setTextEmbedCopied();" ><span class="fa fa-copy"></span> <span id="btnEmbedText"><?php echo __("Copy embed code"); ?></span></button>
<input type="hidden" id="playListEmbedCode<?php echo $playlist['id']; ?>" value='<?php <input type="hidden" id="playListEmbedCode<?php echo $playlist['id']; ?>" value='<?php
$code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/embed.php?playlists_id={$playlist['id']}", $advancedCustom->embedCodeTemplate); $code = str_replace("{embedURL}", "{$global['webSiteRootURL']}plugin/PlayLists/embed.php?playlists_id={$playlist['id']}", $advancedCustom->embedCodeTemplate);
echo ($code); echo ($code);
?>'/> ?>'/>
<?php <?php
} }
@ -159,20 +167,20 @@
<button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $playlist['id']; ?>" ><i class="fas fa-edit"></i> <?php echo __("Rename"); ?></button> <button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $playlist['id']; ?>" ><i class="fas fa-edit"></i> <?php echo __("Rename"); ?></button>
<button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $playlist['id']; ?>" playlist_id="<?php echo $playlist['id']; ?>" style="" > <button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $playlist['id']; ?>" playlist_id="<?php echo $playlist['id']; ?>" style="" >
<span class="fa fa-lock" id="statusPrivate<?php echo $playlist['id']; ?>" style="color: red; <?php <span class="fa fa-lock" id="statusPrivate<?php echo $playlist['id']; ?>" style="color: red; <?php
if ($playlist['status'] !== 'private') { if ($playlist['status'] !== 'private') {
echo ' display: none;'; echo ' display: none;';
} }
?> " ></span> ?> " ></span>
<span class="fa fa-globe" id="statusPublic<?php echo $playlist['id']; ?>" style="color: green; <?php <span class="fa fa-globe" id="statusPublic<?php echo $playlist['id']; ?>" style="color: green; <?php
if ($playlist['status'] !== 'public') { if ($playlist['status'] !== 'public') {
echo ' display: none;'; echo ' display: none;';
} }
?>"></span> ?>"></span>
<span class="fa fa-eye-slash" id="statusUnlisted<?php echo $playlist['id']; ?>" style="color: gray; <?php <span class="fa fa-eye-slash" id="statusUnlisted<?php echo $playlist['id']; ?>" style="color: gray; <?php
if ($playlist['status'] !== 'unlisted') { if ($playlist['status'] !== 'unlisted') {
echo ' display: none;'; echo ' display: none;';
} }
?>"></span> ?>"></span>
</button> </button>
<?php <?php
} }
@ -236,17 +244,17 @@
if (!empty($serie['trailer1'])) { if (!empty($serie['trailer1'])) {
?> ?>
<a href="#" class="btn btn-xs btn-warning" onclick="$(this).removeAttr('href'); $('#serie<?php echo $serie['id']; ?> img').fadeOut(); $('<iframe>', { <a href="#" class="btn btn-xs btn-warning" onclick="$(this).removeAttr('href'); $('#serie<?php echo $serie['id']; ?> img').fadeOut(); $('<iframe>', {
src: '<?php echo parseVideos($serie['trailer1'], 1, 0, 0, 0, 1, 0, 'fill'); ?>', src: '<?php echo parseVideos($serie['trailer1'], 1, 0, 0, 0, 1, 0, 'fill'); ?>',
id: 'myFrame<?php echo $serie['id']; ?>', id: 'myFrame<?php echo $serie['id']; ?>',
allow: 'autoplay', allow: 'autoplay',
frameborder: 0, frameborder: 0,
height: 200, height: 200,
width: '100%', width: '100%',
scrolling: 'no' scrolling: 'no'
}).appendTo('#serie<?php echo $serie['id']; ?>'); }).appendTo('#serie<?php echo $serie['id']; ?>');
$(this).removeAttr('onclick'); $(this).removeAttr('onclick');
$(this).fadeOut(); $(this).fadeOut();
return false;"> return false;">
<span class="fa fa-film"></span> <span class="fa fa-film"></span>
<span class="hidden-xs"><?php echo __("Trailer"); ?></span> <span class="hidden-xs"><?php echo __("Trailer"); ?></span>
</a> </a>
@ -316,14 +324,14 @@
?> ?>
<button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, false, <?php echo $value['watchLaterId']; ?>); <button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, false, <?php echo $value['watchLaterId']; ?>);
return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded<?php echo $value['id']; ?>" title="<?php echo __("Added On Watch Later"); ?>" style="color: #4285f4;<?php echo $watchLaterBtnAddedStyle; ?>" ><i class="fas fa-check"></i></button> return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded<?php echo $value['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 $value['id']; ?>, true, <?php echo $value['watchLaterId']; ?>); <button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, true, <?php echo $value['watchLaterId']; ?>);
return false;" class="btn btn-dark btn-xs watchLaterBtn watchLaterBtn<?php echo $value['id']; ?>" title="<?php echo __("Watch Later"); ?>" style="<?php echo $watchLaterBtnStyle; ?>" ><i class="fas fa-clock"></i></button> return false;" class="btn btn-dark btn-xs watchLaterBtn watchLaterBtn<?php echo $value['id']; ?>" title="<?php echo __("Watch Later"); ?>" style="<?php echo $watchLaterBtnStyle; ?>" ><i class="fas fa-clock"></i></button>
<br> <br>
<button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, false, <?php echo $value['favoriteId']; ?>); <button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, false, <?php echo $value['favoriteId']; ?>);
return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded<?php echo $value['id']; ?>" title="<?php echo __("Added On Favorite"); ?>" style="color: #4285f4; <?php echo $favoriteBtnAddedStyle; ?>"><i class="fas fa-check"></i></button> return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded<?php echo $value['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 $value['id']; ?>, true, <?php echo $value['favoriteId']; ?>); <button onclick="addVideoToPlayList(<?php echo $value['id']; ?>, true, <?php echo $value['favoriteId']; ?>);
return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn<?php echo $value['id']; ?>" title="<?php echo __("Favorite"); ?>" style="<?php echo $favoriteBtnStyle; ?>" ><i class="fas fa-heart" ></i></button> return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn<?php echo $value['id']; ?>" title="<?php echo __("Favorite"); ?>" style="<?php echo $favoriteBtnStyle; ?>" ><i class="fas fa-heart" ></i></button>
</div> </div>
<?php <?php
@ -352,7 +360,7 @@
<div> <div>
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
<span itemprop="interactionCount"> <span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?> <?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
</span> </span>
</div> </div>
<?php <?php

View file

@ -30,7 +30,7 @@ if (User::isLogged() && $user_id == User::getId()) {
$programs = PlayList::getAllFromUser($user_id, $publicOnly, false, @$_GET['program_id']); $programs = PlayList::getAllFromUser($user_id, $publicOnly, false, @$_GET['program_id']);
if (empty($programs)) { if (empty($programs)) {
$programs = PlayList::getAllFromUser($user_id, $publicOnly); $programs = PlayList::getAllFromUser($user_id, $publicOnly);
}else{ } else {
$videosArrayId = PlayList::getVideosIdFromPlaylist($_GET['program_id']); $videosArrayId = PlayList::getVideosIdFromPlaylist($_GET['program_id']);
$videos_id = $videosArrayId[0]; $videos_id = $videosArrayId[0];
} }
@ -53,7 +53,7 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
} }
</style> </style>
<?php <?php
if(!empty($videos_id)){ if (!empty($videos_id)) {
getOpenGraph($videos_id); getOpenGraph($videos_id);
} }
?> ?>
@ -109,11 +109,13 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
?> ?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?> <a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php <?php
$liveLink = PlayLists::getLiveLink($program['id']); if ($isMyChannel && PlayLists::showPlayLiveButton()) {
if(!empty($liveLink)){ $liveLink = PlayLists::getLiveLink($program['id']);
?> if (!empty($liveLink)) {
<a href="<?php echo $liveLink; ?>" class="btn btn-xs btn-default playAll hrefLink" ><i class="fas fa-broadcast-tower"></i> <?php echo __("Play Live"); ?></a> ?>
<?php <a href="<?php echo $liveLink; ?>" class="btn btn-xs btn-default playAll hrefLink" ><i class="fas fa-broadcast-tower"></i> <?php echo __("Play Live"); ?></a>
<?php
}
} }
} }
if ($isMyChannel) { if ($isMyChannel) {
@ -216,7 +218,7 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
<?php <?php
$count = 0; $count = 0;
foreach ($videosP as $value) { foreach ($videosP as $value) {
if(empty($value['created'])){ if (empty($value['created'])) {
$count++; $count++;
continue; continue;
} }
@ -259,8 +261,8 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
<?php <?php
$value['tags'] = Video::getTags($value['id']); $value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) { foreach ($value['tags'] as $value2) {
if(is_array($value2)){ if (is_array($value2)) {
$value2 = (object)$value2; $value2 = (object) $value2;
} }
if ($value2->label === __("Group")) { if ($value2->label === __("Group")) {
?> ?>
@ -339,9 +341,9 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
if (count($programs) > 1) { if (count($programs) > 1) {
?> ?>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle(); <button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideDown();"><i class="fas fa-angle-down"></i> <?php echo __('Show More'); ?></button> $('.<?php echo $class; ?>').slideDown();"><i class="fas fa-angle-down"></i> <?php echo __('Show More'); ?></button>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle(); <button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideUp();" style="display: none;"><i class="fas fa-angle-up"></i> <?php echo __('Show Less'); ?></button> $('.<?php echo $class; ?>').slideUp();" style="display: none;"><i class="fas fa-angle-up"></i> <?php echo __('Show Less'); ?></button>
<?php <?php
} }
if ($isMyChannel && !empty($videosArrayId)) { if ($isMyChannel && !empty($videosArrayId)) {
@ -427,67 +429,67 @@ if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
$('.removeVideo').click(function () { $('.removeVideo').click(function () {
currentObject = this; currentObject = this;
swal({ swal({
title: "<?php echo __("Are you sure?"); ?>", title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>", text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning", icon: "warning",
buttons: true, buttons: true,
dangerMode: true, dangerMode: true,
}) })
.then(function(willDelete) { .then(function (willDelete) {
if (willDelete) { if (willDelete) {
modal.showPleaseWait(); modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id'); var playlist_id = $(currentObject).attr('playlist_id');
var video_id = $(currentObject).attr('video_id'); var video_id = $(currentObject).attr('video_id');
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php',
data: { data: {
"playlist_id": playlist_id, "playlist_id": playlist_id,
"video_id": video_id "video_id": video_id
}, },
type: 'post', type: 'post',
success: function (response) { success: function (response) {
reloadPlayLists(); reloadPlayLists();
$(".playListsIds" + video_id).prop("checked", false); $(".playListsIds" + video_id).prop("checked", false);
$(currentObject).closest('.galleryVideo').fadeOut(); $(currentObject).closest('.galleryVideo').fadeOut();
modal.hidePleaseWait(); modal.hidePleaseWait();
} }
}); });
} }
}); });
}); });
$('.deletePlaylist').click(function () { $('.deletePlaylist').click(function () {
currentObject = this; currentObject = this;
swal({ swal({
title: "<?php echo __("Are you sure?"); ?>", title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>", text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning", icon: "warning",
buttons: true, buttons: true,
dangerMode: true, dangerMode: true,
}) })
.then(function(willDelete) { .then(function (willDelete) {
if (willDelete) { if (willDelete) {
modal.showPleaseWait(); modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id'); var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id); console.log(playlist_id);
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php',
data: { data: {
"playlist_id": playlist_id "playlist_id": playlist_id
}, },
type: 'post', type: 'post',
success: function (response) { success: function (response) {
$(currentObject).closest('.panel').slideUp(); $(currentObject).closest('.panel').slideUp();
modal.hidePleaseWait(); modal.hidePleaseWait();
} }
}); });
} }
}); });
}); });

View file

@ -3,6 +3,7 @@ global $global, $config;
if(!isset($global['systemRootPath'])){ if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
//_error_log("HLS.php: session_id = ". session_id()." IP = ". getRealIpAddr()." URL = ".($actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); //_error_log("HLS.php: session_id = ". session_id()." IP = ". getRealIpAddr()." URL = ".($actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"));
session_write_close(); session_write_close();

View file

@ -397,14 +397,16 @@ function inIframe() {
return true; return true;
} }
} }
var promisePlaytry = 10; var promisePlaytry = 40;
var promisePlayTimeoutTime = 0; var promisePlayTimeoutTime = 500;
var promisePlayTimeout; var promisePlayTimeout;
var promisePlay; var promisePlay;
var browserPreventShowed = false; var browserPreventShowed = false;
function playerPlay(currentTime) { function playerPlay(currentTime) {
if(typeof player === 'undefined' || !player.isReady_){ if (typeof player === 'undefined' || !player.isReady_) {
setTimeout(function(){playerPlay(currentTime);},200); setTimeout(function () {
playerPlay(currentTime);
}, 200);
return false; return false;
} }
if (userIsControling) { // stops here if the user already clicked on play or pause if (userIsControling) { // stops here if the user already clicked on play or pause
@ -413,7 +415,7 @@ function playerPlay(currentTime) {
} }
if (promisePlaytry <= 0) { if (promisePlaytry <= 0) {
console.log("playerPlay: promisePlaytry <= 0"); console.log("playerPlay: promisePlaytry <= 0");
if(!browserPreventShowed){ if (!browserPreventShowed) {
browserPreventShowed = true; browserPreventShowed = true;
$.toast("Your browser prevent autoplay"); $.toast("Your browser prevent autoplay");
} }
@ -433,58 +435,29 @@ function playerPlay(currentTime) {
promisePlay.then(function () { promisePlay.then(function () {
console.log("playerPlay: Autoplay started"); console.log("playerPlay: Autoplay started");
userIsControling = true; userIsControling = true;
clearTimeout(promisePlayTimeout); if (player.paused()) {
setTimeout(function () { console.log("The video still paused, trying to mute and play");
if (player.paused()) { if (promisePlaytry <= 2) {
console.log("The video still paused, trying to mute and play"); console.log("playerPlay: (" + promisePlaytry + ") The video still paused, trying to mute and play");
playMuted(currentTime); tryToPlayMuted(currentTime);
} else { } else {
//player.muted(false); console.log("playerPlay: (" + promisePlaytry + ") The video still paused, trying to play again");
if (player.muted() && !inIframe()) { tryToPlay(currentTime);
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
if (!donotShowUnmuteAgain) {
var span = document.createElement("span");
span.innerHTML = "<b>Would</b> you like to unmute it?<div id='allowAutoplay' style='max-height: 100px; overflow-y: scroll;'></div>";
swal({
title: "Your Media is Muted",
icon: "warning",
content: span,
dangerMode: true,
buttons: {
cancel: "Cancel",
unmute: true,
donotShowUnmuteAgain: {
text: "Don't show again",
value: "donotShowUnmuteAgain",
className: "btn-danger",
},
}
}).then(function (value) {
switch (value) {
case "unmute":
player.muted(false);
break;
case "donotShowUnmuteAgain":
Cookies.set('donotShowUnmuteAgain', true, {
path: '/',
expires: 365
});
break;
}
});
}
showMuteTooltip();
setTimeout(function () {
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
player.userActive(true);
}, 500);
}
} }
} else {
}, 1000); //player.muted(false);
if (player.muted() && !inIframe()) {
showUnmutePopup();
}
}
}).catch(function (error) { }).catch(function (error) {
console.log("playerPlay: Autoplay was prevented, trying to mute and play ***"); if (promisePlaytry <= 2) {
playMuted(currentTime); console.log("playerPlay: (" + promisePlaytry + ") Autoplay was prevented, trying to mute and play ***");
tryToPlayMuted(currentTime);
} else {
console.log("playerPlay: (" + promisePlaytry + ") Autoplay was prevented, trying to play again");
tryToPlay(currentTime);
}
}); });
} else { } else {
tryToPlay(currentTime); tryToPlay(currentTime);
@ -498,9 +471,49 @@ function playerPlay(currentTime) {
} }
} }
function showUnmutePopup() {
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
if (!donotShowUnmuteAgain) {
var span = document.createElement("span");
span.innerHTML = "<b>Would</b> you like to unmute it?<div id='allowAutoplay' style='max-height: 100px; overflow-y: scroll;'></div>";
swal({
title: "Your Media is Muted",
icon: "warning",
content: span,
dangerMode: true,
buttons: {
cancel: "Cancel",
unmute: true,
donotShowUnmuteAgain: {
text: "Don't show again",
value: "donotShowUnmuteAgain",
className: "btn-danger",
},
}
}).then(function (value) {
switch (value) {
case "unmute":
player.muted(false);
break;
case "donotShowUnmuteAgain":
Cookies.set('donotShowUnmuteAgain', true, {
path: '/',
expires: 365
});
break;
}
});
}
showMuteTooltip();
setTimeout(function () {
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
player.userActive(true);
}, 500);
}
function tryToPlay(currentTime) { function tryToPlay(currentTime) {
clearTimeout(promisePlayTimeout); clearTimeout(promisePlayTimeout);
promisePlayTimeoutTime += 200;
promisePlayTimeout = setTimeout(function () { promisePlayTimeout = setTimeout(function () {
if (player.paused()) { if (player.paused()) {
playerPlay(currentTime); playerPlay(currentTime);
@ -508,21 +521,32 @@ function tryToPlay(currentTime) {
}, promisePlayTimeoutTime); }, promisePlayTimeoutTime);
} }
function tryToPlayMuted(currentTime) {
muteInCookieAllow();
return tryToPlay(currentTime);
}
function muteIfNotAudio() { function muteIfNotAudio() {
if (!player.isAudio()) { if (!player.isAudio()) {
console.log("muteIfNotAudio: We will mute this video");
player.muted(true); player.muted(true);
return true; return true;
} }
console.log("muteIfNotAudio: We will not mute an audio");
return false;
}
function muteInCookieAllow() {
var mute = Cookies.get('muted');
if (typeof mute === 'undefined' || (mute && mute !== "false")) {
return muteIfNotAudio();
}
return false; return false;
} }
function playMuted(currentTime) { function playMuted(currentTime) {
var mute = Cookies.get('muted'); muteInCookieAllow();
if (typeof mute === 'undefined' || (mute && mute !== "false")) {
muteIfNotAudio();
}
return playerPlay(currentTime); return playerPlay(currentTime);
;
} }
function showMuteTooltip() { function showMuteTooltip() {

View file

@ -1378,7 +1378,7 @@ echo AVideoPlugin::getManagerVideosReset();
if ($('#encodeProgress' + id).children().length) { if ($('#encodeProgress' + id).children().length) {
return false; return false;
} }
var item = '<div class="progress progress-striped active " id="encodingProgress' + id + '" style="margin: 0;border-bottom-right-radius: 0; border-bottom-left-radius: 0;">'; var item = '<div class="clearfix"></div><div class="progress progress-striped active " id="encodingProgress' + id + '" style="margin: 0;border-bottom-right-radius: 0; border-bottom-left-radius: 0;">';
item += '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0; animation-duration: 15s;animation: 15s;transition-duration: 15s; "><span id="encodingProgressComplete' + id + '">0</span>% Complete</div>'; item += '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0; animation-duration: 15s;animation: 15s;transition-duration: 15s; "><span id="encodingProgressComplete' + id + '">0</span>% Complete</div>';
item += '<span class="progress-type"><span class="badge "><?php echo __("Queue Position"); ?> ' + position + '</span></span><span class="progress-completed">' + queueItem.name + '</span>'; item += '<span class="progress-type"><span class="badge "><?php echo __("Queue Position"); ?> ' + position + '</span></span><span class="progress-completed">' + queueItem.name + '</span>';
item += '</div><div class="progress progress-striped active " id="downloadProgress' + id + '" style="height: 10px; border-top-right-radius: 0; border-top-left-radius: 0;"><div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div></div> '; item += '</div><div class="progress progress-striped active " id="downloadProgress' + id + '" style="height: 10px; border-top-right-radius: 0; border-top-left-radius: 0;"><div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div></div> ';

View file

@ -233,17 +233,6 @@ $metaDescription = __("Trending");
mouseEffect(); mouseEffect();
lazyImage(); lazyImage();
}); });
function lazyImage() {
$('.thumbsJPG').lazy({
effect: 'fadeIn',
visibleOnly: true,
// called after an element was successfully handled
afterLoad: function (element) {
element.removeClass('blur');
}
});
mouseEffect();
}
</script> </script>
</body> </body>
</html> </html>

View file

@ -35,21 +35,14 @@ if (empty($video)) {
forbiddenPage("Video not found"); forbiddenPage("Video not found");
} }
if (empty($customizedAdvanced)) {
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
}
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced'); if (!isSameDomain(@$_SERVER['HTTP_REFERER'], $global['webSiteRootURL'])) {
// allow embrd from in same site
$host = strtolower(parse_url(@$_SERVER['HTTP_REFERER'], PHP_URL_HOST));
$allowedHost = strtolower(parse_url($global['webSiteRootURL'], PHP_URL_HOST));
if ($allowedHost !== $host) {
if (!empty($advancedCustomUser->blockEmbedFromSharedVideos) && !CustomizeUser::canShareVideosFromVideo($video['id'])) { if (!empty($advancedCustomUser->blockEmbedFromSharedVideos) && !CustomizeUser::canShareVideosFromVideo($video['id'])) {
forbiddenPage("Embed is forbidden"); forbiddenPage("Embed is forbidden");
} }
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
if (!empty($objSecure)) {
$objSecure->verifyEmbedSecurity();
}
} }
$imgw = 1280; $imgw = 1280;
@ -526,30 +519,30 @@ if (User::hasBlockedUser($video['users_id'])) {
left: 0; left: 0;
pointer-events: none;"></textarea> pointer-events: none;"></textarea>
<script> <script>
var topInfoTimeout; var topInfoTimeout;
$(document).ready(function () { $(document).ready(function () {
setInterval(function () { setInterval(function () {
if(typeof player !== 'undefined'){ if (typeof player !== 'undefined') {
if (!player.paused() && (!$('.vjs-control-bar').is(":visible") || $('.vjs-control-bar').css('opacity') == "0")) { if (!player.paused() && (!$('.vjs-control-bar').is(":visible") || $('.vjs-control-bar').css('opacity') == "0")) {
$('#topInfo').fadeOut(); $('#topInfo').fadeOut();
} else { } else {
$('#topInfo').fadeIn(); $('#topInfo').fadeIn();
}
} }
}, 200); }
}, 200);
$("iframe, #topInfo").mouseover(function (e) {
clearTimeout(topInfoTimeout);
$('#mainVideo').addClass("vjs-user-active");
});
$("iframe").mouseout(function (e) {
topInfoTimeout = setTimeout(function () {
$('#mainVideo').removeClass("vjs-user-active");
}, 500);
});
$("iframe, #topInfo").mouseover(function (e) {
clearTimeout(topInfoTimeout);
$('#mainVideo').addClass("vjs-user-active");
}); });
$("iframe").mouseout(function (e) {
topInfoTimeout = setTimeout(function () {
$('#mainVideo').removeClass("vjs-user-active");
}, 500);
});
});
</script> </script>
</body> </body>
</html> </html>

View file

@ -1,6 +1,7 @@
<?php <?php
global $global, $config; global $global, $config;
if(!isset($global['systemRootPath'])){ if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
@ -17,16 +18,29 @@ $path_parts = pathinfo($_GET['file']);
$file = $path_parts['basename']; $file = $path_parts['basename'];
$path = "{$global['systemRootPath']}videos/{$file}"; $path = "{$global['systemRootPath']}videos/{$file}";
if($file=="configuration.php"){ if ($file == "X-Sendfile.mp4") {
$path = "{$global['systemRootPath']}plugin/SecureVideosDirectory/test.json";
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Type: application/json');
header('Content-Length: ' . filesize($path));
header("X-Sendfile: {$path}");
exit;
}
if ($file == "configuration.php") {
_error_log("XSENDFILE Cant read this configuration "); _error_log("XSENDFILE Cant read this configuration ");
forbiddenPage("Cant read this"); forbiddenPage("Cant read this");
} }
if (file_exists($path)) { if (file_exists($path)) {
if (!empty($_GET['download'])) { if (!empty($_GET['download'])) {
if(!empty($_GET['title'])){ if (!empty($_GET['title'])) {
$quoted = sprintf('"%s"', addcslashes(basename($_GET['title']), '"\\')); $quoted = sprintf('"%s"', addcslashes(basename($_GET['title']), '"\\'));
}else{ } else {
$quoted = sprintf('"%s"', addcslashes(basename($_GET['file']), '"\\')); $quoted = sprintf('"%s"', addcslashes(basename($_GET['file']), '"\\'));
} }
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
@ -37,21 +51,21 @@ if (file_exists($path)) {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public'); header('Pragma: public');
} }
if(preg_match("/(mp4|webm|m3u8|mp3|ogg)/i", $path_parts['extension'])){ if (preg_match("/(mp4|webm|m3u8|mp3|ogg)/i", $path_parts['extension'])) {
if(isAVideoEncoderOnSameDomain() || empty($_GET['ignoreXsendfilePreVideoPlay'])){ if (isAVideoEncoderOnSameDomain() || empty($_GET['ignoreXsendfilePreVideoPlay'])) {
AVideoPlugin::xsendfilePreVideoPlay(); AVideoPlugin::xsendfilePreVideoPlay();
} }
if (empty($advancedCustom->doNotUseXsendFile)) { if (empty($advancedCustom->doNotUseXsendFile)) {
//_error_log("X-Sendfile: {$path}"); //_error_log("X-Sendfile: {$path}");
header("X-Sendfile: {$path}"); header("X-Sendfile: {$path}");
} }
}else{ } else {
$advancedCustom->doNotUseXsendFile = true; $advancedCustom->doNotUseXsendFile = true;
} }
header("Content-type: " . mime_content_type($path)); header("Content-type: " . mime_content_type($path));
header('Content-Length: ' . filesize($path)); header('Content-Length: ' . filesize($path));
if (!empty($advancedCustom->doNotUseXsendFile)) { if (!empty($advancedCustom->doNotUseXsendFile)) {
ini_set('memory_limit', filesize($path)*1.5); ini_set('memory_limit', filesize($path) * 1.5);
_error_log("Your XSEND File is not enabled, it may slowdown your site, file = $path", AVideoLog::$WARNING); _error_log("Your XSEND File is not enabled, it may slowdown your site, file = $path", AVideoLog::$WARNING);
//echo url_get_contents($path); //echo url_get_contents($path);
// stream the file // stream the file
@ -59,6 +73,6 @@ if (file_exists($path)) {
fpassthru($fp); fpassthru($fp);
} }
die(); die();
}else{ } else {
_error_log("XSENDFILE ERROR: Not exists {$path}"); _error_log("XSENDFILE ERROR: Not exists {$path}");
} }