Gazelle/sections/staffpm/get_post.php

39 lines
1.1 KiB
PHP
Raw Normal View History

2012-03-04 08:00:21 +00:00
<?
//TODO: make this use the cache version of the thread, save the db query
/*********************************************************************\
//--------------Get Post--------------------------------------------//
2013-02-22 08:00:24 +00:00
This gets the raw BBCode of a post. It's used for editing and
quoting posts.
2012-03-04 08:00:21 +00:00
2013-02-22 08:00:24 +00:00
It gets called if $_GET['action'] == 'get_post'. It requires
2012-03-04 08:00:21 +00:00
$_GET['post'], which is the ID of the post.
\*********************************************************************/
// Quick SQL injection check
2013-04-17 08:00:58 +00:00
if (!$_GET['post'] || !is_number($_GET['post'])) {
2012-03-04 08:00:21 +00:00
error(0);
}
// Variables for database input
$PostID = $_GET['post'];
// Message is selected providing the user quoting is the guy who opened the PM or has
// the right level
2013-07-02 08:01:37 +00:00
$DB->query("
SELECT m.Message, c.Level, c.UserID
FROM staff_pm_messages as m
JOIN staff_pm_conversations AS c ON m.ConvID = c.ID
WHERE m.ID = '$PostID'");
2012-03-04 08:00:21 +00:00
list($Message, $Level, $UserID) = $DB->next_record(MYSQLI_NUM);
2013-04-17 08:00:58 +00:00
if (($LoggedUser['ID'] == $UserID) || ($IsFLS && $LoggedUser['Class'] >= $Level)) {
2013-02-22 08:00:24 +00:00
// This gets sent to the browser, which echoes it wherever
2012-03-04 08:00:21 +00:00
echo trim($Message);
} else {
error(403);
}
2013-04-17 08:00:58 +00:00
?>