Exemplo n.º 1
0
/**
 * Check whether the contest is accessible
 * @param type $cid
 * @return type 
 */
function is_contest_accessible($cid)
{
    if (is_contest_modifiable($cid)) {
        return true;
    }
    // This is a user. Auth to login
    $contest = new ContestsTbl($cid);
    if (!$contest->Get()) {
        return false;
    }
    if (!$contest->detail['avail']) {
        return false;
    }
    if ($contest->detail['course_id'] && !is_course_registered($contest->detail['course_id'])) {
        return false;
    }
    if (is_temporary_user()) {
        return $contest->detail['perm'] == 'temp' && is_contest_registered($cid) && is_contest_auth($cid) && is_contest_started($cid);
    } else {
        return $contest->detail['perm'] == 'user' && is_contest_auth($cid) && is_contest_started($cid);
    }
    return false;
}
Exemplo n.º 2
0
<?php

require "./navigation.php";
$course_id = safeget("course_id");
$courseTbl = new CourseTbl($course_id);
if (!$courseTbl->Get()) {
    error("Course not found");
}
$course = $courseTbl->detail;
if ($course['require_cinfo'] && !is_info_complete()) {
    MsgAndRedirect("profile_edit.php", "Your information is not complete.");
}
if ($course['require_bound'] && !is_authorized()) {
    MsgAndRedirect("netid_bind.php", "You need to bind your netid with your account first.");
}
if (is_course_registered($course_id)) {
    MsgAndRedirect("course_detail.php?course_id={$course_id}");
}
$now = time();
?>

<table class="ui-widget tblcontainer ui-widget-content ui-corner-all" width="100%">
    <caption> Course Detail </caption>

    <thead>
        <tr  class="ui-widget-header">
            <th width="50">ID</th>
            <th width="200">Name</th>
            <th width="200">Teacher</th>
            <th>Statistics</th>
        </tr>
Exemplo n.º 3
0
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
require_once "includes.php";
if (!isset($_GET["course"]) || $_GET["course"] == "") {
    header("Location: /" . SITE_ROOT);
}
$course = get_course_info($_GET["course"]);
if (!is_course_registered($course["id"], $account)) {
    header("Location: /" . SITE_ROOT);
}
$title = $course["department"] . $course["number"];
require_once "header_home.php";
if ($account === false) {
    header("Location: /" . SITE_ROOT);
}
if (isset($_POST["content"]) && $_POST["content"] != "") {
    add_post($account, $course["id"], $_POST["content"]);
}
if (isset($_GET["attend"]) && $_GET["attend"] != "") {
    if (is_attending($account, $_GET["attend"])) {
        leave_post($account, $_GET["attend"]);
    } else {
        attend_post($account, $_GET["attend"]);
    }
    header("Location: /" . SITE_ROOT . "/posts?course=" . $_GET["course"]);
}
if (isset($_GET["finish"]) && $_GET["finish"] != "") {
    finish_post($_GET["finish"]);
    header("Location: /" . SITE_ROOT . "/posts?course=" . $_GET["course"]);
}