use warnings;
use strict;
+use IkiWiki;
use IkiWiki::UserInfo;
package IkiWiki;
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");
validate => sub {
my $name=shift;
length $name &&
- $name=~/$wiki_file_regexp/ &&
+ $name=~/$config{wiki_file_regexp}/ &&
! userinfo_get($name, "regdate");
},
);
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}/;
$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);
}
} #}}}
-sub cgi_hyperestraier () { #{{{
- # only works for GET requests
- chdir("$config{wikistatedir}/hyperestraier") || error("chdir: $!");
- exec("./".basename($config{cgiurl})) || error("estseek.cgi failed");
-} #}}}
-
sub cgi () { #{{{
eval q{use CGI};
eval q{use CGI::Session};
my $q=CGI->new;
+ if (exists $hooks{cgi}) {
+ foreach my $id (keys %{$hooks{cgi}}) {
+ $hooks{cgi}{$id}{call}->($q);
+ }
+ }
+
my $do=$q->param('do');
if (! defined $do || ! length $do) {
- if (defined $q->param('phrase')) {
- cgi_hyperestraier();
- }
- else {
- error("\"do\" parameter missing");
- }
+ error("\"do\" parameter missing");
}
# Things that do not need a session.