1 # Shows the upload dialog.
3 package Sesse::pr0n::UploadForm;
7 use Sesse::pr0n::Common qw(error dberror);
11 my $dbh = Sesse::pr0n::Common::get_dbh();
13 # Fix common error: pr0n.sesse.net/upload/event -> pr0n.sesse.net/upload/event/
14 if ($r->path_info !~ /\/$/) {
15 my $res = Plack::Response->new(301);
16 $res->header('Location' => $r->path_info . "/");
19 $r->path_info =~ /^\/upload\/([a-zA-Z0-9-]+)\/?$/
20 or return error($r, "Could not extract event");
23 my ($user,$takenby) = Sesse::pr0n::Common::check_access($r);
24 return Sesse::pr0n::Common::generate_401($r) if (!defined($user));
26 my $res = Plack::Response->new(200);
27 $res->content_type("text/html; charset=utf-8");
28 my $io = IO::String->new;
30 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'upload-title'));
31 Sesse::pr0n::Common::header($r, $io, $title);
32 Sesse::pr0n::Templates::print_template($r, $io, 'upload', {
35 Sesse::pr0n::Common::footer($r, $io);