diff options
author | Yorhel <git@yorhel.nl> | 2008-11-15 12:39:02 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-11-15 12:39:02 +0100 |
commit | c6c8b37d60dfd8943a860043f61a9344ddb1dda6 (patch) | |
tree | fbe3aafdabc514b5e9ed5f3a906318c14bd20801 /lib/VNDB/Func.pm | |
parent | 0dd998b8b90f9a57025e4de0386dd7646f756af7 (diff) |
Proper display of deleted usernames
Well, 'proper'... I should fix the handling of deleted users in
the database, as the current solution is far from perfect.
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index ef18c837..d2f86cf1 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; use POSIX 'strftime'; -our @EXPORT = qw| shorten date datestr bb2html |; +our @EXPORT = qw| shorten date datestr userstr bb2html |; # I would've done this as a #define if this was C... @@ -47,6 +47,13 @@ sub datestr { } +# Arguments: (uid, username), or a hashref containing that info +sub userstr { + my($id,$n) = ref($_[0])eq'HASH'?($_[0]{uid}||$_[0]{requester}, $_[0]{username}):@_; + return !$id ? '[deleted]' : '<a href="/u'.$id.'">'.$n.'</a>'; +} + + # Arguments: input, and optionally the maximum length # Parses: # [url=..] [/url] |