X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/26774c931ce1aa4b91e7129ad602a23b244008b2..182748a9c199ea64131984d7476be741dc6dd8bb:/IkiWiki/CGI.pm?ds=sidebyside diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index f550b673a..fe89e2758 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -83,12 +83,16 @@ sub cgi_recentchanges ($) { #{{{ foreach my $change (@$changelog) { $change->{when} = concise(ago($change->{when})); $change->{user} = htmllink("", "", escapeHTML($change->{user}), 1); + + my $is_excess = exists $change->{pages}[10]; # limit pages to first 10 + delete @{$change->{pages}}[10 .. @{$change->{pages}}] if $is_excess; $change->{pages} = [ map { $_->{link} = htmllink("", "", $_->{page}, 1); $_; } @{$change->{pages}} ]; + push @{$change->{pages}}, { link => '...' } if $is_excess; } my $template=template("recentchanges.tmpl"); @@ -314,6 +318,11 @@ sub cgi_prefs ($$) { #{{{ if (! is_admin($user_name)) { $form->field(name => "locked_pages", type => "hidden"); } + + if ($config{httpauth}) { + $form->field(name => "password", type => "hidden"); + $form->field(name => "confirm_password", type => "hidden"); + } if (! $form->submitted) { $form->field(name => "email", force => 1, @@ -457,7 +466,7 @@ sub cgi_editpage ($$) { #{{{ value => $content, force => 1); $form->field(name => "comments", value => $comments, force => 1); - $config{rss}=0; # avoid preview writing an rss feed! + $config{rss}=$config{atom}=0; # avoid preview writing a feed! $form->tmpl_param("page_preview", htmlize($page, $type, linkify($page, "", @@ -643,6 +652,7 @@ sub cgi () { #{{{ # Everything below this point needs the user to be signed in. if (((! $config{anonok} || $do eq 'prefs') && + (! $config{httpauth}) && (! defined $session->param("name") || ! userinfo_get($session->param("name"), "regdate"))) || $do eq 'signin') { cgi_signin($q, $session); @@ -654,6 +664,22 @@ sub cgi () { #{{{ return; } + + if ($config{httpauth} && (! defined $session->param("name"))) { + if (! defined $q->remote_user()) { + error("Could not determine authenticated username."); + } + else { + $session->param("name", $q->remote_user()); + if (!userinfo_get($session->param("name"),"regdate")) { + userinfo_setall($session->param("name"), { + email => "", + password => "", + regdate=>time, + }); + } + } + } if ($do eq 'create' || $do eq 'edit') { cgi_editpage($q, $session);