2007-10-27 11:59:23 +00:00
|
|
|
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-12-17 12:38:02 +00:00
|
|
|
if($userinfo->{'username'})
|
|
|
|
{
|
|
|
|
if($query->param('show') eq 'settings' and $query->param('submit'))
|
|
|
|
{
|
|
|
|
$dbh->do(qq{update users set locale = ?, pagesize = ?, cortado = ? where id = ?}, undef, $query->param('locale'), $query->param('pagesize'), $query->param('cortado'), $userinfo->{'id'} ) or die $dbh->errstr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@userinfo = get_userinfo_from_sid($session->id);
|
|
|
|
|
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-12-17 12:38:02 +00:00
|
|
|
$page->{'account'}->{'locale'} = $userinfo->{'locale'};
|
|
|
|
$page->{'account'}->{'pagesize'} = $userinfo->{'pagesize'};
|
|
|
|
$page->{'account'}->{'cortado'} = $userinfo->{'cortado'}
|
2007-10-27 11:59:23 +00:00
|
|
|
}
|
2007-10-29 21:26:39 +00:00
|
|
|
elsif($query->param('show') eq 'bookmarks')
|
|
|
|
{
|
|
|
|
$page->{'account'}->{'show'} = 'bookmarks';
|
|
|
|
}
|
2007-10-27 11:59:23 +00:00
|
|
|
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,
|
2007-12-14 06:18:58 +00:00
|
|
|
v.license, filesize, duration, width, height, fps, viewcount, downloadcount, 1
|
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,
|
2007-12-14 06:18:58 +00:00
|
|
|
v.license, 0, 0, 0, 0, 0, 0, 0, v.status
|
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";
|
|
|
|
}
|
|
|
|
|
2007-12-17 18:55:33 +00:00
|
|
|
print output_page();
|