@'.$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 = '消息') { if (UOJContext::isAjax()) { die($msg); } else { echoUOJPageHeader($title); echo $msg; echoUOJPageFooter(); die(); } } function become404Page() { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found", true, 404); becomeMsgPage('
唔……未找到该页面……你是从哪里点进来的……>_<……
禁止入内! T_T
'.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') { echo "
\n"; $this->_print_c($node); echo "\n"; } elseif ($node->nodeName == 'res') { 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) { $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() { $this->subtask_num = null; $this->_print($this->dom->documentElement); } } function echoJudgementDetails($raw_details, $styler, $name) { 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 'panel-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'panel-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'panel-uoj-acceptable-answer'; } else { return 'panel-uoj-wrong'; } } 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 'panel-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'panel-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'panel-uoj-acceptable-answer'; } else { return 'panel-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 'panel-uoj-accepted'; } elseif ($info == 'Time Limit Exceeded') { return 'panel-uoj-tle'; } elseif ($info == 'Acceptable Answer') { return 'panel-uoj-acceptable-answer'; } else { return 'panel-uoj-wrong'; } } public function shouldFadeDetails($info) { return $this->fade_all_details; } } function echoSubmissionDetails($submission_details, $name) { 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 '
---|