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

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