-sub userinfo_get ($$) { #{{{
- my $user=shift;
- my $field=shift;
-
- eval q{use Storable};
- my $userdata=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
- if (! defined $userdata || ! ref $userdata ||
- ! exists $userdata->{$user} || ! ref $userdata->{$user} ||
- ! exists $userdata->{$user}->{$field}) {
- return "";
- }
- return $userdata->{$user}->{$field};
-} #}}}
-
-sub userinfo_set ($$$) { #{{{
- my $user=shift;
- my $field=shift;
- my $value=shift;
-
- eval q{use Storable};
- my $userdata=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
- if (! defined $userdata || ! ref $userdata ||
- ! exists $userdata->{$user} || ! ref $userdata->{$user}) {
- return "";
- }
-
- $userdata->{$user}->{$field}=$value;
- my $oldmask=umask(077);
- my $ret=Storable::lock_store($userdata, "$config{wikistatedir}/userdb");
- umask($oldmask);
- return $ret;
-} #}}}
-
-sub userinfo_setall ($$) { #{{{
- my $user=shift;
- my $info=shift;
-
- eval q{use Storable};
- my $userdata=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") };
- if (! defined $userdata || ! ref $userdata) {
- $userdata={};
- }
- $userdata->{$user}=$info;
- my $oldmask=umask(077);
- my $ret=Storable::lock_store($userdata, "$config{wikistatedir}/userdb");
- umask($oldmask);
- return $ret;
-} #}}}
-
-sub is_admin ($) { #{{{
- my $user_name=shift;
-
- return grep { $_ eq $user_name } @{$config{adminuser}};
-} #}}}
-