当前位置: 首页>>代码示例>>PHP>>正文


PHP dbconfig_get函数代码示例

本文整理汇总了PHP中dbconfig_get函数的典型用法代码示例。如果您正苦于以下问题:PHP dbconfig_get函数的具体用法?PHP dbconfig_get怎么用?PHP dbconfig_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbconfig_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_print_upload

function handle_print_upload()
{
    global $DB, $username;
    ini_set("upload_max_filesize", dbconfig_get('sourcesize_limit') * 1024);
    checkFileUpload($_FILES['code']['error']);
    $filename = $_FILES['code']['name'];
    $realfilename = $_FILES['code']['tmp_name'];
    /* Determine the language */
    $langid = @$_POST['langid'];
    /* sanity check only */
    if ($langid != "") {
        $lang = $DB->q('MAYBETUPLE SELECT langid FROM language
		                WHERE langid = %s AND allow_submit = 1', $langid);
        if (!isset($lang)) {
            error("Unable to find language '{$langid}'");
        }
    }
    if (IS_JURY) {
        $whoami = 'JURY/' . $username;
    } else {
        $whoami = $username;
    }
    $ret = send_print($realfilename, $langid, $whoami, $filename);
    echo "<p>" . nl2br(htmlspecialchars($ret[1])) . "</p>\n\n";
    if ($ret[0]) {
        echo "<p>Print successful.</p>";
    } else {
        error("Error while printing. Contact staff.");
    }
}
开发者ID:nya3jp,项目名称:domjudge,代码行数:30,代码来源:printing.php

示例2: getClarCategories

/**
 * Returns the list of clarification categories as a key,value array.
 * Keys should be non-numeric to distinguish them from problem IDs.
 */
function getClarCategories()
{
    $categs = dbconfig_get('clar_categories');
    $clarcategories = array();
    foreach ($categs as $key => $val) {
        $clarcategories[$key] = $val;
    }
    return $clarcategories;
}
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:13,代码来源:clarification.php

示例3: printtime

/**
 * Print a time in default configured time_format, or formatted as
 * specified. The format is according to strftime().
 * FIXME: reintroduce contest relative time: show time from start of
 * contest, after removing ignored intervals.
 */
function printtime($datetime, $format = NULL)
{
    if (empty($datetime)) {
        return '';
    }
    if (is_null($format)) {
        $format = dbconfig_get('time_format', '%H:%M');
    }
    return htmlspecialchars(strftime($format, floor($datetime)));
}
开发者ID:nya3jp,项目名称:domjudge,代码行数:16,代码来源:print.php

示例4: array

 $contest_row = $DB->q("MAYBETUPLE SELECT * FROM contest WHERE cid = %i", $cid);
 if (!$contest_row) {
     echo "<p>Contest not found.</p>\n";
     require LIBWWWDIR . '/footer.php';
     exit;
 }
 $contest_data = array();
 $contest_data['name'] = $contest_row['name'];
 $contest_data['short-name'] = $contest_row['name'];
 $contest_data['start-time'] = date('c', $contest_row['starttime']);
 $contest_data['duration'] = printtimerel(calcContestTime($contest_row['endtime'], $contest_row['cid']));
 if (!is_null($contest_row['freezetime'])) {
     $contest_data['scoreboard-freeze'] = printtimerel(calcContestTime($contest_row['freezetime'], $contest_row['cid']));
 }
 // TODO: event-feed-port
 $contest_data['penaltytime'] = dbconfig_get('penalty_time');
 /*
 $contest_data['default-clars'] = dbconfig_get('clar_answers');
 $contest_data['clar-categories'] = array_values(dbconfig_get('clar_categories'));
 */
 $contest_data['languages'] = array();
 $q = $DB->q("SELECT * FROM language");
 while ($lang = $q->next()) {
     $language = array();
     $language['name'] = $lang['name'];
     // TODO: compiler, -flags, runner, -flags?
     $contest_data['languages'][] = $language;
 }
 $contest_data['problems'] = array();
 $contests = getCurContests(FALSE);
 if (!empty($contests)) {
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:31,代码来源:impexp_contestyaml.php

示例5: config

/**
 * DB configuration
 */
function config($args)
{
    if (isset($args['name'])) {
        return array($args['name'] => dbconfig_get($args['name'], null, false));
    }
    return dbconfig_get(null, null, false);
}
开发者ID:retnan,项目名称:domjudge,代码行数:10,代码来源:index.php

示例6: function

\tvar matches = location.hash.match(/submitted=(\\d+)/);
\tif (matches) {
\t\tvar \$p = \$('<p class="submissiondone" />').html('submission done <a href="#">x</a>');
\t\t\$('#submitlist > .teamoverview').after(\$p);
\t\t\$('table.submissions tr[data-submission-id=' + matches[1] + ']').addClass('highlight');

\t\t\$('.submissiondone a').on('click', function() {
\t\t\t\$(this).parent().remove();
\t\t\t\$('table.submissions tr.highlight').removeClass('highlight');
\t\t\treloadLocation = 'index.php';
\t\t});
\t}
});
</script>
HTML;
    $maxfiles = dbconfig_get('sourcefiles_limit', 100);
    echo addForm('upload.php', 'post', null, 'multipart/form-data', null, ' onreset="resetUploadForm(' . $refreshtime . ', ' . $maxfiles . ');"') . "<p id=\"submitform\">\n\n";
    echo "<input type=\"file\" name=\"code[]\" id=\"maincode\" required";
    if ($maxfiles > 1) {
        echo " multiple";
    }
    echo " />\n";
    $probs = array();
    foreach ($probdata as $probinfo) {
        $probs[$probinfo['probid']] = $probinfo['shortname'];
    }
    $probs[''] = 'problem';
    echo addSelect('probid', $probs, '', true);
    $langs = array();
    foreach ($langdata as $langid => $langdata) {
        $langs[$langid] = $langdata['name'];
开发者ID:Surya97,项目名称:domjudge,代码行数:31,代码来源:index.php

示例7: auditlog

// judging would be marked as "claimed".
$cnt = $DB->q('RETURNAFFECTED UPDATE judging
               SET verified = %i, jury_member = ' . ($val ? '%s ' : 'NULL %_ ') . ', verify_comment = %s WHERE judgingid = %i', $val, $jury_member, $comment, $id);
auditlog('judging', $id, $val ? 'set verified' : 'set unverified');
if ($cnt == 0) {
    error("Judging '{$id}' not found or nothing changed.");
} else {
    if ($cnt > 1) {
        error("Validated more than one judging.");
    }
}
$jdata = $DB->q('TUPLE SELECT j.result, s.submitid, s.cid, s.teamid, s.probid, s.langid
                 FROM judging j
                 LEFT JOIN submission s USING (submitid)
                 WHERE judgingid = %i', $id);
if (dbconfig_get('verification_required', 0)) {
    calcScoreRow($jdata['cid'], $jdata['teamid'], $jdata['probid']);
    // log to event table (case of no verification required is handled
    // in the REST API function judging_runs_POST)
    $DB->q('INSERT INTO event (eventtime, cid, teamid, langid, probid, submitid, description)
	        VALUES (%s, %i, %s, %s, %s, %i, "problem judged")', now(), $jdata['cid'], $jdata['teamid'], $jdata['langid'], $jdata['probid'], $jdata['submitid']);
    if ($jdata['result'] == 'correct') {
        $balloons_enabled = (bool) $DB->q("VALUE SELECT process_balloons FROM contest WHERE cid = %i", $jdata['cid']);
        if ($balloons_enabled) {
            $DB->q('INSERT INTO balloon (submitid) VALUES(%i)', $jdata['submitid']);
        }
    }
}
/* redirect to referrer page after verification
 * or back to submission page when unverifying. */
if ($val) {
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:31,代码来源:verify.php

示例8: dbconfig_get

     echo "<table>\n{$tclist}";
     if ($lastjud !== NULL) {
         echo $lasttclist;
     }
     echo "</table>\n";
 }
 // Show JS toggle of previous submission results.
 if ($lastjud !== NULL) {
     echo "<span class=\"testcases_prev\">" . "<a href=\"javascript:togglelastruns();\">show/hide</a> results of previous " . "<a href=\"submission.php?id={$lastsubmitid}\">submission s{$lastsubmitid}</a>" . (empty($lastjud['verify_comment']) ? '' : "<span class=\"prevsubmit\"> (verify comment: '" . $lastjud['verify_comment'] . "')</span>") . "</span>";
 }
 // display following data only when the judging has been completed
 if ($judging_ended) {
     // display verification data: verified, by whom, and comment.
     // only if this is a valid judging, otherwise irrelevant
     if ($jud['valid'] || isset($jud['rejudgingid']) && $jud['rvalid']) {
         $verification_required = dbconfig_get('verification_required', 0);
         if (!($verification_required && $jud['verified'])) {
             $val = !$jud['verified'];
             echo addForm('verify.php') . addHidden('id', $jud['judgingid']) . addHidden('val', $val) . addHidden('redirect', @$_SERVER['HTTP_REFERER']);
         }
         echo "<p>Verified: " . "<strong>" . printyn($jud['verified']) . "</strong>";
         if ($jud['verified'] && !empty($jud['jury_member'])) {
             echo ", by " . specialchars($jud['jury_member']);
             if (!empty($jud['verify_comment'])) {
                 echo ' with comment "' . specialchars($jud['verify_comment']) . '"';
             }
         }
         if (!($verification_required && $jud['verified'])) {
             echo '; ' . addSubmit(($val ? '' : 'un') . 'mark verified', 'verify');
             if ($val) {
                 echo ' with comment ' . addInput('comment', '', 25);
开发者ID:sponi78,项目名称:domjudge,代码行数:31,代码来源:submission.php

示例9: while

    echo "<p class=\"nodata\">No judgehosts defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">hostname</th>" . "<th scope=\"col\">active</th>" . "<th class=\"sorttable_nosort\">status</th>" . "<th class=\"sorttable_nosort\">restriction</th>" . "<th class=\"sorttable_nosort\">load</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="judgehost.php?id=' . urlencode($row['hostname']) . '">';
        echo "<tr" . ($row['active'] ? '' : ' class="disabled"') . "><td>" . $link . printhost($row['hostname']) . '</a>' . "</td><td class=\"tdcenter\">" . $link . printyn($row['active']) . "</a></td>";
        echo "<td class=\"tdcenter ";
        if (empty($row['polltime'])) {
            echo "judgehost-nocon";
            echo "\" title =\"never checked in\">";
        } else {
            $reltime = floor(difftime($now, $row['polltime']));
            if ($reltime < dbconfig_get('judgehost_warning', 30)) {
                echo "judgehost-ok";
            } else {
                if ($reltime < dbconfig_get('judgehost_critical', 120)) {
                    echo "judgehost-warn";
                } else {
                    echo "judgehost-crit";
                }
            }
            echo "\" title =\"last checked in {$reltime} seconds ago\">";
        }
        echo $link . CIRCLE_SYM . "</a></td>";
        echo "<td>" . $link . (is_null($row['name']) ? '<i>none</i>' : $row['name']) . '</a></td>';
        echo "<td title=\"load during the last 2 and 10 minutes and the whole contest\">" . $link . sprintf('%.2f&nbsp;%.2f&nbsp;%.2f', @$work2min[$row['hostname']] / (2 * 60), @$work10min[$row['hostname']] / (10 * 60), @$workcontest[$row['hostname']] / $clen) . "</a></td>";
        if (IS_ADMIN) {
            if ($row['active']) {
                $activepicto = "pause";
                $activecmd = "deactivate";
            } else {
开发者ID:nya3jp,项目名称:domjudge,代码行数:31,代码来源:judgehosts.php

示例10: importZippedProblem


//.........这里部分代码省略.........
            $testout = $zip->getFromName("data/{$type}/{$datafile}.ans");
            $description = $datafile;
            if (($descfile = $zip->getFromName("data/{$type}/{$datafile}.desc")) !== FALSE) {
                $description .= ": \n" . $descfile;
            }
            $image_file = $image_type = $image_thumb = FALSE;
            foreach (array('png', 'jpg', 'jpeg', 'gif') as $img_ext) {
                if (($image_file = $zip->getFromName("data/{$type}/{$datafile}" . "." . $img_ext)) !== FALSE) {
                    list($image_thumb, $image_type) = get_image_thumb_type($image_file);
                    break;
                }
            }
            $md5in = md5($testin);
            $md5out = md5($testout);
            // Skip testcases that already exist identically
            $id = $DB->q('MAYBEVALUE SELECT testcaseid FROM testcase
			              WHERE md5sum_input = %s AND md5sum_output = %s AND
			              description = %s AND sample = %i AND probid = %i', $md5in, $md5out, $description, $type == 'sample' ? 1 : 0, $probid);
            if (isset($id)) {
                echo "<li>Skipped {$type} testcase <tt>{$datafile}</tt>: already exists</li>\n";
                continue;
            }
            $DB->q('INSERT INTO testcase (probid, rank, sample,
			        md5sum_input, md5sum_output, input, output, description' . ($image_file !== FALSE ? ', image, image_thumb, image_type' : '') . ')' . 'VALUES (%i, %i, %i, %s, %s, %s, %s, %s' . ($image_file !== FALSE ? ', %s, %s, %s' : '%_ %_ %_') . ')', $probid, $maxrank, $type == 'sample' ? 1 : 0, $md5in, $md5out, $testin, $testout, $description, $image_file, $image_thumb, $image_type);
            $maxrank++;
            $ncases++;
            echo "<li>Added {$type} testcase from: <tt>{$datafile}.{in,ans}</tt></li>\n";
        }
        echo "</ul>\n<p>Added {$ncases} {$type} testcase(s).</p>\n";
    }
    // submit reference solutions
    if ($cid == -1) {
        echo "<p>No jury solutions added: problem is not linked to a contest (yet).</p>\n";
    } else {
        if (empty($teamid)) {
            echo "<p>No jury solutions added: must associate team with your user first.</p>\n";
        } else {
            if ($DB->q('VALUE SELECT allow_submit FROM problem
	                    INNER JOIN contestproblem using (probid)
	                    WHERE probid = %i AND cid = %i', $probid, $cid)) {
                // First find all submittable languages:
                $langs = $DB->q('KEYVALUETABLE SELECT langid, extensions
		                 FROM language WHERE allow_submit = 1');
                $njurysols = 0;
                echo "<ul>\n";
                for ($j = 0; $j < $zip->numFiles; $j++) {
                    $filename = $zip->getNameIndex($j);
                    $filename_parts = explode(".", $filename);
                    $extension = end($filename_parts);
                    if (!starts_with($filename, 'submissions/') || ends_with($filename, '/')) {
                        // skipping non-submission files and directories silently
                        continue;
                    }
                    unset($langid);
                    foreach ($langs as $key => $exts) {
                        if (in_array($extension, json_decode($exts))) {
                            $langid = $key;
                            break;
                        }
                    }
                    if (empty($langid)) {
                        echo "<li>Could not add jury solution <tt>{$filename}</tt>: unknown language.</li>\n";
                    } else {
                        if (!($tmpfname = tempnam(TMPDIR, "ref_solution-"))) {
                            error("Could not create temporary file in directory " . TMPDIR);
                        }
                        $offset = mb_strlen('submissions/');
                        $expectedResult = normalizeExpectedResult(mb_substr($filename, $offset, mb_strpos($filename, '/', $offset) - $offset));
                        $source = $zip->getFromIndex($j);
                        $results = getExpectedResults($source);
                        if ($results === NULL) {
                            // annotate source code with expected result
                            $source = "// added by import: " . $matchstrings[0] . $expectedResult . "\n" . $source;
                        } else {
                            if (!in_array($expectedResult, $results)) {
                                warning("annotated result '" . implode(', ', $results) . "' does not match directory for {$filename}");
                            }
                        }
                        file_put_contents($tmpfname, $source);
                        if (filesize($tmpfname) <= dbconfig_get('sourcesize_limit') * 1024) {
                            submit_solution($teamid, $probid, $cid, $langid, array($tmpfname), array(basename($filename)));
                            echo "<li>Added jury solution from: <tt>{$filename}</tt></li>\n";
                            $njurysols++;
                        } else {
                            echo "<li>Could not add jury solution <tt>{$filename}</tt>: too large.</li>\n";
                        }
                        unlink($tmpfname);
                    }
                }
                echo "</ul>\n<p>Added {$njurysols} jury solution(s).</p>\n";
            } else {
                echo "<p>No jury solutions added: problem not submittable</p>\n";
            }
        }
    }
    if (!in_array($cid, array_keys($cdatas))) {
        echo "<p>The corresponding contest is not activated yet." . "To view the submissions in the submissions list, you have to activate the contest first.</p>\n";
    }
    return $probid;
}
开发者ID:retnan,项目名称:domjudge,代码行数:101,代码来源:common.jury.php

示例11: warning

                warning("No {$file} file specified for new testcase, ignoring.");
            } else {
                checkFileUpload($_FILES['add_' . $file]['error']);
                $content[$file] = file_get_contents($_FILES['add_' . $file]['tmp_name']);
            }
        }
        $DB->q("INSERT INTO testcase\n\t\t        (probid,rank,md5sum_input,md5sum_output,input,output,description,sample)\n\t\t        VALUES (%i,%i,%s,%s,%s,%s,%s,%i)", $probid, $rank, md5(@$content['input']), md5(@$content['output']), @$content['input'], @$content['output'], @$_POST['add_desc'], @$_POST['add_sample']);
        if (!empty($content['image'])) {
            list($thumb, $type) = get_image_thumb_type($content['image']);
            $DB->q('UPDATE testcase SET image = %s, image_thumb = %s, image_type = %s
			        WHERE probid = %i AND rank = %i', @$content['image'], $thumb, $type, $probid, $rank);
        }
        auditlog('testcase', $probid, 'added', "rank {$rank}");
        $result .= "<li>Added new testcase {$rank} from files " . htmlspecialchars($_FILES['add_input']['name']) . " (" . printsize($_FILES['add_input']['size']) . ") and " . htmlspecialchars($_FILES['add_output']['name']) . " (" . printsize($_FILES['add_output']['size']) . ").";
        if ($_FILES['add_output']['size'] > dbconfig_get('output_limit') * 1024) {
            $result .= "<br /><b>Warning: output file size exceeds " . "<code>output_limit</code> of " . dbconfig_get('output_limit') . " kB. This will always result in wrong answers!</b>";
        }
        if (empty($content['input']) || empty($content['output'])) {
            $result .= "<br /><b>Warning: empty testcase file(s)!</b>";
        }
        $result .= "</li>\n";
    }
}
if (!empty($result)) {
    echo "<ul>\n{$result}</ul>\n\n";
    // Reload testcase data after updates
    get_testcase_data();
}
// Check if ranks must be renumbered (if test cases have been deleted).
// There is no need to run this within one MySQL transaction since
// nothing depends on the ranks being sequential, and we do preserve
开发者ID:nya3jp,项目名称:domjudge,代码行数:31,代码来源:testcase.php

示例12: addFileField

    if ($data['type'] == 'compile') {
        $res = $DB->q('SELECT langid AS id FROM language
	               WHERE compile_script = %s ORDER BY langid', $data['execid']);
        $page = "language";
        $prefix = "";
    } else {
        if ($data['type'] == 'run') {
            $res = $DB->q('SELECT probid AS id FROM problem
	               WHERE special_run = %s ORDER BY probid', $data['execid']);
            $page = "problem";
            $prefix = "p";
        }
    }
}
$used = FALSE;
if (($data['type'] == 'compare' || $data['type'] == 'run') && dbconfig_get('default_' . $data['type']) == $data['execid']) {
    $used = TRUE;
    echo '<em>default ' . $data['type'] . '</em> ';
}
while ($row = $res->next()) {
    $used = TRUE;
    echo '<a href="' . $page . '.php?id=' . $row['id'] . '">' . $prefix . $row['id'] . '</a> ';
}
if (!$used) {
    echo "<span class=\"nodata\">none</span>";
}
?>
</td></tr>
<?php 
if (IS_ADMIN && class_exists("ZipArchive")) {
    echo '<tr>' . '<td>Executable archive:</td>' . '<td>' . addFileField('executable_archive[]') . addSubmit('Upload', 'upload') . '</td>' . "</tr>\n";
开发者ID:sponi78,项目名称:domjudge,代码行数:31,代码来源:executable.php

示例13: putSubmissions

/**
 * Print a list of submissions from contests contained in the $cdatas
 * contest data array, either all or only those that match
 * <key> [= <value>] pairs specified in $restrictions:
 *  - 'verified'  if set, only list submissions that are verified
 *  - 'judged'    if set, only list submissions with completed judgings
 *  - 'teamid', 'probid', 'langid', 'categoryid', 'judgehost' can be
 *    set to an ID to filter on that respective team, language, etc.
 * Output is limited to the number $limit, or unlimited by default.
 * If $highlight is a submission ID, then that one is highlighted.
 */
function putSubmissions($cdatas, $restrictions, $limit = 0, $highlight = null)
{
    global $DB, $username;
    /* We need two kind of queries: one for all submissions, and one
     * with the results for the valid ones.
     */
    $cids = array_keys($cdatas);
    $verifyclause = '';
    if (isset($restrictions['verified'])) {
        if ($restrictions['verified']) {
            $verifyclause = 'AND (j.verified = 1) ';
        } else {
            $verifyclause = 'AND (j.verified = 0 OR (j.verified IS NULL AND s.judgehost IS NULL)) ';
        }
    }
    $judgedclause = '';
    if (isset($restrictions['judged'])) {
        if ($restrictions['judged']) {
            $judgedclause = 'AND (j.result IS NOT NULL) ';
        } else {
            $judgedclause = 'AND (j.result IS NULL) ';
        }
    }
    $rejudgingclause = '';
    if (isset($restrictions['rejudgingdiff'])) {
        if ($restrictions['rejudgingdiff']) {
            $rejudgingclause = 'AND (j.result != jold.result) ';
        } else {
            $rejudgingclause = 'AND (j.result = jold.result) ';
        }
    }
    if (isset($restrictions['old_result']) && !isset($restrictions['rejudgingid'])) {
        error('cannot specify restriction on old_result without specifying a rejudgingid');
    }
    // Special case the rejudgingid restriction by showing the
    // corresponding judging and the old (active) judging result:
    $sqlbody = 'FROM submission s
	     LEFT JOIN team           t  USING (teamid)
	     LEFT JOIN problem        p  USING (probid)
	     LEFT JOIN contestproblem cp USING (probid, cid)
	     LEFT JOIN language       l  USING (langid) ' . (isset($restrictions['rejudgingid']) ? 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.rejudgingid = %i)
	     LEFT JOIN judging        jold ON (j.prevjudgingid IS NULL AND s.submitid = jold.submitid AND jold.valid = 1 OR j.prevjudgingid = jold.judgingid) ' : 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.valid = 1) %_ ') . 'WHERE s.cid IN (%Ai) ' . $verifyclause . $judgedclause . $rejudgingclause . (isset($restrictions['teamid']) ? 'AND s.teamid = %i ' : '%_ ') . (isset($restrictions['categoryid']) ? 'AND t.categoryid = %i ' : '%_ ') . (isset($restrictions['probid']) ? 'AND s.probid = %i ' : '%_ ') . (isset($restrictions['langid']) ? 'AND s.langid = %s ' : '%_ ') . (isset($restrictions['judgehost']) ? 'AND s.judgehost = %s ' : '%_ ') . (isset($restrictions['rejudgingid']) ? 'AND (s.rejudgingid = %i OR ' . '     j.rejudgingid = %i) ' : '%_ %_ ') . (isset($restrictions['old_result']) ? 'AND jold.result = %s ' : '%_ ') . (isset($restrictions['result']) ? 'AND j.result = %s ' : '%_ ');
    // No contests; automatically nothing found and the query can not be run...
    if (empty($cids)) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    $res = $DB->q('SELECT s.submitid, s.teamid, s.probid, s.langid, s.cid,
	               s.submittime, s.judgehost, s.valid, t.name AS teamname,
	               cp.shortname, p.name AS probname, l.name AS langname,
	               j.result, j.judgehost, j.verified, j.jury_member, j.seen ' . (isset($restrictions['rejudgingid']) ? ', jold.result AS oldresult ' : '') . $sqlbody . 'ORDER BY s.submittime DESC, s.submitid DESC ' . ($limit > 0 ? 'LIMIT 0, %i' : '%_'), @$restrictions['rejudgingid'], $cids, @$restrictions['teamid'], @$restrictions['categoryid'], @$restrictions['probid'], @$restrictions['langid'], @$restrictions['judgehost'], @$restrictions['rejudgingid'], @$restrictions['rejudgingid'], @$restrictions['old_result'], @$restrictions['result'], $limit);
    // nothing found...
    if ($res->count() == 0) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    if (IS_JURY) {
        echo addForm('submission.php');
    }
    // print the table with the submissions.
    // table header
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\" class=\"sorttable_numeric\">ID</th>" : '') . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\" class=\"sorttable_numeric\">contest</th>" : '') . "<th scope=\"col\">time</th>" . (IS_JURY ? "<th scope=\"col\">team</th>" : '') . "<th scope=\"col\">problem</th>" . "<th scope=\"col\">lang</th>" . "<th scope=\"col\">result</th>" . (IS_JURY ? "<th scope=\"col\">verified</th><th scope=\"col\">by</th>" : '') . (IS_JURY && isset($restrictions['rejudgingid']) ? "<th scope=\"col\">old result</th>" : '') . "</tr>\n</thead>\n<tbody>\n";
    // print each row with links to detailed information
    $iseven = $subcnt = $corcnt = $igncnt = $vercnt = $quecnt = 0;
    while ($row = $res->next()) {
        $sid = (int) $row['submitid'];
        // always provide link if this is Jury. For team, provide link
        // to a different page, provided that the result is actually
        // present and valid.
        if (IS_JURY) {
            // If rejudging list, link to the new rejudging:
            $linkurl = 'submission.php?id=' . $sid . (isset($restrictions['rejudgingid']) ? '&amp;rejudgingid=' . $restrictions['rejudgingid'] : '');
            $link = ' href="' . $linkurl . '"';
        } elseif ($row['submittime'] < $cdatas[$row['cid']]['endtime'] && $row['result'] && $row['valid'] && (!dbconfig_get('verification_required', 0) || $row['verified'])) {
            $link = ' href="submission_details.php?id=' . $sid . '"';
        } else {
            $link = '';
        }
        echo "<tr class=\"" . ($iseven ? 'roweven' : 'rowodd');
        $iseven = !$iseven;
        if ($row['valid']) {
            $subcnt++;
        } else {
            $igncnt++;
            echo ' sub_ignore';
        }
        if ($sid == $highlight) {
            echo ' highlight';
        }
//.........这里部分代码省略.........
开发者ID:nya3jp,项目名称:domjudge,代码行数:101,代码来源:common.php

示例14: XMLaddnode

    XMLaddnode($node, 'id', $row['clarid']);
    XMLaddnode($node, 'team', $team_to_id[$row['sender']]);
    XMLaddnode($node, 'problem', $row['probid']);
    // FIXME: probid is shortname?
    XMLaddnode($node, 'time', calcContestTime($row['submittime'], $cid));
    XMLaddnode($node, 'timestamp', $row['submittime']);
    XMLaddnode($node, 'question', $row['question']);
    if (isset($row['answer'])) {
        XMLaddnode($node, 'answer', $row['answer']);
        XMLaddnode($node, 'answered', 'True');
        XMLaddnode($node, 'to-all', isset($row['recipient']) ? 'False' : 'True');
    } else {
        XMLaddnode($node, 'answered', 'False');
    }
}
$compile_penalty = dbconfig_get('compile_penalty', 0);
// write out runs
while ($row = $events->next()) {
    if ($row['description'] != 'problem submitted' && $row['description'] != 'problem judged') {
        continue;
    }
    $data = $DB->q('MAYBETUPLE SELECT submittime, teamid, probid, name AS langname, valid
	                FROM submission
	                LEFT JOIN language USING (langid)
	                WHERE valid = 1 AND submitid = %i', $row['submitid']);
    if (empty($data) || difftime($data['submittime'], $cdata['endtime']) >= 0 || !isset($prob_to_id[$data['probid']]) || !isset($team_to_id[$data['teamid']])) {
        continue;
    }
    $run = XMLaddnode($root, 'run');
    XMLaddnode($run, 'id', $row['submitid']);
    XMLaddnode($run, 'problem', $prob_to_id[$data['probid']]);
开发者ID:kien8995,项目名称:domjudge,代码行数:31,代码来源:ext.php

示例15: error

}
if (!$allowed) {
    error("You do not have permission to perform that action (Missing role(s): " . implode($REQUIRED_ROLES, ',') . ")");
}
require_once LIBWWWDIR . '/common.jury.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 0) {
    error("POST data exceeded php.ini's 'post_max_size' directive.");
}
$cdatas = getCurContests(TRUE, null, TRUE);
$cids = array_keys($cdatas);
// List of executable script types, used in various places:
$executable_types = array('compare' => 'compare', 'compile' => 'compile', 'run' => 'run');
// If the cookie has a existing contest, use it
if (isset($_COOKIE['domjudge_cid'])) {
    if (isset($cdatas[$_COOKIE['domjudge_cid']])) {
        $cid = $_COOKIE['domjudge_cid'];
        $cdata = $cdatas[$cid];
    }
} elseif (count($cids) >= 1) {
    // Otherwise, select the first contest
    $cid = $cids[0];
    $cdata = $cdatas[$cid];
}
// Data to be sent as AJAX updates:
$updates = array('clarifications' => empty($cids) ? array() : $DB->q('TABLE SELECT clarid, submittime, sender, recipient, probid, body
	          FROM clarification
	          WHERE sender IS NOT NULL AND cid IN (%Ai) AND answered = 0', $cids), 'judgehosts' => $DB->q('TABLE SELECT hostname, polltime
	        FROM judgehost
	        WHERE active = 1 AND unix_timestamp()-polltime >= %i', dbconfig_get('judgehost_critical', 120)), 'rejudgings' => $DB->q('TABLE SELECT rejudgingid
	        FROM rejudging
	        WHERE endtime IS NULL'));
开发者ID:sponi78,项目名称:domjudge,代码行数:31,代码来源:init.php


注:本文中的dbconfig_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。