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

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. #declare(strict_types=1);
  3. // todo: make this use the cache version of the thread, save the db query
  4. /*********************************************************************\
  5. //--------------Get Post--------------------------------------------//
  6. This gets the raw BBCode of a post. It's used for editing and
  7. quoting posts.
  8. It gets called if $_GET['action'] == 'get_post'. It requires
  9. $_GET['post'], which is the ID of the post.
  10. \*********************************************************************/
  11. // Quick SQL injection check
  12. if (!$_GET['post'] || !is_number($_GET['post'])) {
  13. error(0);
  14. }
  15. // Variables for database input
  16. $PostID = $_GET['post'];
  17. // Message is selected providing the user quoting is one of the two people in the thread
  18. $DB->query("
  19. SELECT m.Body
  20. FROM pm_messages AS m
  21. JOIN pm_conversations_users AS u ON m.ConvID = u.ConvID
  22. WHERE m.ID = '$PostID'
  23. AND u.UserID = ".$LoggedUser['ID']);
  24. list($Body) = $DB->next_record(MYSQLI_NUM);
  25. $Body = apcu_exists('DBKEY') ? Crypto::decrypt($Body) : '[Encrypted]';
  26. // This gets sent to the browser, which echoes it wherever
  27. echo trim($Body);