Empty commit

This commit is contained in:
Git 2013-10-21 08:01:00 +00:00
parent fbb35377a2
commit ff177b33a7
4 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,49 @@
<?
$ID = $_GET['id'];
if (!is_number($ID)) {
error(404);
}
$UserID = $_GET['userid'];
if ($UserID != $LoggedUser['ID']) {
error(403);
}
$DB->query("
SELECT Answer
FROM staff_answers
WHERE QuestionID = '$ID' AND UserID = '$UserID'");
if (!$DB->has_results()) {
error("Question not found");
}
list($Answer) = $DB->next_record();
View::show_header("Ask the Staff");
?>
<div class="thin">
<h2>
Edit Answer
</h2>
<div class="linkbox">
<a class="brackets" href="questions.php">View questions</a>
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
<a class="brackets" href="questions.php?action=popular_questions">Popular questions</a>
</div>
<form method="post" class="box box2 center">
<input type="hidden" name="action" value="take_edit_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<? new TEXTAREA_PREVIEW("edit", "edit", $Answer, 40, 8); ?>
<input type="submit" class="submit" value="Answer" />
</form>
</div>
<?
View::show_footer();

View File

@ -44,6 +44,12 @@
case 'take_ignore_question':
include(SERVER_ROOT.'/sections/questions/take_ignore_question.php');
break;
case 'edit':
include(SERVER_ROOT.'/sections/questions/edit.php');
break;
case 'take_edit_answer':
include(SERVER_ROOT.'/sections/questions/take_edit_answer.php');
break;
default:
error(404);
break;

View File

@ -0,0 +1,14 @@
<?
authorize();
$ID = $_POST['id'];
$UserID = $_POST['userid'];
$Answer = db_string($_POST['edit']);
if (empty($Answer) || !is_number($ID) || $UserID != $LoggedUser['ID']) {
error(403);
}
$DB->query("UPDATE staff_answers SET Answer = '$Answer' WHERE QuestionID = '$ID' AND UserID = '$UserID'");
header("Location: questions.php?action=view_answers&userid=$UserID");

View File

@ -74,6 +74,9 @@
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
<? } ?>
<? if ($LoggedUser['ID'] == $UserID) { ?>
<a href="questions.php?action=edit&amp;id=<?=$Question['ID']?>&amp;userid=<?=$UserID?>" class="brackets">Edit</a>
<? } ?>
</span>
</div>