optional template
[ikiwiki.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index 0266edfa45d928cf69a1054dc3bfc00939bc71ba..fa214971bb96bc11c8684844f319b31ec8830e26 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -432,8 +432,8 @@ sub rcs_recentchanges ($) { #{{{
                                return @ret if @ret >= $num;
                                
                                $state='header';
                                return @ret if @ret >= $num;
                                
                                $state='header';
-                               $message=$rev=$user=$when=undef;
-                               @pages=();
+                               $rev=$user=$when=undef;
+                               @pages=@message=();
                        }
                        elsif ($state eq 'body') {
                                push @message, {line => $_},
                        }
                        elsif ($state eq 'body') {
                                push @message, {line => $_},
@@ -693,6 +693,7 @@ sub cgi_signin ($$) { #{{{
                javascript => 0,
                params => $q,
                action => $q->request_uri,
                javascript => 0,
                params => $q,
                action => $q->request_uri,
+               template => (-e "$templatedir/signin.tmpl" ? "$templatedir/signin.tmpl" : "")
        );
        
        $form->sessionid($session->id);
        );
        
        $form->sessionid($session->id);
@@ -777,23 +778,26 @@ sub cgi () { #{{{
        eval q{use CGI::Session};
        
        my $q=CGI->new;
        eval q{use CGI::Session};
        
        my $q=CGI->new;
-       # session id has to be _sessionid for CGI::FormBuilder to work.
-       # TODO: stop having the formbuilder emit cookies and change session
-       # id to something else.
-       CGI::Session->name("_sessionid");
-       my $session = CGI::Session->new(undef, $q,
-               { Directory=> "$srcdir/.ikiwiki/sessions" });
        
        my $do=$q->param('do');
        if (! defined $do || ! length $do) {
                error("\"do\" parameter missing");
        }
        
        
        my $do=$q->param('do');
        if (! defined $do || ! length $do) {
                error("\"do\" parameter missing");
        }
        
+       # This does not need a session.
        if ($do eq 'recentchanges') {
                cgi_recentchanges($q);
                return;
        }
        
        if ($do eq 'recentchanges') {
                cgi_recentchanges($q);
                return;
        }
        
+       # session id has to be _sessionid for CGI::FormBuilder to work.
+       # TODO: stop having the formbuilder emit cookies and change session
+       # id to something else.
+       CGI::Session->name("_sessionid");
+       my $session = CGI::Session->new(undef, $q,
+               { Directory=> "$srcdir/.ikiwiki/sessions" });
+       
+       # Everything below this point needs the user to be signed in.
        if ((! $anonok && ! defined $session->param("name")) || $do eq 'signin') {
                cgi_signin($q, $session);
                return;
        if ((! $anonok && ! defined $session->param("name")) || $do eq 'signin') {
                cgi_signin($q, $session);
                return;