function displayEditorNotes($uid, $pid) { $notes = getEditorNotes($pid); ?> <table class="statusInfo"> <tr> <td class='statusInfo'> <strong>Editor Notes: </strong> <?php echo $notes; ?> </td> <td class='statusInfo'> <a href="#" class="changeLink">[Change]</a> </td> </tr> <tr> <td colspan='2'> <form method="post" action="form-submit.php"> <input type="hidden" name="uid" value="<?php echo $uid; ?> " /> <input type="hidden" name="pid" value="<?php echo $pid; ?> " /> <input type="text" name="notes" maxlength="255" class="longin" value="<?php echo $notes; ?> "/> <input type="submit" name="changeEditorNotes" value="Change" /> </form> </td> </tr> </table> <?php }
function changeEditorNotes($uid, $pid, $notes) { if (!canViewPuzzle($uid, $pid)) { utilsError("You do not have permission to modify this puzzle."); } $purifier = new HTMLPurifier(); mysql_query('START TRANSACTION'); $oldNotes = getEditorNotes($pid); $cleanNotes = $purifier->purify($notes); $cleanNotes = htmlspecialchars($cleanNotes); updateEditorNotes($uid, $pid, $oldNotes, $cleanNotes); mysql_query('COMMIT'); }
function displayAnswers($uid) { $rounds = getRounds(); if (!$rounds) { ?> <span class="emptylist">No rounds to list</span> <?php } foreach ($rounds as $round) { $answers = getAnswersForRound($round['rid']); ?> <table class="boxed"> <tr><th colspan="6"><b><?php echo "{$round['name']}: {$round['answer']}"; ?> </b></th></tr> <tr> <td><b>Answer</b></td> <td><b>ID</b></td> <td><b>Title</b></td> <td><b>Status</b></td> <td><b>Editor Notes</b></td> <td><b>Status Notes</b></td> </tr> <?php if (!$answers) { ?> <tr><td colspan="6"><span class="emptylist">No answers added yet</span></td></tr> <?php } foreach ($answers as $answer) { $pid = $answer['pid']; ?> <tr><td><?php echo $answer['answer']; ?> </td> <td><?php echo $pid ? "<a href=\"puzzle.php?pid={$pid}\">" . $pid . "</a>" : "unassigned"; ?> </td> <td><?php echo $pid ? getTitle($pid) : ""; ?> </td> <td><?php echo $pid ? getStatusNameForPuzzle($pid) : ""; ?> </td> <td><?php echo $pid ? getEditorNotes($pid) : ""; ?> </td> <td><?php echo $pid ? getNotes($pid) : ""; ?> </td> </tr> <?php } ?> <tr> <form method="post" action="answers.php" /> <td><input type="text" name="newAnswer" /> <input type="hidden" name="round" value='<?php echo $round['rid']; ?> '/></td> <td colspan="5"><input type="submit" value='Add Answer For Round <?php echo $round['rid']; ?> ' /></td></form> </tr> </table> <br /> <?php } ?> <table class="boxed"> <tr><th colspan="3"><b>New Round</b></th></tr> <tr> <td>Round Name</td><td>Meta Answer Word</td><td></td> </tr> <tr> <form method="post" action="answers.php" /> <td><input type="text" name="newRound" /></td> <td><input type="text" name="roundAnswer" /></td> <td><input type="submit" value="Add New Round" /></td></form> </tr> </table> <?php }