summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-01-25 12:30:50 +0100
committerYorhel <git@yorhel.nl>2009-01-25 12:30:50 +0100
commite1835977fea7be42b702275ac88e69921d82777d (patch)
tree54d1ed5ef562a1672cea66975d90ce27864c094c /lib
parent63c5fe06d0d4bd0c07f50c39fc26170b2bcc7096 (diff)
Random quote feature
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Misc.pm12
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm8
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm
index 14ef45ac..c13a38d2 100644
--- a/lib/VNDB/DB/Misc.pm
+++ b/lib/VNDB/DB/Misc.pm
@@ -6,7 +6,7 @@ use warnings;
use Exporter 'import';
our @EXPORT = qw|
- dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages
+ dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages dbRandomQuote
|;
@@ -173,6 +173,16 @@ sub dbLanguages {
}
+# Returns a random quote (hashref with keys = vid, quote)
+sub dbRandomQuote {
+ return $_[0]->dbRow(q|
+ SELECT vid, quote
+ FROM quotes
+ ORDER BY RANDOM()
+ LIMIT 1|);
+}
+
+
1;
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index ccf2a9c6..9f0ccc75 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -141,6 +141,14 @@ sub _menu {
sub htmlFooter {
my $self = shift;
div id => 'footer';
+
+ my $q = $self->dbRandomQuote;
+ if($q && $q->{vid}) {
+ lit '"';
+ a href => "/v$q->{vid}", style => 'text-decoration: none', $q->{quote};
+ txt qq|"\n|;
+ }
+
txt "vndb $self->{version} | ";
a href => '/d7', 'about us';
txt ' | ';