9 sub userinfo_retrieve () { #{{{
10 my $userinfo=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
14 sub userinfo_store ($) { #{{{
17 my $oldmask=umask(077);
18 my $ret=Storable::lock_store($userinfo, "$config{wikistatedir}/userdb");
23 sub userinfo_get ($$) { #{{{
27 my $userinfo=userinfo_retrieve();
28 if (! defined $userinfo ||
29 ! exists $userinfo->{$user} || ! ref $userinfo->{$user} ||
30 ! exists $userinfo->{$user}->{$field}) {
33 return $userinfo->{$user}->{$field};
36 sub userinfo_set ($$$) { #{{{
41 my $userinfo=userinfo_retrieve();
42 if (! defined $userinfo ||
43 ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) {
47 $userinfo->{$user}->{$field}=$value;
48 return userinfo_store($userinfo);
51 sub userinfo_setall ($$) { #{{{
55 my $userinfo=userinfo_retrieve();
56 if (! defined $userinfo) {
59 $userinfo->{$user}=$info;
60 return userinfo_store($userinfo);
63 sub is_admin ($) { #{{{
66 return grep { $_ eq $user_name } @{$config{adminuser}};
69 sub page_subscribers (@) { #{{{
71 my $userinfo=userinfo_retrieve();
72 foreach my $user (keys %{$userinfo}) {
73 if (exists $userinfo->{$user}->{subscriptions} &&
74 length $userinfo->{$user}->{subscriptions} &&
75 exists $userinfo->{$user}->{email} &&
76 length $userinfo->{$user}->{email} &&
77 grep { globlist_match($_, $userinfo->{$user}->{subscriptions}) } @_) {
78 push @ret, $userinfo->{$user}->{email};