my $r = shift;
chdir $r->dir_config('root');
my $req = Apache2::Request->new($r);
- my ($problem, $format) = ($req->param('problem'), $req->param('prog_format'));
+ my ($problem, $format, $contest) = map {scalar $req->param($_)} 'problem', 'prog_format', 'contest';
my $ext = FORMAT_EXTENSION->{$format};
my $prog = $req->upload('prog');
+ die if defined $contest && $contest !~ /^\w+$/;
+
+ if (defined $contest) {
+ my $meta = LoadFile "ct/$contest/meta.yml";
+ die unless time >= $meta->{start} && time <= $meta->{end}
+ }
my $dir = tempdir;
$prog->link("$dir/prog.$ext");
},
problem => $problem,
user => $r->user,
+ date => time,
+ defined $contest ? (contest => $contest) : (),
};
my $jobname = int rand 1_000_000_000;