1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
Oinktube/objects/pluginAddDataObject.json.php
Caleb Mazalevskis 27a7925b98
Refactor.
2022-01-06 21:44:29 +08:00

22 lines
701 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().'"}';