1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/playlistAddNew.json.php
2022-07-26 11:39:06 -03:00

29 lines
809 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';
require_once $global['systemRootPath'] . 'objects/playlist.php';
$plugin = AVideoPlugin::loadPluginIfEnabled("PlayLists");
if (empty($plugin)) {
die('{"error":"Plugin not enabled"}');
}
if (!User::isLogged()) {
die('{"error":"'.__("Permission denied").'"}');
}
if (empty($_POST['name'])) {
die('{"error":"'.__("Name can't be blank").'"}');
}
$obj = new PlayList(@$_POST['id']);
if(!empty($obj->getUsers_id())){
forbidIfItIsNotMyUsersId($obj->getUsers_id());
}
$obj->setName($_POST['name']);
$obj->setStatus($_POST['status']);
echo '{"status":"'.$obj->save().'"}';