1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
DanielnetoDotCom 2020-12-29 12:55:35 -03:00
parent 31295962d7
commit 05852f7045
7 changed files with 1627 additions and 177 deletions

View file

@ -3,12 +3,13 @@ $defaultSwitch = false;
$youtubeSwitch = Plugin::isEnabledByName('YouTube');
$gallerySwitch = Plugin::isEnabledByName('Gallery');
$netflixSwitch = Plugin::isEnabledByName('YouPHPFlix2');
if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
$channelListSwitch = Plugin::isEnabledByName('FirstPageChannelList');
if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch) && empty($channelListSwitch)) {
$defaultSwitch = true;
}
?>
<div class="row">
<div class="col-xs-3">
<div class="col-sm-6 col-md-3 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
Default
@ -22,7 +23,7 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
</div>
</div>
</div>
<div class="col-xs-3">
<div class="col-sm-6 col-md-3 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
Netflix
@ -36,7 +37,22 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
</div>
</div>
</div>
<div class="col-xs-3">
<div class="clearfix hidden-md hidden-lg"></div>
<div class="col-sm-6 col-md-3 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
Channel
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="channelListSwitch" <?php echo $channelListSwitch ? "checked" : ""; ?>>
<label for="channelListSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/channel.png" class="img-responsive img-radio">
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
Gallery
@ -50,7 +66,8 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
</div>
</div>
</div>
<div class="col-xs-3">
<div class="clearfix"></div>
<div class="col-sm-6 col-md-3 col-lg-3">
<div class="panel panel-danger">
<div class="panel-heading">
YouTube <span class="label label-danger" data-toggle="tooltip" title="This layout will be removed in future releases, use the Gallery instead"> Deprecated </span>
@ -71,10 +88,12 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
var netflixSwitch = $('#netflixSwitch').is(":checked");
var gallerySwitch = $('#gallerySwitch').is(":checked");
var youtubeSwitch = $('#youtubeSwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch && !youtubeSwitch) {
var channelListSwitch = $('#channelListSwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch && !youtubeSwitch && !channelListSwitch) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', true);
}
}
@ -84,6 +103,7 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
@ -102,6 +122,11 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
@ -117,12 +142,15 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
});
}
});
}
});
});
$('#netflixSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
@ -141,6 +169,11 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
@ -156,12 +189,15 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
});
}
});
}
});
});
$('#gallerySwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#netflixSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
@ -180,6 +216,11 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
@ -195,12 +236,15 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
});
}
});
}
});
});
$('#youtubeSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
@ -219,6 +263,11 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
@ -234,6 +283,57 @@ if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch)) {
});
}
});
}
});
});
$('#channelListSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});

BIN
admin/img/channel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

View file

@ -0,0 +1,39 @@
<?php
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
class FirstPageChannelList extends PluginAbstract {
public function getTags() {
return array(
PluginTags::$RECOMMENDED,
PluginTags::$FREE,
PluginTags::$GALLERY,
PluginTags::$LAYOUT,
);
}
public function getDescription() {
return "Make the first page a Channel list";
}
public function getName() {
return "FirstPageChannelList";
}
public function getUUID() {
return "channel-first-page-977a-fd0e5cab205d";
}
public function getPluginVersion() {
return "1.0";
}
public function getFirstPage(){
global $global;
if(!AVideoPlugin::isEnabledByName("YouPHPFlix2") && !AVideoPlugin::isEnabledByName("CombineSites")){
return $global['systemRootPath'].'view/channels.php';
}
}
}

File diff suppressed because one or more lines are too long

135
view/downloadChecker.php Normal file
View file

@ -0,0 +1,135 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
$metaDescription = "Download checker";
function getChecked($text, $isChecked, $help = array()) {
$helpTXT = "";
if (!empty($help)) {
$helpTXT = '<ul class="list-group">';
foreach ($help as $value) {
$helpTXT .= '<li class="list-group-item" style="font-size: 0.7em;">' . $value . '</li>';
}
$helpTXT .= '</ul>';
}
if ($isChecked) {
return '<li class="list-group-item list-group-item-success"><i class="far fa-check-square"></i> ' . $text . $helpTXT . '</li>';
} else {
return '<li class="list-group-item list-group-item-danger"><i class="far fa-square"></i> ' . $text . $helpTXT . '</li>';
}
}
?>
<div class="panel panel-default">
<div class="panel-heading">
Site Download Configuration
</div>
<div class="panel-body">
<ul class="list-group">
<?php
$globallyDownload = CustomizeUser::canDownloadVideos();
$obj = AVideoPlugin::getObjectDataIfEnabled("CustomizeUser");
if (User::isAdmin()) {
$help = array();
$help[] = "Site Configurations menu / Advanced Configuration / Allow download video";
}
if (!$globallyDownload) {
if (empty($config->getAllow_download())) {
echo getChecked(__("Your Site Configurations is set to NOT Allow Download"), false, $help);
} else {
echo getChecked(__("Your Site Configurations is set to Allow Download"), true, $help);
}
if (User::isAdmin()) {
$help = array();
$help[] = "Plugins menu / CustomizeUser / nonAdminCannotDownload";
}
if ($obj->nonAdminCannotDownload) {
echo getChecked(__("Non admin users can download videos"), true, $help);
} else {
echo getChecked(__("Non admin users can NOT download videos"), false, $help);
}
}else{
echo getChecked(__("This site configuration allow download"), true, $help);
}
?>
</ul>
</div>
</div>
<?php
if (!empty($_REQUEST['videos_id'])) {
$video = new Video('', '', $_REQUEST['videos_id']);
$users_id = $video->getUsers_id();
$user = new User($users_id);
?>
<div class="panel panel-default">
<div class="panel-heading">
User Download Configuration (<?php echo User::getNameIdentificationById($users_id); ?>)
</div>
<div class="panel-body">
<ul class="list-group">
<?php
if (User::isAdmin()) {
$help = array();
$help[] = "Plugins menu / CustomizeUser / userCanAllowFilesDownload";
}else{
$help = array();
}
if (!empty($obj->userCanAllowFilesDownload)) {
$help[] = "My Videos menu / Allow Download My Videos";
if (!empty($user->getExternalOption('userCanAllowFilesDownload'))) {
if (!empty($obj->userCanAllowFilesDownloadSelectPerVideo)) {
echo getChecked(__("This user do allow download selected videos"), true, $help);
} else {
echo getChecked(__("This user do allow download all his files"), true, $help);
}
} else {
echo getChecked(__("This user do NOT allow download his files"), false, $help);
}
} else {
echo getChecked(__("The download is controlled by the system, there is nothing to check on the user"), true, $help);
}
?>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Video Download Configuration (<?php echo $video->getTitle(); ?>)
</div>
<div class="panel-body">
<ul class="list-group">
<?php
$canDownloadVideoFromVideo = CustomizeUser::canDownloadVideosFromVideo($video->getId());
if ($canDownloadVideoFromVideo) {
echo getChecked(__("This video can be downloaded"), true);
} else {
$category = new Category($video->getCategories_id());
$help = array();
$help[] = "Categories menu / Edit a category / Meta Data / Allow Download";
if (is_object($category) && !$category->getAllow_download()) {
echo getChecked(__("This category do not allow download"), false, $help);
} else {
echo getChecked(__("This category allow download"), true, $help);
}
if (!empty($obj->userCanAllowFilesDownloadSelectPerVideo)) {
$help = array();
$help[] = "My Videos menu / Edit a video / Allow Download This media";
if (empty($video->getCan_download())) {
echo getChecked(__("User must allow each video individually, but this video is not marked for download"), false, $help);
} else {
echo getChecked(__("This video checked for download"), true, $help);
}
} else {
echo getChecked(__("The download permission is site wide, so there is nothing to check on the video"), true);
}
}
?>
</ul>
</div>
</div>
<?php
}
?>

View file

@ -865,22 +865,37 @@ function avideoToast(msg) {
$.toast(msg);
}
function avideoAlertAJAXHTML(url) {
modal.showPleaseWait();
$.ajax({
url: url,
success: function (response) {
avideoAlertText(response);
modal.hidePleaseWait();
}
});
}
function avideoAlertHTMLText(title, msg, type) {
var span = document.createElement("span");
span.innerHTML = msg;
swal({
title: title,
content: span,
type: type,
icon: type,
html: true,
closeModal: true
closeModal: true,
buttons: type?true:false,
});
}
function avideoAlertText(msg) {
avideoAlert("", msg, '');
}
function avideoAlertInfo(msg) {
avideoAlert("Info", msg, 'info');
}
function avideoAlertError(msg) {
avideoAlert("Error", msg, 'error');
}

View file

@ -534,7 +534,7 @@
<input type="number" step="1" id="views_count" class="form-control externalOptions" >
</div>
<?php
}else{
} else {
?><input type="hidden" id="views_count" value="-1"><?php
}
?>
@ -1791,7 +1791,7 @@ if (CustomizeUser::canDownloadVideos()) {
var downloadURL = addGetParam(url, 'download', 1);
var pattern = /^m3u8/i;
if (pattern.test(k) === true) {
downloadURL = addGetParam(downloadURL, 'title', row.clean_title+'_'+k+'.mp4');
downloadURL = addGetParam(downloadURL, 'title', row.clean_title + '_' + k + '.mp4');
download += '<div class="btn-group btn-group-justified">';
download += '<a class="btn btn-default btn-xs" onclick="copyToClipboard(\'' + url + '\');" ><span class="fa fa-copy " aria-hidden="true"></span> ' + k + '</a>';
download += '<a href="' + downloadURL + '" class="btn btn-default btn-xs" target="_blank" ><span class="fa fa-download " aria-hidden="true"></span> MP4</a>';
@ -1802,6 +1802,10 @@ if (CustomizeUser::canDownloadVideos()) {
}
<?php
} else if(!empty ($config->getAllow_download()) || User::isAdmin()){
?>
download = '<button type="button" class="btn btn-default btn-xs btn-block" onclick="whyICannotDownload(' + row.id + ');" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Why I cannot download?")); ?>"><span class="fa-stack" style="font-size: 0.8em;"><i class="fa fa-download fa-stack-1x"></i><i class="fas fa-ban fa-stack-2x" style="color:Tomato"></i></span></button>';
<?php
}
?>
@ -2205,4 +2209,7 @@ if (!empty($_GET['link'])) {
}, 500);
});
function whyICannotDownload(videos_id) {
avideoAlertAJAXHTML(webSiteRootURL + "view/downloadChecker.php?videos_id=" + videos_id);
}
</script>