1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Oinktube/objects/pluginAddDataObject.json.php
2021-05-07 00:17:25 +08:00

23 lines
720 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/plugin.php';
if (!User::isAdmin()) {
die('{"error":"'.__("Permission denied").'"}');
}
if(empty($_POST['id'])){
die('{"error":"'.__("ID can't be blank").'"}');
}
$obj = new Plugin($_POST['id']);
// verify if some field needs to be encrypted
$_POST['object_data'] = Plugin::encryptIfNeed($_POST['object_data']);
$obj->setObject_data(addcslashes($_POST['object_data'],'\\'));
echo '{"status":"'.$obj->save().'"}';