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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. ini_set('max_file_uploads', '100');
  14. View::show_header(
  15. 'Upload',
  16. 'upload,bbcode,vendor/easymde.min',
  17. 'vendor/easymde.min'
  18. );
  19. if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
  20. $GroupID = $_GET['groupid'];
  21. $DB->prepare_query("
  22. SELECT
  23. tg.`id` as GroupID,
  24. tg.`category_id`,
  25. tg.`title` AS Title,
  26. tg.`subject`,
  27. tg.`object` AS TitleJP,
  28. tg.`year`,
  29. tg.`workgroup`,
  30. tg.`location`,
  31. tg.`identifier`,
  32. tg.`picture` AS Image,
  33. tg.`description` AS GroupDescription
  34. FROM `torrents_group` AS tg
  35. LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`
  36. WHERE tg.`id` = '$GroupID'
  37. GROUP BY tg.`id`
  38. ");
  39. $DB->exec_prepared_query();
  40. if ($DB->has_results()) {
  41. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  42. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  43. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  44. $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
  45. $DB->query("
  46. SELECT
  47. GROUP_CONCAT(tags.`Name` SEPARATOR ', ') AS TagList
  48. FROM
  49. `torrents_tags` AS tt
  50. JOIN `tags` ON tags.`ID` = tt.`TagID`
  51. WHERE
  52. tt.`GroupID` = '$_GET[groupid]'
  53. ");
  54. list($Properties['TagList']) = $DB->next_record();
  55. } else {
  56. unset($_GET['groupid']);
  57. }
  58. if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
  59. $Properties['RequestID'] = $_GET['requestid'];
  60. }
  61. } elseif (empty($Properties) && isset($_GET['requestid']) && is_number($_GET['requestid'])) {
  62. $RequestID = $_GET['requestid'];
  63. $DB->query("
  64. SELECT
  65. `ID` AS RequestID,
  66. `CategoryID`,
  67. `Title` AS Title,
  68. `Title2`,
  69. `TitleJP` AS TitleJP,
  70. `CatalogueNumber`,
  71. `Image`
  72. FROM
  73. `requests`
  74. WHERE
  75. `ID` = '$RequestID'
  76. ");
  77. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  78. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  79. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  80. $Properties['Artists'] = Requests::get_artists($_GET['requestid']);
  81. $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
  82. }
  83. if (!empty($ArtistForm)) {
  84. $Properties['Artists'] = $ArtistForm;
  85. }
  86. /**
  87. * TorrentForm
  88. */
  89. require_once SERVER_ROOT.'/classes/torrent_form.class.php';
  90. $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
  91. /**
  92. * Genre tags
  93. */
  94. $GenreTags = $Cache->get_value('genre_tags');
  95. if (!$GenreTags) {
  96. $DB->query("
  97. SELECT
  98. `Name`
  99. FROM
  100. `tags`
  101. WHERE
  102. `TagType` = 'genre'
  103. ORDER BY
  104. `Name`
  105. ");
  106. $GenreTags = $DB->collect('Name');
  107. $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
  108. }
  109. # Page contents
  110. echo $TorrentForm->uploadNotice();
  111. echo $TorrentForm->announceSource();
  112. echo $TorrentForm->error();
  113. # Stuff inside the table layout
  114. echo $TorrentForm->head();
  115. echo $TorrentForm->basicInfo();
  116. echo $TorrentForm->upload_form();
  117. View::show_footer();