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 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. /**
  94. * Do Not Upload
  95. */
  96. $DB->query('
  97. SELECT
  98. Name,
  99. Comment,
  100. Time
  101. FROM do_not_upload
  102. ORDER BY Sequence');
  103. $DNU = $DB->to_array();
  104. $DB->query('SELECT MAX(Time) FROM do_not_upload');
  105. list($Updated) = $DB->next_record();
  106. $DB->query("
  107. SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
  108. FROM torrents
  109. WHERE UserID = ".$LoggedUser['ID']);
  110. list($NewDNU) = $DB->next_record();
  111. $HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU; ?>
  112. <div
  113. class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>"
  114. style="margin: 0px auto; width: 700px;">
  115. <h3 id="dnu_header">Do Not Upload List</h3>
  116. <p>
  117. <?=$NewDNU ? '<strong class="important_text">' : '' ?>
  118. Last updated:
  119. <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?>
  120. </p>
  121. <p>
  122. The following releases are currently forbidden from being uploaded to the site.
  123. Do not upload them unless your torrent meets a condition specified in the comment.
  124. <?php if ($HideDNU) { ?>
  125. <span id="showdnu">
  126. <a data-toggle-target="#dnulist" data-toggle-replace="Hide" class="brackets">Show</a>
  127. </span>
  128. <?php } ?>
  129. </p>
  130. <table id="dnulist"
  131. class="<?=($HideDNU ? 'hidden' : '')?>">
  132. <tr class="colhead">
  133. <td width="50%"><strong>Name</strong></td>
  134. <td><strong>Comment</strong></td>
  135. </tr>
  136. <?php $TimeDiff = strtotime('-1 month', strtotime('now'));
  137. foreach ($DNU as $BadUpload) {
  138. list($Name, $Comment, $Updated) = $BadUpload; ?>
  139. <tr>
  140. <td>
  141. <?=display_str($Name) . "\n" ?>
  142. <?php if ($TimeDiff < strtotime($Updated)) { ?>
  143. <strong class="important_text">(New!)</strong>
  144. <?php } ?>
  145. </td>
  146. <td>
  147. <?=Text::full_format($Comment)?>
  148. </td>
  149. </tr>
  150. <?php
  151. } ?>
  152. </table>
  153. </div>
  154. <?=($HideDNU ? '<br />' : '')?>
  155. <?php
  156. # Page contents (DNU should be a TorrentForm function)
  157. echo $TorrentForm->uploadNotice();
  158. echo $TorrentForm->announceSource();
  159. echo $TorrentForm->error();
  160. # Stuff inside the table layout
  161. echo $TorrentForm->head();
  162. echo $TorrentForm->basicInfo();
  163. echo $TorrentForm->upload_form();
  164. View::show_footer();