Example #1
0
 static function admin_comment_settings($admin)
 {
     if (!Visitor::current()->group->can("change_settings")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
     }
     if (empty($_POST)) {
         return $admin->display("comment_settings");
     }
     if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
         show_403(__("Access Denied"), __("Invalid security key."));
     }
     $config = Config::current();
     $set = array($config->set("allowed_comment_html", explode(", ", $_POST['allowed_comment_html'])), $config->set("default_comment_status", $_POST['default_comment_status']), $config->set("comments_per_page", $_POST['comments_per_page']), $config->set("auto_reload_comments", $_POST['auto_reload_comments']), $config->set("enable_reload_comments", isset($_POST['enable_reload_comments'])));
     if (!empty($_POST['defensio_api_key'])) {
         $_POST['defensio_api_key'] = trim($_POST['defensio_api_key']);
         $defensio = new Defensio($config->url, $_POST['defensio_api_key']);
         if ($defensio->errorsExist()) {
             Flash::warning(__("Invalid Defensio API key."));
             $set[] = false;
         } else {
             $set[] = $config->set("defensio_api_key", $_POST['defensio_api_key']);
         }
     }
     if (!in_array(false, $set)) {
         Flash::notice(__("Settings updated."), "/admin/?action=comment_settings");
     }
 }