From d4b44755215a40dd163753719e539bf84124587d Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 20 Nov 2006 21:02:45 +0000 Subject: improvement --- IkiWiki/CGI.pm | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'IkiWiki') 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} = "{user}."\">".escapeHTML($oid->display).""; - } - 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 "".escapeHTML($oid->display).""; + } + else { + return htmllink("", "", escapeHTML($user), 1); + } +} #}}} + 1 -- cgit v1.2.3