2007-10-27 11:59:23 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
require "include.pl";
|
|
|
|
require "functions.pl";
|
|
|
|
|
|
|
|
#initialize session data
|
|
|
|
CGI::Session->name($session_name);
|
|
|
|
$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);
|
|
|
|
|
|
|
|
if($userinfo->{'username'})
|
2007-10-27 11:59:23 +00:00
|
|
|
{
|
|
|
|
if($query->param('show') eq 'settings')
|
|
|
|
{
|
2007-10-29 16:47:16 +00:00
|
|
|
$page->{'account'}->{'show'} = 'settings';
|
2007-10-27 11:59:23 +00:00
|
|
|
#results per page
|
|
|
|
#language
|
|
|
|
#cortado or plugin
|
|
|
|
}
|
|
|
|
elsif($query->param('show') eq 'uploads')
|
|
|
|
{
|
2007-10-29 16:47:16 +00:00
|
|
|
$page->{'account'}->{'show'} = 'uploads';
|
2007-10-27 11:59:23 +00:00
|
|
|
$page->{'results'}->{'scriptname'} = 'account.pl';
|
|
|
|
$page->{'results'}->{'argument'} = 'show';
|
|
|
|
$page->{'results'}->{'value'} = 'uploads';
|
|
|
|
$page->{'results'}->{'orderby'} = $query->param('orderby');
|
|
|
|
$page->{'results'}->{'sort'} = $query->param('sort');
|
|
|
|
|
|
|
|
#build mysql query
|
2007-10-29 16:47:16 +00:00
|
|
|
$dbquery = "(select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ) as timestamp,
|
|
|
|
v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights,
|
|
|
|
v.license, filesize, duration, width, height, fps, viewcount, downloadcount
|
2007-10-27 11:59:23 +00:00
|
|
|
from videos as v, users as u where v.userid = u.id and u.sid = ?)
|
|
|
|
union
|
2007-10-29 16:47:16 +00:00
|
|
|
(select v.id, v.title, '', u.username, from_unixtime( v.timestamp ) as timestamp,
|
|
|
|
v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights,
|
|
|
|
v.license, 0, 0, 0, 0, 0, 0, 0
|
2007-10-27 11:59:23 +00:00
|
|
|
from uploaded as v, users as u where v.userid = u.id and u.sid = ?)";
|
|
|
|
|
|
|
|
if($query->param('orderby'))
|
|
|
|
{
|
|
|
|
if($query->param('orderby') eq 'filesize')
|
|
|
|
{
|
|
|
|
$dbquery .= " order by filesize";
|
|
|
|
}
|
|
|
|
elsif($query->param('orderby') eq 'duration')
|
|
|
|
{
|
|
|
|
$dbquery .= " order by duration";
|
|
|
|
}
|
|
|
|
elsif($query->param('orderby') eq 'viewcount')
|
|
|
|
{
|
|
|
|
$dbquery .= " order by viewcount";
|
|
|
|
}
|
|
|
|
elsif($query->param('orderby') eq 'timestamp')
|
|
|
|
{
|
|
|
|
$dbquery .= " order by timestamp";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$dbquery .= " order by id";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($query->param('sort') eq "asc")
|
|
|
|
{
|
|
|
|
$dbquery .= " asc"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$dbquery .= " desc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-29 16:47:16 +00:00
|
|
|
fill_results($session->id, $session->id);
|
2007-10-27 11:59:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page->{'account'} = [''];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page->{'message'}->{'type'} = "error";
|
|
|
|
$page->{'message'}->{'text'} = "error_202c";
|
|
|
|
}
|
|
|
|
|
|
|
|
#print xml http header along with session cookie
|
|
|
|
print $session->header(-type=>'text/xml', -charset=>'UTF-8');
|
|
|
|
|
|
|
|
#print xml
|
|
|
|
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1');
|