diff --git a/trunk/functions.pl b/trunk/functions.pl index 496b731..ae12c0a 100644 --- a/trunk/functions.pl +++ b/trunk/functions.pl @@ -55,6 +55,34 @@ sub get_username_from_sid return $username; } +#return a username from passed id +sub get_username_from_id +{ + #get parameters + my ($id) = @_; + + #connect to db + my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; + + #prepare query + my $sth = $dbh->prepare(qq{select username from users where id = ?}) or die $dbh->errstr; + + #execute it + $sth->execute($id) or die $dbh->errstr; + + #save the resulting username + my ($username) = $sth->fetchrow_array(); + + #finish query + $sth->finish() or die $dbh->errstr; + + #close db + $dbh->disconnect() or die $dbh->errstr; + + #return + return $username; +} + #return a username from passed session id sub get_userid_from_sid { diff --git a/trunk/search.pl b/trunk/search.pl index c37fcfb..7520333 100644 --- a/trunk/search.pl +++ b/trunk/search.pl @@ -25,13 +25,13 @@ if($query->param('query')) my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; #prepare query - my $sth = $dbh->prepare(qq{select title, caption, timestamp from videos where match(title, caption) against( ? ) }) or die $dbh->errstr; + my $sth = $dbh->prepare(qq{select title, caption, userid, timestamp from videos where match(title, caption) against( ? ) }) or die $dbh->errstr; #execute it $sth->execute($query->param('query')) or die $dbh->errstr; #get every returned value - while (my ($title, $caption, $timestamp) = $sth->fetchrow_array()) + while (my ($title, $caption, $userid, $timestamp) = $sth->fetchrow_array()) { #really obfuscated array/hash creation push @{ $page->{'results'}->{'result'} }, @@ -43,7 +43,8 @@ if($query->param('query')) { 'rdf:about' => './videos/1050x700/4chan_city_mashup.ogg', 'dc:title' => [$title], - 'dc:date' => [$timestamp] + 'dc:date' => [$timestamp], + 'dc:publisher' => [get_username_from_id($userid)] }, 'cc:License' => { diff --git a/trunk/xsl/xhtml.xsl b/trunk/xsl/xhtml.xsl index bbd60f6..72359b2 100755 --- a/trunk/xsl/xhtml.xsl +++ b/trunk/xsl/xhtml.xsl @@ -223,9 +223,9 @@ - :
-
- + :
+ :
+ :