1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +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;
}
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) {
global $global;
$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;
}
function get_domain($url) {
function get_domain($url, $ifEmptyReturnSameString=false) {
$pieces = parse_url($url);
$domain = isset($pieces['host']) ? $pieces['host'] : '';
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)) {
return $regs['domain'];

View file

@ -24,17 +24,6 @@ if (!empty($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/configuration.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');
$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");
$customizePlugin = AVideoPlugin::getObjectData("Customize");
$permissionsPlugin = AVideoPlugin::getObjectData("Permissions");

View file

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

View file

@ -2811,26 +2811,43 @@ if (!class_exists('Video')) {
return false;
}
$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'])) {
foreach ($types as $value) {
if (!empty($paths['mp4'][$value])) {
if (is_string($paths['mp4'][$value])) {
return $paths['mp4'][$value];
} else {
return $paths['mp4'][$value]["url"];
}
}
}
}
if (!empty($paths['webm'])) {
foreach ($types as $value) {
if (!empty($paths['webm'][$value])) {
if (is_string($paths['webm'][$value])) {
return $paths['webm'][$value];
} else {
return $paths['webm'][$value]["url"];
}
}
}
if (!empty($paths['m3u8'])) {
if (!empty($paths['m3u8'])) {
return $paths['m3u8']["url"];
}
if (!empty($paths['m3u8'])) {
if (!empty($paths['m3u8'])) {
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;
}

View file

@ -194,9 +194,40 @@ class API extends PluginAbstract {
if (empty($videos[$parameters['nextIndex']])) {
$parameters['nextIndex'] = 0;
}
$playlist = new PlayList($parameters['playlists_id']);
$user = new User($playlist->getUsers_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['path'] = $videoPath;
$parameters['duration'] = $video['duration'];
$parameters['duration_seconds'] = durationToSeconds($parameters['duration']);
return new ApiObject("", false, $parameters);
}

View file

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

View file

@ -24,6 +24,9 @@
<center style="margin:5px;">
<?php echo getAdsLeaderBoardTop2(); ?>
</center>
<?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>
@ -40,6 +43,15 @@
}
</script>
<?php
}else{
?>
<script>
function afterExtraVideos($liveLi) {
return false;
}
</script>
<?php
}
echo AVideoPlugin::getGallerySection();
?>
<!-- For Live Videos End -->
@ -57,7 +69,7 @@
$countSections++;
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++;
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>
</div>
</div>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$container = $('#categoriesContainer').infiniteScroll({
@ -108,26 +121,11 @@
lazyImage();
}, 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>
<?php
}
// 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'])) {
$_GET['page'] = 1;
}
@ -141,16 +139,18 @@
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
if (!empty($videos)) {
?>
<div class="row clear clearfix">
<div class="row clear clearfix" id="Div<?php echo $currentCat['clean_name']; ?>">
<h3 class="galleryTitle">
<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'] ; ?>
</a>
</h3>
<div class="Div<?php echo $currentCat['clean_name']; ?>Section">
<?php
createGallerySection($videos, "", array(), true);
?>
</div>
</div>
<?php
$total = Video::getTotalVideos("viewable");
$totalPages = ceil($total / getRowCount());
@ -161,7 +161,8 @@
?>
<div class="col-sm-12" style="z-index: 1;">
<?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>
<?php

View file

@ -8,7 +8,6 @@ include $global['systemRootPath'] . 'plugin/Gallery/view/topLogic.php';
echo $siteTitle;
?></title>
<?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>
<body class="<?php echo $global['bodyClass']; ?>">

View file

@ -49,5 +49,5 @@ foreach ($categories as $value) {
?>
</div>
<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>

View file

@ -475,6 +475,9 @@ class Live extends PluginAbstract {
$o->protectLive = $liveServer->getProtectLive();
$o->useAadaptiveMode = $liveServer->getUseAadaptiveMode();
}
$uuid = LiveTransmition::keyNameFix($uuid);
if ($o->protectLive && empty($doNotProtect)) {
return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$live_servers_id}&uuid=" . encryptString($uuid);
} else if ($o->useAadaptiveMode) {
@ -690,8 +693,12 @@ class Live extends PluginAbstract {
if (empty($channelName)) {
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']}live/{$live_servers_id}/" . urlencode($channelName);
return "{$global['webSiteRootURL']}live/{$live_servers_id}/" . urlencode($channelName).$playlists_id_live;
}
static function getAvailableLiveServersId() {
@ -945,11 +952,22 @@ class Live extends PluginAbstract {
$channelName = $u->getChannelName();
$photo = $u->getPhotoDB();
$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);
// this variable is to keep it compatible for Mobile app
$UserPhoto = $photo;
$obj->applications[] = array(
"key" => $value->name,
"key" => LiveTransmition::keyNameFix($value->name),
"isPrivate" => self::isAPrivateLiveFromLiveKey($value->name),
"users" => $users,
"name" => $userName,
@ -959,7 +977,9 @@ class Live extends PluginAbstract {
"title" => $title,
'channelName' => $channelName,
'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) {
$obj->error = property_exists($value, 'publishing') ? false : true;

View file

@ -170,6 +170,8 @@ class LiveTransmition extends ObjectYPT {
if (!is_string($key)) {
return false;
}
$parts = explode("_", $key);
$key = $parts[0];
$key = preg_replace("/[^A-Za-z0-9]/", '', $key);
$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";
@ -277,4 +279,11 @@ class LiveTransmition extends ObjectYPT {
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']);
_error_log("Live:getImage start");
if($lt->userCanSeeTransmition()){
$uuid = $livet['key'];
$uuid = LiveTransmition::keyNameFix($livet['key']);
$p = AVideoPlugin::loadPlugin("Live");
$video = Live::getM3U8File($uuid);
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
_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()) {
$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"));
$_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"));
@ -62,7 +66,7 @@ if($lt->userCanSeeTransmition()){
if(!empty($_SESSION[$url]['content'])){
ob_end_clean();
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{
ob_end_clean();
echo file_get_contents($filename);

View file

@ -123,7 +123,13 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
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, '');
if ($(".extraVideos").length && $("#" + id).length == 0) {
var $liveLi = $('.extraVideosModel').clone();
@ -138,9 +144,9 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
$liveLi.find('.liveUsersViews').text(views);
$liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + 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) {
$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 {
$liveLi.find('.thumbsGIF').remove();
}
@ -245,7 +251,7 @@ if (isLive()) {
$('#liveVideos').slideDown();
} else {
//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;
name = application.name;
user = application.user;

View file

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

View file

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

View file

@ -20,7 +20,7 @@ if (!empty($_GET['c'])) {
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
$livet = LiveTransmition::getFromDbByUserName($_GET['u']);
$uuid = $livet['key'];
$uuid = LiveTransmition::keyNameFix($livet['key']);
$p = AVideoPlugin::loadPlugin("Live");
$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;
}
static function showPlayLiveButton(){
if(!$obj = AVideoPlugin::getDataObjectIfEnabled("PlayLists")){
return false;
}
return !empty($obj->showPlayLiveButton);
}
static function canPlayProgramsLive(){
// can the user live?
if(!User::canStream()){
@ -315,13 +322,14 @@ class PlayLists extends PluginAbstract {
. " LEFT JOIN videos v ON videos_id = v.id "
. " WHERE playlists_id = ? AND v.status IN ('" . implode("','", Video::getViewableStatus(true)) . "')"
. " AND (`type` = 'video' OR `type` = 'audio' ) ORDER BY p.`order` ";
cleanSearchVar();
$sort = @$_POST['sort'];
$_POST['sort'] = array();
$_POST['sort']['p.`order`'] = 'ASC';
$_POST['sort'] = $sort;
$res = sqlDAL::readSql($sql, "i", array($playlists_id));
$fullData = sqlDAL::fetchAllAssoc($res);
reloadSearchVar();
sqlDAL::close($res);
$rows = array();
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 playList = [];
function reloadPlayLists() {
console.log('reloadPlayLists');
//console.log('reloadPlayLists');
$.ajax({
url: webSiteRootURL + 'objects/playlists.json.php',
success: function (response) {
@ -13,7 +13,7 @@
}
function reloadPlayListButtons() {
console.log('reloadPlayListButtons');
//console.log('reloadPlayListButtons');
$('.watchLaterBtnAdded').hide();
$('.favoriteBtnAdded').hide();
$('.watchLaterBtn').show();
@ -38,7 +38,7 @@
loadPlayListsResponseObject = {timestamp: 0, response: false};
function loadPlayLists(videos_id, crc) {
console.log('loadPlayLists');
//console.log('loadPlayLists');
if (loadPlayListsResponseObject.timestamp + 5000 < Date.now()) {
loadPlayListsResponseObject.timestamp = Date.now();
loadPlayListsResponseObject.response = [];
@ -66,8 +66,8 @@
}
function loadPlayListsResponse(response, videos_id, crc) {
console.log('loadPlayListsResponse');
console.log(response, videos_id, crc);
//console.log('loadPlayListsResponse');
//console.log(response, videos_id, crc);
$('.searchlist' + videos_id + crc).html('');
for (var i in response) {
@ -110,7 +110,7 @@
}
function addVideoToPlayList(videos_id, isChecked, playlists_id) {
console.log('addVideoToPlayList');
//console.log('addVideoToPlayList');
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playListAddVideo.json.php',
@ -122,7 +122,7 @@
},
success: function (response) {
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);
modal.hidePleaseWait();
setTimeout(function () {

View file

@ -71,12 +71,13 @@ if(empty($status->version) || version_compare($status->version, "3.2") < 0){
Live::stopLive($users_id);
$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 &";
_error_log("playProgramsLive:: {$cmd}");
//echo "** executing command {$cmd}\n";
exec($cmd);
//exec($cmd);
$obj->videosListToLive = $videosListToLive;
$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;
$(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; ?>
<?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">
<?php

View file

@ -109,6 +109,7 @@ $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; ?>
<?php
if ($isMyChannel && PlayLists::showPlayLiveButton()) {
$liveLink = PlayLists::getLiveLink($program['id']);
if (!empty($liveLink)) {
?>
@ -116,6 +117,7 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
<?php
}
}
}
if ($isMyChannel) {
?>
<script>

View file

@ -3,6 +3,7 @@ global $global, $config;
if(!isset($global['systemRootPath'])){
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]"));
session_write_close();

View file

@ -397,14 +397,16 @@ function inIframe() {
return true;
}
}
var promisePlaytry = 10;
var promisePlayTimeoutTime = 0;
var promisePlaytry = 40;
var promisePlayTimeoutTime = 500;
var promisePlayTimeout;
var promisePlay;
var browserPreventShowed = false;
function playerPlay(currentTime) {
if (typeof player === 'undefined' || !player.isReady_) {
setTimeout(function(){playerPlay(currentTime);},200);
setTimeout(function () {
playerPlay(currentTime);
}, 200);
return false;
}
if (userIsControling) { // stops here if the user already clicked on play or pause
@ -433,14 +435,44 @@ function playerPlay(currentTime) {
promisePlay.then(function () {
console.log("playerPlay: Autoplay started");
userIsControling = true;
clearTimeout(promisePlayTimeout);
setTimeout(function () {
if (player.paused()) {
console.log("The video still paused, trying to mute and play");
playMuted(currentTime);
if (promisePlaytry <= 2) {
console.log("playerPlay: (" + promisePlaytry + ") The video still paused, trying to mute and play");
tryToPlayMuted(currentTime);
} else {
console.log("playerPlay: (" + promisePlaytry + ") The video still paused, trying to play again");
tryToPlay(currentTime);
}
} else {
//player.muted(false);
if (player.muted() && !inIframe()) {
showUnmutePopup();
}
}
}).catch(function (error) {
if (promisePlaytry <= 2) {
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 {
tryToPlay(currentTime);
}
} catch (e) {
console.log("playerPlay: We could not autoplay, trying again in 1 second");
tryToPlay(currentTime);
}
} else {
console.log("playerPlay: Player is Undefined");
}
}
function showUnmutePopup() {
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
if (!donotShowUnmuteAgain) {
var span = document.createElement("span");
@ -479,28 +511,9 @@ function playerPlay(currentTime) {
player.userActive(true);
}, 500);
}
}
}, 1000);
}).catch(function (error) {
console.log("playerPlay: Autoplay was prevented, trying to mute and play ***");
playMuted(currentTime);
});
} else {
tryToPlay(currentTime);
}
} catch (e) {
console.log("playerPlay: We could not autoplay, trying again in 1 second");
tryToPlay(currentTime);
}
} else {
console.log("playerPlay: Player is Undefined");
}
}
function tryToPlay(currentTime) {
clearTimeout(promisePlayTimeout);
promisePlayTimeoutTime += 200;
promisePlayTimeout = setTimeout(function () {
if (player.paused()) {
playerPlay(currentTime);
@ -508,21 +521,32 @@ function tryToPlay(currentTime) {
}, promisePlayTimeoutTime);
}
function tryToPlayMuted(currentTime) {
muteInCookieAllow();
return tryToPlay(currentTime);
}
function muteIfNotAudio() {
if (!player.isAudio()) {
console.log("muteIfNotAudio: We will mute this video");
player.muted(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;
}
function playMuted(currentTime) {
var mute = Cookies.get('muted');
if (typeof mute === 'undefined' || (mute && mute !== "false")) {
muteIfNotAudio();
}
muteInCookieAllow();
return playerPlay(currentTime);
;
}
function showMuteTooltip() {

View file

@ -1378,7 +1378,7 @@ echo AVideoPlugin::getManagerVideosReset();
if ($('#encodeProgress' + id).children().length) {
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 += '<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> ';

View file

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

View file

@ -35,20 +35,13 @@ if (empty($video)) {
forbiddenPage("Video not found");
}
if (empty($customizedAdvanced)) {
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
// 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'])) {
forbiddenPage("Embed is forbidden");
}
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
if (!empty($objSecure)) {
$objSecure->verifyEmbedSecurity();
if (!isSameDomain(@$_SERVER['HTTP_REFERER'], $global['webSiteRootURL'])) {
if (!empty($advancedCustomUser->blockEmbedFromSharedVideos) && !CustomizeUser::canShareVideosFromVideo($video['id'])) {
forbiddenPage("Embed is forbidden");
}
}

View file

@ -1,4 +1,5 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
@ -17,6 +18,19 @@ $path_parts = pathinfo($_GET['file']);
$file = $path_parts['basename'];
$path = "{$global['systemRootPath']}videos/{$file}";
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 ");
forbiddenPage("Cant read this");