Exemple #1
0
	<link type="text/css" media="screen" rel="stylesheet" href="theme/jquery.colorbox/colorbox.css" />
	<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
	<script src="js/jquery.countdown.min.js" type="text/javascript"></script>
	<script src="js/countdown.custom.js" type="text/javascript"></script>
	<script src="js/server.time.js" type="text/javascript"></script>
	<?php 
    //Check if there's an active match
    if (!$arn->active_match()) {
        system_messages(0, "There is no active match");
        return;
    }
    //Check if user logged in i.e to entice him/her to login
    if (!$login) {
        system_messages(0, "To participate in the arena, you must login");
        return;
    }
    //Initialize arena validation
    require_once 'ajphp' . DS . 'arenaValidatorHelper.php';
    $arnv = new arenaValidatorHelper(time(), $_pre, $db, $arn, $_max_submissions, $_submission_timeout);
    //Is this user registered...?
    if (!$arnv->isUserRegistered() && !$su) {
        system_messages(0, 'You are not registered to participate in this match');
        return;
    }
    //Set participated column to 1 in user_match_log table
    $arn->set_participate();
    /**
    There's an active match... Now we need to render the match arena ie. the problem statement plus the relevant ajax scripts to handle data transfer, countdown timing, scoreboard refreshes ...
    */
    $arn->render_arena();
}
$_pre = $ecjConfig->table_prefix;
$_submission_timeout = $ecjConfig->submission_timeout;
$_max_submissions = $ecjConfig->max_submissions;
unset($ecjConfig);
//Get the mysqlHelper class
require_once '..' . DS . 'include' . DS . 'mysqlHelper.php';
$db = new mysqlHelper();
require_once '..' . DS . 'include' . DS . 'cleanPostAndGet.php';
//Clean $_POST and $_GET of malicious
if (isset($_GET['a']) && @$_GET['a'] == 'arenaval') {
    //Get the arena helper class
    require_once '..' . DS . 'include' . DS . 'arenaAppletHelper.php';
    $arn = new arenaAppletHelper(time());
    require_once 'arenaValidatorHelper.php';
    /**Instantiate the arenaValidatorHelper class*/
    $arnv = new arenaValidatorHelper(time(), $_pre, $db, $arn, $_max_submissions, $_submission_timeout);
    if (isset($_GET['v'])) {
        $v = $_GET['v'];
        if ($v == 'start_download') {
            echo $arnv->download_link();
        } else {
            if ($v == 'get_timeout') {
                echo $arnv->get_timeout();
            } else {
                if ($v == 'render_submission_form') {
                    $arnv->render_submission_form();
                } else {
                    if ($v == 'is_download') {
                        $arnv->is_download($_GET);
                    } else {
                        if ($v == 'solution-submission') {