mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Template/Update (Part 44)
* convert admin - config * test for presence of Memcached on enable * allow self-signed certs on domain self test
This commit is contained in:
34
endpoints/admin/siteconfig_add.php
Normal file
34
endpoints/admin/siteconfig_add.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
class AdminSiteconfigActionAddResponse extends TextResponse
|
||||
{
|
||||
protected int $requiredUserGroup = U_GROUP_DEV | U_GROUP_ADMIN;
|
||||
|
||||
protected array $expectedGET = array(
|
||||
'key' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Cfg::PATTERN_CONF_KEY_FULL]],
|
||||
'val' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextBlob'] ]
|
||||
);
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
if (!$this->assertGET('key', 'val'))
|
||||
{
|
||||
trigger_error('AdminSiteconfigActionAddResponse - malformed request received', E_USER_ERROR);
|
||||
$this->result = Lang::main('intError');
|
||||
return;
|
||||
}
|
||||
|
||||
$key = trim($this->_get['key']);
|
||||
$val = trim(urldecode($this->_get['val']));
|
||||
|
||||
$this->result = Cfg::add($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user