Пример #1
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();
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";
Пример #2
0
function postprodAll($uid)
{
    @ini_set('zlib.output_compression', 0);
    @ini_set('implicit_flush', 1);
    @ob_end_clean();
    set_time_limit(0);
    header('Content-type: text/plain; charset=utf-8');
    print "Postprodding all...\n\n";
    ob_flush();
    flush();
    $allofem = getPuzzlesInPostprodAndLater();
    foreach ($allofem as $puz) {
        print "{$puz} ... ";
        ob_flush();
        flush();
        $status = pushToPostProdHelper($uid, $puz, $output);
        if ($status == 0) {
            print "OK\n\n{$output}\n\n";
        } else {
            print "FAILED\n\n{$output}\n\n";
        }
        ob_flush();
        flush();
    }
    print "Done!\n";
    exit(1);
}