1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Oinktube/objects/videoSuggest.php
2021-01-01 17:20:30 +08:00

22 lines
642 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 (!Permissions::canModerateVideos()) {
die('{"error":"'.__("Permission denied").'"}');
}
require_once $global['systemRootPath'] . 'objects/video.php';
if (!is_array($_POST['id'])) {
$_POST['id'] = array($_POST['id']);
}
$id = 0;
foreach ($_POST['id'] as $value) {
$obj = new Video('', '', $value);
$obj->setIsSuggested($_POST['isSuggested']);
$id = $obj->save();
}
echo '{"status":"'.$id.'"}';