fixed 404 error when video isnt there
git-svn-id: http://yolanda.mister-muffin.de/svn@258 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
b65e347a5e
commit
10ca9fdb84
5 changed files with 52 additions and 52 deletions
|
@ -50,9 +50,10 @@ if($query->param('id'))
|
||||||
}
|
}
|
||||||
|
|
||||||
#in both cases - do some slurp-eaze to the browser
|
#in both cases - do some slurp-eaze to the browser
|
||||||
#TODO: lol insecure!
|
$file = open(FILE, "<$root/videos/$videoid");
|
||||||
open(FILE, "<$root/videos/".$query->param('id'));
|
|
||||||
|
|
||||||
|
if($file)
|
||||||
|
{
|
||||||
$filesize = -s "$root/videos/".$query->param('id');
|
$filesize = -s "$root/videos/".$query->param('id');
|
||||||
$range = $query->http('range');
|
$range = $query->http('range');
|
||||||
$range =~ s/bytes=([0-9]+)-/$1/;
|
$range =~ s/bytes=([0-9]+)-/$1/;
|
||||||
|
@ -94,14 +95,16 @@ if($query->param('id'))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@userinfo = get_userinfo_from_sid($session->id);
|
print $session->header(
|
||||||
|
-status=>'500 Internal Server Error'
|
||||||
@page = get_page_array(@userinfo);
|
)
|
||||||
|
}
|
||||||
$page->{'message'}->{'type'} = "error";
|
}
|
||||||
$page->{'message'}->{'text'} = "error_202c";
|
else
|
||||||
|
{
|
||||||
print output_page();
|
print $session->header(
|
||||||
|
-status=>'404 Not found'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -166,13 +166,11 @@ sub output_page
|
||||||
-charset=>'UTF-8',
|
-charset=>'UTF-8',
|
||||||
-cookie=>@cookies
|
-cookie=>@cookies
|
||||||
),
|
),
|
||||||
$parser->parse_string(
|
|
||||||
XMLout(
|
XMLout(
|
||||||
$page,
|
$page,
|
||||||
KeyAttr => {},
|
KeyAttr => {},
|
||||||
RootName => 'page'
|
RootName => 'page'
|
||||||
)
|
);
|
||||||
)->toString;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -187,9 +185,6 @@ sub output_page
|
||||||
|
|
||||||
my $stylesheet = $xslt->parse_stylesheet($parser->parse_file($xsltpath));
|
my $stylesheet = $xslt->parse_stylesheet($parser->parse_file($xsltpath));
|
||||||
|
|
||||||
# TODO: this usage of libxsl omits the xsl:output definition (no ident of html) but outputs in UTF8
|
|
||||||
# TODO: later versions of XML::LibXSLT (>= 1.62) define output_as_bytes - this is what we want to use
|
|
||||||
# TODO: wait for debian packagers to update to 1.62 or later
|
|
||||||
$output = $stylesheet->transform(
|
$output = $stylesheet->transform(
|
||||||
$parser->parse_string(
|
$parser->parse_string(
|
||||||
XMLout(
|
XMLout(
|
||||||
|
@ -209,6 +204,7 @@ sub output_page
|
||||||
-cookie=>@cookies
|
-cookie=>@cookies
|
||||||
),
|
),
|
||||||
$output->toString;
|
$output->toString;
|
||||||
|
#$stylesheet->output_as_bytes($output); <= for future use with XML::LibXSLT (>= 1.62)
|
||||||
}
|
}
|
||||||
elsif($param_xslt eq "pr0n")
|
elsif($param_xslt eq "pr0n")
|
||||||
{
|
{
|
||||||
|
@ -225,6 +221,7 @@ sub output_page
|
||||||
-cookie=>@cookies
|
-cookie=>@cookies
|
||||||
),
|
),
|
||||||
$output->toString;
|
$output->toString;
|
||||||
|
#$stylesheet->output_as_bytes($output); <= for future use with XML::LibXSLT (>= 1.62)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
<string id="error_repeat_password">Please repeat your password.</string>
|
<string id="error_repeat_password">Please repeat your password.</string>
|
||||||
<string id="error_no_query">You passed no query string.</string>
|
<string id="error_no_query">You passed no query string.</string>
|
||||||
<string id="error_no_ogg_plugin">Your browser does not support Ogg Theora video playback.</string>
|
<string id="error_no_ogg_plugin">Your browser does not support Ogg Theora video playback.</string>
|
||||||
|
<string id="error_no_video">There is no video matching your request</string>
|
||||||
<string id=""></string>
|
<string id=""></string>
|
||||||
|
|
||||||
<!-- information -->
|
<!-- information -->
|
||||||
|
|
|
@ -18,7 +18,7 @@ if($query->url_param('action') eq 'bookmark' and $query->url_param('id'))
|
||||||
$page->{'message'}->{'type'} = "information";
|
$page->{'message'}->{'type'} = "information";
|
||||||
}
|
}
|
||||||
#check if id or title is passed
|
#check if id or title is passed
|
||||||
elsif($query->url_param('title') or $query->url_param('id'))
|
if($query->url_param('title') or $query->url_param('id'))
|
||||||
{
|
{
|
||||||
if($query->url_param('id'))
|
if($query->url_param('id'))
|
||||||
{
|
{
|
||||||
|
@ -67,8 +67,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
{
|
{
|
||||||
#still no results
|
#still no results
|
||||||
#there is nothing we can do now - this video doesn't exist...
|
#there is nothing we can do now - this video doesn't exist...
|
||||||
$page->{'message'}->{'type'} = "error";
|
print $query->redirect("/index.pl?error=error_no_video");
|
||||||
$page->{'message'}->{'text'} = "error_202c";
|
|
||||||
}
|
}
|
||||||
elsif($rowcount == 1)
|
elsif($rowcount == 1)
|
||||||
{
|
{
|
||||||
|
@ -249,6 +248,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
'referer' => $referer
|
'referer' => $referer
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
print output_page();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -260,6 +260,5 @@ else
|
||||||
{
|
{
|
||||||
$page->{'message'}->{'type'} = "error";
|
$page->{'message'}->{'type'} = "error";
|
||||||
$page->{'message'}->{'text'} = "error_202c";
|
$page->{'message'}->{'text'} = "error_202c";
|
||||||
}
|
|
||||||
|
|
||||||
print output_page();
|
print output_page();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue