2007-10-11 17:06:08 +00:00
|
|
|
require "functions.pl";
|
2007-10-11 14:59:55 +00:00
|
|
|
|
|
|
|
#initialize session data
|
2008-04-15 18:56:13 +00:00
|
|
|
CGI::Session->name($config->{"page_cookie_name"});
|
2007-10-11 14:59:55 +00:00
|
|
|
$query = new CGI;
|
|
|
|
$session = new CGI::Session;
|
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@userinfo = get_userinfo_from_sid($session->id);
|
2007-10-27 11:59:23 +00:00
|
|
|
|
2007-10-29 15:00:40 +00:00
|
|
|
@page = get_page_array(@userinfo);
|
2007-10-26 00:35:29 +00:00
|
|
|
|
2007-10-11 14:59:55 +00:00
|
|
|
#check if query is set
|
2007-12-21 17:39:49 +00:00
|
|
|
if($query->param('query'))
|
2007-10-11 17:26:39 +00:00
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
$page->{'results'}->{'query'} = $query->param('query');
|
|
|
|
|
2008-04-16 21:07:07 +00:00
|
|
|
my ($dbquery, @args) = get_sqlquery($query->param('query'));
|
2008-02-14 22:15:38 +00:00
|
|
|
|
2008-04-16 21:07:07 +00:00
|
|
|
if($dbquery)
|
2008-02-14 22:15:38 +00:00
|
|
|
{
|
2008-04-16 21:07:07 +00:00
|
|
|
fill_results($dbquery, @args);
|
2008-04-16 13:32:20 +00:00
|
|
|
|
|
|
|
if(@{$page->{'results'}->{'result'}} == 0)
|
2008-02-14 22:15:38 +00:00
|
|
|
{
|
2008-04-16 13:32:20 +00:00
|
|
|
print $query->redirect("index.pl?warning=warning_no_results");
|
2008-02-14 22:15:38 +00:00
|
|
|
}
|
2008-04-16 13:32:20 +00:00
|
|
|
elsif((@{$page->{'results'}->{'result'}} == 1) and (not $query->param('page') or $query->param('page') == 1))
|
2008-02-14 22:15:38 +00:00
|
|
|
{
|
2008-04-16 13:32:20 +00:00
|
|
|
print $query->redirect($page->{'results'}->{'result'}[0]->{'rdf:RDF'}->{'cc:Work'}->{'dc:identifier'}[0]);
|
2008-02-14 22:15:38 +00:00
|
|
|
}
|
2008-04-16 13:32:20 +00:00
|
|
|
else
|
2008-02-14 22:15:38 +00:00
|
|
|
{
|
2008-04-16 13:32:20 +00:00
|
|
|
print output_page();
|
2008-02-14 22:15:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-04-16 13:32:20 +00:00
|
|
|
print $query->redirect("index.pl?error=error_no_query");
|
2008-02-14 22:15:38 +00:00
|
|
|
}
|
2007-10-11 17:26:39 +00:00
|
|
|
}
|
2007-12-27 14:50:08 +00:00
|
|
|
elsif($query->param('advanced'))
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
print $query->redirect("index.pl?error=error_202c");
|
2007-12-27 14:50:08 +00:00
|
|
|
}
|
2007-10-11 17:26:39 +00:00
|
|
|
else
|
|
|
|
{
|
2008-02-14 22:15:38 +00:00
|
|
|
print $query->redirect("index.pl?error=error_no_query");
|
2007-10-11 14:59:55 +00:00
|
|
|
}
|