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.

upload.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * Upload form
  5. *
  6. * This page relies on the TorrentForm class.
  7. * All it does is call the necessary functions.
  8. *
  9. * $Properties, $Err and $UploadForm are set in takeupload.php,
  10. * and are only used when the form doesn't validate
  11. * and this page must be called again.
  12. */
  13. View::show_header(
  14. 'Upload',
  15. 'upload,vendor/easymde.min',
  16. 'vendor/easymde.min'
  17. );
  18. if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
  19. $GroupID = $_GET['groupid'];
  20. $DB->prepare_query("
  21. SELECT
  22. tg.`id` as GroupID,
  23. tg.`category_id`,
  24. tg.`title` AS Title,
  25. tg.`subject`,
  26. tg.`object` AS TitleJP,
  27. tg.`year`,
  28. tg.`workgroup`,
  29. tg.`location`,
  30. tg.`identifier`,
  31. tg.`picture` AS Image,
  32. tg.`description` AS GroupDescription
  33. FROM `torrents_group` AS tg
  34. LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`
  35. WHERE tg.`id` = '$GroupID'
  36. GROUP BY tg.`id`
  37. ");
  38. $DB->exec_prepared_query();
  39. if ($DB->has_results()) {
  40. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  41. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  42. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  43. $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
  44. $DB->query("
  45. SELECT
  46. GROUP_CONCAT(tags.`Name` SEPARATOR ', ') AS TagList
  47. FROM
  48. `torrents_tags` AS tt
  49. JOIN `tags` ON tags.`ID` = tt.`TagID`
  50. WHERE
  51. tt.`GroupID` = '$_GET[groupid]'
  52. ");
  53. list($Properties['TagList']) = $DB->next_record();
  54. } else {
  55. unset($_GET['groupid']);
  56. }
  57. if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
  58. $Properties['RequestID'] = $_GET['requestid'];
  59. }
  60. } elseif (empty($Properties) && isset($_GET['requestid']) && is_number($_GET['requestid'])) {
  61. $RequestID = $_GET['requestid'];
  62. $DB->query("
  63. SELECT
  64. `ID` AS RequestID,
  65. `CategoryID`,
  66. `Title` AS Title,
  67. `Title2`,
  68. `TitleJP` AS TitleJP,
  69. `CatalogueNumber`,
  70. `Image`
  71. FROM
  72. `requests`
  73. WHERE
  74. `ID` = '$RequestID'
  75. ");
  76. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  77. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  78. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  79. $Properties['Artists'] = Requests::get_artists($_GET['requestid']);
  80. $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
  81. }
  82. if (!empty($ArtistForm)) {
  83. $Properties['Artists'] = $ArtistForm;
  84. }
  85. /**
  86. * TorrentForm
  87. */
  88. require_once SERVER_ROOT.'/classes/torrent_form.class.php';
  89. $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
  90. /**
  91. * Genre tags
  92. */
  93. $GenreTags = $Cache->get_value('genre_tags');
  94. if (!$GenreTags) {
  95. $DB->query("
  96. SELECT
  97. `Name`
  98. FROM
  99. `tags`
  100. WHERE
  101. `TagType` = 'genre'
  102. ORDER BY
  103. `Name`
  104. ");
  105. $GenreTags = $DB->collect('Name');
  106. $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
  107. }
  108. # Twig based class
  109. $TorrentForm->render();
  110. View::show_footer();