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

25 lines
808 B
PHP

<?php
namespace Misuzu;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->getPerms('global')->check(Perm::G_CONFIG_MANAGE))
Template::throwError(403);
$valueName = (string)filter_input(INPUT_GET, 'name');
$valueInfo = $msz->config->getValueInfo($valueName);
if($valueInfo === null)
Template::throwError(404);
if($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
$valueName = $valueInfo->getName();
$msz->createAuditLog('CONFIG_DELETE', [$valueName]);
$msz->config->removeValues($valueName);
Tools::redirect($msz->urls->format('manage-general-settings'));
return;
}
Template::render('manage.general.setting-delete', [
'config_value' => $valueInfo,
]);