Example #1
0
    echo "You are currently testing this puzzle.";
    foot();
    exit(0);
}
// Does the user have permission to see this page?
if (!canViewPuzzle($uid, $pid)) {
    echo "<div class='errormsg'>You do not have permission to view this puzzle.</div>";
    foot();
    exit(0);
}
// Record this user's visit (in two ways)
$lastVisit = updateLastVisit($uid, $pid);
if (!isEditorChief($uid) && !isCohesion($uid)) {
    addSpoiledUserQuietly($uid, $pid);
    if ($_GET['discuss'] && isEditorAvailable($uid, $pid) && !isEditorChief($uid)) {
        changeEditors($uid, $pid, array($uid), array());
    } else {
        if ($_GET['approve'] && isApproverAvailable($uid, $pid) && !isEditorChief($uid)) {
            changeApprovers($uid, $pid, array($uid), array());
        } else {
            if ($_GET['factcheck'] && isFactcheckerAvailable($uid, $pid) && !isEditorChief($uid)) {
                changeFactcheckers($uid, $pid, array($uid), array());
            }
        }
    }
}
// If author is a blind tester, turn page background red
if (isAnyAuthorBlind($pid)) {
    echo '<style type="text/css">html {background-color: #B00000;}</style>';
}
// Hide puzzle info from testing admins, to prevent spoilage
        $add = $_POST['addEditor'];
        if (isAutoSubEditor($uid)) {
            subscribe($uid, $pid);
        }
    } else {
        $add = NULL;
    }
    if (isset($_POST['removeEditor'])) {
        $remove = $_POST['removeEditor'];
        if (isAutoSubEditor($uid)) {
            unsubscribe($uid, $pid);
        }
    } else {
        $remove = NULL;
    }
    changeEditors($uid, $pid, $add, $remove);
    header("Location: " . URL . "/puzzle.php?pid={$pid}");
    exit(0);
}
if (isset($_POST['changeApprovers'])) {
    $pid = $_POST['pid'];
    if (isset($_POST['addApprover'])) {
        $add = $_POST['addApprover'];
        if (isAutoSubEditor($uid)) {
            subscribe($uid, $pid);
        }
    } else {
        $add = NULL;
    }
    if (isset($_POST['removeApprover'])) {
        $remove = $_POST['removeApprover'];