Example #1
0
/**
 * Check whether the profile info is complete for the registering courses
 * @global type $login_uid
 * @global type $logged
 * @return type 
 */
function is_info_complete()
{
    if (is_admins() || is_manager()) {
        return true;
    }
    global $login_uid;
    global $logged;
    if (!$logged) {
        return false;
    }
    $userTbl = new UserTbl($login_uid);
    if (!$userTbl->Get()) {
        return false;
    }
    $user = $userTbl->detail;
    return trim($user['cn_name']) && is_chinese($user['cn_name']) && trim($user['major']) && trim($user['grade']) && is_grade_valid($user['grade']) && trim($user['class']) && trim($user['student_id']) && is_student_id_valid($user['student_id']);
}
Example #2
0
            continue;
        }
        ?>
                <td height=20 align="center">
                    <?php 
        if ($cid == 0) {
            echo $rs->Fields['sid'];
        } else {
            echo $rs->Fields['sid'] - $min_sid;
        }
        ?>
 </td>
                <td>
                    <?php 
        if ($cid == 0) {
            if ($user_id == get_uid() || is_admins() || is_manager()) {
                echo "<a href=\"../viewsource.php?sid=" . $rs->Fields['sid'] . "\" class=\"black\">";
                echo "<center><img src='../images/source-code.png' alt='view' title='View source code' /></center>";
                echo "</a>";
            }
        } else {
            $timestamp = strtotime($time) - strtotime($contest->detail['starttime']);
            if ($user_id == get_uid() || is_contest_modifiable($cid)) {
                echo "<a href=\"../viewsource.php?cid=" . $cid . "&sid=" . $rs->Fields['sid'] . "\" class=\"black\">";
                echo "<center><img src='../images/source-code.png' alt='view' title='View source code' /></center>";
                echo "</a>";
            }
        }
        ?>

                </td>
Example #3
0
<?php

require "./navigation.php";
$p = tryget("p", 1);
$rs = new RecordSet($conn);
global $login_uid;
$query_str = "SELECT course_id, name, teacher, description FROM courses WHERE avail = 1 ";
$count_str = "SELECT count(*) FROM courses WHERE avail = 1 ";
if (!is_admins()) {
    $query_str .= "AND owner = {$login_uid} ";
    $count_str .= "AND owner = {$login_uid} ";
}
$rs->nPageSize = 20;
$rs->PageCount($count_str);
$rs->SetPage($p);
$query_str .= "ORDER BY course_id DESC";
$rs->dpQuery($query_str);
$now = time();
?>

<table class="ui-widget tblcontainer ui-widget-content ui-corner-all" width="100%">
    <caption>Current Courses</caption>
    <thead >
        <tr class="ui-widget-header">
            <th width="50">ID</th>
            <th width="200">Name</th>
            <th width="200">Teacher</th>
            <th>Operation</th>
        </tr>
    </thead>
    <tbody>
Example #4
0
<?php

include_once "../inc/global.inc.php";
require "../inc/user.inc.php";
/*
 * 请求处理,如果没有相应的处理程序,发出错误信息
 */
if (!is_admins() && !is_manager()) {
    error("Admin Only Operation");
}
$act = safeget('act');
$avail_functions = array('AddContestProblem', 'AddProblem', 'ContestEditProblem', 'CreateContest', 'EditContest', 'DeleteContest', 'IncContestProblem', 'DecContestProblem', 'EditContestProblem', 'DeleteProblem', 'DeleteContestProblem', 'EditProblem', 'ImportArchiveProblem', 'ExportProblem', 'ExportSource', 'ExportContest', 'RejudgeProblem', 'ResetContest', 'StartContest', 'CreateCourse', 'EditCourse', 'DeleteCourse', 'KickoutUser', 'StdSubmit');
if (in_array($act, $avail_functions) && function_exists($act)) {
    if (strtoupper($_SERVER['REQUEST_METHOD']) == "GET") {
        $arg =& $_GET;
    } else {
        $arg =& $_POST;
    }
    $act($arg);
} else {
    error('Illegal Opeartions');
}
exit;
/*
 * 上传rar和zip测试数据
 */
function ArchiveUpload(&$arg, $problem_prefix, $handle)
{
    // extract files
    $archive_file_name = $_FILES['arcfile']['tmp_name'];
    // unrar
Example #5
0
/**
 * check whether internal ip in sysu
 * Not really accurate, only cover dorms
 */
function is_internal_IP()
{
    if (is_admins()) {
        return true;
    }
    $ip_prefix = array("172.31.", "172.", "10.", "222.200.", "192.168.", "202.116.", "211.66", "219.222", "125.217", "127.0.0.1");
    foreach ($ip_prefix as $ip) {
        if (!strncmp($_SERVER['REMOTE_ADDR'], $ip, strlen($ip))) {
            return true;
        }
    }
    return false;
}
Example #6
0
                <td>During</td>
                <td><input name="during" type="text" id="during" size="12" maxlength="12" value="05:00:00"></td>
                <td>05:00:00</td>
            </tr>
            <tr>
                <td>Accessibility</td>
                <td><select name="perm">
                        <?php 
if (!Config::$onsite) {
    ?>
                            <option selected="selected" value="user">All user</option>
                        <?php 
}
?>
                        <?php 
if (is_admins()) {
    ?>
                            <option value="admin">Admin only</option>
                        <?php 
} else {
    ?>
                            <option value="manager">Admin only</option>
                        <?php 
}
?>
                        <?php 
if (Config::$onsite) {
    ?>
                            <option value="temp" selected="selected">Temporary user</option>
                        <?php 
} else {