mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
parent
bf6d700807
commit
0a1b889e07
4 changed files with 40 additions and 12 deletions
|
@ -3,6 +3,8 @@
|
||||||
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
||||||
|
|
||||||
class BulkEmbed extends PluginAbstract {
|
class BulkEmbed extends PluginAbstract {
|
||||||
|
|
||||||
|
const PERMISSION_BULK_EMBED = 0;
|
||||||
|
|
||||||
public function getTags() {
|
public function getTags() {
|
||||||
return array(
|
return array(
|
||||||
|
@ -50,12 +52,39 @@ class BulkEmbed extends PluginAbstract {
|
||||||
public function getUploadMenuButton(){
|
public function getUploadMenuButton(){
|
||||||
global $global;
|
global $global;
|
||||||
$obj = $this->getDataObject();
|
$obj = $this->getDataObject();
|
||||||
if(($obj->onlyAdminCanBulkEmbed && !User::isAdmin()) || !User::canUpload()){
|
|
||||||
|
if(BulkEmbed::canBulkEmbed()){
|
||||||
|
return '<li><a href="#" onclick="avideoModalIframeFull(webSiteRootURL+\'plugin/BulkEmbed/search.php\');return false;" class="faa-parent animated-hover"><span class="fas fa-link faa-burst"></span> '.__("Bulk Embed").'</a></li>';
|
||||||
|
}else{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<li><a href="#" onclick="avideoModalIframeFull(webSiteRootURL+\'plugin/BulkEmbed/search.php\');return false;" class="faa-parent animated-hover"><span class="fas fa-link faa-burst"></span> '.__("Bulk Embed").'</a></li>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getPermissionsOptions()
|
||||||
|
{
|
||||||
|
$permissions = array();
|
||||||
|
|
||||||
|
$permissions[] = new PluginPermissionOption(self::PERMISSION_BULK_EMBED, __("Can Bulk Embed"), "Members of the designated user group will have access Bulk Embed videos", 'BulkEmbed');
|
||||||
|
return $permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function canBulkEmbed()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (User::isAdmin() || isCommandLineInterface()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!User::isLogged()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$objo = AVideoPlugin::getObjectData("BulkEmbed");
|
||||||
|
if($objo->onlyAdminCanBulkEmbed && !User::isAdmin()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Permissions::hasPermission(self::PERMISSION_BULK_EMBED, 'BulkEmbed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,10 @@ $obj->msg = array();
|
||||||
$obj->playListId = 0;
|
$obj->playListId = 0;
|
||||||
|
|
||||||
$objo = AVideoPlugin::getObjectDataIfEnabled('BulkEmbed');
|
$objo = AVideoPlugin::getObjectDataIfEnabled('BulkEmbed');
|
||||||
if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
|
||||||
|
if(!BulkEmbed::canBulkEmbed()){
|
||||||
$obj->msg[] = __("Permission denied");
|
$obj->msg[] = __("Permission denied");
|
||||||
$obj->msg[] = "Plugin disabled";
|
$obj->msg[] = "Plugin disabled";
|
||||||
} else if (!User::canUpload()) {
|
|
||||||
$obj->msg[] = __("Permission denied");
|
|
||||||
$obj->msg[] = "User can not upload videos";
|
|
||||||
} else if (!empty($_POST['itemsToSave'])) {
|
} else if (!empty($_POST['itemsToSave'])) {
|
||||||
|
|
||||||
if (!empty($_POST['playListName'])) {
|
if (!empty($_POST['playListName'])) {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
require_once '../../videos/configuration.php';
|
require_once '../../videos/configuration.php';
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
if (!User::isLogged()) {
|
if(!BulkEmbed::canBulkEmbed()){
|
||||||
die(json_encode(['error' => true, 'msg'=>'You must be logged in to search']));
|
forbiddenPage('You cannot search');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $_POST['query'] ?? '';
|
$query = $_POST['query'] ?? '';
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
require_once '../../videos/configuration.php';
|
require_once '../../videos/configuration.php';
|
||||||
if (!User::isLogged()) {
|
|
||||||
forbiddenPage("You can not do this");
|
if(!BulkEmbed::canBulkEmbed()){
|
||||||
exit;
|
forbiddenPage('You cannot do this');
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = AVideoPlugin::getObjectData("BulkEmbed");
|
$obj = AVideoPlugin::getObjectData("BulkEmbed");
|
||||||
|
|
||||||
$_page = new Page(array('Search'));
|
$_page = new Page(array('Search'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue