Esempio n. 1
0
function pushToPostProdHelper($uid, $pid, &$output)
{
    $round_rows = getRoundDictForPuzzle($pid);
    $rinfo = $round_rows[0];
    $answer_dict = getAnswersAndDeepForPuzzle($pid);
    $aid = $answer_dict['aid'];
    $deep = $answer_dict['deep'];
    $answer = $answer_dict['answer'];
    #$runscript = "/usr/bin/env | grep ^CATTLEPROD";
    #$runscript = "/srv/veil/venv/bin/cattleprod 2>&1";
    #  $runscript = "/nfs/sages/deploy/mh2013/present/bin/cattleprod 2>&1";
    $runscript = "/home/puzzletron/cattleprod.py 2>&1";
    $roundname = $rinfo['name'];
    $roundslug = postprodCanonRound($roundname);
    $title = getTitle($pid);
    $titleslug = postprodCanon($title);
    $fileList = getFileListForPuzzle($pid, 'postprod');
    $file = $fileList[0];
    $credits = getCreditsWithDefault($pid);
    $filename = $file['filename'];
    if (empty($filename)) {
        return "Nothing in the postproduction slot of this puzzle: Nothing to push!";
    }
    $username = getUserUsername($uid);
    # ???
    putenv("CATTLEPROD_PUZZLE_SLUG=" . $titleslug);
    putenv("CATTLEPROD_ROUND_SLUG=" . $roundslug);
    putenv("CATTLEPROD_ROUND_NAME=" . $roundname);
    putenv("CATTLEPROD_TITLE=" . $title);
    putenv("CATTLEPROD_MEDIA=" . "{$filename}");
    putenv("CATTLEPROD_ANSWER_ID=" . $aid);
    putenv("CATTLEPROD_PUZZLE_ID=" . $pid);
    putenv("CATTLEPROD_ANSWER=" . $answer);
    putenv("CATTLEPROD_DEEP=" . $deep);
    putenv("CATTLEPROD_CREDITS=" . $credits);
    putenv("CATTLEPROD_PUSHER=" . $username);
    #  putenv("CATTLEPROD_ASSET_PATH=/nfs/enigma/mh2013/chazelle/assets");
    exec($runscript, $output, $exit_status);
    $output = implode("\n", $output);
    return $exit_status;
}
Esempio n. 2
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 
}
Esempio n. 3
0
echo "<p><a href=\"";
echo PHPMYADMIN_URL;
echo "\">Go To phpMyAdmin</a> (manipulate MySQL database)</p><br>";
?>
    <p><a href="adminpassword.php">Admin Reset Password Interface</a></p>
    <p>Enter New Message of the Day (MOTD) For Team:<br>
    <form method="post" action="admin.php" />
        <table class="boxed">
            <td><textarea name="newmotd" style="resize:none; width:75ex" wrap="hard" cols=75 rows=10></textarea></td>
        </tr>
        <tr>
            <td><input type="submit" value="Submit"></td>
        </tr>
        </table>
        <input type="hidden" value='<?php 
echo getUserUsername($_SESSION['uid']);
?>
' />
    </form>
    </p>
<?php 
function postMotdForm($newmotd, $username)
{
    if ($newmotd == '') {
        echo "<div class='errormsg'>Empty MOTD is unacceptable.</div>";
        return NULL;
    }
    $result = addNewMotd($newmotd, $username);
    echo "<div class='okmsg'>Added new MOTD successfully</div>";
    return $result;
}