public function getAdvertWithCategories(array $categoryNames) { $qb = $this->createQueryBuilder('a'); $qb->join('a.categories', 'c') - addSelect('c'); $qb->where($qb->expr()->in('c.name', $categoryNames)); return $qb->getQuery()->getResult(); }
function addMultiplicationForm() { echo '<div class="controls">'; echo '<h3 class="light">Please select the dimensions for your multiplication table below:</h3><br>'; echo '<div class="form_div"><form action="" method="post">'; addSelect('x'); echo 'by'; addSelect('y'); echo '<br><br><input class="btn btn-default btn-submit" type="submit" value="Refresh"></input></form></div></div><br>'; }
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"> </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"> </td></tr> <tr><td></td> <td><?php echo addSubmit('Print code', 'submit'); ?> </td> </tr> </table> <?php echo addEndForm(); }
<td> <?php echo addSelect("data[{id}][restrictionid]", $restrictions, null, true); ?> </td> </tr> </script> <?php echo "\n<table id=\"judgehosts\">\n" . "<tr><th>Hostname</th><th>Active</th><th>Restrictions</th></tr>\n"; if ($cmd == 'add') { // Nothing, added by javascript in addAddRowButton } else { $res = $DB->q('SELECT * FROM judgehost ORDER BY hostname'); $i = 0; while ($row = $res->next()) { echo "<tr><td>" . addHidden("keydata[{$i}][hostname]", $row['hostname']) . printhost($row['hostname']) . "</td><td>" . addSelect("data[{$i}][active]", array(1 => 'yes', 0 => 'no'), $row['active'], true) . "</td><td>" . addSelect("data[{$i}][restrictionid]", $restrictions, $row['restrictionid'], true) . "</td></tr>\n"; ++$i; } } echo "</table>\n\n<br /><br />\n"; echo addHidden('cmd', $cmd) . ($cmd == 'add' ? addHidden('skipwhenempty', 'hostname') : '') . addHidden('table', 'judgehost') . ($cmd == 'add' ? addAddRowButton('judgehost_template', 'judgehosts') : '') . addSubmit('Save Judgehosts') . addEndForm(); require LIBWWWDIR . '/footer.php'; exit; } $res = $DB->q('SELECT judgehost.*, judgehost_restriction.name FROM judgehost LEFT JOIN judgehost_restriction USING (restrictionid) ORDER BY hostname'); $now = now(); $query = 'KEYVALUETABLE SELECT judgehost, SUM(IF(endtime,endtime,%i) - GREATEST(%i,starttime))
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'])) {
// 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';
<tr><td><label for="data_0__categoryid_">Category:</label></td> <td><?php $cmap = $DB->q("KEYVALUETABLE SELECT categoryid,name FROM team_category ORDER BY categoryid"); echo addSelect('data[0][categoryid]', $cmap, @$row['categoryid'], true); ?> </td></tr> <tr><td><label for="data_0__members_">Members:</label></td> <td><?php echo addTextArea('data[0][members]', @$row['members'], 40, 3); ?> </td></tr> <tr><td><label for="data_0__affilid_">Affiliation:</label></td> <td><?php $amap = $DB->q("KEYVALUETABLE SELECT affilid,name FROM team_affiliation ORDER BY name"); $amap[''] = 'none'; echo addSelect('data[0][affilid]', $amap, @$row['affilid'], true); ?> </td></tr> <tr><td><label for="data_0__penalty_">Penalty time:</label></td> <td><?php echo addInput('data[0][penalty]', isset($row['penalty']) ? $row['penalty'] : 0, 10, 15, 'required'); ?> </td></tr> <tr><td><label for="data_0__room_">Location:</label></td> <td><?php echo addInput('data[0][room]', @$row['room'], 10, 15); ?> </td></tr> <tr><td><label for="data_0__comments_">Comments:</label></td> <td><?php echo addTextArea('data[0][comments]', @$row['comments']);
for ($i = 0; $i < $mailfetch_server_number; $i++) { echo "<option value=\"{$i}\">" . sm_encode_html_special_chars($mailfetch_alias_[$i] == '' ? $mailfetch_server_[$i] : $mailfetch_alias_[$i]) . "</option>"; } echo '</select>' . ' <input type="submit" name="mf_action_mod" value="' . _("Modify") . '" />' . ' <input type="submit" name="mf_action_del" value="' . _("Delete") . '" />' . '</form>'; } else { echo _("No servers known."); } echo '</td></tr></table>'; break; case 'Delete': //erase confirmation about a server echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Confirm Deletion of a Server") . '</b>', 'center', $color[9])) . html_tag('tr', html_tag('td', "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_delete" />' . '<br />' . _("Selected Server:") . " <b>" . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . "</b><br />" . _("Confirm delete of selected server?") . '<br /><br />' . '<input type="submit" name="submit_mailfetch" value="' . _("Confirm Delete") . '" />' . '<br /></form>', 'center', $color[9])), 'center', '', 'width="70%" cellpadding="5" cellspacing="1"'); break; //modify a server //modify a server case 'Modify': echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"') . html_tag('tr', html_tag('td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9])) . html_tag('tr') . html_tag('td', '', 'center', $color[0]) . "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_modify" />' . html_tag('table') . html_tag('tr', html_tag('th', _("Server:"), 'right') . html_tag('td', '<input type="text" name="mf_server" value="' . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Port:"), 'right') . html_tag('td', '<input type="text" name="mf_port" value="' . sm_encode_html_special_chars($mailfetch_port_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Alias:"), 'right') . html_tag('td', '<input type="text" name="mf_alias" value="' . sm_encode_html_special_chars($mailfetch_alias_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Username:"******"text" name="mf_user" value="' . sm_encode_html_special_chars($mailfetch_user_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Password:"******"password" name="mf_pass" value="' . sm_encode_html_special_chars($mailfetch_pass_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Authentication type:"), 'right') . html_tag('td', addSelect('mf_auth', array(MAIL_FETCH_AUTH_USER => _("USER"), MAIL_FETCH_AUTH_APOP => _("APOP"), MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")), $mailfetch_auth_[$mf_sn], true), 'left')) . html_tag('tr', html_tag('th', _("Connection type:"), 'right') . html_tag('td', addSelect('mf_type', array(MAIL_FETCH_USE_PLAIN => _("Plain text"), MAIL_FETCH_USE_TLS => _("Use TLS"), MAIL_FETCH_USE_STLS => _("Use StartTLS")), $mailfetch_type_[$mf_sn], true), 'left')) . html_tag('tr') . html_tag('th', _("Store in Folder:"), 'right') . html_tag('td', '', 'left'); $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options); $boxes = sqimap_mailbox_list($imapConnection); echo '<select name="mf_subfolder">'; $selected = 0; if (isset($mailfetch_subfolder_[$mf_sn])) { $selected = array(strtolower($mailfetch_subfolder_[$mf_sn])); } echo sqimap_mailbox_option_list($imapConnection, $selected) . '</select></td></tr>' . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_lmos" ' . ($mailfetch_lmos_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Leave Mail on Server"), 'left')) . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_login" ' . ($mailfetch_login_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at login"), 'left')) . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_fref" ' . ($mailfetch_fref_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at folder refresh"), 'left')) . html_tag('tr', html_tag('td', '<input type="submit" name="submit_mailfetch" value="' . _("Modify Server") . '" />', 'center', '', 'colspan="2"')) . '</table></form></td></tr></table>'; break; default: //unsupported action echo '</form>' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Undefined Function") . '</b>', 'center', $color[9]) . html_tag('td', '<b>' . _("The function you requested is unknown.") . '</b>', 'center', $color[0])), 'center', '', 'width="70%"'); } $oTemplate->display('footer.tpl');
* 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&id=' . urlencode($row['execid']) . '"><img src="../images/b_save.png" alt="export" /></a></td>' . "<td class=\"editdel\">" . editLink('executable', $row['execid']) . " " . 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';
/** * Output a form to send a new clarification. * Set respid to a clarid, to make only responses to same * sender(s)/recipient(s) or ALL selectable. */ function putClarificationForm($action, $respid = NULL, $onlycontest = NULL) { $cdatas = getCurContests(TRUE); if (isset($onlycontest)) { $cdatas = array($onlycontest => $cdatas[$onlycontest]); } $cids = array_keys($cdatas); if (empty($cids)) { echo '<p class="nodata">No active contests</p>'; return; } require_once 'forms.php'; global $DB; ?> <script type="text/javascript"> <!-- function confirmClar() { <?php if (IS_JURY) { ?> var sendto_field = document.forms['sendclar'].sendto; var sendto = sendto_field.value; var sendto_text = sendto_field.options[sendto_field.selectedIndex].text; if ( sendto=='domjudge-must-select' ) { alert('You must select a recipient for this clarification.'); return false; } return confirm("Send clarification to " + sendto_text + "?"); <?php } else { ?> return confirm("Send clarification request to Jury?"); <?php } ?> } // --> </script> <?php echo addForm($action, 'post', 'sendclar'); echo "<table>\n"; if ($respid) { $clar = $DB->q('MAYBETUPLE SELECT c.*, t.name AS toname, f.name AS fromname FROM clarification c LEFT JOIN team t ON (t.teamid = c.recipient) LEFT JOIN team f ON (f.teamid = c.sender) WHERE c.clarid = %i', $respid); } if (IS_JURY) { // list all possible recipients in the "sendto" box echo "<tr><td><b><label for=\"sendto\">Send to</label>:</b></td><td>\n"; if (!empty($respid)) { echo addHidden('id', $respid); } $options = array('domjudge-must-select' => '(select...)', '' => 'ALL'); if (!$respid) { $teams = $DB->q('KEYVALUETABLE SELECT teamid, name FROM team ORDER BY categoryid ASC, team.name COLLATE utf8_general_ci ASC'); $options += $teams; } else { if ($clar['sender']) { $options[$clar['sender']] = $clar['fromname'] . ' (t' . $clar['sender'] . ')'; } else { if ($clar['recipient']) { $options[$clar['recipient']] = $clar['toname'] . ' (t' . $clar['recipient'] . ')'; } } } echo addSelect('sendto', $options, 'domjudge-must-select', true); echo "</td></tr>\n"; } else { echo "<tr><td><b>To:</b></td><td>Jury</td></tr>\n"; } // Select box for a specific problem (only when the contest // has started) or general issue. $options = array(); foreach ($cdatas as $cid => $cdata) { $row = $DB->q('TUPLE SELECT CONCAT(cid, "-general") AS c FROM contest WHERE cid = %i', $cid); if (IS_JURY && count($cdatas) > 1) { $options[$row['c']] = "{$cdata['shortname']} - General issue"; } else { $options[$row['c']] = "General issue"; } if (difftime($cdata['starttime'], now()) <= 0) { $problem_options = $DB->q('KEYVALUETABLE SELECT CONCAT(cid, "-", probid), CONCAT(shortname, ": ", name) as name FROM problem INNER JOIN contestproblem USING (probid) WHERE cid = %i AND allow_submit = 1 ORDER BY shortname ASC', $cid); if (IS_JURY && count($cdatas) > 1) { foreach ($problem_options as &$problem_option) { $problem_option = $cdata['shortname'] . ' - ' . $problem_option; } unset($problem_option); } $options += $problem_options; } } echo "<tr><td><b>Subject:</b></td><td>\n" . addSelect('problem', $options, $respid ? $clar['cid'] . '-' . $clar['probid'] : 'general', true) . "</td></tr>\n"; ?> <tr> <td><b><label for="bodytext">Text</label>:</b></td> <td><?php $body = ""; if ($respid) { $text = explode("\n", wrap_unquoted($clar['body']), 75); foreach ($text as $line) { $body .= "> {$line}\n"; } } echo addTextArea('bodytext', $body, 80, 10, 'required'); ?> </td></tr> <tr> <td> </td> <td><?php echo addSubmit('Send', 'submit', 'return confirmClar()'); ?> </td> </tr> </table> </form> <script type="text/javascript"> <!-- document.forms['sendclar'].bodytext.focus(); document.forms['sendclar'].bodytext.select(); // --> </script> <?php }
} if (isset($vcard_nice['tel;fax'])) { $opts[$vcard_nice['tel;fax']] = _("Fax"); } if (isset($vcard_nice['note'])) { $opts[$vcard_nice['note']] = _("Note"); } /* * If the vcard comes with nothing but name and e-mail address, the user gets * the chance to type some additional info. If there's more info in the card, * the user gets to choose what will be added as additional info. */ if (count($opts) == 0) { echo addInput('addaddr[label]', '', '20'); } else { echo addSelect('addaddr[label]', $opts, '', TRUE); } ?> </td></tr> <tr><td colspan="2" align="center"><br /> <?php echo addHidden('addaddr[firstname]', $vcard_safe['firstname']) . addHidden('addaddr[lastname]', $vcard_safe['lastname']) . addSubmit(_("Add to Address Book"), 'addaddr[SUBMIT]'); ?> </td></tr> </table> </form> </td></tr> <tr><td align="center"> <?php echo '<a href="../src/download.php?absolute_dl=true&passed_id=' . urlencode($passed_id) . '&mailbox=' . urlencode($mailbox) . '&ent_id=' . urlencode($ent_id) . '">' . _("Download this as a file") . '</a>'; ?>
function showComposeButtonRow() { global $use_javascript_addr_book, $save_as_draft, $default_use_priority, $mailprio, $default_use_mdn, $request_mdn, $request_dr, $data_dir, $username; echo ' <tr>' . "\n" . ' <td></td>' . "\n" . ' <td>' . "\n"; if ($default_use_priority) { if (!isset($mailprio)) { $mailprio = '3'; } echo ' ' . _("Priority") . addSelect('mailprio', array('1' => _("High"), '3' => _("Normal"), '5' => _("Low")), $mailprio, TRUE); } $mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', $default_use_mdn); if ($default_use_mdn) { if ($mdn_user_support) { echo ' ' . _("Receipt") . ': ' . addCheckBox('request_mdn', $request_mdn == '1', '1') . _("On Read") . addCheckBox('request_dr', $request_dr == '1', '1') . _("On Delivery"); } } echo ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td></td>' . "\n" . ' <td>' . "\n" . ' <input type="submit" name="sigappend" value="' . _("Signature") . '" />' . "\n"; if ($use_javascript_addr_book) { echo " <script language=\"JavaScript\"><!--\n document.write(\"" . " <input type=button value=\\\"" . _("Addresses") . "\\\" onclick=\\\"javascript:open_abook();\\\" />\");" . " // --></script><noscript>\n" . ' <input type="submit" name="html_addr_search" value="' . _("Addresses") . '" />' . " </noscript>\n"; } else { echo ' <input type="submit" name="html_addr_search" value="' . _("Addresses") . '" />' . "\n"; } if ($save_as_draft) { echo ' <input type="submit" name ="draft" value="' . _("Save Draft") . "\" />\n"; } echo ' <input type="submit" name="send" value="' . _("Send") . '" />' . "\n"; do_hook('compose_button_row'); echo ' </td>' . "\n" . ' </tr>' . "\n\n"; }
} /* Initialize addressbook */ $abook = addressbook_init(); /* Create search form */ if ($show == 'form' && empty($listall)) { echo '<form name="sform" target="abookres" action="addrbook_search.php' . '" method="post">' . "\n" . html_tag('table', '', '', '', 'border="0" width="100%" height="100%"') . html_tag('tr') . html_tag('td', ' <strong>' . _("Search for") . "</strong>\n", 'left', '', 'nowrap valign="middle" width="10%"') . html_tag('td', '', 'left', '', '') . addInput('query', $query, 28); /* List all backends to allow the user to choose where to search */ if ($abook->numbackends > 1) { echo '<strong>' . _("in") . '</strong> ' . "\n"; $selopts = array(); $selopts['-1'] = _("All address books"); $ret = $abook->get_backend_list(); while (list($undef, $v) = each($ret)) { $selopts[$v->bnum] = $v->sname; } echo addSelect('backend', $selopts, '-1', TRUE); } else { echo addHidden('backend', '-1'); } echo '</td></tr>' . html_tag('tr', html_tag('td', '', 'left') . html_tag('td', '<input type="submit" value="' . _("Search") . '" name="show" />' . ' | <input type="submit" value="' . _("List all") . '" name="listall" />' . "\n" . ' | <input type="button" value="' . _("Close") . '" onclick="parent.close();" />' . "\n", 'left')) . '</table></form>' . "\n"; } else { /* Show personal addressbook */ if ($show == 'blank' && empty($listall)) { if ($backend != -1 || $show == 'blank') { if ($show == 'blank') { $backend = $abook->localbackend; } $res = $abook->list_addr($backend); if (is_array($res)) { usort($res, 'alistcmp'); display_result($res, false);
/** * Output clock */ function putClock() { global $cdata, $username; echo '<div id="clock">'; // timediff to end of contest if (difftime(now(), $cdata['starttime']) >= 0 && difftime(now(), $cdata['endtime']) < 0) { $left = "time left: " . printtimediff(now(), $cdata['endtime']); } else { if (difftime(now(), $cdata['activatetime']) >= 0 && difftime(now(), $cdata['starttime']) < 0) { $left = "time to start: " . printtimediff(now(), $cdata['starttime']); } else { $left = ""; } } echo "<span id=\"timeleft\">" . $left . "</span>"; global $cid, $cdatas; // Show a contest selection form, if there are contests if (IS_JURY || count($cdatas) > 1) { echo "<div id=\"selectcontest\">\n"; echo addForm('change_contest.php', 'get', 'selectcontestform'); $contests = array_map(function ($c) { return $c['shortname']; }, $cdatas); if (IS_JURY) { $values = array(-1 => '- No contest'); } foreach ($contests as $contestid => $name) { $values[$contestid] = $name; } echo 'contest: ' . addSelect('cid', $values, $cid, true); echo addEndForm(); echo "<script type=\"text/javascript\">\n\t\t document.getElementById('cid').addEventListener('change', function() {\n\t\t document.getElementById('selectcontestform').submit();\n\t});\n</script>\n"; echo "</div>\n"; } if (logged_in()) { echo "<div id=\"username\">logged in as " . $username . (have_logout() ? " <a href=\"../auth/logout.php\">×</a>" : "") . "</div>"; } echo "</div>"; echo "<script type=\"text/javascript\">\n\tvar initial = " . time() . ";\n\tvar activatetime = " . (isset($cdata['activatetime']) ? $cdata['activatetime'] : -1) . ";\n\tvar starttime = " . (isset($cdata['starttime']) ? $cdata['starttime'] : -1) . ";\n\tvar endtime = " . (isset($cdata['endtime']) ? $cdata['endtime'] : -1) . ";\n\tvar offset = 0;\n\tvar date = new Date(initial*1000);\n\tvar timeleftelt = document.getElementById(\"timeleft\");\n\n\tsetInterval(function(){updateClock();},1000);\n\tupdateClock();\n</script>\n"; }
/** * Make an input field * @param string $label * @param string $field * @param string $name * @param string $size * @param array $values * @param string $add */ function addressbook_inp_field($label, $field, $name, $size, $values, $add = '') { global $color; $value = isset($values[$field]) ? $values[$field] : ''; if (is_array($value)) { $td_str = addSelect($name . '[' . $field . ']', $value); } else { $td_str = addInput($name . '[' . $field . ']', $value, $size); } $td_str .= $add; return html_tag('tr', html_tag('td', $label . ':', 'right', $color[4]) . html_tag('td', $td_str, 'left', $color[4])) . "\n"; }
?> <h1>Import and Export</h1> <h2>Import / Export via file up/download</h2> <ul> <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&fmt=groups">groups.tsv</a>, <a href="impexp_tsv.php?act=ex&fmt=teams">teams.tsv</a>, <a href="impexp_tsv.php?act=ex&fmt=scoreboard">scoreboard.tsv</a>, <a href="impexp_tsv.php?act=ex&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");
</td></tr> <tr><td><label for="data_0__type_">Executable type:</label></td> <td><?php echo addSelect('data[0][type]', $executable_types, @$row['type'], True); ?> </td></tr> <tr><td>Content: </td><td><a href="show_executable.php?edit_source=1&id=<?php echo specialchars($id); ?> ">edit file contents</a></td></tr> </table> <?php echo addHidden('cmd', $cmd) . addHidden('table', 'executable') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm(); if (class_exists("ZipArchive")) { echo "<br /><em>or</em><br /><br />\n" . addForm($pagename, 'post', null, 'multipart/form-data') . addHidden('id', @$row['execid']) . '<label for="executable_archive__">Upload executable archive:</label>' . ($cmd == 'add' ? addSelect('type', $executable_types) : '') . addFileField('executable_archive[]') . addSubmit('Upload', 'upload') . addEndForm(); } require LIBWWWDIR . '/footer.php'; exit; } $data = $DB->q('MAYBETUPLE SELECT execid, description, md5sum, type, OCTET_LENGTH(zipfile) AS size FROM executable WHERE execid = %s', $id); if (!$data) { error("Missing or invalid problem id"); } echo "<h1>Executable " . specialchars($id) . "</h1>\n\n"; echo addForm($pagename . '?id=' . urlencode($id), 'post', null, 'multipart/form-data') . "<p>\n" . addHidden('id', $id) . "</p>\n"; ?> <table> <tr><td>ID: </td><td class="execid"><?php
} echo "</script>\n\n"; ?> <h3>Create new testcase</h3> <table> <tr><td>Input testdata: </td><td><?php echo addFileField('add_input'); ?> </td></tr> <tr><td>Output testdata:</td><td><?php echo addFileField('add_output'); ?> </td></tr> <tr><td>Sample testcase:</td><td><?php echo addSelect('add_sample', array("no", "yes"), 0, true); ?> </td></tr> <tr><td>Description: </td><td><?php echo addInput('add_desc', '', 30); ?> </td></tr> <tr><td>Image: </td><td><?php echo addFileField('add_image'); ?> </td></tr> </table> <?php echo "<br />" . addSubmit('Submit all changes') . addEndForm(); } require LIBWWWDIR . '/footer.php';
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 = ' '; $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 * **************************************************/
echo html_tag('td', '', 'left') . "\n"; if ($action == 'edit' && isset($theid) && isset($message_highlight_list[$theid]['name'])) { $disp = $message_highlight_list[$theid]['name']; } else { $disp = ''; } echo " " . addInput('identname', $disp); echo " </td>\n"; echo " </tr>\n"; echo html_tag('tr', html_tag('td', '<small><small> </small></small>', 'left')) . "\n"; echo html_tag('tr', '', '', $color[0]) . "\n"; echo html_tag('td', '<b>' . _("Color") . ':</b>', 'right'); echo html_tag('td', '', 'left'); echo ' ' . addRadioBox('color_type', $selected_choose, '1'); $selops = array($color_list[0] => _("Dark Blue"), $color_list[1] => _("Dark Green"), $color_list[2] => _("Dark Yellow"), $color_list[3] => _("Dark Cyan"), $color_list[4] => _("Dark Magenta"), $color_list[5] => _("Light Blue"), $color_list[6] => _("Light Green"), $color_list[7] => _("Light Yellow"), $color_list[8] => _("Light Cyan"), $color_list[9] => _("Light Magenta"), $color_list[10] => _("Dark Gray"), $color_list[11] => _("Medium Gray"), $color_list[12] => _("Light Gray"), $color_list[13] => _("White")); echo addSelect('newcolor_choose', $selops, $selected_i, TRUE); echo "<br />\n"; echo ' ' . addRadioBox('color_type', $selected_input, 2) . ' ' . _("Other:") . addInput('newcolor_input', $selected_input && isset($theid) ? $message_highlight_list[$theid]['color'] : '', '7'); echo _("Ex: 63aa7f") . "<br />\n"; echo " </td>\n"; echo " </tr>\n"; # Show grid of color choices echo html_tag('tr', '', '', $color[0]) . "\n"; echo html_tag('td', '', 'left', '', 'colspan="2"'); echo html_tag('table', '', 'center', '', 'border="0" cellpadding="2" cellspacing="1"') . "\n"; for ($x = 0; $x < 5; $x++) { echo html_tag('tr') . "\n"; for ($y = 0; $y < 19; $y++) { $gridindex = "{$y},{$x}"; $gridcolor = $new_color_list[$gridindex]; echo html_tag('td', addRadioBox('color_type', $gridcolor == $current_color, '#' . $gridcolor), 'left', '#' . $gridcolor, 'colspan="2"');
} 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>
/** * 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&startMessage=1&mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&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&startMessage=1&mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&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 = ' '; } $accesskeys_constructed = TRUE; /* Return our final magical paginator string. */ return $result; }
if (!isset($addrquery)) { $addrquery = ''; } echo addInput('addrquery', $addrquery, 26); /* List all backends to allow the user to choose where to search */ if (!isset($backend)) { $backend = ''; } if ($abook->numbackends > 1) { echo '<strong>' . _("in") . '</strong> '; $selopts['-1'] = _("All address books"); $ret = $abook->get_backend_list(); while (list($undef, $v) = each($ret)) { $selopts[$v->bnum] = $v->sname; } echo addSelect('backend', $selopts, $backend, TRUE); } else { echo addHidden('backend', '-1'); } if (isset($session)) { echo addHidden('session', $session); } echo '<input type="submit" value="' . _("Search") . '" />' . ' | <input type="submit" value="' . _("List all") . '" name="listall" />' . "\n" . '</form></center></td></tr></table>' . "\n"; addr_insert_hidden(); echo '</center>'; do_hook('addrbook_html_search_below'); /* End search form */ /* Show personal addressbook */ if (!empty($listall)) { $addrquery = '*'; }
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']; } $langs[''] = 'language'; echo addSelect('langid', $langs, '', true); echo addSubmit('submit', 'submit', "return checkUploadForm();"); echo addReset('cancel'); if ($maxfiles > 1) { echo "<br /><span id=\"auxfiles\"></span>\n" . "<input type=\"button\" name=\"addfile\" id=\"addfile\" " . "value=\"Add another file\" onclick=\"addFileUpload();\" " . "disabled=\"disabled\" />\n"; } echo "<script type=\"text/javascript\">initFileUploads({$maxfiles});</script>\n\n"; echo "</p>\n</form>\n\n"; } // call putSubmissions function from common.php for this team. $restrictions = array('teamid' => $teamid); putSubmissions(array($cdata['cid'] => $cdata), $restrictions, null, $submitted); echo "</div>\n\n"; echo "<div id=\"clarlist\">\n"; $requests = $DB->q('SELECT c.*, cp.shortname, t.name AS toname, f.name AS fromname FROM clarification c
$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']) . '&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']) . " " . 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';
<tr><td><label for="data_0__enabled_">Enabled:</label></td> <td><?php echo addRadioButton('data[0][enabled]', !isset($row['']) || $row['enabled'], 1); ?> <label for="data_0__enabled_1">yes</label> <?php echo addRadioButton('data[0][enabled]', isset($row['enabled']) && !$row['enabled'], 0); ?> <label for="data_0__enabled_0">no</label></td></tr> <!-- team selection --> <tr><td><label for="data_0__teamid_">Team:</label></td> <td><?php $tmap = $DB->q("KEYVALUETABLE SELECT teamid,name FROM team ORDER BY name"); $tmap[''] = 'none'; echo addSelect('data[0][teamid]', $tmap, isset($row['teamid']) ? $row['teamid'] : @$_GET['forteam'], true); ?> </td></tr> <!-- role selection --> <tr><td>Roles:</td> <td><?php $roles = $DB->q('TABLE SELECT r.roleid, r.role, r.description, max(ur.userid=%s) AS hasrole FROM role r LEFT JOIN userrole ur USING (roleid) GROUP BY r.roleid', @$row['userid']); $i = 0; foreach ($roles as $role) { echo "<label>"; echo addCheckbox("data[0][mapping][0][items][{$i}]", $role['hasrole'] == 1, $role['roleid']); echo $role['description'] . "</label><br/>";
$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';
/** * Provides list of writeable backends. * Works only when address is added ($name='addaddr') * @param string $name name of form * @return string html formated backend field (select or hidden) */ function list_writable_backends($name) { global $color, $abook; if ($name != 'addaddr') { return; } $writeable_abook = 1; if ($abook->numbackends > 1) { $backends = $abook->get_backend_list(); $writeable_abooks = array(); while (list($undef, $v) = each($backends)) { if ($v->writeable) { // add each backend to array $writeable_abooks[$v->bnum] = $v->sname; // save backend number $writeable_abook = $v->bnum; } } if (count($writeable_abooks) > 1) { // we have more than one writeable backend $ret = addSelect('backend', $writeable_abooks, null, true); return html_tag('tr', html_tag('td', _("Add to:"), 'right', $color[4]) . html_tag('td', $ret, 'left', $color[4])) . "\n"; } } // Only one backend exists or is writeable. return html_tag('tr', html_tag('td', addHidden('backend', $writeable_abook), 'center', $color[4], 'colspan="2"')) . "\n"; }
/** * 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…" title="filter…" 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; }
<?php echo addRadioButton('data[0][allow_judge]', isset($row['allow_judge']) && !$row['allow_judge'], 0); ?> <label for="data_0__allow_judge_0">no</label></td></tr> <tr><td><label for="data_0__time_factor_">Time factor:</label></td> <td><?php echo addInputField('number', 'data[0][time_factor]', isset($row['time_factor']) ? $row['time_factor'] : 1, ' min="0" step="any" required'); ?> ×</td></tr> <tr><td><label for="data_0__compile_script_">Compile script:</label></td> <td> <?php $execmap = $DB->q("KEYVALUETABLE SELECT execid,description FROM executable\n\t\t\tWHERE type = 'compile'\n\t\t\tORDER BY execid"); $execmap[''] = 'none'; echo addSelect('data[0][compile_script]', $execmap, @$row['compile_script'], True); ?> </td></tr> <tr><td><label for="data_0__extensions_">Extensions:</label></td> <td><?php echo addInput('data[0][extensions]', @$row['extensions'], 20, 255, 'required'); ?> (as JSON encoded array, for example <kbd>["cpp","cc","c++"]</kbd>)</td></tr> </table> <?php echo addHidden('cmd', $cmd) . addHidden('table', 'language') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm(); require LIBWWWDIR . '/footer.php'; exit; } $data = $DB->q('TUPLE SELECT * FROM language WHERE langid = %s', $id);