} } } } } } ?> </b> </div> <div class="rankcontainer"> <?php if ($locktu == 0) { $locktu = $fitimeu + 1; } if ($nowtime >= $sttimeu + $srefresh) { if ($locktu < $sttimeu || $nowtime >= $fitimeu || contest_passed($cid)) { $locktu = $fitimeu; } $num_of_problem = 0; $map2 = array(); $map3 = array(); $titles = array(); $usernum = contest_get_number_of_users($cid); foreach ((array) contest_get_problem_summaries($cid) as $row) { if ($row['type'] == 3) { $pacnum = $row["ac_user"]; $row['type'] = 1; if ($usernum == 0) { $rto = 0; } else { $rto = $pacnum / $usernum;
echo date("Y-m-d") . " 14:00:00"; ?> '/><span class="add-on"><i class="icon-th"></i></span></div></td></tr> <tr><td>( Set it later than end time if you don't want to lock board )</td></tr> <tr><td><label class="radio inline"><input type="radio" name="localtime" value="1" />Use local timezone</label><label class="radio inline"><input type="radio" name="localtime" value="0" checked="checked" /> Use server timezone</label></td></tr> <tr><td>Your timezone: <span id="localtz"></span><input name="localtz" type="hidden" id="tzinp" /></td></tr> <tr><td><label class="radio inline"><input type="radio" name="hide_others" value="1" /> Hide others' status</label><label class="radio inline"><input type="radio" name="hide_others" value="0" checked="checked" /> Show others' status</label></td></tr> <tr><td><div class="input-prepend"><span class="add-on">Password: </span><input type="password" name="password" /></div></td></tr> <tr><td>( Leave it blank if not needed )</td></tr> </table> </div> <?php if ($_GET['clone'] == 1) { $ccid = convert_str($_GET['cid']); if (contest_passed($ccid) && (!contest_is_private($ccid) || $current_user->is_valid() && ($current_user->is_in_contest($ccid) || $current_user->is_root()))) { $ccrow = contest_get_problem_basic($ccid); } } $nn = $config["limits"]["problems_on_contest_add"]; ?> <div class='span6'> <table style="width:100%"> <tr><th colspan="2">Add Problems For Contest</th></tr> <tr><th colspan="2">Leave Problem ID blank if you don't want to add it.</th></tr> <?php $ccrow = (array) $ccrow; for ($i = 0; $i < $nn; $i++) { if ($i >= sizeof($ccrow)) { $trow = array(); } else {
die("SQL Error!"); } /* * SQL queries * Get data to display */ $sQuery = "\n SELECT COUNT(" . $sIndexColumn . ")\n FROM {$sTable}\n {$sWhere}\n {$sOrder}\n"; $db->query($sQuery); list($iFilteredTotal) = $db->get_row($sQuery, ARRAY_N); /* * Output */ $output = array("sEcho" => intval($_GET['sEcho']), "iTotalRecords" => $iTotal, "iTotalDisplayRecords" => $iFilteredTotal, "aaData" => array()); $sQuery = "\n SELECT " . str_replace(" , ", " ", implode(", ", $aColumns)) . "\n FROM {$sTable}\n {$sWhere}\n {$sOrder}\n {$sLimit}\n"; $cshows = false; if ($current_user->is_valid() && contest_passed($cid)) { $cshows = true; } $isv = $current_user->is_codeviewer(); foreach ((array) $db->get_results($sQuery, ARRAY_A) as $aRow) { $row = array(); $aRow["language"] = match_lang($aRow["language"]); if ($aRow["memory_used"] != 0) { $aRow["memory_used"] .= " KB"; $aRow["time_used"] .= " ms"; } else { $aRow["memory_used"] = ""; if ($aRow["time_used"] != 0) { $aRow["time_used"] .= " ms"; } else { $aRow["time_used"] = "";
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; include_once dirname(__FILE__) . "/../functions/runs.php"; $runid = convert_str($_GET['runid']); $cid = run_get_val($runid, "contest_belong"); $uname = run_get_val($runid, "username"); $ret["code"] = 1; if (!($cid == "0" || contest_get_val($cid, "hide_others") == 0 || contest_passed($cid) || $current_user->match($uname) || $current_user->is_root())) { $ret["msg"] = "Permission denined."; } else { $query = "select runid,result,memory_used,time_used from status where runid='{$runid}'"; $ret = $db->get_row($query, ARRAY_A); $ret["code"] = 0; } echo json_encode($ret);
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/problems.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; $cid = convert_str($_POST['cid']); $ret = array(); $ret["code"] = 1; if (contest_exist($cid) && !contest_passed($cid) && ($current_user->is_root() || $current_user->match(contest_get_val($cid, "owner")))) { $title = htmlspecialchars(convert_str($_POST['title'])); $isprivate = 0; $description = htmlspecialchars(convert_str($_POST['description'])); $lock_board_time = convert_str($_POST['lock_board_time']); $start_time = convert_str($_POST['start_time']); $end_time = convert_str($_POST['end_time']); if (!contest_started($cid) && $_POST["localtime"] == 1) { $dt = new DateTime($start_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $start_time = $dt->format('Y-m-d H:i:s'); $dt = new DateTime($lock_board_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $lock_board_time = $dt->format('Y-m-d H:i:s'); $dt = new DateTime($end_time, new DateTimeZone($_POST['localtz'])); $dt->setTimezone(new DateTimeZone($mytimezone)); $end_time = $dt->format('Y-m-d H:i:s'); } $ctype = convert_str($_POST['ctype']); $hide_others = convert_str($_POST['hide_others']); $pass = pwd(convert_str($_POST['password'])); if ($_POST['password'] != "") { $isprivate = 2;
$ret["msg"] = "Please login as root!"; die(json_encode($ret)); } $runid = convert_str($_GET['runid']); if ($runid == "") { $ret["msg"] = "Invalid request."; die(json_encode($ret)); } $sql = "select pid,result,contest_belong from status where runid='{$runid}'"; list($pid, $result, $cid) = $db->get_row($sql, ARRAY_N); if ($pid == "") { $ret["msg"] = "Invalid runid."; die(json_encode($ret)); } $ispretest = true; if ($cid == "0" || contest_get_val($cid, "has_cha") == 0 || contest_passed($cid)) { $ispretest = false; } $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; list($vname) = $db->get_row("select vname from problem where pid='{$pid}'", ARRAY_N); $sql_r = "update status set result='Rejudging' where runid='{$runid}' "; $db->query($sql_r); $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; $fp = @fsockopen($host, $port, $errno, $errstr); if (!$fp) { $ret["msg"] = "Socket open error!"; echo json_encode($ret); die; } else {
echo latex_content($show_problem->get_val("hint")) . "\n"; ?> <div style="clear:both"></div> </div> <?php } ?> <div class="functions tcenter" style="margin-bottom:20px"> <div class="btn-group"> <a href="#" class="submitprob btn btn-primary">Submit</a> <a href="#status/<?php echo $label; ?> " class="btn">Status</a> <?php if (contest_passed($cid) && $show_problem->get_val("hide") == 0) { ?> <a href="problem_show.php?pid=<?php echo $pid; ?> " class="btn">PID: <?php echo $pid; ?> </a> <?php } ?> </div> <?php if ($current_user->is_root()) { ?>
<?php include_once dirname(__FILE__) . "/../functions/users.php"; include_once dirname(__FILE__) . "/../functions/contests.php"; include_once dirname(__FILE__) . "/../functions/runs.php"; $runid = convert_str($_GET['runid']); $cid = run_get_val($runid, "contest_belong"); $uname = run_get_val($runid, "username"); $query = "select result,memory_used,time_used,username,source,language,pid,isshared,contest_belong from status where runid='{$runid}'"; $ret = $db->get_row($query, ARRAY_A); if (!$current_user->is_valid()) { unset($ret); $ret["code"] = 1; $ret["msg"] = "Permission denined. Please login."; } else { if (!($ret["isshared"] == TRUE && ($cid == "0" || contest_passed($cid)) || $current_user->match($uname) || $current_user->is_codeviewer())) { unset($ret); $ret["code"] = 1; $ret["msg"] = "Permission denined."; } else { $ret["source"] = htmlspecialchars($ret["source"]); $ret["language"] = match_lang($ret["language"]); if ($current_user->match($uname) || $current_user->is_root()) { $ret["control"] = 1; } else { $ret["control"] = 0; } if ($_GET["cid"] != "") { $ret["pid"] = contest_get_label_from_pid($cid, $ret["pid"]); } $ret["code"] = 0;
?> <script type="text/javascript"> var statperpage = <?php echo $config["limits"]["status_per_page"]; ?> ; var gcid = '<?php echo $cid; ?> '; var cpass= <?php echo contest_passed($cid) ? "true" : "false"; ?> ; var cnt=<?php if (contest_passed($cid)) { echo "0"; } else { if (contest_intermission($cid)) { echo strtotime(contest_get_val($cid, "challenge_start_time")); } else { if (contest_challenging($cid)) { echo strtotime(contest_get_val($cid, "challenge_end_time")); } else { if (contest_running($cid)) { echo strtotime(contest_get_val($cid, "end_time")); } else { echo strtotime(contest_get_val($cid, "start_time")); } } }
if (contest_challenging($cid)) { $ret["msg"] = "You cannot submit in challenge phase."; echo json_encode($ret); die; } if ($lang == 0) { $ret["msg"] = "Please Select Language."; echo json_encode($ret); die; } if (time() - strtotime($current_user->get_val("last_submit_time")) < 5) { $ret["msg"] = "Too Fast!"; echo json_encode($ret); die; } if ($cid == "" || contest_passed($cid)) { $cid = "0"; } if ($lang < 4 && $lang > 0) { setcookie($config["cookie_prefix"] . "lastlang", $lang, time() + 60 * 60 * 24 * 30, $config["base_path"]); } $query = "insert into status set pid='{$pid}' ,source='{$src}' ,contest_belong='{$cid}', result='Waiting', language='{$lang}', username='******', ipaddr='{$ip}', isshared='{$isshare}', time_submit='" . date("Y-m-d G:i:s", time()) . "' "; $result = $db->query($query); $nowid = $db->insert_id; $query = "update problem set total_submit=total_submit+1 where pid='{$pid}' "; $result = $db->query($query); $query = "update user set total_submit=total_submit+1 where username='******' "; $result = $db->query($query); $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; $fp = @fsockopen($host, $port, $errno, $errstr);
$ret = array(); $ret["code"] = 1; $sql = "select pid,result,contest_belong,jnum from status where runid='{$runid}'"; list($pid, $result, $cid, $jnum) = $db->get_row($sql, ARRAY_N); if (!$current_user->is_root() && $jnum + 1 >= $config["limits"]["max_error_rejudge_times"]) { $ret["msg"] = "Unable to rejudge. Already tried " . ($jnum + 1) . " times."; echo json_encode($ret); die; } if ($result != "Judge Error" && $result != "Judge Error (Vjudge Failed)" && $result != "") { $ret["msg"] = "Unable to rejudge."; echo json_encode($ret); die; } $ispretest = true; if ($cid == "0" || !contest_has_challenge($cid) || contest_passed($cid)) { $ispretest = false; } $host = $config["contact"]["server"]; $port = $config["contact"]["port"]; list($vname) = $db->get_row("select vname from problem where pid='{$pid}'", ARRAY_N); $db->query("update status set result='Rejudging',jnum=jnum+1 where runid='{$runid}'"); $fp = @fsockopen($host, $port, $errno, $errstr); if (!$fp) { $ret["msg"] = "Socket open error!"; echo json_encode($ret); die; } else { if (!$ispretest) { $msg = $config["contact"]["error_rejudge"] . "\n" . $runid . "\n" . $vname; } else {