summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/moderatedcomments.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-06-23 16:32:20 -0400
committerJoey Hess <joey@kitenet.net>2010-06-23 16:35:51 -0400
commit4292802ee5f93f7ec7644c5d0a30f7ffeb95e566 (patch)
tree603a4a6f366f411b2ef1909825d400db6ad65bc7 /IkiWiki/Plugin/moderatedcomments.pm
parentb4a43406f61b7ff9ab77d242edf4d59369ac8596 (diff)
stop using REMOTE_ADDR
Everywhere that REMOTE_ADDR was used, a session object is available, so instead use its remote_addr method. In IkiWiki::Receive, stop setting a dummy REMOTE_ADDR. Note that it's possible for a session cookie to be obtained using one IP address, and then used from another IP. In this case, the first IP will now be used. I think that should be ok.
Diffstat (limited to 'IkiWiki/Plugin/moderatedcomments.pm')
-rw-r--r--IkiWiki/Plugin/moderatedcomments.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/moderatedcomments.pm b/IkiWiki/Plugin/moderatedcomments.pm
index ff2c2b160..5957833fc 100644
--- a/IkiWiki/Plugin/moderatedcomments.pm
+++ b/IkiWiki/Plugin/moderatedcomments.pm
@@ -48,11 +48,11 @@ sub checkcontent (@) {
}
my $session=$params{session};
- my $user=$session->param("name") if $session;
+ my $user=$session->param("name");
if (pagespec_match($params{page}, $config{moderate_pagespec},
location => $params{page},
(defined $user ? (user => $user) : ()),
- (defined $ENV{REMOTE_ADDR} ? (ip => $ENV{REMOTE_ADDR}) : ()),
+ (defined $session->remote_addr() ? (ip => $session->remote_addr()) : ()),
)) {
return gettext("comment needs moderation");
}