Ejemplo n.º 1
0
    echo "No roles assigned";
} else {
    while ($role = $roles->next()) {
        echo "{$role['role']} - {$role['description']}<br>";
    }
}
?>
</td></tr>
<tr><td>Team:</td><?php 
if ($row['teamid']) {
    echo "<td class=\"teamid\"><a href=\"team.php?id=" . urlencode($row['teamid']) . "\">" . htmlspecialchars($row['teamname'] . " (t" . $row['teamid'] . ")") . "</a></td>";
} else {
    echo "<td>-</td>";
}
?>
</tr>
<tr><td>Last login:</td><td><?php 
echo printtime($row['last_login'], '%a %d %b %Y %T %Z');
?>
</td></tr>
<tr><td>Last IP:   </td><td><?php 
echo @$row['ip_address'] ? printhost($row['ip_address'], TRUE) : '';
?>
</td></tr>
</table></div>

<?php 
if (IS_ADMIN) {
    echo "<p class=\"nomorecol\">" . editLink('user', $id) . "\n" . delLink('user', 'userid', $id) . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 2
0
 case "editRSS":
     editRSS();
     break;
 case "addRSS":
     $newRSS = getRequestVar('newRSS');
     addRSS($newRSS);
     break;
 case "deleteRSS":
     $rid = getRequestVar('rid');
     deleteRSS($rid);
     break;
 case "editLink":
     $lid = getRequestVar('lid');
     $editLink = getRequestVar('editLink');
     $editSite = getRequestVar('editSite');
     editLink($lid, $editLink, $editSite);
     break;
 case "editLinks":
     editLinks();
     break;
 case "addLink":
     $newLink = getRequestVar('newLink');
     $newSite = getRequestVar('newSite');
     addLink($newLink, $newSite);
     break;
 case "moveLink":
     $lid = getRequestVar('lid');
     $direction = getRequestVar('direction');
     moveLink($lid, $direction);
     break;
 case "deleteLink":
Ejemplo n.º 3
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';
Ejemplo n.º 4
0
if (isset($_GET['linkid'])) {
    ?>
	<!-- EDITING LINK -->
	<div class="content">	
		<div class="content-header">
			<h4><a href="?p=admin">Main Menu</a> / <a href="?p=admin&sub=fplinks">Frontpage Links</a> / Edit</h4>
		</div> <!-- .content-header -->				
		<div class="main-content">
			<?php 
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'edit') {
            if (isset($_POST['delete'])) {
                deleteLink();
            } else {
                editLink();
            }
        }
    }
    ?>
			<form method="POST" action="?p=admin&sub=fplinks&linkid=<?php 
    echo $_GET['linkid'];
    ?>
" class="form label-inline">
			<input type="hidden" name="action" value="edit">
			<?php 
    $edit_info = $DB->selectRow("SELECT * FROM `mw_menu_items` WHERE `id`='" . $_GET['linkid'] . "'");
    ?>
			
			<!-- Link Title -->
			<div class="field">
Ejemplo n.º 5
0
if (!empty($row['country'])) {
    echo '<tr><td>Country:</td><td>';
    if (is_readable($countryflag)) {
        echo '<img src="' . $countryflag . '" alt="' . specialchars($row['country']) . '" /> ';
    }
    echo specialchars($row['country']) . "</td></tr>\n";
}
if (!empty($row['members'])) {
    echo '<tr><td>Members:   </td><td>' . nl2br(specialchars($row['members'])) . "</td></tr>\n";
}
if (!empty($row['comments'])) {
    echo '<tr><td>Comments:</td><td>' . nl2br(specialchars($row['comments'])) . "</td></tr>\n";
}
echo "</table></div>\n";
if (IS_ADMIN) {
    echo "<p class=\"nomorecol\">" . editLink('team', $id) . "\n" . delLink('team', 'teamid', $id) . "</p>\n\n";
}
echo rejudgeForm('team', $id) . "\n\n";
if ($cid) {
    echo "<h3>Score</h3>\n\n";
    putTeamRow($cdata, array($id));
}
echo '<h3>Submissions';
if (isset($key)) {
    $keystr = "";
    switch ($key) {
        case 'probid':
            $keystr = "problem";
            break;
        case 'langid':
            $keystr = "language";
Ejemplo n.º 6
0
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">name</th>" . "<th scope=\"col\" class=\"sorttable_numeric\"># contests</th>" . "<th scope=\"col\">time<br />limit</th>" . "<th scope=\"col\">memory<br />limit</th>" . "<th scope=\"col\">output<br />limit</th>" . "<th scope=\"col\">test<br />cases</th>" . "<th scope=\"col\"></th>" . (IS_ADMIN ? "<th scope=\"col\"></th><th scope=\"col\"></th>" : '') . "</tr></thead>\n<tbody>\n";
    $lastcid = -1;
    while ($row = $res->next()) {
        $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";
Ejemplo n.º 7
0
require LIBWWWDIR . '/header.php';
echo "<h1>Users</h1>\n\n";
if ($users->count() == 0) {
    echo "<p class=\"nodata\">No users defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">username</th><th scope=\"col\">name</th>" . "<th scope=\"col\">email</th><th scope=\"col\">roles</th>" . "<th scope=\"col\">team</th>" . "<th class=\"thleft\" scope=\"col\">status</th><th></th>" . "</tr>\n</thead>\n<tbody>\n";
    while ($row = $users->next()) {
        $status = 0;
        if (isset($row['last_login'])) {
            $status = 1;
        }
        $link = '<a href="user.php?id=' . urlencode($row['userid']) . '">';
        echo "<tr class=\"" . ($row['enabled'] == 1 ? '' : 'sub_ignore') . "\">" . "<td class=\"username\">" . $link . specialchars($row['username']) . "</a></td>" . "<td>" . $link . specialchars($row['name']) . "</a></td>" . "<td>" . $link . (isset($row['email']) ? specialchars($row['email']) : '&nbsp;') . "</a></td>" . "<td>" . $link . specialchars($row['roles']) . "</a></td>" . "<td>" . $link . (isset($row['teamid']) ? "t" . specialchars($row['teamid']) : '&nbsp;') . "</a></td>";
        echo "<td sorttable_customkey=\"" . $status . "\" class=\"";
        if ($status == 1) {
            echo 'team-ok" title="logged in: ' . printtime($row['last_login']) . '"';
        } else {
            echo 'team-nocon" title="no connections made"';
        }
        echo ">{$link}" . CIRCLE_SYM . "</a></td>";
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('user', $row['userid']) . "&nbsp;" . delLink('user', 'userid', $row['userid'], $row['name']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('user') . "</p>\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 8
0
<?php

/**
 * View the languages
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Languages';
require LIBWWWDIR . '/header.php';
echo "<h1>Languages</h1>\n\n";
$res = $DB->q('SELECT * FROM language ORDER BY name');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No languages defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID/ext</th><th scope=\"col\">name</th>" . "<th scope=\"col\">allow<br />submit</th>" . "<th scope=\"col\">allow<br />judge</th><th scope=\"col\">timefactor</th>" . "<th scope=\"col\">extensions</th><th scope=\"col\"></th>" . "</tr>\n</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="language.php?id=' . urlencode($row['langid']) . '">';
        echo "<tr" . ($row['allow_submit'] ? '' : ' class="disabled"') . "><td>" . $link . specialchars($row['langid']) . "</a>" . "</td><td>" . $link . specialchars($row['name']) . "</a>" . "</td><td>" . $link . printyn($row['allow_submit']) . "</a>" . "</td><td>" . $link . printyn($row['allow_judge']) . "</a>" . "</td><td>" . $link . specialchars($row['time_factor']) . "</a>" . "</td><td>" . $link . specialchars(implode(', ', json_decode($row['extensions']))) . "</a>";
        if (IS_ADMIN) {
            echo "</td><td class=\"editdel\">" . editLink('language', $row['langid']) . "&nbsp;" . delLink('language', 'langid', $row['langid']);
        }
        echo "</td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('language') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 9
0
            echo "\">" . $link . "-";
        }
        echo "</a></td><td>" . $link . ($row['room'] ? htmlspecialchars($row['room']) : '&nbsp;') . "</a></td>";
        echo "<td class=\"";
        switch ($status) {
            case 0:
                echo 'team-nocon" title="no connections made"';
                break;
            case 1:
                echo 'team-nosub" title="teampage viewed, no submissions"';
                break;
            case 2:
                echo 'team-nocor" title="submitted, none correct"';
                break;
            case 3:
                echo 'team-ok" title="correct submission(s)"';
                break;
        }
        echo ">{$link}" . CIRCLE_SYM . "</a></td>";
        echo "<td class=\"teamstat\" title=\"{$numcor} correct / {$numsub} submitted\">{$link}{$numcor} / {$numsub}</a></td>";
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('team', $row['teamid']) . " " . delLink('team', 'teamid', $row['teamid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('team') . "</p>\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 10
0
?>
</td></tr>
<tr><td>Time factor:  </td><td><?php 
echo specialchars($data['time_factor']);
?>
 &times;</td></tr>
<tr><td>Compile script:</td><td class="filename">
<?php 
if (empty($data['compile_script'])) {
    echo '<span class="nodata">none specified</span>';
} else {
    echo '<a href="executable.php?id=' . urlencode($data['compile_script']) . '">' . specialchars($data['compile_script']) . '</a>';
}
?>
</td></tr>
<tr><td>Extensions:  </td><td><?php 
echo specialchars(implode(', ', json_decode($data['extensions'])));
?>
</td></tr>
</table>

<?php 
echo addEndForm();
if (IS_ADMIN) {
    echo "<p>" . editLink('language', $data['langid']) . "\n" . delLink('language', 'langid', $data['langid']) . "</p>\n\n";
}
echo rejudgeForm('language', $data['langid']) . "<br />\n\n";
echo "<h2>Submissions in " . specialchars($data['name']) . "</h2>\n\n";
$restrictions = array('langid' => $id);
putSubmissions($cdatas, $restrictions);
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 11
0
            echo "\">" . $link . "-";
        }
        echo "</a></td><td>" . $link . ($row['room'] ? specialchars($row['room']) : '&nbsp;') . "</a></td>";
        echo "<td class=\"";
        switch ($status) {
            case 0:
                echo 'team-nocon" title="no connections made"';
                break;
            case 1:
                echo 'team-nosub" title="teampage viewed, no submissions"';
                break;
            case 2:
                echo 'team-nocor" title="submitted, none correct"';
                break;
            case 3:
                echo 'team-ok" title="correct submission(s)"';
                break;
        }
        echo ">{$link}" . CIRCLE_SYM . "</a></td>";
        echo "<td class=\"teamstat\" title=\"{$numcor} correct / {$numsub} submitted\">{$link}{$numcor} / {$numsub}</a></td>";
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('team', $row['teamid']) . "&nbsp;" . delLink('team', 'teamid', $row['teamid'], $row['name']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('team') . "</p>\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 12
0
require LIBWWWDIR . '/header.php';
echo "<h1>Users</h1>\n\n";
if ($users->count() == 0) {
    echo "<p class=\"nodata\">No users defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">username</th><th scope=\"col\">name</th>" . "<th scope=\"col\">email</th><th scope=\"col\">roles</th>" . "<th scope=\"col\">team</th>" . "<th class=\"thleft\" scope=\"col\">status</th><th></th>" . "</tr>\n</thead>\n<tbody>\n";
    while ($row = $users->next()) {
        $status = 0;
        if (isset($row['last_login'])) {
            $status = 1;
        }
        $link = '<a href="user.php?id=' . urlencode($row['userid']) . '">';
        echo "<tr class=\"" . ($row['enabled'] == 1 ? '' : 'sub_ignore') . "\">" . "<td class=\"username\">" . $link . htmlspecialchars($row['username']) . "</a></td>" . "<td>" . $link . htmlspecialchars($row['name']) . "</a></td>" . "<td>" . $link . htmlspecialchars($row['email']) . "</a></td>" . "<td>" . $link . htmlspecialchars($row['roles']) . "</a></td>" . "<td>" . (isset($row['teamid']) ? $link . "t" . htmlspecialchars($row['teamid']) . "</a>" : '') . "</td>";
        echo "<td sorttable_customkey=\"" . $status . "\" class=\"";
        if ($status == 1) {
            echo 'team-ok" title="logged in: ' . printtime($row['last_login']) . '"';
        } else {
            echo 'team-nocon" title="no connections made"';
        }
        echo ">{$link}" . CIRCLE_SYM . "</a></td>";
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('user', $row['userid']) . " " . delLink('user', 'userid', $row['userid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('user') . "</p>\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 13
0
     deleteCategory($id);
     break;
 case $lang["add_group"]:
     addGroup();
     break;
 case $lang["edit_group"]:
     editGroup($id);
     break;
 case $lang["delete_group"]:
     deleteGroup($id);
     break;
 case $lang["add_link"]:
     addLink();
     break;
 case $lang["edit_link"]:
     editLink($id);
     break;
 case $lang["delete_link"]:
     deleteLink($id);
     break;
 case $lang["delete_user"]:
     deleteUser($id);
     break;
 case $lang["delete_event"]:
     deleteEvent($id);
     break;
 case $lang["add_profile"]:
     addProfile();
     break;
 case $lang["update modules"]:
     updateModules();
Ejemplo n.º 14
0
 * View all team affiliations
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Affiliations';
require LIBWWWDIR . '/header.php';
echo "<h1>Affiliations</h1>\n\n";
$res = $DB->q('SELECT a.*, COUNT(teamid) AS cnt FROM team_affiliation a
               LEFT JOIN team USING (affilid)
               GROUP BY affilid ORDER BY name');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No affiliations defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th>ID</th>" . "<th>shortname</th>" . "<th>name</th>" . "<th>country</th>" . "<th>#teams</th>" . "<th></th></tr>\n</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $countryflag = "../images/countries/" . urlencode($row['country']) . ".png";
        $link = '<a href="team_affiliation.php?id=' . urlencode($row['affilid']) . '">';
        echo '<tr><td>' . $link . htmlspecialchars($row['affilid']) . '</a></td><td>' . $link . htmlspecialchars($row['shortname']) . '</a></td><td>' . $link . htmlspecialchars($row['name']) . '</a></td><td class="tdcenter">' . $link . htmlspecialchars($row['country']) . (is_readable($countryflag) ? ' <img src="' . $countryflag . '" alt="' . htmlspecialchars($row['country']) . '" />' : '&nbsp;') . '</a></td><td class="tdright">' . $link . (int) $row['cnt'] . '</a></td>';
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('team_affiliation', $row['affilid']) . "&nbsp;" . delLink('team_affiliation', 'affilid', $row['affilid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('team_affiliation') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 15
0
                echo '</td></tr>';
                echo '<tr><td></td><td>';
            }
            echo '<a href="team.php?id=' . $team['teamid'] . '&cid=' . $id . '">';
            echo $team['name'] . ' (t' . $team['teamid'] . ')';
            echo '</a>';
        }
    }
}
echo '</td></tr>';
echo "</table>\n\n";
if (IS_ADMIN) {
    if (in_array($data['cid'], $cids)) {
        echo "<p>" . rejudgeForm('contest', $data['cid']) . "</p>\n\n";
    }
    echo "<p>" . editLink('contest', $data['cid']) . "\n" . delLink('contest', 'cid', $data['cid']) . "</p>\n\n";
}
echo "<h3>Problems</h3>\n\n";
$res = $DB->q('TABLE SELECT *
               FROM problem
               INNER JOIN contestproblem USING (probid)
               WHERE cid = %i
               ORDER BY shortname', $id);
if (count($res) == 0) {
    echo "<p class=\"nodata\">No problems added yet</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">probid</th>";
    echo "<th scope=\"col\">name</th>";
    echo "<th scope=\"col\">shortname</th>";
    echo "<th scope=\"col\">points</th>";
    echo "<th scope=\"col\">allow<br />submit</th>";
Ejemplo n.º 16
0
}
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";
$listteams = array();
$teams = $DB->q('SELECT teamid,name FROM team WHERE categoryid = %i', $id);
if ($teams->count() == 0) {
    echo "<p class=\"nodata\">no teams</p>\n\n";
} else {
    echo "<table class=\"list\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">teamname</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($team = $teams->next()) {
        $listteams[] = $team['teamid'];
        $link = '<a href="team.php?id=' . urlencode($team['teamid']) . '">';
        echo "<tr><td>" . $link . "t" . specialchars($team['teamid']) . "</a></td><td>" . $link . specialchars($team['name']) . "</a></td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
    echo "<h2>Submissions for " . specialchars($data['name']) . "</h2>\n\n";
Ejemplo n.º 17
0
    if (empty($restrictions[$type])) {
        echo "<td class=\"nodata\">none</td></tr>\n";
    } else {
        $first = true;
        foreach ($restrictions[$type] as $val) {
            if (!$first) {
                echo '<tr><td></td>';
            }
            $first = false;
            echo "<td>" . $lists[$type][$val] . "</td></tr>\n";
        }
    }
}
echo '<tr><td>Rejudge by same judgehost:</td><td>' . printyn(!isset($restrictions['rejudge_own']) || (bool) $restrictions['rejudge_own']) . "</td></tr>\n";
echo "</table>\n\n";
if (IS_ADMIN) {
    echo "<p>" . editLink('judgehost_restriction', $data['restrictionid']) . "\n" . delLink('judgehost_restriction', 'restrictionid', $data['restrictionid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Judgehosts having restriction " . specialchars($data['name']) . "</h2>\n\n";
$judgehosts = $DB->q('SELECT hostname, active FROM judgehost WHERE restrictionid = %i', $id);
if ($judgehosts->count() == 0) {
    echo "<p class=\"nodata\">no judgehosts</p>\n\n";
} else {
    echo "<table class=\"list\">\n<thead>\n" . "<tr><th scope=\"col\">hostname</th><th scope=\"col\">active</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($judgehost = $judgehosts->next()) {
        $link = '<a href="judgehost.php?id=' . urlencode($judgehost['hostname']) . '">';
        echo "<tr" . ($judgehost['active'] ? '' : ' class="disabled"') . "><td>" . $link . specialchars($judgehost['hostname']) . "</a></td><td>" . $link . printyn($judgehost['active']) . "</a></td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 18
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';
Ejemplo n.º 19
0
        if ($data['type'] == 'run') {
            $res = $DB->q('SELECT probid AS id FROM problem
	               WHERE special_run = %s ORDER BY probid', $data['execid']);
            $page = "problem";
            $prefix = "p";
        }
    }
}
$used = FALSE;
if (($data['type'] == 'compare' || $data['type'] == 'run') && dbconfig_get('default_' . $data['type']) == $data['execid']) {
    $used = TRUE;
    echo '<em>default ' . $data['type'] . '</em> ';
}
while ($row = $res->next()) {
    $used = TRUE;
    echo '<a href="' . $page . '.php?id=' . $row['id'] . '">' . $prefix . $row['id'] . '</a> ';
}
if (!$used) {
    echo "<span class=\"nodata\">none</span>";
}
?>
</td></tr>
<?php 
if (IS_ADMIN && class_exists("ZipArchive")) {
    echo '<tr>' . '<td>Executable archive:</td>' . '<td>' . addFileField('executable_archive[]') . addSubmit('Upload', 'upload') . '</td>' . "</tr>\n";
}
echo "</table>\n" . addEndForm();
if (IS_ADMIN) {
    echo "<p>" . '<a href="executable.php?fetch&amp;id=' . urlencode($id) . '"><img src="../images/b_save.png" ' . ' title="export executable as zip-file" alt="export" /></a>' . editLink('executable', $id) . "\n" . delLink('executable', 'execid', $id) . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 20
0
if (is_readable($affillogo)) {
    echo '<img src="' . $affillogo . '" alt="' . specialchars($data['shortname']) . "\" /></td></tr>\n";
} else {
    echo "not available</td></tr>\n";
}
echo '<tr><td>Country:</td><td>' . specialchars($data['country']);
if (is_readable($countryflag)) {
    echo ' <img src="' . $countryflag . '" alt="' . specialchars($data['country']) . "\" />";
}
echo "</td></tr>\n";
if (!empty($data['comments'])) {
    echo '<tr><td>Comments:</td><td>' . nl2br(specialchars($data['comments'])) . "</td></tr>\n";
}
echo "</table>\n\n";
if (IS_ADMIN) {
    echo "<p>" . editLink('team_affiliation', $data['affilid']) . "\n" . delLink('team_affiliation', 'affilid', $data['affilid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Teams from " . specialchars($data['name']) . "</h2>\n\n";
$listteams = array();
$teams = $DB->q('SELECT teamid,name FROM team WHERE affilid = %s', $id);
if ($teams->count() == 0) {
    echo "<p class=\"nodata\">no teams</p>\n\n";
} else {
    echo "<table class=\"list\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">teamname</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($team = $teams->next()) {
        $listteams[] = $team['teamid'];
        $link = '<a href="team.php?id=' . urlencode($team['teamid']) . '">';
        echo "<tr><td>" . $link . "t" . specialchars($team['teamid']) . "</a></td><td>" . $link . specialchars($team['name']) . "</a></td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
    putTeamRow($cdata, $listteams);
Ejemplo n.º 21
0
/**
 * View the categories
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Categories';
require LIBWWWDIR . '/header.php';
echo "<h1>Categories</h1>\n\n";
$res = $DB->q('SELECT team_category.*, COUNT(teamid) AS numteams
               FROM team_category LEFT JOIN team USING (categoryid)
               GROUP BY team_category.categoryid ORDER BY sortorder, categoryid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No categories defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">sort</th>" . "<th scope=\"col\">name</th><th scope=\"col\">#teams</th>" . "<th scope=\"col\">visible</th><th scope=\"col\"></th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="team_category.php?id=' . (int) $row['categoryid'] . '">';
        echo '<tr' . (isset($row['color']) ? ' style="background: ' . $row['color'] . ';"' : '') . '><td>' . $link . (int) $row['categoryid'] . '</a></td><td>' . $link . (int) $row['sortorder'] . '</a></td><td>' . $link . htmlspecialchars($row['name']) . '</a></td><td class="tdright">' . $link . (int) $row['numteams'] . '</a></td><td class="tdcenter">' . $link . printyn($row['visible']) . '</a></td>';
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('team_category', $row['categoryid']) . " " . delLink('team_category', 'categoryid', $row['categoryid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('team_category') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 22
0
</td></tr>
<?php 
if (!empty($data['color'])) {
    echo '<tr><td>Colour:</td><td><div class="circle" style="background-color: ' . specialchars($data['color']) . ';"></div> ' . specialchars($data['color']) . "</td></tr>\n";
}
if (!empty($data['problemtext_type'])) {
    echo '<tr><td>Problem text:</td><td class="nobreak"><a href="problem.php?id=' . urlencode($id) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($data['problemtext_type']) . '.png" alt="problem text" ' . 'title="view problem description" /></a> ' . "</td></tr>\n";
}
echo '<tr><td>Run script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_run']) . '">' . specialchars($data['special_run']) . "</a>" . (@$defaultrun ? ' (default)' : '') . "</td></tr>\n";
echo '<tr><td>Compare script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_compare']) . '">' . specialchars($data['special_compare']) . "</a>" . (@$defaultcompare ? ' (default)' : '') . "</td></tr>\n";
if (!empty($data['special_compare_args'])) {
    echo '<tr><td>Compare script arguments:</td><td>' . specialchars($data['special_compare_args']) . "</td></tr>\n";
}
echo "</table>\n" . addEndForm();
if (IS_ADMIN) {
    echo "<p>" . exportLink($id) . "\n" . editLink('problem', $id) . "\n" . delLink('problem', 'probid', $id) . "</p>\n\n";
}
echo rejudgeForm('problem', $id) . "<br />\n\n";
if ($current_cid === null) {
    echo "<h3>Contests</h3>\n\n";
    $res = $DB->q('TABLE SELECT c.*, cp.shortname AS problemshortname,
	                            cp.allow_submit, cp.allow_judge, cp.color
	               FROM contest c
	               INNER JOIN contestproblem cp USING (cid)
	               WHERE cp.probid = %i ORDER BY starttime DESC', $id);
    if (count($res) == 0) {
        echo "<p class=\"nodata\">No contests defined</p>\n\n";
    } else {
        $times = array('activate', 'start', 'freeze', 'end', 'unfreeze');
        echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>";
        echo "<th scope=\"col\">contest<br />shortname</th>\n";
Ejemplo n.º 23
0
    }
    echo "<th scope=\"col\">process<br />balloons?</th>";
    echo "<th scope=\"col\">public?</th>";
    echo "<th scope=\"col\" class=\"sorttable_numeric\"># teams</th>";
    echo "<th scope=\"col\" class=\"sorttable_numeric\"># problems</th>";
    echo "<th scope=\"col\">name</th>" . (IS_ADMIN ? "<th scope=\"col\"></th>" : '') . "</tr>\n</thead>\n<tbody>\n";
    $iseven = false;
    foreach ($res as $row) {
        $link = '<a href="contest.php?id=' . urlencode($row['cid']) . '">';
        echo '<tr class="' . ($iseven ? 'roweven' : 'rowodd') . (!$row['enabled'] ? ' disabled' : '') . (in_array($row['cid'], $curcids) ? ' highlight' : '') . '">' . "<td class=\"tdright\">" . $link . "c" . (int) $row['cid'] . "</a></td>\n";
        echo "<td>" . $link . specialchars($row['shortname']) . "</a></td>\n";
        foreach ($times as $time) {
            echo "<td title=\"" . printtime(@$row[$time . 'time'], '%Y-%m-%d %H:%M:%S (%Z)') . "\">" . $link . (isset($row[$time . 'time']) ? printtime($row[$time . 'time']) : '-') . "</a></td>\n";
        }
        echo "<td>" . $link . ($row['process_balloons'] ? 'yes' : 'no') . "</a></td>\n";
        echo "<td>" . $link . ($row['public'] ? 'yes' : 'no') . "</a></td>\n";
        echo "<td>" . $link . ($row['public'] ? '<em>all</em>' : $row['numteams']) . "</a></td>\n";
        echo "<td>" . $link . $numprobs[$row['cid']] . "</a></td>\n";
        echo "<td>" . $link . specialchars($row['name']) . "</a></td>\n";
        $iseven = !$iseven;
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('contest', $row['cid']) . "&nbsp;" . delLink('contest', 'cid', $row['cid']) . "</td>\n";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('contest') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
    }
    $_POST['data'][0]['restrictions'] = json_encode($_POST['data'][0]['restrictions']);
    require_once 'edit.php';
    exit;
}
require 'init.php';
$title = 'Judgehost restrictions';
require LIBWWWDIR . '/header.php';
echo "<h1>Judgehost Restrictions</h1>\n\n";
$res = $DB->q('SELECT judgehost_restriction.*, COUNT(hostname) AS numjudgehosts
               FROM judgehost_restriction LEFT JOIN judgehost USING (restrictionid)
               GROUP BY judgehost_restriction.restrictionid ORDER BY restrictionid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No judgehost restrictions defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th>" . "<th scope=\"col\">name</th><th scope=\"col\">#contests</th>\n" . "<th scope=\"col\">#problems</th><th scope=\"col\">#languages</th>\n" . "<th scope=\"col\">#linked judgehosts</th>\n" . "<th scope=\"col\"></th>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $restrictions = json_decode($row['restrictions'], true);
        $link = '<a href="judgehost_restriction.php?id=' . (int) $row['restrictionid'] . '">';
        echo '<tr><td>' . $link . (int) $row['restrictionid'] . '</a></td><td>' . $link . specialchars($row['name']) . '</a></td><td class="tdright">' . $link . count($restrictions['contest']) . '</a></td><td class="tdright">' . $link . count($restrictions['problem']) . '</a></td><td class="tdright">' . $link . count($restrictions['language']) . '</a></td><td class="tdright">' . $link . (int) $row['numjudgehosts'] . '</a></td>';
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('judgehost_restriction', $row['restrictionid']) . "&nbsp;" . delLink('judgehost_restriction', 'restrictionid', $row['restrictionid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('judgehost_restriction') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Ejemplo n.º 25
0
</td></tr>
<?php 
if (!empty($data['color'])) {
    echo '<tr><td>Colour:</td><td><div class="circle" style="background-color: ' . specialchars($data['color']) . ';"></div> ' . specialchars($data['color']) . "</td></tr>\n";
}
if (!empty($data['problemtext_type'])) {
    echo '<tr><td>Problem text:</td><td class="nobreak"><a href="problem.php?id=' . urlencode($id) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($data['problemtext_type']) . '.png" alt="problem text" ' . 'title="view problem description" /></a> ' . "</td></tr>\n";
}
echo '<tr><td>Run script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_run']) . '">' . specialchars($data['special_run']) . "</a>" . (@$defaultrun ? ' (default)' : '') . "</td></tr>\n";
echo '<tr><td>Compare script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_compare']) . '">' . specialchars($data['special_compare']) . "</a>" . (@$defaultcompare ? ' (default)' : '') . "</td></tr>\n";
if (!empty($data['special_compare_args'])) {
    echo '<tr><td>Compare script arguments:</td><td>' . specialchars($data['special_compare_args']) . "</td></tr>\n";
}
echo "</table>\n" . addEndForm();
if (IS_ADMIN) {
    echo "<p>" . exportProblemLink($id) . "\n" . editLink('problem', $id) . "\n" . delLink('problem', 'probid', $id, $data['name']) . "</p>\n\n";
}
echo rejudgeForm('problem', $id) . "<br />\n\n";
if ($current_cid === null) {
    echo "<h3>Contests</h3>\n\n";
    $res = $DB->q('TABLE SELECT c.*, cp.shortname AS problemshortname,
	                            cp.allow_submit, cp.allow_judge, cp.color
	               FROM contest c
	               INNER JOIN contestproblem cp USING (cid)
	               WHERE cp.probid = %i ORDER BY starttime DESC', $id);
    if (count($res) == 0) {
        echo "<p class=\"nodata\">No contests defined</p>\n\n";
    } else {
        $times = array('activate', 'start', 'freeze', 'end', 'unfreeze');
        echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>";
        echo "<th scope=\"col\">contest<br />shortname</th>\n";