32 lines
810 B
PHP
32 lines
810 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
use Misuzu\Config\CfgTools;
|
|
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;
|
|
}
|
|
|
|
$valueName = (string)filter_input(INPUT_GET, 'name');
|
|
$valueInfo = $cfg->getValueInfo($valueName);
|
|
if($valueInfo === null) {
|
|
echo render_error(404);
|
|
return;
|
|
}
|
|
|
|
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,
|
|
]);
|