misuzu/public-legacy/manage/general/setting-delete.php

24 lines
670 B
PHP

<?php
namespace Misuzu;
use Misuzu\Config\CfgTools;
if(!$msz->getAuthInfo()->getPerms('global')->check(Perm::G_CONFIG_MANAGE))
Template::throwError(403);
$valueName = (string)filter_input(INPUT_GET, 'name');
$valueInfo = $cfg->getValueInfo($valueName);
if($valueInfo === null)
Template::throwError(404);
if($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
$valueName = $valueInfo->getName();
$msz->createAuditLog('CONFIG_DELETE', [$valueName]);
$cfg->removeValues($valueName);
url_redirect('manage-general-settings');
return;
}
Template::render('manage.general.setting-delete', [
'config_value' => $valueInfo,
]);