diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/DB/Users.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Util/Auth.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Util/LayoutHTML.pm | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index 49b56823..d5cdcc6c 100644 --- a/lib/VNDB/DB/Users.pm +++ b/lib/VNDB/DB/Users.pm @@ -9,7 +9,7 @@ our @EXPORT = qw|dbUserGet dbUserEdit dbUserAdd dbUserDel|; # %options->{ username passwd mail order uid ip registered search results page what } -# what: stats +# what: stats mymessages sub dbUserGet { my $s = shift; my %o = ( @@ -54,6 +54,8 @@ sub dbUserGet { '(SELECT COUNT(DISTINCT tag) FROM tags_vn WHERE uid = u.id) AS tagcount', '(SELECT COUNT(DISTINCT vid) FROM tags_vn WHERE uid = u.id) AS tagvncount', ) : (), + $o{what} =~ /mymessages/ ? + '(SELECT COUNT(*) FROM threads_boards tb JOIN threads t ON t.id = tb.tid WHERE tb.type = \'u\' AND tb.iid = u.id AND t.hidden = FALSE) AS mymessages' : (), ); my($r, $np) = $s->dbPage(\%o, q| diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm index b520eeba..cb0751e9 100644 --- a/lib/VNDB/Util/Auth.pm +++ b/lib/VNDB/Util/Auth.pm @@ -84,7 +84,7 @@ sub _authCheck { !$user || length($user) > 15 || length($user) < 2 || !$pass || length($pass) != 32; - my $d = $self->dbUserGet(username => $user, passwd => $pass)->[0]; + my $d = $self->dbUserGet(username => $user, passwd => $pass, what => 'mymessages')->[0]; return 0 if !defined $d->{id} || !$d->{rank}; $self->{_auth} = $d; diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm index 1e6d8a60..2cf3fc40 100644 --- a/lib/VNDB/Util/LayoutHTML.pm +++ b/lib/VNDB/Util/LayoutHTML.pm @@ -87,7 +87,7 @@ sub _menu { a href => "$uid/edit", 'My Profile'; br; a href => "$uid/list", 'My Visual Novel List'; br; a href => "$uid/wish", 'My Wishlist'; br; - a href => "/t$uid", 'My Messages'; br; + a href => "/t$uid", sprintf 'My Messages (%d)', $self->authInfo->{mymessages}; br; a href => "$uid/hist", 'My Recent Changes'; br; a href => "$uid/tags", 'My Tags'; br; br; |