Example #1
0
function getFinalLink($title)
{
    return POSTPROD_URLPREFIX . "puzzle/" . postprodCanon($title) . "/";
}
<?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();
header("Content-type: text/json");
$puzzles = getPuzzlesInPostprodAndLater($uid);
$exportdata = array();
foreach ($puzzles as $pid) {
    # pid, status, title, slug, round name, round slug.
    $status = getStatusNameForPuzzle($pid);
    $title = getTitle($pid);
    $titleslug = postprodCanon($title);
    $rinfo = getRoundForPuzzle($pid);
    $answer = getAnswersForPuzzleAsList($pid);
    if ($rinfo) {
        $roundname = $rinfo['name'];
        $roundslug = postprodCanonRound($roundname);
        $exportdata[] = array('url' => "/{$roundslug}/{$titleslug}/", 'pid' => $pid, 'status' => $status, 'title' => $title, 'titleslug' => $titleslug, 'round' => $roundname, 'roundslug' => $roundslug, 'answer' => $answer);
    }
}
print json_encode($exportdata) . "\n";
Example #3
0
function displayPostProd($uid, $pid, $pp)
{
    $rinfo = getRoundForPuzzle($pid);
    $urlprefix = POSTPROD_URLPREFIX;
    $beta_urlprefix = POSTPROD_BETA_URLPREFIX;
    $roundname = $rinfo['name'];
    $title = getTitle($pid);
    /*
    $showmeta = FALSE;
    if ($roundname == 'Metas') {
        $m = array();
        $regexp = '/^\s*\(([CS])-META\)\s*(.*)$/';
        if (preg_match($regexp, $title, $m)) {
            $roundname = $m[2];
            $title = ($m[1]=='C') ? "Investigator's Report" : "Meta";
            if ($m[1]=='S') { $showmeta = TRUE; }
        }
    }
    */
    $fileList = getFileListForPuzzle($pid, 'postprod');
    $file = $fileList[0];
    $url = $beta_urlprefix;
    //  $url .= "/" . postprodCanonRound($roundname);
    $url .= "puzzle/" . postprodCanon($title) . "/";
    if ($pp) {
        ?>
        <strong>Final Fact Check Beta Link: </strong>
        <a href="<?php 
        echo $url;
        ?>
">View postprod (as pushed from puzzletron)</a>.  <--  Use this to perform final fact check!  Username/password is jarthur/random17.  If it gives a 404, push the button below (which takes a minute).
        <br>
<?php 
        if ($pp) {
            ?>
        <form action="form-submit.php" method="post">
            <input type="hidden" name="pid" value="<?php 
            echo $pid;
            ?>
" />
            <input type="hidden" name="uid" value="<?php 
            echo $uid;
            ?>
" />
            <input type="submit" name="postprod" value="Push this puzzle to post-production">
        </form><br/>
<?php 
        }
        $url = $urlprefix;
        // $url .= "/" . postprodCanonRound($roundname);
        $url .= "/" . postprodCanon($title) . "/";
        ?>
    <strong>Actually Final Link: </strong>
    <a href="<?php 
        echo $url;
        ?>
">View postprod (version installed as final, doesn't work yet)</a>
    <br>
<?php 
    }
}