mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
bf6d700807
commit
0a1b889e07
4 changed files with 40 additions and 12 deletions
|
@ -4,6 +4,8 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
|||
|
||||
class BulkEmbed extends PluginAbstract {
|
||||
|
||||
const PERMISSION_BULK_EMBED = 0;
|
||||
|
||||
public function getTags() {
|
||||
return array(
|
||||
PluginTags::$FREE,
|
||||
|
@ -50,12 +52,39 @@ class BulkEmbed extends PluginAbstract {
|
|||
public function getUploadMenuButton(){
|
||||
global $global;
|
||||
$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 '<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;
|
||||
|
||||
$objo = AVideoPlugin::getObjectDataIfEnabled('BulkEmbed');
|
||||
if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
||||
|
||||
if(!BulkEmbed::canBulkEmbed()){
|
||||
$obj->msg[] = __("Permission denied");
|
||||
$obj->msg[] = "Plugin disabled";
|
||||
} else if (!User::canUpload()) {
|
||||
$obj->msg[] = __("Permission denied");
|
||||
$obj->msg[] = "User can not upload videos";
|
||||
} else if (!empty($_POST['itemsToSave'])) {
|
||||
|
||||
if (!empty($_POST['playListName'])) {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
require_once '../../videos/configuration.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if (!User::isLogged()) {
|
||||
die(json_encode(['error' => true, 'msg'=>'You must be logged in to search']));
|
||||
if(!BulkEmbed::canBulkEmbed()){
|
||||
forbiddenPage('You cannot search');
|
||||
}
|
||||
|
||||
$query = $_POST['query'] ?? '';
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
require_once '../../videos/configuration.php';
|
||||
if (!User::isLogged()) {
|
||||
forbiddenPage("You can not do this");
|
||||
exit;
|
||||
|
||||
if(!BulkEmbed::canBulkEmbed()){
|
||||
forbiddenPage('You cannot do this');
|
||||
}
|
||||
|
||||
$obj = AVideoPlugin::getObjectData("BulkEmbed");
|
||||
|
||||
$_page = new Page(array('Search'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue