mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-12 18:36:29 +00:00
Empty commit
This commit is contained in:
parent
fbb35377a2
commit
ff177b33a7
49
sections/questions/edit.php
Normal file
49
sections/questions/edit.php
Normal 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();
|
@ -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;
|
||||
|
14
sections/questions/take_edit_answer.php
Normal file
14
sections/questions/take_edit_answer.php
Normal 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");
|
@ -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&id=<?=$Question['ID']?>&userid=<?=$UserID?>" class="brackets">Edit</a>
|
||||
<? } ?>
|
||||
</span>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user