BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

get_post.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. // todo: Make this use the cache version of the thread, save the db query
  3. /*********************************************************************\
  4. //--------------Get Post--------------------------------------------//
  5. This gets the raw BBCode of a post. It's used for editing and
  6. quoting posts.
  7. It gets called if $_GET['action'] == 'get_post'. It requires
  8. $_GET['post'], which is the ID of the post.
  9. \*********************************************************************/
  10. // Quick SQL injection check
  11. if (!$_GET['post'] || !is_number($_GET['post'])) {
  12. error(0);
  13. }
  14. // Variables for database input
  15. $PostID = $_GET['post'];
  16. // Message is selected providing the user quoting is the guy who opened the PM or has the right level
  17. $DB->query("
  18. SELECT m.Message, c.Level, c.UserID
  19. FROM staff_pm_messages AS m
  20. JOIN staff_pm_conversations AS c ON m.ConvID = c.ID
  21. WHERE m.ID = '$PostID'");
  22. list($Message, $Level, $UserID) = $DB->next_record(MYSQLI_NUM);
  23. if (($LoggedUser['ID'] === $UserID) || ($IsFLS && $LoggedUser['Class'] >= $Level)) {
  24. // This gets sent to the browser, which echoes it wherever
  25. echo trim($Message);
  26. } else {
  27. error(403);
  28. }