blog->settings->addNamespace('rest'); if (is_null($core->blog->settings->rest->rest_active)) { try { $core->blog->settings->rest->put('rest_active',false,'boolean',true); $core->blog->settings->rest->put('rest_send_cors_headers',true,'boolean',true); $core->blog->triggerBlog(); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } //a form is submitted if (!empty($_POST['saveconfig'])){ try { $core->blog->settings->addNameSpace('rest'); $active = (empty($_POST['active'])) ? false : true; $core->blog->settings->rest->put('rest_active',$active,'boolean'); $sendHeaders = (empty($_POST['sendHeaders'])) ? false : true; $core->blog->settings->rest->put('rest_send_cors_headers',$sendHeaders,'boolean'); dcPage::addSuccessNotice(__('Configuration successfully updated.')); http::redirect($p_url); }catch (Exception $e) { $core->error->add($e->getMessage()); } http::redirect($p_url.'&saveconfig=1'); } // Getting current parameters $active = (boolean)$core->blog->settings->rest->rest_active; $sendHeaders =(boolean)$core->blog->settings->rest->rest_send_cors_headers; ?>