summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-20 21:02:45 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-20 21:02:45 +0000
commitd4b44755215a40dd163753719e539bf84124587d (patch)
tree2132c9a25a41588dc8046e62ab8565013bbc1390 /IkiWiki
parentc24be1b752c2b9a0067eddd911b8cee2808ac766 (diff)
improvement
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm30
1 files changed, 18 insertions, 12 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index e1cb83b49..b031aef56 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -46,7 +46,7 @@ sub page_locked ($$;$) { #{{{
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.");
}
}
@@ -77,22 +77,12 @@ sub cgi_recentchanges ($) { #{{{
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;
@@ -655,4 +645,20 @@ sub cgi (;$$) { #{{{
}
} #}}}
+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);
+ return "<a href=\"$user\">".escapeHTML($oid->display)."</a>";
+ }
+ else {
+ return htmllink("", "", escapeHTML($user), 1);
+ }
+} #}}}
+
1