Пример #1
0
/**
 * Output form to add and modify address data
 */
function address_form($name, $submittext, $values = array())
{
    global $color, $squirrelmail_language;
    if ($squirrelmail_language == 'ja_JP') {
        echo html_tag('table', addressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, ' <small>' . _("Must be unique") . '</small>') . addressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') . addressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') . addressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') . addressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') . list_writable_backends($name) . html_tag('tr', html_tag('td', addSubmit($submittext, $name . '[SUBMIT]'), 'center', $color[4], 'colspan="2"')), 'center', '', 'border="0" cellpadding="1" width="90%"') . "\n";
    } else {
        echo html_tag('table', addressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, ' <small>' . _("Must be unique") . '</small>') . addressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') . addressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') . addressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') . addressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') . list_writable_backends($name) . html_tag('tr', html_tag('td', addSubmit($submittext, $name . '[SUBMIT]'), 'center', $color[4], 'colspan="2"')), 'center', '', 'border="0" cellpadding="1" width="90%"') . "\n";
    }
}
Пример #2
0
function put_print_form()
{
    global $DB, $pagename;
    $langs = $DB->q('KEYTABLE SELECT langid AS ARRAYKEY, name, extensions FROM language
	                 WHERE allow_submit = 1 ORDER BY name');
    echo "<script type=\"text/javascript\">\n<!--\n";
    echo "function detectLanguage(filename)\n\t{\n\t\tvar parts = filename.toLowerCase().split('.').reverse();\n\t\tif ( parts.length < 2 ) return;\n\n\t\t// language ID\n\n\t\tvar elt=document.getElementById('langid');\n\t\t// the 'autodetect' option has empty value\n\t\tif ( elt.value != '' ) return;\n\n\t\tvar langid = getMainExtension(parts[0]);\n\t\tfor (i=0;i<elt.length;i++) {\n\t\t\tif ( elt.options[i].value == langid ) {\n\t\t\t\telt.selectedIndex = i;\n\t\t\t}\n\t\t}\n\n\t}\n";
    putgetMainExtension($langs);
    echo "// -->\n</script>\n";
    echo addForm($pagename, 'post', null, 'multipart/form-data');
    ?>

	<table>
	<tr><td><label for="code">File</label>:</td>
	<td><input type="file" name="code" id="code" size="40" required onChange='detectLanguage(document.getElementById("code").value);' /></td>
	</tr>
	<tr><td colspan="2">&nbsp;</td></tr>
	<tr><td><label for="langid">Language</label>:</td>
	    <td><?php 
    $langlist = array();
    foreach ($langs as $langid => $langdata) {
        $langlist[$langid] = $langdata['name'];
    }
    $langlist[''] = 'plain text';
    echo addSelect('langid', $langlist, '', true);
    ?>
</td>
	</tr>
	<tr><td colspan="2">&nbsp;</td></tr>
	<tr><td></td>
	    <td><?php 
    echo addSubmit('Print code', 'submit');
    ?>
</td>
	</tr>
	</table>

	<?php 
    echo addEndForm();
}
Пример #3
0
    $viewall = $_COOKIE['domjudge_balloonviewall'];
}
// Did someone press the view button?
if (isset($_REQUEST['viewall'])) {
    $viewall = $_REQUEST['viewall'];
}
dj_setcookie('domjudge_balloonviewall', $viewall);
$refresh = array('after' => 15, 'url' => 'balloons.php');
require LIBWWWDIR . '/header.php';
echo "<h1>Balloon Status</h1>\n\n";
foreach ($cdatas as $cdata) {
    if (isset($cdata['freezetime']) && difftime($cdata['freezetime'], now()) <= 0) {
        echo "<h4>Scoreboard of c{$cdata['cid']} ({$cdata['shortname']}) is now frozen.</h4>\n\n";
    }
}
echo addForm($pagename, 'get') . "<p>\n" . addHidden('viewall', $viewall ? 0 : 1) . addSubmit($viewall ? 'view unsent only' : 'view all') . "</p>\n" . addEndForm();
$contestids = $cids;
if ($cid !== null) {
    $contestids = array($cid);
}
// Problem metadata: colours and names.
if (empty($cids)) {
    $probs_data = array();
} else {
    $probs_data = $DB->q('KEYTABLE SELECT probid AS ARRAYKEY,name,color,cid
	                      FROM problem
	                      INNER JOIN contestproblem USING (probid)
	                      WHERE cid IN (%Ai)', $contestids);
}
$freezecond = array();
if (!dbconfig_get('show_balloons_postfreeze', 0)) {
Пример #4
0
        // 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);
                }
                echo "</p>" . addEndForm();
            } else {
                echo "</p>\n";
            }
        }
    } else {
        // judging not ended yet
        echo "<p><b>Judging is not finished yet!</b></p>\n";
    }
    ?>
<script type="text/javascript">
<!--
Пример #5
0
            } 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 {
                $activepicto = "play";
                $activecmd = "activate";
            }
            echo "<td><a href=\"judgehost.php?id=" . $row['hostname'] . "&amp;cmd=" . $activecmd . "\"><img class=\"picto\" alt=\"" . $activecmd . "\" title=\"" . $activecmd . " judgehost\" " . "src=\"../images/" . $activepicto . ".png\" /></a></td>";
            echo "<td>" . delLink('judgehost', 'hostname', $row['hostname']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo addForm($pagename) . "<p>" . addSubmit('Start all judgehosts', 'cmd-activate') . addSubmit('Stop all judgehosts', 'cmd-deactivate') . "<br /><br />\n\n" . addLink('judgehosts', true) . "\n" . editLink('judgehosts', null, true) . "</p>\n" . addEndForm();
}
require LIBWWWDIR . '/footer.php';
Пример #6
0
    $restrictions['judged'] = 0;
}
if ($viewtypes[$view] == 'diff') {
    $restrictions['rejudgingdiff'] = 1;
}
if (isset($_REQUEST['old_verdict']) && $_REQUEST['old_verdict'] != 'all') {
    $restrictions['old_result'] = $_REQUEST['old_verdict'];
}
if (isset($_REQUEST['new_verdict']) && $_REQUEST['new_verdict'] != 'all') {
    $restrictions['result'] = $_REQUEST['new_verdict'];
}
echo "<p>Show submissions:</p>\n" . addForm($pagename, 'get') . addHidden('id', $id);
for ($i = 0; $i < count($viewtypes); ++$i) {
    echo addSubmit($viewtypes[$i], 'view[' . $i . ']', null, $view != $i);
}
if (isset($_REQUEST['old_verdict'])) {
    echo addHidden('old_verdict', $_REQUEST['old_verdict']);
}
if (isset($_REQUEST['new_verdict'])) {
    echo addHidden('new_verdict', $_REQUEST['new_verdict']);
}
echo addEndForm() . "<br />\n";
echo addForm($pagename, 'get') . addHidden('id', $id) . addHidden("view[{$view}]", $viewtypes[$view]);
$verdicts = array_keys($verdicts);
array_unshift($verdicts, 'all');
echo "old verdict: " . addSelect('old_verdict', $verdicts, isset($_REQUEST['old_verdict']) ? $_REQUEST['old_verdict'] : 'all');
echo ", new verdict: " . addSelect('new_verdict', $verdicts, isset($_REQUEST['new_verdict']) ? $_REQUEST['new_verdict'] : 'all');
echo addSubmit('filter') . addEndForm();
echo addForm($pagename, 'get') . addHidden('id', $id) . addHidden("view[{$view}]", $viewtypes[$view]) . addSubmit('clear') . addEndForm() . "<br /><br />\n";
putSubmissions($cdatas, $restrictions);
require LIBWWWDIR . '/footer.php';
Пример #7
0
    echo addInput('data[0][special_compare_args]', @$row['special_compare_args'], 30, 255);
    ?>
</td></tr>

</table>

<?php 
    echo addHidden('cmd', $cmd) . addHidden('table', 'problem') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm();
    if (class_exists("ZipArchive")) {
        $selected_cid = $cid === null ? -1 : $cid;
        $contests = $DB->q("KEYVALUETABLE SELECT cid, CONCAT('c', cid, ': ' , shortname, ' - ', name) FROM contest");
        $values = array(-1 => 'Do not add / update contest data');
        foreach ($contests as $cid => $contest) {
            $values[$cid] = $contest;
        }
        echo "<br /><em>or</em><br /><br />\n" . addForm($pagename, 'post', null, 'multipart/form-data') . addHidden('id', @$row['probid']) . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . '<label for="problem_archive__">Upload problem archive:</label>' . addFileField('problem_archive[]') . addSubmit('Upload', 'upload') . addEndForm();
    }
    require LIBWWWDIR . '/footer.php';
    exit;
}
$data = $DB->q('TUPLE SELECT p.probid,p.name,
                             p.timelimit,p.memlimit,p.outputlimit,
                             p.special_run,p.special_compare,p.special_compare_args,
                             p.problemtext_type, count(rank) AS ntestcases
                FROM problem p
                LEFT JOIN testcase USING (probid)
                WHERE probid = %i GROUP BY probid', $id);
if (!$data) {
    error("Missing or invalid problem id");
}
if (!isset($data['memlimit'])) {
Пример #8
0
                    break;
                case 'NOCONSTRAINT':
                    break;
                default:
                    error("{$t}.{$key} is referenced in {$table} with unknown action '{$action}'.");
            }
        }
    }
}
if (isset($_POST['confirm'])) {
    // LIMIT 1 is a security measure to prevent our bugs from
    // wiping a table by accident.
    $DB->q("DELETE FROM {$t} WHERE %SS LIMIT 1", $k);
    auditlog($t, implode(', ', $k), 'deleted');
    echo "<p>" . ucfirst($t) . " <strong>" . specialchars(implode(", ", $k)) . "</strong> has been deleted.</p>\n\n";
    if (!empty($referrer)) {
        echo "<p><a href=\"" . $referrer . "\">back to overview</a></p>";
    } else {
        // one table falls outside the predictable filenames
        $tablemulti = $t == 'team_category' ? 'team_categories' : $t . 's';
        echo "<p><a href=\"" . $tablemulti . ".php\">back to {$tablemulti}</a></p>";
    }
} else {
    echo addForm($pagename) . addHidden('table', $t);
    foreach ($k as $key => $val) {
        echo addHidden($key, $val);
    }
    echo msgbox("Really delete?", "You're about to delete {$t} <strong>" . specialchars(join(", ", array_values($k))) . (empty($desc) ? '' : ' "' . specialchars($desc) . '"') . "</strong>.<br />\n" . (count($warnings) > 0 ? "<br /><strong>Warning, this will:</strong><br />" . implode('<br />', $warnings) : '') . "<br /><br />\n" . "Are you sure?<br /><br />\n\n" . (empty($referrer) ? '' : addHidden('referrer', $referrer)) . addSubmit(" Never mind... ", 'cancel') . addSubmit(" Yes I'm sure! ", 'confirm'));
    echo addEndForm();
}
require LIBWWWDIR . '/footer.php';
Пример #9
0
            // Our color field can be both a HTML color name and an RGB value,
            // so we output it only in the human-readable field "color" and
            // leave the field "rgb" unset.
            $problem['color'] = $prob['color'];
            $contest_data['problems'][] = $problem;
        }
    }
    $yaml = Spyc::YAMLDump($contest_data);
    echo $yaml;
    header('Content-type: text/x-yaml');
    header('Content-Disposition: attachment; filename="contest.yaml"');
    exit;
}
$title = "Import / export configuration";
require LIBWWWDIR . '/header.php';
echo "<h1>Import / export configuration</h1>\n\n";
if (isset($_GET['import-ok'])) {
    echo msgbox("Import successful!", "The file " . specialchars(@$_GET['file']) . " is successfully imported.");
}
echo "<h2>Import from YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php', 'post', null, 'multipart/form-data');
echo msgbox("Please note!", "Importing a contest.yaml may overwrite some settings " . "(e.g. penalty time, clarification categories, clarification answers, etc.)." . "This action can not be undone!");
echo addFileField('import_config');
echo addSubmit('Import', 'import') . addEndForm();
echo "<h2>Export to YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php');
echo '<label for="contest">Select contest: </label>';
$contests = $DB->q("KEYVALUETABLE SELECT cid, name FROM contest");
echo addSelect('contest', $contests, null, true);
echo addSubmit('Export', 'export') . addEndForm();
require LIBWWWDIR . '/footer.php';
Пример #10
0
            $editfield = '';
            $i = 0;
            foreach ($data['value'] as $k => $v) {
                if ($data['type'] == 'array_keyval') {
                    $editfield .= addInput("config_{$key}[{$i}][key]", $k, 0, 0, $extra);
                    $editfield .= addInput("config_{$key}[{$i}][val]", $v, 0, 0, $extra);
                } else {
                    $editfield .= addInput("config_{$key}[{$i}]", $v, 0, 0, $extra);
                }
                $editfield .= "<br />";
                $i++;
            }
            if ($data['type'] == 'array_keyval') {
                $editfield .= addInput("config_{$key}[{$i}][key]", '', 0, 0, $extra);
                $editfield .= addInput("config_{$key}[{$i}][val]", '', 0, 0, $extra);
            } else {
                $editfield .= addInput("config_{$key}[{$i}]", '', 0, 0, $extra);
            }
            break;
        default:
            $editfield = '';
            break;
    }
    // Ignore unknown datatypes
    if (empty($editfield)) {
        continue;
    }
    echo "<tr><td>" . htmlspecialchars(ucfirst(strtr($key, '_', ' '))) . "</td><td style=\"white-space: nowrap;\">" . $editfield . "</td><td>" . htmlspecialchars($data['desc']) . "</td></tr>\n";
}
echo "</tbody>\n</table>\n<p>" . addSubmit('Save', 'save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . "</p>" . addEndForm();
require LIBWWWDIR . '/footer.php';
Пример #11
0
    ?>
 <label for="data_0__visible_0">no</label></td></tr>

</table>

<?php 
    echo addHidden('cmd', $cmd) . addHidden('table', 'team_category') . addHidden('referrer', @$_GET['referrer'] . ($cmd == 'edit' ? strstr(@$_GET['referrer'], '?') === FALSE ? '?edited=1' : '&edited=1' : '')) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate' . (isset($_GET['referrer']) ? ' formaction="' . specialchars($_GET['referrer']) . '"' : '')) . addEndForm();
    require LIBWWWDIR . '/footer.php';
    exit;
}
$data = $DB->q('TUPLE SELECT * FROM team_category WHERE categoryid = %i', $id);
if (!$data) {
    error("Missing or invalid category id");
}
if (isset($_GET['edited'])) {
    echo addForm('refresh_cache.php') . msgbox("Warning: Refresh scoreboard cache", "If the category sort order was changed, it may be necessary to " . "recalculate any cached scoreboards.<br /><br />" . addSubmit('recalculate caches now', 'refresh')) . addHidden('cid', $id) . addEndForm();
}
echo "<h1>Category: " . specialchars($data['name']) . "</h1>\n\n";
echo "<table>\n";
echo '<tr><td>ID:</td><td>' . specialchars($data['categoryid']) . "</td></tr>\n";
echo '<tr><td>Name:</td><td>' . specialchars($data['name']) . "</td></tr>\n";
echo '<tr><td>Sortorder:</td><td>' . specialchars($data['sortorder']) . "</td></tr>\n";
if (isset($data['color'])) {
    echo '<tr><td>Colour:       </td><td style="background: ' . specialchars($data['color']) . ';">' . specialchars($data['color']) . "</td></tr>\n";
}
echo '<tr><td>Visible:</td><td>' . printyn($data['visible']) . "</td></tr>\n";
echo "</table>\n\n";
if (IS_ADMIN) {
    echo "<p>" . editLink('team_category', $data['categoryid']) . "\n" . delLink('team_category', 'categoryid', $data['categoryid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Teams in " . specialchars($data['name']) . "</h2>\n\n";
Пример #12
0
<li><a href="impexp_contestyaml.php">Contest data (contest.yaml)</a></li>
<li><a href="problems.php">Problem archive</a></li>
<li>Tab separated, export:
	<a href="impexp_tsv.php?act=ex&amp;fmt=groups">groups.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=teams">teams.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=scoreboard">scoreboard.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=results">results.tsv</a>
<li>
<?php 
echo addForm('impexp_tsv.php', 'post', null, 'multipart/form-data') . 'Tab separated, import: ' . '<label for="fmt">type:</label> ' . addSelect('fmt', array('groups', 'teams', 'accounts')) . ', <label for="tsv">file:</label>' . addFileField('tsv') . addHidden('act', 'im') . addSubmit('import') . addEndForm();
?>
</li>
</ul>

<h2>Import teams / Upload standings from / to icpc.baylor.edu</h2>

<p>
Create a "Web Services Token" with appropriate rights in the "Export" section
for your contest at <a
href="https://icpc.baylor.edu/login">https://icpc.baylor.edu/login</a>. You can
find the Contest ID (e.g. <code>Southwestern-Europe-2014</code>) in the URL.
</p>

<?php 
echo addForm("impexp_baylor.php");
echo "<table>\n";
echo "<tr><td><label for=\"contest\">Contest ID:</label></td>" . "<td>" . addInput('contest', @$contest, null, null, 'required') . "</td></tr>\n";
echo "<tr><td><label for=\"token\">Access token:</label></td>" . "<td>" . addInput('token', @$token, null, null, 'required') . "</td></tr>\n";
echo "</table>\n";
echo addSubmit('Fetch teams', 'fetch') . addSubmit('Upload standings', 'upload') . addEndForm();
require LIBWWWDIR . '/footer.php';
Пример #13
0
            // display checkmark when done or ellipsis when next up
            if (empty($row[$time . 'time'])) {
                // don't display anything before an empty row
            } elseif ($haspassed) {
                echo "<img src=\"../images/s_success.png\" alt=\"&#10003;\" class=\"picto\" />\n";
                $prevchecked = true;
            } elseif ($prevchecked) {
                echo "…";
                $prevchecked = false;
            }
            echo "</td><td>" . ucfirst($time) . " time:</td><td>" . printtime($row[$time . 'time'], '%Y-%m-%d %H:%M (%Z)') . "</td><td>";
            // Show a button for setting the time to now(), only when that
            // makes sense. E.g. only for end contest when contest has started.
            // No button for 'activate', because when shown by definition always already active
            if (IS_ADMIN && ($time == 'start' && !$hasstarted || $time == 'end' && $hasstarted && !$hasended && (empty($row['freezetime']) || $hasfrozen) || $time == 'deactivate' && $hasended && (empty($row['unfreezetime']) || $hasunfrozen) || $time == 'freeze' && $hasstarted && !$hasended && !$hasfrozen || $time == 'unfreeze' && $hasfrozen && !$hasunfrozen && $hasended)) {
                echo addSubmit("{$time} now", "donow[{$time}]");
            }
            echo "</td></tr>";
        }
        echo "</table>\n";
        echo "</fieldset>\n</form>\n\n";
    }
}
echo "</fieldset>\n\n";
// Get data. Starttime seems most logical sort criterion.
$res = $DB->q('TABLE SELECT contest.*, COUNT(teamid) AS numteams
               FROM contest
               LEFT JOIN contestteam USING (cid)
               GROUP BY cid ORDER BY starttime DESC');
$numprobs = $DB->q('KEYVALUETABLE SELECT cid, COUNT(probid) FROM contest LEFT JOIN contestproblem USING(cid) GROUP BY cid');
if (count($res) == 0) {
Пример #14
0
                    LEFT JOIN team t ON (t.teamid = c.recipient)
                    LEFT JOIN team f ON (f.teamid = c.sender)
                    WHERE c.cid = %i AND c.sender = %i
                    ORDER BY submittime DESC, clarid DESC', $cid, $teamid);
$clarifications = $DB->q('SELECT c.*, cp.shortname, t.name AS toname, f.name AS fromname,
                          u.mesgid AS unread
                          FROM clarification c
                          LEFT JOIN problem p USING (probid)
                          LEFT JOIN contestproblem cp USING (probid, cid)
                          LEFT JOIN team t ON (t.teamid = c.recipient)
                          LEFT JOIN team f ON (f.teamid = c.sender)
                          LEFT JOIN team_unread u ON (c.clarid=u.mesgid AND u.teamid = %i)
                          WHERE c.cid = %i AND c.sender IS NULL
                          AND ( c.recipient IS NULL OR c.recipient = %i )
                          ORDER BY c.submittime DESC, c.clarid DESC', $teamid, $cid, $teamid);
echo "<h3 class=\"teamoverview\">Clarifications</h3>\n";
# FIXME: column width and wrapping/shortening of clarification text
if ($clarifications->count() == 0) {
    echo "<p class=\"nodata\">No clarifications.</p>\n\n";
} else {
    putClarificationList($clarifications, $teamid);
}
echo "<h3 class=\"teamoverview\">Clarification Requests</h3>\n";
if ($requests->count() == 0) {
    echo "<p class=\"nodata\">No clarification requests.</p>\n\n";
} else {
    putClarificationList($requests, $teamid);
}
echo addForm('clarification.php', 'get') . "<p>" . addSubmit('request clarification') . "</p>" . addEndForm();
echo "</div>\n";
require LIBWWWDIR . '/footer.php';
Пример #15
0
/**
 * This function computes the comapact paginator string.
 *
 * @param string  $box           mailbox name
 * @param integer $iOffset       offset in total number of messages
 * @param integer $iTotal        total number of messages
 * @param integer $iLimit        maximum number of messages to show on a page
 * @param bool    $bShowAll      whether or not to show all messages at once 
 *                               ("show all" == non paginate mode)
 * @param bool    $javascript_on whether or not javascript is currently enabled
 * @param bool    $page_selector whether or not to show the page selection widget
 *
 * @return string $result   paginate string with links to pages
 *
 */
function get_compact_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll, $javascript_on, $page_selector)
{
    static $accesskeys_constructed = FALSE;
    /* This will be used as a space. */
    global $oTemplate, $nbsp;
    // keeps count of how many times
    // the paginator is used, avoids
    // duplicate naming of <select>
    // and GO button
    static $display_iterations = 0;
    $display_iterations++;
    sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER);
    /* Initialize paginator string chunks. */
    $prv_str = '';
    $nxt_str = '';
    $pg_str = '';
    $all_str = '';
    $box = urlencode($box);
    /* Create simple strings that will be creating the paginator. */
    /* This will be used as a seperator. */
    $sep = '|';
    /* Make sure that our start message number is not too big. */
    $iOffset = min($iOffset, $iTotal);
    /* Compute the starting message of the previous and next page group. */
    $next_grp = $iOffset + $iLimit;
    $prev_grp = $iOffset - $iLimit;
    if (!$bShowAll) {
        /* Compute the basic previous and next strings. */
        global $accesskey_mailbox_previous, $accesskey_mailbox_next;
        if ($next_grp <= $iTotal && $prev_grp >= 0) {
            $prv_str = get_paginator_link($box, $prev_grp, '<', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_previous);
            $nxt_str = get_paginator_link($box, $next_grp, '>', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_next);
        } else {
            if ($next_grp > $iTotal && $prev_grp >= 0) {
                $prv_str = get_paginator_link($box, $prev_grp, '<', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_previous);
                $nxt_str = '>';
            } else {
                if ($next_grp <= $iTotal && $prev_grp < 0) {
                    $prv_str = '<';
                    $nxt_str = get_paginator_link($box, $next_grp, '>', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_next);
                }
            }
        }
        /* Page selector block. Following code computes page links. */
        if ($iLimit != 0 && $page_selector && $iTotal > $iLimit) {
            /* Most importantly, what is the current page!!! */
            $cur_pg = intval($iOffset / $iLimit) + 1;
            /* Compute total # of pages and # of paginator page links. */
            $tot_pgs = ceil($iTotal / $iLimit);
            /* Total number of Pages */
            $last_grp = ($tot_pgs - 1) * $iLimit + 1;
        }
    } else {
        global $accesskey_mailbox_all_paginate;
        $pg_str = create_hyperlink("{$php_self}?showall=0&amp;startMessage=1&amp;mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&amp;smtoken=' . sm_generate_security_token() : ''), _("Paginate"), '', '', '', '', '', $accesskeys_constructed ? array() : array('accesskey' => $accesskey_mailbox_all_paginate));
    }
    /* Put all the pieces of the paginator string together. */
    /**
     * Hairy code... But let's leave it like it is since I am not certain
     * a different approach would be any easier to read. ;)
     */
    $result = '';
    if ($prv_str || $nxt_str) {
        /* Compute the 'show all' string. */
        global $accesskey_mailbox_all_paginate;
        $all_str = create_hyperlink("{$php_self}?showall=1&amp;startMessage=1&amp;mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&amp;smtoken=' . sm_generate_security_token() : ''), _("Show All"), '', '', '', '', '', $accesskeys_constructed ? array() : array('accesskey' => $accesskey_mailbox_all_paginate));
        $result .= '[' . get_paginator_link($box, 1, '<<') . ']';
        $result .= '[' . $prv_str . ']';
        $pg_url = $php_self . '?mailbox=' . $box . (strpos($php_self, 'src/search.php') ? '&smtoken=' . sm_generate_security_token() : '');
        $result .= '[' . $nxt_str . ']';
        $result .= '[' . get_paginator_link($box, $last_grp, '>>') . ']';
        if ($page_selector) {
            $options = array();
            for ($p = 0; $p < $tot_pgs; $p++) {
                $options[$p * $iLimit + 1 . '_' . $box] = $p + 1 . "/{$tot_pgs}";
            }
            $result .= $nbsp . addSelect('startMessage_' . $display_iterations, $options, ($cur_pg - 1) * $iLimit + 1, TRUE, $javascript_on ? array('onchange' => 'JavaScript:SubmitOnSelect(this, \'' . $pg_url . '&startMessage=\')') : array());
            if ($javascript_on) {
                //FIXME: What in the world?  Two issues here: for one, $javascript_on is supposed
                //       to have already detected whether or not JavaScript is available and enabled.
                //       Secondly, we need to rid ourselves of any HTML output in the core.  This
                //       is being removed (but left in case the original author points out why it
                //       should not be) and we'll trust $javascript_on to do the right thing.
                //                $result .= '<noscript language="JavaScript">'
                //                . addSubmit(_("Go"), 'paginator_submit_' . $display_iterations)
                //                . '</noscript>';
            } else {
                $result .= addSubmit(_("Go"), 'paginator_submit_' . $display_iterations);
            }
        }
    }
    $result .= $pg_str != '' ? '[' . $pg_str . ']' . $nbsp : '';
    $result .= $all_str != '' ? $nbsp . '[' . $all_str . ']' . $nbsp . $nbsp : '';
    /* If the resulting string is blank, return a non-breaking space. */
    if ($result == '') {
        $result = '&nbsp;';
    }
    $accesskeys_constructed = TRUE;
    /* Return our final magical paginator string. */
    return $result;
}
Пример #16
0
    echo addInput('data[0][country]', @$row['country'], 4, 3, 'pattern="[A-Z]{3}" title="three uppercase letters (ISO-3166-1 alpha-3)"');
    ?>
<a target="_blank"
href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Current_codes"><img
src="../images/b_help.png" class="smallpicto" alt="?" /></a></td></tr>

<tr><td><label for="data_0__comments_">Comments:</label></td>
<td><?php 
    echo addTextArea('data[0][comments]', @$row['comments']);
    ?>
</td></tr>

</table>

<?php 
    echo addHidden('cmd', $cmd) . addHidden('table', 'team_affiliation') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm();
    require LIBWWWDIR . '/footer.php';
    exit;
}
$data = $DB->q('MAYBETUPLE SELECT * FROM team_affiliation WHERE affilid = %s', $id);
if (!$data) {
    error("Missing or invalid affiliation id");
}
$affillogo = "../images/affiliations/" . urlencode($data['affilid']) . ".png";
$countryflag = "../images/countries/" . urlencode($data['country']) . ".png";
echo "<h1>Affiliation: " . specialchars($data['name']) . "</h1>\n\n";
echo "<table>\n";
echo '<tr><td>ID:</td><td>' . specialchars($data['affilid']) . "</td></tr>\n";
echo '<tr><td>Shortname:</td><td>' . specialchars($data['shortname']) . "</td></tr>\n";
echo '<tr><td>Name:</td><td>' . specialchars($data['name']) . "</td></tr>\n";
echo '<tr><td>Logo:</td><td>';
Пример #17
0
}
echo "</table>\n";
echo "<h2>Details</h2>\n";
$restrictions = array('rejudgingid' => $id);
if ($viewtypes[$view] == 'unverified') {
    $restrictions['verified'] = 0;
}
if ($viewtypes[$view] == 'unjudged') {
    $restrictions['judged'] = 0;
}
if ($viewtypes[$view] == 'diff') {
    $restrictions['rejudgingdiff'] = 1;
}
if (isset($_REQUEST['old_verdict']) && $_REQUEST['old_verdict'] != 'all') {
    $restrictions['old_result'] = $_REQUEST['old_verdict'];
}
if (isset($_REQUEST['new_verdict']) && $_REQUEST['new_verdict'] != 'all') {
    $restrictions['result'] = $_REQUEST['new_verdict'];
}
echo addForm($pagename, 'get') . "<p>Show submissions:\n" . addHidden('id', $id);
for ($i = 0; $i < count($viewtypes); ++$i) {
    echo addSubmit($viewtypes[$i], 'view[' . $i . ']', null, $view != $i);
}
$verdicts = array_keys($verdicts);
array_unshift($verdicts, 'all');
echo "<br/>old verdict: " . addSelect('old_verdict', $verdicts, isset($_REQUEST['old_verdict']) ? $_REQUEST['old_verdict'] : 'all');
echo ", new verdict: " . addSelect('new_verdict', $verdicts, isset($_REQUEST['new_verdict']) ? $_REQUEST['new_verdict'] : 'all');
echo addSubmit('filter');
echo "</p>\n" . addEndForm();
putSubmissions($cdatas, $restrictions);
require LIBWWWDIR . '/footer.php';
Пример #18
0
// Set cookie of submission view type, expiry defaults to end of session.
dj_setcookie('domjudge_submissionview', $view);
$jury_member = $username;
$jqtokeninput = true;
require LIBWWWDIR . '/header.php';
echo "<h1>{$title}</h1>\n\n";
$restrictions = array();
if ($viewtypes[$view] == 'unverified') {
    $restrictions['verified'] = 0;
}
if ($viewtypes[$view] == 'unjudged') {
    $restrictions['judged'] = 0;
}
echo addForm($pagename, 'get') . "<p>Show submissions:\n";
for ($i = 0; $i < count($viewtypes); ++$i) {
    echo addSubmit($viewtypes[$i], 'view[' . $i . ']', null, $view != $i);
}
echo "</p>\n" . addEndForm();
$submissions_filter = array();
if (isset($_COOKIE['submissions-filter'])) {
    $submissions_filter = json_decode($_COOKIE['submissions-filter'], true);
}
echo "<a class=\"collapse\" href=\"javascript:collapse('submissions-filter')\"><img src=\"../images/filter.png\" alt=\"filter&hellip;\" title=\"filter&hellip;\" class=\"picto\" /></a>";
echo "<div id='detailsubmissions-filter' class='submissions-filter'>\n";
if (empty($submissions_filter)) {
    echo <<<HTML
<script type="text/javascript">
<!--
collapse("submissions-filter");
// -->
</script>
Пример #19
0
        $classes = array();
        if (!isset($activecontests[$row['probid']])) {
            $classes[] = 'disabled';
        }
        $link = '<a href="problem.php?id=' . urlencode($row['probid']) . '">';
        echo "<tr class=\"" . implode(' ', $classes) . "\"><td>" . $link . "p" . specialchars($row['probid']) . "</a>" . "</td><td>" . $link . specialchars($row['name']) . "</a>" . "</td><td>" . $link . specialchars(isset($activecontests[$row['probid']]) ? $activecontests[$row['probid']] : 0) . "</a>" . "</td><td>" . $link . (int) $row['timelimit'] . "</a>" . "</td><td>" . $link . (isset($row['memlimit']) ? (int) $row['memlimit'] : 'default') . "</a>" . "</td><td>" . $link . (isset($row['outputlimit']) ? (int) $row['outputlimit'] : 'default') . "</a>" . "</td><td><a href=\"testcase.php?probid=" . $row['probid'] . "\">" . $row['testcases'] . "</a></td>";
        if (!empty($row['problemtext_type'])) {
            echo '<td title="view problem description">' . '<a href="problem.php?id=' . urlencode($row['probid']) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($row['problemtext_type']) . '.png" alt="problem text" /></a></td>';
        } else {
            echo '<td></td>';
        }
        if (IS_ADMIN) {
            echo '<td title="export problem as zip-file">' . exportLink($row['probid']) . '</td>' . "<td class=\"editdel\">" . editLink('problem', $row['probid']) . "&nbsp;" . delLink('problem', 'probid', $row['probid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('problem') . "</p>\n\n";
    if (class_exists("ZipArchive")) {
        $selected_cid = $cid === null ? -1 : $cid;
        $contests = $DB->q("KEYVALUETABLE SELECT cid,\n\t\t                    CONCAT('c', cid, ': ', shortname, ' - ', name) FROM contest");
        $values = array(-1 => 'Do not link to a contest');
        foreach ($contests as $cid => $contest) {
            $values[$cid] = $contest;
        }
        echo "\n" . addForm('problem.php', 'post', null, 'multipart/form-data') . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . 'Problem archive(s): ' . addFileField('problem_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
    }
}
require LIBWWWDIR . '/footer.php';
Пример #20
0
/**
 * Confirms event update
 * @return void
 * @access private
 */
function confirm_update()
{
    global $calself, $year, $month, $day, $hour, $minute, $calendardata, $color, $event_year, $event_month, $event_day, $event_hour, $event_minute, $event_length, $event_priority, $event_title, $event_text;
    $tmparray = $calendardata["{$month}{$day}{$year}"]["{$hour}{$minute}"];
    $tab = '    ';
    echo html_tag('table', html_tag('tr', html_tag('th', _("Do you really want to change this event from:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($hour, $minute, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $tmparray['priority'], 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($tmparray['title']), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($tmparray['message'])), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('th', _("to:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($event_hour, $event_minute, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $event_priority, 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($event_title), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($event_text)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', "<form name=\"updateevent\" method=\"post\" action=\"{$calself}\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addHidden('hour', $hour) . $tab . addHidden('minute', $minute) . $tab . addHidden('event_year', $event_year) . $tab . addHidden('event_month', $event_month) . $tab . addHidden('event_day', $event_day) . $tab . addHidden('event_hour', $event_hour) . $tab . addHidden('event_minute', $event_minute) . $tab . addHidden('event_priority', $event_priority) . $tab . addHidden('event_length', $event_length) . $tab . addHidden('event_title', $event_title) . $tab . addHidden('event_text', $event_text) . $tab . addHidden('updated', 'yes') . $tab . addHidden('confirmed', 'yes') . $tab . addSubmit(_("Yes")) . "</form>\n", 'right', $color[4]) . "\n" . html_tag('td', "<form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addSubmit(_("No")) . "</form>\n", 'left', $color[4]) . "\n"), '', $color[0], 'border="0" cellpadding="2" cellspacing="1"');
}
Пример #21
0
        if ($reltime < dbconfig_get('judgehost_critical', 120)) {
            echo "Warning";
        } else {
            echo "Critical";
        }
    }
    echo ", time since judgehost last checked in: " . printtimediff($row['polltime']) . 's.';
}
?>
</td></tr>
</table>

<?php 
if (IS_ADMIN) {
    $cmd = $row['active'] == 1 ? 'deactivate' : 'activate';
    echo addForm($pagename) . "<p>\n" . addHidden('id', $row['hostname']) . addHidden('cmd', $cmd) . addSubmit($cmd) . "</p>\n" . addEndForm();
}
if (IS_ADMIN) {
    echo "<p>" . delLink('judgehost', 'hostname', $row['hostname']) . "</p>\n\n";
}
echo rejudgeForm('judgehost', $row['hostname']) . "<br />\n\n";
echo "<h3>Judgings by " . printhost($row['hostname']) . "</h3>\n\n";
// get the judgings for a specific key and value pair
// select only specific fields to avoid retrieving large blobs
$cids = getCurContests(FALSE);
if (!empty($cids)) {
    $res = $DB->q('SELECT judgingid, submitid, starttime, endtime, judgehost,
	               result, verified, valid FROM judging
	               WHERE cid IN (%Ai) AND judgehost = %s
	               ORDER BY starttime DESC, judgingid DESC', $cids, $row['hostname']);
}
Пример #22
0
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Executables';
require LIBWWWDIR . '/header.php';
echo "<h1>Executables</h1>\n\n";
// Select all data, sort problems from the current contest on top.
$res = $DB->q('SELECT execid, description, md5sum, type, OCTET_LENGTH(zipfile) AS size
               FROM executable ORDER BY execid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No executables defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">type</th>" . "<th scope=\"col\">description</th>" . "<th scope=\"col\">size</th><th scope=\"col\">md5</th>" . "<th></th><th></th></tr></thead>\n<tbody>\n";
    $lastcid = -1;
    while ($row = $res->next()) {
        $link = '<a href="executable.php?id=' . urlencode($row['execid']) . '">';
        echo "<tr><td class=\"execid\">" . $link . htmlspecialchars($row['execid']) . "</a>" . "</td><td>" . $link . htmlspecialchars($row['type']) . "</a>" . "</td><td>" . $link . htmlspecialchars(str_cut($row['description'], 40)) . "</a>" . "</td><td class=\"size\">" . $link . printsize($row['size']) . "</a>" . "</td><td class=\"md5\">" . $link . htmlspecialchars($row['md5sum']) . "</a>" . "</td>";
        if (IS_ADMIN) {
            echo '<td title="export executable as zip-file"><a href="executable.php?fetch&amp;id=' . urlencode($row['execid']) . '"><img src="../images/b_save.png" alt="export" /></a></td>' . "<td class=\"editdel\">" . editLink('executable', $row['execid']) . "&nbsp;" . delLink('executable', 'execid', $row['execid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('executable') . "</p>\n\n";
    if (class_exists("ZipArchive")) {
        echo "\n" . addForm('executable.php', 'post', null, 'multipart/form-data') . 'Executable archive(s): ' . addSelect('type', $executable_types) . addFileField('executable_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
    }
}
require LIBWWWDIR . '/footer.php';
Пример #23
0
        $nunchecked++;
        if ($results === NULL) {
            $nomatch[] = "string '<code>@EXPECTED_RESULTS@:</code>' not found in " . "<a href=\"submission.php?id=" . $sid . "\">s{$sid}</a>, leaving submission unchecked";
        } else {
            $earlier[] = "<a href=\"submission.php?id=" . $sid . "\">s{$sid}</a> already verified earlier";
        }
    }
}
echo "{$nchecked} submissions checked: " . count($unexpected) . " unexpected results, " . count($multiple) . ($verify_multiple ? " automatically verified (multiple outcomes), " : " to check manually, ") . count($verified) . " automatically verified<br/>\n";
echo "{$nunchecked} submissions not checked: " . count($earlier) . " verified earlier, " . count($nomatch) . " without magic string<br/>\n";
if (count($unexpected)) {
    flushresults("Unexpected results", $unexpected);
}
if (count($multiple)) {
    if ($verify_multiple) {
        flushresults("Automatically verified (multiple outcomes)", $multiple, TRUE);
    } else {
        flushresults("Check manually", $multiple);
        echo "<div class=\"details\" id=\"detail{$section}\">\n" . addForm($pagename) . "<p>Verify all multiple outcome submissions: " . addHidden('verify_multiple', '1') . addSubmit('verify') . addEndForm() . "</p>\n</div>\n\n";
    }
}
if (count($verified)) {
    flushresults("Automatically verified", $verified, TRUE);
}
if (count($earlier)) {
    flushresults("Verified earlier", $earlier, TRUE);
}
if (count($nomatch)) {
    flushresults("Without magic string", $nomatch, TRUE);
}
require LIBWWWDIR . '/footer.php';
Пример #24
0
echo _("New Password:"******"Verify New Password:"******"center" colspan="2">
        <?php 
echo addSubmit(_("Change Password"), 'cpw_go');
?>
</td>
      </tr>
    </table>
    </form>
</td></tr>
</table>
</body></html>
Пример #25
0
if (checkrole('team')) {
    echo "<a target=\"_top\" href=\"../team/\" accesskey=\"t\"><span class=\"octicon octicon-arrow-right\"></span> team</a>\n";
}
?>
</div>

<div id="menutopright">
<?php 
putClock();
$notify_flag = isset($_COOKIE["domjudge_notify"]) && (bool) $_COOKIE["domjudge_notify"];
$refresh_flag = !isset($_COOKIE["domjudge_refresh"]) || (bool) $_COOKIE["domjudge_refresh"];
echo "<div id=\"toggles\">\n";
if (isset($refresh)) {
    $text = $refresh_flag ? 'Disable' : 'Enable';
    echo '<input id="refresh-toggle" type="button" value="' . $text . ' refresh" />';
}
// Default hide this from view, only show when javascript and
// notifications are available:
echo '<div id="notify" style="display: none">' . addForm('toggle_notify.php', 'get') . addHidden('enable', $notify_flag ? 0 : 1) . addSubmit(($notify_flag ? 'Dis' : 'En') . 'able notifications', 'toggle_notify', 'return toggleNotifications(' . ($notify_flag ? 'false' : 'true') . ')') . addEndForm() . "</div>";
?>
<script type="text/javascript">
<!--
    if ( 'Notification' in window ) {
		document.getElementById('notify').style.display = 'block';
	}
// -->
</script>

</div>
</div></nav>
Пример #26
0
    exit;
}
$current_backend = $abook->localbackend;
if (sqgetGlobalVar('new_bnum', $new_backend, SQ_FORM) && array_key_exists($new_backend, $abook->backends)) {
    $current_backend = (int) $new_backend;
}
$abook_selection = '&nbsp;';
$list_backends = array();
if (count($abook->backends) > 1) {
    foreach ($abook->get_backend_list() as $oBackend) {
        if ($oBackend->listing) {
            $list_backends[$oBackend->bnum] = $oBackend->sname;
        }
    }
    if (count($list_backends) > 1) {
        $abook_selection = addSelect('new_bnum', $list_backends, $current_backend, true) . addSubmit(_("Change"), 'change_abook');
    }
}
$defdata = array();
$formerror = '';
$abortform = false;
$showaddrlist = true;
$defselected = array();
$form_url = 'addressbook.php';
/* Handle user's actions */
if (sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'POST') {
    // first, validate security token
    sm_validate_security_token($submitted_token, -1, TRUE);
    /**************************************************
     * Add new address                                *
     **************************************************/
Пример #27
0
/**
 * Function to output a complete scoreboard.
 * This takes care of outputting the headings, start/endtimes and footer
 * of the scoreboard. It calls genScoreBoard to generate the data and
 * renderScoreBoardTable for displaying the actual table.
 *
 * Arguments:
 * $cdata       current contest data, as from an index in 'getCurContests(TRUE)'
 * $myteamid    set to highlight that teamid in the scoreboard
 * $static      generate a static scoreboard, e.g. for external use
 * $filter      set to TRUE to generate filter options, or pass array
 *              with keys 'affilid', 'country', 'categoryid' pointing
 *              to array of values to filter on these.
 * $sdata       if not NULL, use this as scoreboard data instead of fetching it locally
 */
function putScoreBoard($cdata, $myteamid = NULL, $static = FALSE, $filter = FALSE, $sdata = NULL)
{
    global $DB, $pagename;
    if (empty($cdata)) {
        echo "<p class=\"nodata\">No active contest</p>\n";
        return;
    }
    $fdata = calcFreezeData($cdata);
    if ($sdata === NULL) {
        $sdata = genScoreBoard($cdata, IS_JURY, $filter);
    }
    // page heading with contestname and start/endtimes
    echo '<div class="score-head">';
    echo "<h1>Scoreboard " . htmlspecialchars($cdata['name']) . "</h1>\n\n";
    if ($fdata['showfinal']) {
        echo "<h4>final standings</h4>\n\n";
    } elseif (!$fdata['cstarted']) {
        echo "<h4>" . printContestStart($cdata) . "</h4>\n\n";
        // Stop here (do not leak problem number, descriptions etc).
        // Alternatively we could only display the list of teams?
        if (!IS_JURY) {
            return;
        }
    } else {
        echo "<h4>starts: " . printtime($cdata['starttime']) . " - ends: " . printtime($cdata['endtime']);
        if ($fdata['showfrozen']) {
            echo " (";
            if (IS_JURY) {
                echo '<a href="../public/">the public scoreboard</a> is ';
            }
            echo "frozen since " . printtime($cdata['freezetime']) . ")";
        }
        echo "</h4>\n\n";
    }
    echo '</div>';
    // The static scoreboard does not support filtering
    if ($filter !== FALSE && $static !== TRUE) {
        $categids = $DB->q('KEYVALUETABLE SELECT categoryid, name FROM team_category ' . (IS_JURY ? '' : 'WHERE visible = 1 '));
        // show only affilids/countries with visible teams
        if (empty($categids)) {
            $affils = array();
        } else {
            $affils = $DB->q('KEYTABLE SELECT affilid AS ARRAYKEY,
			                  team_affiliation.name, country
			                  FROM team_affiliation
			                  LEFT JOIN team t USING (affilid)
			                  INNER JOIN contest c ON (c.cid = %i)
			                  LEFT JOIN contestteam ct ON (ct.teamid = t.teamid AND ct.cid = c.cid)
			                  WHERE categoryid IN (%As) AND c.cid = %i AND
			                  (c.public = 1 OR ct.teamid IS NOT NULL)
			                  GROUP BY affilid', $cdata['cid'], array_keys($categids), $cdata['cid']);
        }
        $affilids = array();
        $countries = array();
        foreach ($affils as $id => $affil) {
            $affilids[$id] = $affil['name'];
            if (isset($affil['country'])) {
                $countries[] = $affil['country'];
            }
        }
        $countries = array_unique($countries);
        sort($countries);
        $filteron = array();
        $filtertext = "";
        foreach (array('affilid' => 'affiliation', 'country' => 'country', 'categoryid' => 'category') as $type => $text) {
            if (isset($filter[$type])) {
                $filteron[] = $text;
            }
        }
        if (sizeof($filteron) > 0) {
            $filtertext = "(filtered on " . implode(", ", $filteron) . ")";
        }
        require_once LIBWWWDIR . '/forms.php';
        ?>

<table class="scorefilter">
<tr>
<td><a class="collapse" href="javascript:collapse('filter')"><img src="../images/filter.png" alt="filter&hellip;" title="filter&hellip;" class="picto" /></a></td>
<td><?php 
        echo $filtertext;
        ?>
</td>
<td><div id="detailfilter">
<?php 
        echo addForm($pagename, 'get') . (count($affilids) > 1 ? addSelect('affilid[]', $affilids, @$filter['affilid'], TRUE, 8) : "") . (count($countries) > 1 ? addSelect('country[]', $countries, @$filter['country'], FALSE, 8) : "") . (count($categids) > 1 ? addSelect('categoryid[]', $categids, @$filter['categoryid'], TRUE, 8) : "") . addSubmit('filter', 'filter') . addSubmit('clear', 'clear') . addEndForm();
        ?>
</div></td></tr>
</table>
<script type="text/javascript">
<!--
collapse("filter");
// -->
</script>
		<?php 
    }
    renderScoreBoardTable($sdata, $myteamid, $static);
    // last modified date, now if we are the jury, else include the
    // freeze time
    if (!IS_JURY && $fdata['showfrozen']) {
        $lastupdate = printtime($cdata['freezetime'], '%a %d %b %Y %T %Z');
    } else {
        $lastupdate = printtime(now(), '%a %d %b %Y %T %Z');
    }
    echo "<p id=\"lastmod\">Last Update: {$lastupdate}<br />\n" . "using <a href=\"https://www.domjudge.org/\">DOMjudge</a></p>\n\n";
    return;
}
Пример #28
0
    }
    echo '</table>' . "\n";
}
if (count($index_order) != count($available)) {
    $opts = array();
    for ($i = 1; $i <= count($available); $i++) {
        $found = false;
        for ($j = 1; $j <= count($index_order); $j++) {
            if ($index_order[$j] == $i) {
                $found = true;
            }
        }
        if (!$found) {
            $opts[$i] = $available[$i];
        }
    }
    echo addForm('options_order.php', 'post', 'f');
    echo addSelect('add', $opts, '', TRUE);
    echo addHidden('method', 'add');
    echo addSubmit(_("Add"), 'submit');
    echo '</form>';
}
echo html_tag('p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br />');
?>
    </td></tr>
    </table>

</td></tr>
</table>
</body></html>
Пример #29
0
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('mailbox', $mailbox, SQ_POST);
/* end globals */
if ($mailbox == '') {
    displayPageHeader($color, 'None');
    plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
    exit;
}
if (sqgetGlobalVar('backingout', $tmp, SQ_POST)) {
    $location = get_location();
    header("Location: {$location}/folders.php");
    exit;
}
if (!sqgetGlobalVar('confirmed', $tmp, SQ_POST)) {
    displayPageHeader($color, 'None');
    echo '<br />' . html_tag('table', '', 'center', '', 'width="95%" border="0"') . html_tag('tr', html_tag('td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[0])) . html_tag('tr') . html_tag('td', '', 'center', $color[4]) . sprintf(_("Are you sure you want to delete %s?"), str_replace(array(' ', '<', '>'), array('&nbsp;', '&lt;', '&gt;'), imap_utf7_decode_local($mailbox))) . addForm('folders_delete.php', 'post') . "<p>\n" . addHidden('mailbox', $mailbox) . addSubmit(_("Yes"), 'confirmed') . addSubmit(_("No"), 'backingout') . '</p></form><br /></td></tr></table>';
    exit;
}
$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imap_stream);
$numboxes = count($boxes);
global $delete_folder;
if (substr($mailbox, -1) == $delimiter) {
    $mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1);
} else {
    $mailbox_no_dm = $mailbox;
}
/** lets see if we CAN move folders to the trash.. otherwise,
 ** just delete them **/
if (isset($delete_folder) && $delete_folder || eregi('^' . $trash_folder . '.+', $mailbox)) {
    $can_move_to_trash = FALSE;
Пример #30
0
$restrictions = array();
if (isset($_GET['restrict'])) {
    list($key, $value) = explode(":", $_GET['restrict'], 2);
    $restrictions[$key] = $value;
}
$row = $DB->q('MAYBETUPLE SELECT t.*, a.country, c.name AS catname,
                                 a.shortname AS affshortname, a.name AS affname
               FROM team t
               LEFT JOIN team_category c USING (categoryid)
               LEFT JOIN team_affiliation a ON (t.affilid = a.affilid)
               WHERE teamid = %i', $id);
if (!$row) {
    error("Invalid team identifier");
}
if (isset($_GET['edited'])) {
    echo addForm('refresh_cache.php') . msgbox("Warning: Refresh scoreboard cache", "If the membership of a team in a contest was changed, it may be necessary to recalculate any cached scoreboards.<br /><br />" . addSubmit('recalculate caches now', 'refresh')) . addEndForm();
}
$users = $DB->q('TABLE SELECT userid,username FROM user WHERE teamid = %i', $id);
$affillogo = "../images/affiliations/" . urlencode($row['affilid']) . ".png";
$countryflag = "../images/countries/" . urlencode($row['country']) . ".png";
$teamimage = "../images/teams/" . urlencode($row['teamid']) . ".jpg";
echo "<h1>Team " . specialchars($row['name']) . "</h1>\n\n";
if ($row['enabled'] != 1) {
    echo "<p><em>Team is disabled</em></p>\n\n";
}
?>

<div class="col1"><table>
<tr><td>ID:        </td><td>t<?php 
echo specialchars($row['teamid']);
?>