if (pagespec_match($page, userinfo_get($admin, "locked_pages"))) {
return 1 if $nonfatal;
error(htmllink("", "", $page, 1)." is locked by ".
- htmllink("", "", $admin, 1)." and cannot be edited.");
+ userlink($admin)." and cannot be edited.");
}
}
eval q{use Time::Duration};
error($@) if $@;
- eval q{use CGI 'escapeHTML'};
- error($@) if $@;
my $changelog=[rcs_recentchanges(100)];
foreach my $change (@$changelog) {
$change->{when} = concise(ago($change->{when}));
- if ($change->{user} =~ m!^https?://! &&
- eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
- # Munge user-urls, as used by eg, OpenID.
- my $oid=Net::OpenID::VerifiedIdentity->new(identity => $change->{user});
- $change->{user} = "<a href=\"".$change->{user}."\">".escapeHTML($oid->display)."</a>";
- }
- else {
- $change->{user} = htmllink("", "", escapeHTML($change->{user}), 1);
- }
+ $change->{user} = userlink($change->{user});
my $is_excess = exists $change->{pages}[10]; # limit pages to first 10
delete @{$change->{pages}}[10 .. @{$change->{pages}}] if $is_excess;
}
} #}}}
+sub userlink ($) { #{{{
+ my $user=shift;
+
+ eval q{use CGI 'escapeHTML'};
+ error($@) if $@;
+ if ($user =~ m!^https?://! &&
+ eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
+ # Munge user-urls, as used by eg, OpenID.
+ my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
+ my $display=$oid->display;
+ # Convert "user.somehost.com" to "user [somehost.com]".
+ if ($display !~ /\[/) {
+ $display=~s/^(.*?)\.([^.]+\.[a-z]+)$/$1 [$2]/;
+ }
+ return "<a href=\"$user\">".escapeHTML($display)."</a>";
+ }
+ else {
+ return htmllink("", "", escapeHTML($user), 1);
+ }
+} #}}}
+
1