foreach my $b (@{$config{banned_users}}) {
if (pagespec_match("", $b,
- ip => $ENV{REMOTE_ADDR},
+ ip => $session->remote_addr(),
name => defined $name ? $name : "",
)) {
$banned=1;
$config{allowed_attachments},
file => $file,
user => $session->param("name"),
- ip => $ENV{REMOTE_ADDR},
+ ip => $session->remote_addr(),
);
}
IkiWiki::disable_commit_hook();
IkiWiki::rcs_commit($filename, gettext("attachment upload"),
IkiWiki::rcs_prepedit($filename),
- $session->param("name"), $ENV{REMOTE_ADDR});
+ $session->param("name"),
+ $session->remote_addr());
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
}
sub checkcontent (@) {
my %params=@_;
+ my $session=$params{session};
if (exists $config{blogspam_pagespec}) {
return undef
push @options, "exclude=stopwords";
my %req=(
- ip => $ENV{REMOTE_ADDR},
+ ip => $session->remote_addr(),
comment => defined $params{diff} ? $params{diff} : $params{content},
subject => defined $params{subject} ? $params{subject} : "",
name => defined $params{author} ? $params{author} : "",
$username =~ s/"/"/g;
$content .= " username=\"$username\"\n";
}
- elsif (defined $ENV{REMOTE_ADDR}) {
- my $ip = $ENV{REMOTE_ADDR};
+ elsif (defined $session->remote_addr()) {
+ my $ip = $session->remote_addr();
if ($ip =~ m/^([.0-9]+)$/) {
$content .= " ip=\"$1\"\n";
}
IkiWiki::rcs_add($file);
IkiWiki::disable_commit_hook();
$conflict = IkiWiki::rcs_commit_staged($message,
- $session->param('name'), $ENV{REMOTE_ADDR});
+ $session->param('name'),
+ $session->remote_addr());
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
}
my $message = gettext("Comment moderation");
IkiWiki::disable_commit_hook();
$conflict=IkiWiki::rcs_commit_staged($message,
- $session->param('name'), $ENV{REMOTE_ADDR});
+ $session->param('name'),
+ $session->remote_addr());
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
}
disable_commit_hook();
$conflict=rcs_commit($file, $message,
$form->field("rcsinfo"),
- $session->param("name"), $ENV{REMOTE_ADDR});
+ $session->param("name"),
+ $session->remote_addr());
enable_commit_hook();
rcs_update();
}
if (defined $config{locked_pages} && length $config{locked_pages} &&
pagespec_match($page, $config{locked_pages},
user => $session->param("name"),
- ip => $ENV{REMOTE_ADDR},
+ ip => $session->remote_addr(),
)) {
if ((! defined $user ||
! IkiWiki::userinfo_get($session->param("name"), "regdate")) &&
}
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");
}
),
wikiurl => $config{url},
wikiname => $config{wikiname},
- REMOTE_ADDR => $ENV{REMOTE_ADDR},
+ remote_addr => $session->remote_addr(),
);
eval q{use Mail::Sendmail};
IkiWiki::disable_commit_hook();
IkiWiki::rcs_commit($pagesources{$page}, "poll vote ($choice)",
IkiWiki::rcs_prepedit($pagesources{$page}),
- $session->param("name"), $ENV{REMOTE_ADDR});
+ $session->param("name"),
+ $session->remote_addr());
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
}
IkiWiki::rcs_remove($file);
}
IkiWiki::rcs_commit_staged(gettext("removed"),
- $session->param("name"), $ENV{REMOTE_ADDR});
+ $session->param("name"),
+ $session->remote_addr());
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
}
}
IkiWiki::rcs_commit_staged(
sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
- $session->param("name"), $ENV{REMOTE_ADDR}) if $config{rcs};
+ $session->param("name"),
+ $session->remote_addr(),
+ ) if $config{rcs};
# Then link fixups.
foreach my $rename (@torename) {
$file,
sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}),
$token,
- $session->param("name"),
- $ENV{REMOTE_ADDR}
+ $session->param("name"),
+ $session->remote_addr(),
);
push @fixedlinks, $page if ! defined $conflict;
}
eval q{use CGI};
error($@) if $@;
my $cgi=CGI->new;
- $ENV{REMOTE_ADDR}='unknown' unless exists $ENV{REMOTE_ADDR};
# And dummy up a session object.
require IkiWiki::CGI;