summaryrefslogtreecommitdiff
path: root/lib/VNDB/Func.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r--lib/VNDB/Func.pm9
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]