. */ namespace Liuch\DmarcSrg; use Liuch\DmarcSrg\ErrorHandler; use Liuch\DmarcSrg\Settings\SettingsList; use Liuch\DmarcSrg\Exception\RuntimeException; require 'init.php'; if (Core::isJson()) { if (Core::method() == 'GET') { try { Core::instance()->auth()->isAllowed(); $result = Core::instance()->status()->get(); if (!($result['error_code'] ?? 0)) { $settings_query = $_GET['settings'] ?? ''; if (!empty($settings_query)) { $settings = []; foreach (explode(',', $settings_query) as $name) { $setting = SettingsList::getSettingByName($name); $settings[$name] = $setting->value(); } $result['settings'] = $settings; } } Core::sendJson($result); } catch (RuntimeException $e) { $r = ErrorHandler::exceptionResult($e); if ($e->getCode() == -2) { $r['authenticated'] = 'no'; } Core::sendJson($r); } return; } } Core::sendBad();