X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/5cd32c2eeeafc5e9f3feae7983fc48a9711462a3..3b0fce93e40e5457b63ceda9692901539eb4fc82:/IkiWiki/CGI.pm diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index e5cee9cb9..e219c8c1c 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -2,6 +2,7 @@ use warnings; use strict; +use IkiWiki; use IkiWiki::UserInfo; package IkiWiki; @@ -12,7 +13,7 @@ sub page_locked ($$;$) { #{{{ my $nonfatal=shift; my $user=$session->param("name"); - return if length $user && is_admin($user); + return if defined $user && is_admin($user); foreach my $admin (@{$config{adminuser}}) { my $locked_pages=userinfo_get($admin, "locked_pages"); @@ -360,13 +361,6 @@ sub cgi_editpage ($$) { #{{{ if (! $form->submitted || $form->submitted eq "Preview" || ! $form->validate) { if ($form->field("do") eq "create") { - if (exists $pagesources{lc($page)}) { - # hmm, someone else made the page in the - # meantime? - print $q->redirect("$config{url}/".htmlpage($page)); - return; - } - my @page_locs; my $best_loc; my ($from)=$form->param('from')=~/$config{wiki_file_regexp}/; @@ -395,13 +389,20 @@ sub cgi_editpage ($$) { #{{{ $dir=~s![^/]+/+$!!; push @page_locs, $dir.$page; } - - @page_locs = grep { - ! exists $pagesources{lc($_)} && - ! page_locked($_, $session, 1) - } @page_locs; } + @page_locs = grep { + ! exists $pagesources{lc($_)} && + ! page_locked($_, $session, 1) + } @page_locs; + + if (! @page_locs) { + # hmm, someone else made the page in the + # meantime? + print $q->redirect("$config{url}/".htmlpage($page)); + return; + } + $form->tmpl_param("page_select", 1); $form->field(name => "page", type => 'select', options => \@page_locs, value => $best_loc);