Example #1
0
 public function ACT_submit()
 {
     if (!$this->acl->check('general')) {
         $this->deny();
     }
     if ($this->config->getVar('judge_allowed') != 1) {
         $this->deny();
     }
     $user = $this->acl->getUser();
     $contest_id = $_POST['contest_id'];
     $contest = new MDL_Contest($contest_id);
     $contest_user = new MDL_Contest_User($contest, $user);
     if (!$contest_user->canSubmit()) {
         $this->deny();
     }
     $prob_id = $_POST['prob_id'];
     $language = $_POST['lang'];
     $source = file_get_contents($_FILES['source']['tmp_name']);
     $record_display = $contest->getConfig()->getRecordDisplay('during');
     $record_id = MDL_Judge_Single::submit($user->getID(), $prob_id, $language, $source, $record_display);
     $contest_user->addRecord($record_id);
     MDL_Judger_Process::processTaskQueue();
     $this->locator->redirect('record/detail', array(), '/' . $record_id);
 }