Ejemplo n.º 1
0
function addApprovers($uid, $pid, $add)
{
    if (!$add) {
        return;
    }
    if (!canViewPuzzle($uid, $pid)) {
        utilsError("You do not have permission to modify puzzle {$pid}.");
    }
    $name = getUserName($uid);
    $comment = 'Added ';
    foreach ($add as $approver) {
        // Check that this editor is available for this puzzle
        if (!isApproverAvailable($approver, $pid)) {
            utilsError(getUserName($approver) . ' is not available.');
        }
        // Add approver to puzzle
        $sql = sprintf("INSERT INTO approver_queue (uid, pid) VALUES ('%s', '%s')", mysql_real_escape_string($approver), mysql_real_escape_string($pid));
        query_db($sql);
        // Add to comment
        if ($comment != 'Added ') {
            $comment .= ', ';
        }
        $comment .= getUserName($approver);
        // Email new approver
        $title = getTitle($pid);
        $codename = getCodename($pid);
        $subject = "Approval Editor on {$codename} (puzzle {$pid})";
        $message = "{$name} added you as an approval editor to {$title} (puzzle {$pid}).";
        $link = URL . "/puzzle.php?pid={$pid}";
        sendEmail($approver, $subject, $message, $link);
        // Subscribe approvers to comments on their puzzles
        if (isAutoSubEditor($approver)) {
            subscribe($approver, $pid);
        }
    }
    $comment .= ' as approval editor';
    if (count($add) > 1) {
        $comment .= "s";
    }
    addComment($uid, $pid, $comment, TRUE);
}
Ejemplo n.º 2
0
    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
$hidePuzzleInfo = (isServerAdmin($uid) || isTestingAdmin($uid)) && !isAuthorOnPuzzle($uid, $pid) && !isEditorOnPuzzle($uid, $pid);
// If Testing Admin, hide answer, summary, and description