aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-02-04 18:24:15 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-02-04 18:24:15 -0500
commit8380a9d0009fee740f980aee3d45a933a5b24219 (patch)
tree625a29926e459c0f81fd5f70cd6ac45144297c36 /IkiWiki
parenta2e78ebcf27680eedf30e00f1ee9b86ed1d9e127 (diff)
downloadikiwiki-8380a9d0009fee740f980aee3d45a933a5b24219.tar
ikiwiki-8380a9d0009fee740f980aee3d45a933a5b24219.tar.gz
factor out a userpage function
Not yet exported, as only 4 quite core plugins use it.
Diffstat (limited to 'IkiWiki')
-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
4 files changed, 7 insertions, 7 deletions
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}),
);
}