From e0131b6ab501eaeda1003ac5131f803a36192d46 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Thu, 23 Dec 2010 11:48:09 +0100 Subject: Added users_prefs table and removed users.(skin|customcss) Will convert the other preferences later. --- lib/VNDB/Util/Auth.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/VNDB/Util/Auth.pm') diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm index 24e316ce..50b81eb2 100644 --- a/lib/VNDB/Util/Auth.pm +++ b/lib/VNDB/Util/Auth.pm @@ -14,7 +14,7 @@ use YAWF ':html'; use VNDB::Func; -our @EXPORT = qw| authInit authLogin authLogout authInfo authCan authPreparePass authGetCode authCheckCode |; +our @EXPORT = qw| authInit authLogin authLogout authInfo authCan authPreparePass authGetCode authCheckCode authPref |; # initializes authentication information and checks the vndb_auth cookie @@ -27,7 +27,7 @@ sub authInit { return _rmcookie($self) if length($cookie) < 41; my $token = substr($cookie, 0, 40); my $uid = substr($cookie, 40); - $self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended notifycount')->[0]; + $self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended notifycount prefs')->[0]; # update the sessions.lastused column if lastused < now()'6 hours' $self->dbSessionUpdateLastUsed($uid, $token) if $self->{_auth} && $self->{_auth}{session_lastused} < time()-6*3600; return _rmcookie($self) if !$self->{_auth}; @@ -196,5 +196,13 @@ sub _incorrectcode { } +sub authPref { + my($self, $key, $val) = @_; + return '' if !$self->authInfo->{id}; + return $self->{_auth}{prefs}{$key}||'' if @_ == 2; + $self->{_auth}{prefs}{$key} = $val; + $self->dbUserPrefSet($key, $val); +} + 1; -- cgit v1.2.3