if (isTesterOnPuzzle($uid, $pid)) { 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>'; }
function getNewPuzzleForEditor($uid) { $sql = "SELECT puzzle_idea.id FROM puzzle_idea LEFT JOIN pstatus ON puzzle_idea.pstatus=pstatus.id WHERE pstatus.addToEditorQueue='1'"; $puzzles = get_elements($sql); $puzzles = sortByNumEditors($puzzles); foreach ($puzzles as $p) { if (isEditorAvailable($uid, $p)) { return $p; } } return FALSE; }
header("Location: " . URL . "/test.php?pid=" . $pid); } else { if (isTesterOnPuzzle($uid, $pid)) { header("Location: " . URL . "/test.php?pid=" . $pid); } else { if (!isset($_SESSION['testError'])) { $_SESSION['testError'] = "Could not add Puzzle {$pid} to your queue"; } header("Location: " . URL . "/testsolving.php"); } } exit(0); } if (isset($_POST['getPuzz'])) { $pid = $_POST['pid']; if ($pid && isEditorAvailable($uid, $pid)) { addPuzzleToEditorQueue($uid, $pid); if (isAutoSubEditor($uid)) { subscribe($uid, $pid); } } else { $_SESSION['failedToAdd'] = TRUE; $_SESSION['failedToAddEdit'] = TRUE; } header("Location: " . URL . "/editor.php"); exit(0); } if (isset($_POST['checkAns'])) { $pid = $_POST['pid']; $answer = $_POST['ans']; $_SESSION['answer'] = $answer;