示例#1
0
function head($selnav = "", $title = -1)
{
    if ($title == -1) {
        $title = fullTitle();
    }
    $hunt = mktime(12, 17, 00, 1, HUNT_DOM, HUNT_YEAR);
    $now = time();
    $timediff = abs($hunt - $now);
    $days = (int) ($timediff / (60 * 60 * 24));
    $hrs = (int) ($timediff / (60 * 60)) - 24 * $days;
    $mins = (int) ($timediff / 60) - 24 * 60 * $days - 60 * $hrs;
    $cdmsg = "";
    if ($now > $hunt) {
        $cdmsg = "after hunt started!!!";
        $cdclass = "cunum";
    } else {
        $cdmsg = "left until hunt.";
        $cdclass = "cdnum";
    }
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />

    <!-- CSS -->
    <link rel="stylesheet" type="text/css" href="css/reset-min.css" />
    <link rel="stylesheet" type="text/css" href="css/base-min.css" />
    <link rel="stylesheet" type="text/css" href="css/fonts-min.css" />
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <?php 
    if ($selnav == "people" || $selnav == "account") {
        ?>
 <link rel="stylesheet" type="text/css" href="css/profiles.css" /> <?php 
    }
    ?>
    <title><?php 
    echo $title;
    ?>
</title>
    <script type='text/javascript' src='jquery-1.4.2.js'></script>
    <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
    <script type="text/javascript" src='js.js'></script>
</head>
<body>
<div id="container">
    <div id="header">
        <div id="top">
            <div id="countdowndiv">
                <span id="countdown">
                <?php 
    if ($days !== 0) {
        $daypl = $days === 1 ? "" : "s";
        echo "<span class=\"{$cdclass}\">{$days}</span> day{$daypl}, ";
    }
    $hrpl = $hrs === 1 ? "" : "s";
    echo "<span class=\"{$cdclass}\">{$hrs}</span> hour{$hrpl} and ";
    $minpl = $mins === 1 ? "" : "s";
    echo "<span class=\"{$cdclass}\">{$mins}</span> minute{$minpl} {$cdmsg}";
    ?>
                </span>
            </div>
            <div id="titlediv">
                <h1><?php 
    echo fullTitle();
    ?>
</h1>
            </div>
            <div id="logindiv">
<?php 
    if (isset($_SESSION['uid'])) {
        echo 'Logged in as <strong>' . getUserUsername($_SESSION['uid']) . '</strong>';
        echo '<a href="account.php"' . ($selnav == "account" ? ' class="accsel"' : "") . '>Your Account</a>';
        if (MAILING_LISTS) {
            echo '<a href="mailinglists.php"' . ($selnav == "mailinglists" ? ' class="accsel"' : "") . '>Mailing Lists</a>';
        }
        if (!TRUST_REMOTE_USER) {
            echo '<a href="logout.php">Logout</a>';
        }
    } else {
        ?>
                <span class="notloggedin">Not logged in</span> <a href="login.php">Login</a>
        <?php 
    }
    ?>
            </div>
        </div>
        <div id="navbar">
            <ul class="nav">
                <li class="nav"><a class="nav wikinav" target="_blank" href="<?php 
    echo WIKI_URL;
    ?>
 ">Wiki</a></li>
<?php 
    echoNav($selnav == "home", "index.php", "Home", true);
    if (isset($_SESSION['uid'])) {
        $suid = $_SESSION['uid'];
        echoNav1($selnav, "people", "People", true);
        echoNav1($selnav, "admin", "Admin", isServerAdmin($suid));
        echoNav1($selnav, "author", "Author", true);
        echoNav1($selnav, "roundcaptain", "Round Captain", USING_ROUND_CAPTAINS && isRoundCaptain($suid));
        echoNav1($selnav, "spoiled", "Spoiled", true);
        echoNav1($selnav, "editor", "Discussion Editor", isEditor($suid));
        echoNav1($selnav, "approver", "Approval Editor", USING_APPROVERS && (isApprover($suid) || isEditorChief($suid)));
        echoNav1($selnav, "testsolving", "Testsolving", true);
        //    echoNav1($selnav, "factcheck",      "Fact Check",          true);
        echoNav1($selnav, "ffc", "Final Fact Check", true);
        echoNav1($selnav, "editorlist", "Editor List", isEditorChief($suid) || isServerAdmin($suid));
        echoNav1($selnav, "testadmin", "Testing Admin", isTestingAdmin($suid));
        echoNav1($selnav, "testsolveteams", "TS Team Assignments", USING_TESTSOLVE_TEAMS && isTestingAdmin($suid));
        echoNav1($selnav, "answers", "Answers", canChangeAnswers($suid));
        echoNav1($selnav, "allpuzzles", "All Puzzles", canSeeAllPuzzles($suid));
        echoNav1($selnav, "editor-pick-special", "Puzzles Needing Help", true);
    }
    ?>
            </ul>
        </div>
        <div class="clear"></div>
    </div>
    <div id="body">
<?php 
}
示例#2
0
function displayAnswers($uid, $pid)
{
    $currentAnswers = getAnswersForPuzzle($pid);
    $availableAnswers = getAvailableAnswers();
    ?>
    <tr class='hideFromTest'>
        <td>
            <strong>Answers: <?php 
    echo getAnswersForPuzzleAsList($pid);
    ?>
</strong>
        <?php 
    if (canChangeAnswers($uid) && ($currentAnswers != NULL || $availableAnswers != NULL)) {
        ?>
                &nbsp;&nbsp;<a href="#" class="changeLink">[Change]</a>
        </td>
    </tr>
    <tr>
        <td>
            <table>
                <form method="post" action="form-submit.php">
                <input type="hidden" name="uid" value="<?php 
        echo $uid;
        ?>
" />
                <input type="hidden" name="pid" value="<?php 
        echo $pid;
        ?>
" />
                <tr>
                <?php 
        if ($currentAnswers != NULL) {
            ?>
                        <td>
                        <p><strong>Remove Answer(s):</strong></p>
                        <?php 
            makeOptionElements($currentAnswers, 'removeAns');
            ?>
                        </td>
                <?php 
        }
        if ($availableAnswers != NULL) {
            ?>
                        <td>
                        <p><strong>Add Answer(s):</strong></p>
                        <?php 
            makeOptionElements($availableAnswers, 'addAns');
            ?>
                        </td>
                <?php 
        }
        ?>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="changeAnswers" value="Change Answers" />
                    </td>
                </tr>
                </form>
            </table>
        <?php 
    }
    ?>
        </td>
    </tr>
<?php 
}
示例#3
0
function removeAnswers($uid, $pid, $remove)
{
    if (!$remove) {
        return;
    }
    if (!isAuthorOnPuzzle($uid, $pid) && !canChangeAnswers($uid)) {
        utilsError("You do not have permission to remove answers.");
    }
    foreach ($remove as $ans) {
        // Check that this answer is assigned to this puzzle
        if (!isAnswerOnPuzzle($pid, $ans)) {
            utilsError(getAnswerWord($ans) . " is not assigned to puzzle {$pid}");
        }
        // Remove answer from puzzle
        $sql = sprintf("UPDATE answers SET pid=NULL WHERE aid='%s'", mysql_real_escape_string($ans));
        query_db($sql);
    }
    $comment = "Unassigned answer";
    if (count($remove) > 1) {
        $comment .= "s";
    }
    addComment($uid, $pid, $comment, TRUE);
}
示例#4
0
<?php

// vim:set ts=4 sw=4 sts=4 et:
require_once "config.php";
require_once "html.php";
require_once "db-func.php";
require_once "utils.php";
// Redirect to the login page, if not logged in
$uid = isLoggedIn();
// Start HTML
head("answers", "Answers");
// Check for answers permissions
if (!canChangeAnswers($uid) && !isApprover($uid)) {
    echo "<div class='errormsg'>You do not have permission for this page.</div>";
    foot();
    exit(1);
}
if (isset($_POST['newAnswer'])) {
    $result = submitAnswersForm(strtoupper($_POST['newAnswer']), $_POST['round']);
    if ($result == FALSE) {
        echo '<div class="errormsg">Error in submitting new answer</div>';
    }
}
if (isset($_POST['newRound'])) {
    $result = submitNewRound($_POST['newRound'], strtoupper($_POST['roundAnswer']));
    if ($result == FALSE) {
        echo '<div class="errormsg">Error in submitting new round</div>';
    }
}
displayAnswers($uid);
// End HTML