connecting to db only once, fixed referer regex, added user preferences, information on empty results, correcting the spelling of my nick, fixed space bug with libxslt, sanitized settings interface, repaired results.xsl, videos and thumbnails now only have a max hight, videos get resized
git-svn-id: http://yolanda.mister-muffin.de/svn@201 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
666fa10be9
commit
52ba4dadb1
19 changed files with 187 additions and 104 deletions
|
@ -1,2 +1,2 @@
|
||||||
Nils Dagsson Moskopp (erlehmann)
|
Nils Dagsson Moskopp (erlehmann)
|
||||||
Johannes Schauer (Josch)
|
Johannes Schauer (josch)
|
||||||
|
|
|
@ -7,6 +7,16 @@ $session = new CGI::Session;
|
||||||
|
|
||||||
@userinfo = get_userinfo_from_sid($session->id);
|
@userinfo = get_userinfo_from_sid($session->id);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
@page = get_page_array(@userinfo);
|
@page = get_page_array(@userinfo);
|
||||||
|
|
||||||
if($userinfo->{'username'})
|
if($userinfo->{'username'})
|
||||||
|
@ -14,9 +24,9 @@ if($userinfo->{'username'})
|
||||||
if($query->param('show') eq 'settings')
|
if($query->param('show') eq 'settings')
|
||||||
{
|
{
|
||||||
$page->{'account'}->{'show'} = 'settings';
|
$page->{'account'}->{'show'} = 'settings';
|
||||||
#results per page
|
$page->{'account'}->{'locale'} = $userinfo->{'locale'};
|
||||||
#language
|
$page->{'account'}->{'pagesize'} = $userinfo->{'pagesize'};
|
||||||
#cortado or plugin
|
$page->{'account'}->{'cortado'} = $userinfo->{'cortado'}
|
||||||
}
|
}
|
||||||
elsif($query->param('show') eq 'bookmarks')
|
elsif($query->param('show') eq 'bookmarks')
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,19 +130,17 @@ while(1)
|
||||||
$thumbnailsec = int($duration/3 + .5);
|
$thumbnailsec = int($duration/3 + .5);
|
||||||
|
|
||||||
#the width/height calculation could of course be much shorter but less readable then
|
#the width/height calculation could of course be much shorter but less readable then
|
||||||
$tnmaxwidth = 160;
|
#all thumbs have equal height
|
||||||
$tnmaxheight = 120
|
$tnmaxheight = 120;
|
||||||
$tnwidth = $tnmaxwidth;
|
|
||||||
$tnheight = int($tnwidth*($height/$width)/2 + .5)*2;
|
|
||||||
if($tnheight > $tnmaxheight)
|
|
||||||
{
|
|
||||||
$tnheight = $tnmaxheight;
|
$tnheight = $tnmaxheight;
|
||||||
$tnwidth = int($tnheight*($width/$height)/2 + .5)*2;
|
$tnwidth = int($tnheight*($width/$height)/2 + .5)*2;
|
||||||
}
|
|
||||||
system "ffmpeg -i $root/tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $root/video-stills/$id";
|
system "ffmpeg -i $root/tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $root/video-stills/$id";
|
||||||
|
|
||||||
#check if the upload already is in the right format
|
$vmaxheight = 240;
|
||||||
if ($container eq 'ogg' and $video eq 'theora' and $audio eq 'vorbis')
|
|
||||||
|
#check if the upload already is in the right format and smaller/equal max-width/height
|
||||||
|
if ($container eq 'ogg' and $video eq 'theora' and $audio eq 'vorbis' and $height <= $vmaxheight)
|
||||||
{
|
{
|
||||||
appendlog $id, "file already is ogg-theora/vorbis";
|
appendlog $id, "file already is ogg-theora/vorbis";
|
||||||
|
|
||||||
|
@ -158,16 +156,20 @@ while(1)
|
||||||
}
|
}
|
||||||
else #encode video
|
else #encode video
|
||||||
{
|
{
|
||||||
|
#calculate video width
|
||||||
|
$vheight = $vmaxheight <= $height ? $vmaxheight : $height;
|
||||||
|
$vwidth = int($vheight*($width/$height)/2 + .5)*2;
|
||||||
|
|
||||||
#TODO: addmetadata information
|
#TODO: addmetadata information
|
||||||
system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --output $root/videos/$id $root/tmp/$id 2>&1";
|
system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --width $vwidth --height $vheight --output $root/videos/$id $root/tmp/$id 2>&1";
|
||||||
appendlog $id, $audio, $video, $width, $height, $fps, $duration, $sha;
|
appendlog $id, $audio, $video, $vwidth, $vheight, $fps, $duration, $sha;
|
||||||
|
|
||||||
#add video to videos table
|
#add video to videos table
|
||||||
$dbh->do(qq{insert into videos select id, title, description, userid, timestamp, creator,
|
$dbh->do(qq{insert into videos select id, title, description, userid, timestamp, creator,
|
||||||
subject, contributor, source, language, coverage, rights, license, notice,
|
subject, contributor, source, language, coverage, rights, license, notice,
|
||||||
derivativeworks, sharealike, commercialuse, ?, ?, ?, ?, ?, ?, 0, 0
|
derivativeworks, sharealike, commercialuse, ?, ?, ?, ?, ?, ?, 0, 0
|
||||||
from uploaded where id = ?}, undef, $filesize, $duration, $width,
|
from uploaded where id = ?}, undef, $filesize, $duration, $vwidth,
|
||||||
$height, $fps, $sha, $id) or interrupt $dbh->errstr;
|
$vheight, $fps, $sha, $id) or interrupt $dbh->errstr;
|
||||||
|
|
||||||
#delete temp file
|
#delete temp file
|
||||||
unlink "$root/tmp/$id";
|
unlink "$root/tmp/$id";
|
||||||
|
|
|
@ -8,9 +8,6 @@ $session = new CGI::Session;
|
||||||
#do we have an id?
|
#do we have an id?
|
||||||
if($query->param('id'))
|
if($query->param('id'))
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
|
||||||
|
|
||||||
#check if video with requested id is in the database
|
#check if video with requested id is in the database
|
||||||
my $sth = $dbh->prepare(qq{select title from videos where id = ? });
|
my $sth = $dbh->prepare(qq{select title from videos where id = ? });
|
||||||
$sth->execute($query->param('id'));
|
$sth->execute($query->param('id'));
|
||||||
|
@ -19,8 +16,7 @@ if($query->param('id'))
|
||||||
{
|
{
|
||||||
#if referer is not the local site update referer table
|
#if referer is not the local site update referer table
|
||||||
$referer = $query->referer() or $referer = '';
|
$referer = $query->referer() or $referer = '';
|
||||||
$server_name = $query->server_name();
|
if($referer !~ /^$domain/)
|
||||||
if($referer !~ /^\w+:\/\/$server_name/)
|
|
||||||
{
|
{
|
||||||
#check if already in database
|
#check if already in database
|
||||||
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
||||||
|
@ -78,9 +74,6 @@ if($query->param('id'))
|
||||||
#print xml
|
#print xml
|
||||||
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
|
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
|
||||||
}
|
}
|
||||||
|
|
||||||
#disconnect db
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,6 @@ sub get_userinfo_from_sid
|
||||||
#get parameters
|
#get parameters
|
||||||
my ($sid) = @_;
|
my ($sid) = @_;
|
||||||
|
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
|
||||||
|
|
||||||
#prepare query
|
#prepare query
|
||||||
my $sth = $dbh->prepare(qq{select id, username, locale, pagesize, cortado from users where sid = ?}) or die $dbh->errstr;
|
my $sth = $dbh->prepare(qq{select id, username, locale, pagesize, cortado from users where sid = ?}) or die $dbh->errstr;
|
||||||
|
|
||||||
|
@ -20,9 +17,6 @@ sub get_userinfo_from_sid
|
||||||
#finish query
|
#finish query
|
||||||
$sth->finish() or die $dbh->errstr;
|
$sth->finish() or die $dbh->errstr;
|
||||||
|
|
||||||
#close db
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
|
|
||||||
#return
|
#return
|
||||||
return @userinfo;
|
return @userinfo;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +37,7 @@ sub get_page_array
|
||||||
{
|
{
|
||||||
($page->{'locale'}) = $query->http('HTTP_ACCEPT_LANGUAGE') =~ /^([^,]+),.*$/;
|
($page->{'locale'}) = $query->http('HTTP_ACCEPT_LANGUAGE') =~ /^([^,]+),.*$/;
|
||||||
}
|
}
|
||||||
$page->{stylesheet} = $stylesheet;
|
$page->{'stylesheet'} = $stylesheet;
|
||||||
$page->{'xmlns:dc'} = $xmlns_dc;
|
$page->{'xmlns:dc'} = $xmlns_dc;
|
||||||
$page->{'xmlns:cc'} = $xmlns_cc;
|
$page->{'xmlns:cc'} = $xmlns_cc;
|
||||||
$page->{'xmlns:rdf'} = $xmlns_rdf;
|
$page->{'xmlns:rdf'} = $xmlns_rdf;
|
||||||
|
@ -54,16 +48,13 @@ sub get_page_array
|
||||||
# and account.pl (display own videos)
|
# and account.pl (display own videos)
|
||||||
sub fill_results
|
sub fill_results
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
|
||||||
|
|
||||||
#prepare query
|
#prepare query
|
||||||
my $sth = $dbh->prepare($dbquery) or die $dbh->errstr;
|
my $sth = $dbh->prepare($dbquery) or die $dbh->errstr;
|
||||||
|
|
||||||
#execute it
|
#execute it
|
||||||
$resultcount = $sth->execute(@_) or die $dbh->errstr;
|
$resultcount = $sth->execute(@_) or die $dbh->errstr;
|
||||||
|
|
||||||
$pagesize = $query->param('pagesize') or $pagesize = 5;
|
$pagesize = $query->param('pagesize') or $pagesize = $userinfo->{'pagesize'} or $pagesize = 5;
|
||||||
|
|
||||||
#rediculous but funny round up, will fail with 100000000000000 results per page
|
#rediculous but funny round up, will fail with 100000000000000 results per page
|
||||||
#on 0.0000000000001% of all queries - this is a risk we can handle
|
#on 0.0000000000001% of all queries - this is a risk we can handle
|
||||||
|
@ -84,6 +75,12 @@ sub fill_results
|
||||||
$page->{'results'}->{'resultcount'} = $resultcount eq '0E0' ? 0 : $resultcount;
|
$page->{'results'}->{'resultcount'} = $resultcount eq '0E0' ? 0 : $resultcount;
|
||||||
$page->{'results'}->{'pagesize'} = $pagesize;
|
$page->{'results'}->{'pagesize'} = $pagesize;
|
||||||
|
|
||||||
|
if($resultcount eq '0E0')
|
||||||
|
{
|
||||||
|
$page->{'message'}->{'type'} = "information";
|
||||||
|
$page->{'message'}->{'text'} = "information_no_results";
|
||||||
|
}
|
||||||
|
|
||||||
#get every returned value
|
#get every returned value
|
||||||
while (my ($id, $title, $description, $publisher, $timestamp, $creator,
|
while (my ($id, $title, $description, $publisher, $timestamp, $creator,
|
||||||
$subject, $contributor, $source, $language, $coverage, $rights,
|
$subject, $contributor, $source, $language, $coverage, $rights,
|
||||||
|
@ -126,9 +123,6 @@ sub fill_results
|
||||||
|
|
||||||
#finish query
|
#finish query
|
||||||
$sth->finish() or die $dbh->errstr;
|
$sth->finish() or die $dbh->errstr;
|
||||||
|
|
||||||
#close db
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#replace chars in url as said in this rfc: http://www.rfc-editor.org/rfc/rfc1738.txt
|
#replace chars in url as said in this rfc: http://www.rfc-editor.org/rfc/rfc1738.txt
|
||||||
|
|
|
@ -26,5 +26,5 @@ $stylesheet = "/style/default.css";
|
||||||
$xmlns_dc = "http://purl.org/dc/elements/1.1/";
|
$xmlns_dc = "http://purl.org/dc/elements/1.1/";
|
||||||
$xmlns_cc = "http://web.resource.org/cc/";
|
$xmlns_cc = "http://web.resource.org/cc/";
|
||||||
$xmlns_rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
$xmlns_rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||||
|
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -24,8 +24,6 @@ elsif($query->param('error'))
|
||||||
$page->{'message'}->{'text'} = $query->param('error');
|
$page->{'message'}->{'text'} = $query->param('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
|
||||||
|
|
||||||
#prepare query
|
#prepare query
|
||||||
my $sth = $dbh->prepare(qq{select text, count from tagcloud }) or die $dbh->errstr;
|
my $sth = $dbh->prepare(qq{select text, count from tagcloud }) or die $dbh->errstr;
|
||||||
|
@ -51,4 +49,3 @@ print $session->header(-type=>'text/xml', -charset=>'UTF-8');
|
||||||
|
|
||||||
#print xml
|
#print xml
|
||||||
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1');
|
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1');
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
CGI::Session->name($session_name);
|
CGI::Session->name($session_name);
|
||||||
my $session = new CGI::Session;
|
my $session = new CGI::Session;
|
||||||
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr;
|
|
||||||
|
|
||||||
$dbh->do(qq{drop table config});
|
$dbh->do(qq{drop table config});
|
||||||
|
|
||||||
$dbh->do(qq{drop table users});
|
$dbh->do(qq{drop table users});
|
||||||
|
@ -149,7 +147,5 @@ $dbh->do(qq{create table
|
||||||
)
|
)
|
||||||
}) or die $dbh->errstr;
|
}) or die $dbh->errstr;
|
||||||
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
|
|
||||||
print $session->header();
|
print $session->header();
|
||||||
print "initiated database";
|
print "initiated database";
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
<string id="error_insert_username">Please insert a username.</string>
|
<string id="error_insert_username">Please insert a username.</string>
|
||||||
<string id="error_insert_password">Please insert a password.</string>
|
<string id="error_insert_password">Please insert a password.</string>
|
||||||
<string id="error_repeat_password">Please repeat your password.</string>
|
<string id="error_repeat_password">Please repeat your password.</string>
|
||||||
<string id="information_no_results">There are no results satisfying your query.</string>
|
|
||||||
<string id=""></string>
|
<string id=""></string>
|
||||||
|
|
||||||
<!-- information -->
|
<!-- information -->
|
||||||
|
@ -65,6 +64,7 @@
|
||||||
<string id="information_comment_created">Your comment has been submitted.</string>
|
<string id="information_comment_created">Your comment has been submitted.</string>
|
||||||
<string id="information_registered">Your account has been created.</string>
|
<string id="information_registered">Your account has been created.</string>
|
||||||
<string id="information_uploaded">Your file has been uploaded.</string>
|
<string id="information_uploaded">Your file has been uploaded.</string>
|
||||||
|
<string id="information_no_results">There are no results satisfying your query.</string>
|
||||||
|
|
||||||
<!-- warnings -->
|
<!-- warnings -->
|
||||||
|
|
||||||
|
@ -181,6 +181,9 @@
|
||||||
<string id="account_uploads">my uploads</string>
|
<string id="account_uploads">my uploads</string>
|
||||||
<string id="account_settings">edit my settings</string>
|
<string id="account_settings">edit my settings</string>
|
||||||
<string id="account_bookmarks">my bookmarks</string>
|
<string id="account_bookmarks">my bookmarks</string>
|
||||||
|
<string id="account_locale">locale</string>
|
||||||
|
<string id="account_pagesize">pagesize</string>
|
||||||
|
<string id="account_cortado">cortado</string>
|
||||||
|
|
||||||
</strings>
|
</strings>
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,6 @@ $session = new CGI::Session;
|
||||||
#check if action is set
|
#check if action is set
|
||||||
if($query->param('action'))
|
if($query->param('action'))
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
|
|
||||||
|
|
||||||
if($query->param('action') eq "logout")
|
if($query->param('action') eq "logout")
|
||||||
{
|
{
|
||||||
#if logout is requested
|
#if logout is requested
|
||||||
|
@ -155,9 +152,6 @@ if($query->param('action'))
|
||||||
|
|
||||||
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1');
|
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
#disconnect db
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
}
|
||||||
#check if user is logged in
|
#check if user is logged in
|
||||||
elsif($userinfo->{'username'})
|
elsif($userinfo->{'username'})
|
||||||
|
|
|
@ -25,16 +25,10 @@ elsif($query->param('user') and $query->param('pass') and $query->param('pass_re
|
||||||
{
|
{
|
||||||
if($query->param('pass') eq $query->param('pass_repeat'))
|
if($query->param('pass') eq $query->param('pass_repeat'))
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr;
|
|
||||||
|
|
||||||
#do query
|
#do query
|
||||||
$dbh->do(qq{insert into users (username, password, timestamp, locale) values ( ?, password( ? ), unix_timestamp(), ?)}, undef,
|
$dbh->do(qq{insert into users (username, password, timestamp, locale) values ( ?, password( ? ), unix_timestamp(), ?)}, undef,
|
||||||
$query->param("user"), $query->param("pass"), $page->{'locale'}) or die $dbh->errstr;
|
$query->param("user"), $query->param("pass"), $page->{'locale'}) or die $dbh->errstr;
|
||||||
|
|
||||||
#disconnect db
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
|
|
||||||
print $query->redirect("index.pl?information=information_registered");
|
print $query->redirect("index.pl?information=information_registered");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -12,6 +12,8 @@ $session = new CGI::Session;
|
||||||
#check if query is set
|
#check if query is set
|
||||||
if($query->param('query') or $query->param('orderby'))
|
if($query->param('query') or $query->param('orderby'))
|
||||||
{
|
{
|
||||||
|
#TODO: clean up scriptname, argument, value only being there because of
|
||||||
|
#TODO: account.pl also calling fill_results() which will be changed
|
||||||
$page->{'search'} = [''];
|
$page->{'search'} = [''];
|
||||||
$page->{'results'}->{'scriptname'} = 'search.pl';
|
$page->{'results'}->{'scriptname'} = 'search.pl';
|
||||||
$page->{'results'}->{'argument'} = 'query';
|
$page->{'results'}->{'argument'} = 'query';
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
<str id="page_account_settings">/account.pl?show=settings</str>
|
<str id="page_account_settings">/account.pl?show=settings</str>
|
||||||
<str id="page_account_uploads">/account.pl?show=uploads</str>
|
<str id="page_account_uploads">/account.pl?show=uploads</str>
|
||||||
<str id="page_account_bookmarks">/account.pl?show=bookmarks</str>
|
<str id="page_account_bookmarks">/account.pl?show=bookmarks</str>
|
||||||
<str id="page_bookmarks"></str>
|
|
||||||
<str id="page_login">/login.pl</str>
|
<str id="page_login">/login.pl</str>
|
||||||
<str id="page_login-openid">/login.pl?action=openid</str>
|
<str id="page_login-openid">/login.pl?action=openid</str>
|
||||||
<str id="page_logout">/login.pl?action=logout</str>
|
<str id="page_logout">/login.pl?action=logout</str>
|
||||||
|
|
|
@ -22,9 +22,6 @@ sub hook
|
||||||
|
|
||||||
if($userinfo->{'id'}&&$query->param("DC.Title") && $query->param("DC.Description") && $query->param("DC.Subject"))
|
if($userinfo->{'id'}&&$query->param("DC.Title") && $query->param("DC.Description") && $query->param("DC.Subject"))
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr;
|
|
||||||
|
|
||||||
#make new entry for video into the databse
|
#make new entry for video into the databse
|
||||||
#FIXME: contributor, rights
|
#FIXME: contributor, rights
|
||||||
$dbh->do(qq{insert into uploaded (title, description, userid, timestamp,
|
$dbh->do(qq{insert into uploaded (title, description, userid, timestamp,
|
||||||
|
@ -51,9 +48,6 @@ if($userinfo->{'id'}&&$query->param("DC.Title") && $query->param("DC.Description
|
||||||
|
|
||||||
$page->{'message'}->{'type'} = "information";
|
$page->{'message'}->{'type'} = "information";
|
||||||
$page->{'message'}->{'text'} = "information_uploaded";
|
$page->{'message'}->{'text'} = "information_uploaded";
|
||||||
|
|
||||||
#disconnect db
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,9 +20,6 @@ if($query->url_param('action') eq 'bookmark' and $query->url_param('id'))
|
||||||
#check if id or title is passed
|
#check if id or title is passed
|
||||||
elsif($query->url_param('title') or $query->url_param('id'))
|
elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
{
|
{
|
||||||
#connect to db
|
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
|
|
||||||
|
|
||||||
if($query->url_param('id'))
|
if($query->url_param('id'))
|
||||||
{
|
{
|
||||||
#if id is passed ignore title and check for the id
|
#if id is passed ignore title and check for the id
|
||||||
|
@ -103,8 +100,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
|
|
||||||
#if referer is not the local site update referer table
|
#if referer is not the local site update referer table
|
||||||
$referer = $query->referer() or $referer = '';
|
$referer = $query->referer() or $referer = '';
|
||||||
$server_name = $query->server_name();
|
if($referer !~ /^$domain/)
|
||||||
if($referer !~ /^\w+:\/\/$server_name/)
|
|
||||||
{
|
{
|
||||||
#check if already in database
|
#check if already in database
|
||||||
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
$sth = $dbh->prepare(qq{select 1 from referer where videoid = ? and referer = ? }) or die $dbh->errstr;
|
||||||
|
@ -123,11 +119,32 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($query->param('cortado') eq 'true')
|
||||||
|
{
|
||||||
|
$cortado = 'true';
|
||||||
|
}
|
||||||
|
elsif($query->param('cortado') eq 'false')
|
||||||
|
{
|
||||||
|
$cortado = 'false'
|
||||||
|
}
|
||||||
|
elsif($userinfo->{'cortado'} = 1)
|
||||||
|
{
|
||||||
|
$cortado = 'true';
|
||||||
|
}
|
||||||
|
elsif($userinfo->{'cortado'} = 0)
|
||||||
|
{
|
||||||
|
$cortado = 'false';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cortado = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
#before code cleanup, this was a really obfuscated array/hash creation
|
#before code cleanup, this was a really obfuscated array/hash creation
|
||||||
push @{ $page->{'video'} },
|
push @{ $page->{'video'} },
|
||||||
{
|
{
|
||||||
'thumbnail' => "$domain/video-stills/$id",
|
'thumbnail' => "$domain/video-stills/$id",
|
||||||
'cortado' => $query->param('cortado') eq 'false' ? "false" : "true",
|
'cortado' => $cortado,
|
||||||
'filesize' => $filesize,
|
'filesize' => $filesize,
|
||||||
'duration' => $duration,
|
'duration' => $duration,
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
|
@ -202,9 +219,6 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
|
|
||||||
fill_results(@args);
|
fill_results(@args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#close db
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
<xsl:when test="document(concat('../locale/', //@locale, '.xml'))">
|
<xsl:when test="document(concat('../locale/', //@locale, '.xml'))">
|
||||||
<xsl:value-of select="//@locale" />
|
<xsl:value-of select="//@locale" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>en-us</xsl:otherwise>
|
||||||
en-us
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
|
@ -147,7 +145,7 @@
|
||||||
<xsl:value-of select="$locale_strings[@id='separator']" />
|
<xsl:value-of select="$locale_strings[@id='separator']" />
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="$site_strings[@id='page_bookmarks']" />
|
<xsl:value-of select="$site_strings[@id='page_account_bookmarks']" />
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="$locale_strings[@id='bookmarks']" />
|
<xsl:value-of select="$locale_strings[@id='bookmarks']" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -54,45 +54,132 @@
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//account/@show='uploads'">
|
<xsl:when test="//account/@show='uploads'">
|
||||||
<h2>results</h2>
|
<h2><xsl:value-of select="$locale_strings[@id='account_uploads']" /></h2>
|
||||||
<xsl:call-template name="results"/>
|
<xsl:call-template name="results"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="//account/@show='settings'">
|
<xsl:when test="//account/@show='settings'">
|
||||||
<h2>settings</h2>
|
<h2><xsl:value-of select="$locale_strings[@id='account_settings']" /></h2>
|
||||||
<form>
|
<form method="POST">
|
||||||
|
<xsl:attribute name="action">
|
||||||
|
<xsl:value-of select="$site_strings[@id='page_account_settings']" />
|
||||||
|
</xsl:attribute>
|
||||||
|
<input type="hidden" name="show" value="settings" />
|
||||||
<div>
|
<div>
|
||||||
locale
|
<h3><xsl:value-of select="$locale_strings[@id='account_locale']" /></h3>
|
||||||
<br />
|
<br />
|
||||||
<select name="DC.Language">
|
<select name="locale" size="2">
|
||||||
<option>English</option>
|
<option value="en-us">
|
||||||
<option>German</option>
|
<xsl:if test="//account/@locale='en-us'">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="$locale_strings[@id='language_en-us']" />
|
||||||
|
</option>
|
||||||
|
<option value="de-de">
|
||||||
|
<xsl:if test="//account/@locale='de-de'">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="$locale_strings[@id='language_de-de']" />
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
pagesize
|
<h3><xsl:value-of select="$locale_strings[@id='account_pagesize']" /></h3>
|
||||||
<br />
|
<br />
|
||||||
<select>
|
<select name="pagesize" size="7">
|
||||||
<option>1</option>
|
<option>
|
||||||
<option>2</option>
|
<xsl:if test="//account/@pagesize=1">
|
||||||
<option>5</option>
|
<xsl:attribute name="selected">
|
||||||
<option>10</option>
|
selected
|
||||||
<option>20</option>
|
</xsl:attribute>
|
||||||
<option>50</option>
|
</xsl:if>
|
||||||
<option>100</option>
|
1
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=2">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
2
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=5">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
5
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=10">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
10
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=20">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
20
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=50">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
50
|
||||||
|
</option>
|
||||||
|
<option>
|
||||||
|
<xsl:if test="//account/@pagesize=100">
|
||||||
|
<xsl:attribute name="selected">
|
||||||
|
selected
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
100
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="radio" name="cortado" value="true" />cortado
|
<h3><xsl:value-of select="$locale_strings[@id='account_cortado']" /></h3>
|
||||||
<input type="radio" name="cortado" value="false" />video plugin
|
<input type="radio" name="cortado" value="1">
|
||||||
|
<xsl:if test="//account/@cortado=1">
|
||||||
|
<xsl:attribute name="checked">
|
||||||
|
checked
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
</input>
|
||||||
|
<xsl:value-of select="$locale_strings[@id='watch_cortadoapplet']" />
|
||||||
|
<br />
|
||||||
|
<input type="radio" name="cortado" value="0">
|
||||||
|
<xsl:if test="//account/@cortado=0">
|
||||||
|
<xsl:attribute name="checked">
|
||||||
|
checked
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
</input>
|
||||||
|
<xsl:value-of select="$locale_strings[@id='watch_browserplugin']" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="submit" />
|
<input name="submit" type="submit" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="//account/@show='bookmarks'">
|
<xsl:when test="//account/@show='bookmarks'">
|
||||||
<h2>bookmarks</h2>
|
<h2><xsl:value-of select="$locale_strings[@id='account_bookmarks']" /></h2>
|
||||||
|
<p>coming soon...</p>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<p></p>
|
||||||
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="results-heading">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
this is deprecated - dont use it.
|
||||||
|
-->
|
||||||
<div>
|
<div>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//results/@value!=''">
|
<xsl:when test="//results/@value!=''">
|
||||||
|
@ -142,6 +147,7 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</div>
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="results">
|
<xsl:template name="results">
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,10 @@
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//@embed='true'">
|
<xsl:when test="//@embed='true'">
|
||||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'embed=true')" />
|
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'cortado=true&embed=true')" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
|
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'cortado=true')" />
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
|
Loading…
Reference in a new issue