2007-10-11 17:06:08 +00:00
|
|
|
require "functions.pl";
|
2007-10-10 21:48:12 +00:00
|
|
|
|
|
|
|
#create or resume session
|
2008-04-15 18:56:13 +00:00
|
|
|
CGI::Session->name($config->{"page_cookie_name"});
|
2007-10-24 10:03:04 +00:00
|
|
|
$query = new CGI;
|
2007-12-17 18:55:33 +00:00
|
|
|
$session = new CGI::Session;
|
2007-10-10 21:48:12 +00:00
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@userinfo = get_userinfo_from_sid($session->id);
|
2007-10-10 21:48:12 +00:00
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@page = get_page_array(@userinfo);
|
|
|
|
|
2008-04-01 16:16:04 +00:00
|
|
|
$page->{frontpage} = [''];
|
2007-10-10 21:48:12 +00:00
|
|
|
|
2007-10-24 10:03:04 +00:00
|
|
|
if($query->param('information'))
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
$page->{'message'}->{'type'} = "information";
|
|
|
|
$page->{'message'}->{'text'} = $query->param('information');
|
|
|
|
$page->{'message'}->{'value'} = $query->param('value');
|
2007-10-24 10:03:04 +00:00
|
|
|
}
|
|
|
|
elsif($query->param('error'))
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = $query->param('error');
|
|
|
|
$page->{'message'}->{'value'} = $query->param('value');
|
2007-12-21 17:39:49 +00:00
|
|
|
}
|
|
|
|
elsif($query->param('warning'))
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
$page->{'message'}->{'type'} = "warning";
|
|
|
|
$page->{'message'}->{'text'} = $query->param('warning');
|
|
|
|
$page->{'message'}->{'value'} = $query->param('value');
|
2007-10-24 10:03:04 +00:00
|
|
|
}
|
|
|
|
|
2007-12-01 22:49:58 +00:00
|
|
|
|
|
|
|
#prepare query
|
|
|
|
my $sth = $dbh->prepare(qq{select text, count from tagcloud }) or die $dbh->errstr;
|
|
|
|
|
|
|
|
#execute it
|
|
|
|
$sth->execute() or die $dbh->errstr;
|
|
|
|
|
|
|
|
#get every returned value
|
|
|
|
while (my ($text, $count) = $sth->fetchrow_array())
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
#push the new value to the $page->tagcloud array
|
|
|
|
push @{ $page->{tagcloud}->{tag} }, { text => [$text =~ / / ? "\"$text\"" : $text], count => [$count] };
|
2007-12-01 22:49:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#finish query
|
|
|
|
$sth->finish() or die $dbh->errstr;
|
|
|
|
|
2008-04-16 21:07:07 +00:00
|
|
|
#TODO: make this configureable
|
|
|
|
@querystrings = ("* orderby:timestamp sort:descending", "*", "*");
|
|
|
|
|
|
|
|
foreach $strquery (@querystrings)
|
|
|
|
{
|
|
|
|
#new results block
|
|
|
|
push @{$page->{'results'} }, { "query" => $strquery };
|
|
|
|
|
|
|
|
#get query string and args
|
|
|
|
my ($dbquery, @args) = get_sqlquery($strquery);
|
|
|
|
$dbquery .= " limit 0, 3";
|
|
|
|
|
|
|
|
#prepare query
|
|
|
|
$sth = $dbh->prepare($dbquery) or die $dbh->errstr;
|
|
|
|
|
|
|
|
#execute it
|
|
|
|
$sth->execute(@args) or die $dbquery;
|
|
|
|
|
|
|
|
#foreach result, fill appropriate results hash
|
|
|
|
while (my ($id, $title, $description, $publisher, $timestamp, $creator,
|
|
|
|
$subject, $source, $language, $coverage, $rights,
|
|
|
|
$license, $filesize, $duration, $width, $height, $fps, $viewcount,
|
|
|
|
$downloadcount) = $sth->fetchrow_array())
|
|
|
|
{
|
|
|
|
push @{$page->{'results'}[$#{$page->{'results'} }]->{'result'}},
|
|
|
|
{
|
|
|
|
'thumbnail' => $config->{"url_root"}."/video-stills/thumbnails/$id",
|
|
|
|
'preview' => $config->{"url_root"}."/video-stills/previews/$id",
|
|
|
|
'duration' => $duration,
|
|
|
|
'viewcount' => $viewcount,
|
|
|
|
'rdf:RDF' =>
|
|
|
|
{
|
|
|
|
'cc:Work' =>
|
|
|
|
{
|
|
|
|
'rdf:about' => $config->{"url_root"}."/download/$id/",
|
|
|
|
'dc:title' => [$title],
|
|
|
|
'dc:creator' => [$creator],
|
|
|
|
'dc:subject' => [$subject],
|
|
|
|
'dc:description' => [$description],
|
|
|
|
'dc:publisher' => [$publisher],
|
|
|
|
'dc:date' => [$timestamp],
|
|
|
|
'dc:identifier' => [$config->{"url_root"}."/video/".urlencode($title)."/$id/"],
|
|
|
|
'dc:source' => [$source],
|
|
|
|
'dc:language' => [$language],
|
|
|
|
'dc:coverage' => [$coverage],
|
|
|
|
'dc:rights' => [$rights]
|
|
|
|
},
|
|
|
|
'cc:License' =>
|
|
|
|
{
|
|
|
|
'rdf:about' => 'http://creativecommons.org/licenses/GPL/2.0/'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|