]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/signinedit.pm
Improve translatable texts to ease translation (e.g. to→into and from→inside)
[git.ikiwiki.info.git] / IkiWiki / Plugin / signinedit.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::signinedit;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9         hook(type => "getsetup", id => "signinedit", call => \&getsetup);
10         hook(type => "canedit", id => "signinedit", call => \&canedit,
11              last => 1);
12 }
14 sub getsetup () {
15         return
16                 plugin => {
17                         safe => 1,
18                         rebuild => 0,
19                 },
20 }
22 sub canedit ($$$) {
23         my $page=shift;
24         my $cgi=shift;
25         my $session=shift;
27         # Have the user sign in, if they are not already. This is why the
28         # hook runs last, so that any hooks that don't need the user to
29         # signin can override this.
30         if (! defined $session->param("name") ||
31             ! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
32                 return sub { IkiWiki::needsignin($cgi, $session) };
33         }
34         else {
35                 return "";
36         }
37 }
39 1