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.

tcomments.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. #declare(strict_types=1);
  3. if (empty($_GET['id']) || !is_number($_GET['id'])) {
  4. json_die('failure');
  5. }
  6. list($NumComments, $Page, $Thread) = Comments::load('torrents', (int)$_GET['id'], false);
  7. # Begin printing
  8. $JsonComments = [];
  9. foreach ($Thread as $Key => $Post) {
  10. list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
  11. list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
  12. $JsonComments[] = [
  13. 'postId' => (int) $PostID,
  14. 'addedTime' => $AddedTime,
  15. 'bbBody' => $Body,
  16. 'body' => Text::full_format($Body),
  17. 'editedUserId' => (int) $EditedUserID,
  18. 'editedTime' => $EditedTime,
  19. 'editedUsername' => $EditedUsername,
  20. 'userinfo' => [
  21. 'authorId' => (int) $AuthorID,
  22. 'authorName' => $Username,
  23. 'artist' => $Artist === 1,
  24. 'donor' => $Donor === 1,
  25. 'warned' => (bool) $Warned,
  26. 'avatar' => $Avatar,
  27. 'enabled' => ($Enabled === 2 ? false : true),
  28. 'userTitle' => $UserTitle
  29. ]
  30. ];
  31. }
  32. json_die('success', [
  33. 'page' => (int) $Page,
  34. 'pages' => ceil($NumComments / TORRENT_COMMENTS_PER_PAGE),
  35. 'comments' => $JsonComments
  36. ]);