From 85662575c5ca5fdca4581e3c13d612cc4c82f218 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 27 Mar 2020 19:42:46 +0000 Subject: [PATCH] stop warning for lack of referer / user-agent - not having those is now pretty normal --- ext/comment/main.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 29effc54..c8ac0060 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -551,18 +551,9 @@ class CommentList extends Extension 'website' => '', 'body' => $text, 'permalink' => '', - ]; - - # akismet breaks if there's no referrer in the environment; so if there - # isn't, supply one manually - if (!isset($_SERVER['HTTP_REFERER'])) { - $comment['referrer'] = 'none'; - log_warning("comment", "User '{$user->name}' commented with no referrer: $text"); - } - if (!isset($_SERVER['HTTP_USER_AGENT'])) { - $comment['user_agent'] = 'none'; - log_warning("comment", "User '{$user->name}' commented with no user-agent: $text"); - } + 'referrer' => $_SERVER['HTTP_REFERER'] ?? 'none', + 'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'none', + ]; $akismet = new Akismet( $_SERVER['SERVER_NAME'],