2022-09-13 13:14:49 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
2023-01-01 20:23:53 +00:00
|
|
|
use Misuzu\Config\CfgTools;
|
2022-09-13 13:14:49 +00:00
|
|
|
use Misuzu\Users\User;
|
|
|
|
|
|
|
|
require_once '../../../misuzu.php';
|
|
|
|
|
|
|
|
if(!User::hasCurrent()
|
|
|
|
|| !perms_check_user(MSZ_PERMS_GENERAL, User::getCurrent()->getId(), MSZ_PERM_GENERAL_MANAGE_CONFIG)) {
|
|
|
|
echo render_error(403);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-07-18 21:48:44 +00:00
|
|
|
$valueName = (string)filter_input(INPUT_GET, 'name');
|
|
|
|
$valueInfo = $cfg->getValueInfo($valueName);
|
|
|
|
if($valueInfo === null) {
|
|
|
|
echo render_error(404);
|
|
|
|
return;
|
|
|
|
}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-07-18 21:48:44 +00:00
|
|
|
if($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
|
|
|
|
$valueName = $valueInfo->getName();
|
|
|
|
$msz->createAuditLog('CONFIG_DELETE', [$valueName]);
|
|
|
|
$cfg->removeValues($valueName);
|
2022-09-13 13:14:49 +00:00
|
|
|
url_redirect('manage-general-settings');
|
2023-07-18 21:48:44 +00:00
|
|
|
return;
|
2022-09-13 13:14:49 +00:00
|
|
|
}
|
2023-07-18 21:48:44 +00:00
|
|
|
|
|
|
|
Template::render('manage.general.setting-delete', [
|
|
|
|
'config_value' => $valueInfo,
|
|
|
|
]);
|