Beispiel #1
0
<?php

include_once dirname(__FILE__) . "/../functions/users.php";
include_once dirname(__FILE__) . "/../functions/contests.php";
$cid = convert_str($_GET["cid"]);
$ret["code"] = 1;
$ret["msg"] = "Permission denied.";
if ($current_user->is_root() || $current_user->match(contest_get_val($cid, "owner")) && !contest_started($cid)) {
    $ret["code"] = 0;
    contest_delete($cid);
    $ret["msg"] = "Contest {$cid} has been successfully deleted.";
}
echo json_encode($ret);
Beispiel #2
0
          <h1 class="pagetitle" style="display:none">Status of Contest <?php 
echo $cid;
?>
</h1>
          <div>
            <form id="filterform" class="form-inline" method="">
              <b>Filter: </b>
              <label>Username: <input type='text' name='showname' id="showname" placeholder="Username" class="input-small" value='<?php 
echo $current_user->get_username();
?>
' /></label>
              <label>ID:
                <select type='text' name='showpid' id="showpid" class="input-medium">
                  <option value=''>All</option>
<?php 
if (contest_started($cid)) {
    foreach ((array) contest_get_problem_basic($cid) as $row) {
        ?>
                  <option value='<?php 
        echo $row["lable"];
        ?>
'><?php 
        echo $row["lable"] . ". " . $row['title'];
        ?>
</option>
<?php 
    }
}
?>
                </select>
              </label>
<?php

include_once 'functions/users.php';
include_once 'functions/sidebars.php';
include_once 'functions/contests.php';
$cid = convert_str($_GET["cid"]);
if (!contest_started($cid) || !($current_user->is_root() || contest_get_val($cid, "isprivate") == 0 || contest_get_val($cid, "isprivate") == 1 && $current_user->is_in_contest($cid) || contest_get_val($cid, "isprivate") == 2 && contest_get_val($cid, "password") == $_COOKIE[$config["cookie_prefix"] . "contest_pass_{$cid}"])) {
    ?>
        <div class="span12">
          <p class="alert alert-error">Contest not started or you're not in this contest.</p>
        </div>
<?php 
} else {
    ?>
        <div class="span9">
          <h1 class="pagetitle" style="display:none">Clarifications For Contest <?php 
    echo $cid;
    ?>
</h1>
<?php 
    if ($current_user->is_root()) {
        $res = contest_get_all_clarify($cid);
    } else {
        $res = contest_get_visible_clarify($cid, convert_str($current_user->get_username()));
    }
    foreach ((array) $res as $row) {
        ?>
          <h4><?php 
        echo $row["ispublic"] == '0' ? "Private Message" : "Public Message";
        ?>
</h4>
Beispiel #4
0
function contest_get_comparable_list($cid)
{
    global $db, $contest_infos;
    if (!isset($contest_infos[$cid])) {
        load_contest_infos($cid);
    }
    if (!$contest_infos[$cid]["valid"]) {
        return false;
    }
    if (isset($contest_infos[$cid]["comparable_list"])) {
        return $contest_infos[$cid]["comparable_list"];
    }
    $allp = $db->escape(contest_get_val($cid, "allp"));
    if (!contest_started($cid)) {
        $csql = "select cid from contest where cid = '{$cid}'";
    } else {
        $csql = "select cid from contest where allp = '{$allp}' and start_time < NOW() order by start_time desc";
    }
    foreach ((array) $db->get_results($csql, ARRAY_A) as $value) {
        $contest_infos[$cid]["comparable_list"][] = $value["cid"];
    }
    return $contest_infos[$cid]["comparable_list"];
}