@'.$user['username'].''; } } }, $str); $referrers_list = array(); foreach ($referrers as $referrer => $val) { $referrers_list[] = $referrer; } return array($res, $referrers_list); } function uojFilePreview($file_name, $output_limit, $file_type = 'text') { switch ($file_type) { case 'text': return strOmit(file_get_contents($file_name, false, null, 0, $output_limit + 4), $output_limit); default: return strOmit(shell_exec('xxd -g 4 -l 5000 ' . escapeshellarg($file_name) . ' | head -c ' . ($output_limit + 4)), $output_limit); } } function uojIncludeView($name, $view_params = array()) { extract($view_params); include $_SERVER['DOCUMENT_ROOT'].'/app/views/'.$name.'.php'; } function redirectTo($url) { header('Location: '.$url); die(); } function permanentlyRedirectTo($url) { header("HTTP/1.1 301 Moved Permanently"); header('Location: '.$url); die(); } function redirectToLogin() { if (UOJContext::isAjax()) { die('please login'); } else { header('Location: '.HTML::url('/login')); die(); } } function becomeMsgPage($msg, $title = '消息') { global $REQUIRE_LIB; if (UOJContext::isAjax()) { die($msg); } else { if (!isset($_COOKIE['bootstrap4'])) { $REQUIRE_LIB['bootstrap5'] = ''; } echoUOJPageHeader($title); echo $msg; echoUOJPageFooter(); die(); } } function become404Page($message = '未找到页面。') { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found", true, 404); becomeMsgPage('
' . $message . '
' . $message . '
'.UOJLocale::get('none').' |
ID | '; } if (!isset($config['problem_hidden'])) { echo ''.UOJLocale::get('problems::problem').' | '; } if (!isset($config['submitter_hidden'])) { echo ''.UOJLocale::get('problems::submitter').' | '; } if (!isset($config['result_hidden'])) { echo ''.UOJLocale::get('problems::result').' | '; } if (!isset($config['used_time_hidden'])) { echo ''.UOJLocale::get('problems::used time').' | '; } if (!isset($config['used_memory_hidden'])) { echo ''.UOJLocale::get('problems::used memory').' | '; } echo ''.UOJLocale::get('problems::language').' | '; echo ''.UOJLocale::get('problems::file size').' | '; if (!isset($config['submit_time_hidden'])) { echo ''.UOJLocale::get('problems::submit time').' | '; } if (!isset($config['judge_time_hidden'])) { echo ''.UOJLocale::get('problems::judge time').' | '; } echo '
---|
'.$file_content."\n".'
';
echo ''."\n".$file_content."\n".''; echo '
\n"; $this->_print_c($node); echo "\n"; } elseif ($node->nodeName == 'tests') { echo '
\n"; $this->_print_c($node); echo "\n"; } elseif ($node->nodeName == 'out') { if (isset($REQUIRE_LIB['bootstrap5'])) { echo '
\n"; $this->_print_c($node); echo "\n"; } elseif ($node->nodeName == 'res') { if (isset($REQUIRE_LIB['bootstrap5'])) { echo '
\n"; $this->_print_c($node); echo "\n"; } else { echo '<', $node->nodeName; foreach ($node->attributes as $attr) { echo ' ', $attr->name, '="', htmlspecialchars($attr->value), '"'; } echo '>'; $this->_print_c($node); echo '', $node->nodeName, '>'; } } public function __construct($details, $styler, $name) { global $REQUIRE_LIB; $this->name = $name; $this->styler = $styler; $this->details = $details; $this->dom = new DOMDocument(); if (!$this->dom->loadXML($this->details)) { throw new Exception("XML syntax error"); } $this->details = ''; } public function printHTML() { global $REQUIRE_LIB; $this->subtask_num = null; $this->_print($this->dom->documentElement); } } function echoJudgementDetails($raw_details, $styler, $name) { global $REQUIRE_LIB; try { $printer = new JudgementDetailsPrinter($raw_details, $styler, $name); $printer->printHTML(); } catch (Exception $e) { echo 'Failed to show details'; } } class SubmissionDetailsStyler { public $show_score = true; public $show_small_tip = true; public $collapse_in = false; public $fade_all_details = false; public function getTestInfoClass($info) { if ($info == 'Accepted' || $info == 'Extra Test Passed') { return 'card-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'card-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'card-uoj-acceptable-answer'; } else { return 'card-uoj-wrong'; } } public function getTestInfoIcon($test_info) { if ($test_info == 'Accepted' || $test_info == 'Extra Test Passed') { return ' '; } elseif ($test_info == 'Time Limit Exceeded') { return ' '; } elseif ($test_info == 'Acceptable Answer') { return ' '; } elseif ($test_info == 'Wrong Answer') { return ' '; } else { return ' '; } } public function shouldFadeDetails($info) { return $this->fade_all_details || $info == 'Extra Test Passed'; } } class CustomTestSubmissionDetailsStyler { public $show_score = true; public $show_small_tip = false; public $collapse_in = true; public $fade_all_details = false; public $ioi_contest_is_running = false; public function getTestInfoClass($info) { if ($info == 'Success') { return 'card-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'card-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'card-uoj-acceptable-answer'; } else { return 'card-uoj-wrong'; } } public function shouldFadeDetails($info) { return $this->fade_all_details; } } class HackDetailsStyler { public $show_score = false; public $show_small_tip = false; public $collapse_in = true; public $fade_all_details = false; public function getTestInfoClass($info) { if ($info == 'Accepted' || $info == 'Extra Test Passed') { return 'card-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'card-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'card-uoj-acceptable-answer'; } else { return 'card-uoj-wrong'; } } public function shouldFadeDetails($info) { return $this->fade_all_details; } } function echoSubmissionDetails($submission_details, $name) { global $REQUIRE_LIB; echoJudgementDetails($submission_details, new SubmissionDetailsStyler(), $name); } function echoCustomTestSubmissionDetails($submission_details, $name) { echoJudgementDetails($submission_details, new CustomTestSubmissionDetailsStyler(), $name); } function echoHackDetails($hack_details, $name) { echoJudgementDetails($hack_details, new HackDetailsStyler(), $name); } function echoHack($hack, $config, $user) { $problem = queryProblemBrief($hack['problem_id']); echo '
ID | '; } if (!isset($config['submission_id_hidden'])) { echo ''.UOJLocale::get('problems::submission id').' | '; } if (!isset($config['problem_hidden'])) { echo ''.UOJLocale::get('problems::problem').' | '; } if (!isset($config['hacker_hidden'])) { echo ''.UOJLocale::get('problems::hacker').' | '; } if (!isset($config['owner_hidden'])) { echo ''.UOJLocale::get('problems::owner').' | '; } if (!isset($config['result_hidden'])) { echo ''.UOJLocale::get('problems::result').' | '; } if (!isset($config['submit_time_hidden'])) { echo ''.UOJLocale::get('problems::submit time').' | '; } if (!isset($config['judge_time_hidden'])) { echo ''.UOJLocale::get('problems::judge time').' | '; } echo '
---|