name = __('Reserved names'); $this->description = __('Whitelist of reserved names of users'); } public function isSpam($type, $author, $email, $site, $ip, $content, $post_id, &$status) { if ($type != 'comment') { return null; } $throw = false; try { $wlc = new Core(); if (true === $wlc->isReserved($author, $email)) { $status = 'reserved name'; //return true; $throw = true; } else { return null; } } catch (Exception $e) { } # This message is show to author even if comments are moderated, comment is not saved if ($throw) { throw new Exception(__('This name is reserved to an other user.')); } } public function getStatusMessage($status, $comment_id) { return __('This name is reserved to an other user.'); } public function gui(string $url): string { $wlc = new Core(); $comments = []; try { if (!empty($_POST['update_reserved'])) { $wlc->emptyReserved(); foreach ($_POST['reserved'] as $email => $name) { $wlc->addReserved($name, $email); } $wlc->commit(); } $comments = $wlc->getCommentsUsers(); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } $res = '
'; return $res; } }