name = __('Unmoderated authors'); $this->description = __('Whitelist of unmoderated authors'); } public function isSpam($type, $author, $email, $site, $ip, $content, $post_id, &$status) { if ($type != 'comment' || dcCore::app()->blog === null || dcCore::app()->blog->settings->system->comments_pub) { return null; } try { $wlc = new Core(); if ($wlc->isUnmoderated($email)) { $status = 'unmoderated'; # return true in order to change comment_status after return true; } return null; } catch (Exception $e) { } } public function gui(string $url): string { $wlc = new Core(); $posts = $comments = []; try { if (!empty($_POST['update_unmoderated'])) { $wlc->emptyUnmoderated(); foreach ($_POST['unmoderated'] as $email) { $wlc->addUnmoderated($email); } $wlc->commit(); dcPage::addSuccessNotice(__('Unmoderated names have been successfully updated.')); http::redirect($url); } $posts = $wlc->getPostsUsers(); $comments = $wlc->getCommentsUsers(); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } $res = ''; if (dcCore::app()->blog->settings->system->comments_pub) { $res .= '
'; } $res .= ''; return $res; } }