summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm5
-rw-r--r--IkiWiki/Plugin/comments.pm5
-rw-r--r--IkiWiki/Plugin/editpage.pm5
-rw-r--r--IkiWiki/Plugin/passwordauth.pm2
-rw-r--r--IkiWiki/Plugin/recentchanges.pm2
5 files changed, 12 insertions, 7 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 6226824df..0715f1869 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1090,6 +1090,11 @@ sub htmllink ($$$;@) {
return "<a href=\"$bestlink\"@attrs>$linktext</a>";
}
+sub userpage ($) {
+ my $user=shift;
+ return length $config{userdir} ? "$config{userdir}/$user" : $user;
+}
+
sub openiduser ($) {
my $user=shift;
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 5586cca52..caed0d58c 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -171,9 +171,8 @@ sub preprocess {
else {
$commentauthorurl = IkiWiki::cgiurl(
do => 'goto',
- page => (length $config{userdir}
- ? "$config{userdir}/$commentuser"
- : "$commentuser"));
+ page => IkiWiki::userpage($commentuser)
+ );
$commentauthor = $commentuser;
}
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index fca970c60..219386a30 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -245,8 +245,9 @@ sub cgi_editpage ($$) {
push @page_locs, $dir.$page;
}
- push @page_locs, "$config{userdir}/$page"
- if length $config{userdir};
+ my $userpage=IkiWiki::userpage($page);
+ push @page_locs, $userpage
+ if ! grep { $_ eq $userpage } @page_locs;
}
@page_locs = grep {
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index b3a798055..c07065b7d 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -223,7 +223,7 @@ sub formbuilder_setup (@) {
shift eq $form->field("password");
});
- my $userpage=$config{userdir} ? $config{userdir}."/".$user : $user;
+ my $userpage=IkiWiki::userpage($user);
if (exists $pagesources{$userpage}) {
$form->text(gettext("Your user page: ").
htmllink("", "", $userpage,
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index fa851e466..5c7b71aaa 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -124,7 +124,7 @@ sub store ($$$) {
elsif (length $config{cgiurl}) {
$change->{authorurl} = IkiWiki::cgiurl(
do => "goto",
- page => (length $config{userdir} ? "$config{userdir}/" : "").$change->{author},
+ page => IkiWiki::userpage($change->{author}),
);
}