1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/videoDelete.json.php
2022-03-17 11:43:59 -03:00

25 lines
721 B
PHP

<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::canUpload() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}');
}
require_once 'video.php';
if (!is_array($_POST['id'])) {
$_POST['id'] = [$_POST['id']];
}
$id = 0;
foreach ($_POST['id'] as $value) {
$obj = new Video("", "", $value);
if (!$obj->userCanManageVideo()) {
$obj->msg = __("You can not Manage This Video");
die(json_encode($obj));
}
$id = $obj->delete();
}
echo '{"status":"'.$id.'"}';