Oppaitime'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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?
  2. //**********************************************************************//
  3. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Upload form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  4. // This page relies on the TORRENT_FORM class. All it does is call //
  5. // the necessary functions. //
  6. //----------------------------------------------------------------------//
  7. // $Properties, $Err and $UploadForm are set in takeupload.php, and //
  8. // are only used when the form doesn't validate and this page must be //
  9. // called again. //
  10. //**********************************************************************//
  11. ini_set('max_file_uploads', '100');
  12. View::show_header('Upload', 'upload,validate_upload,multiformat_uploader,bbcode');
  13. if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
  14. $DB->query('
  15. SELECT
  16. tg.ID as GroupID,
  17. tg.CategoryID,
  18. tg.Name AS Title,
  19. tg.NameJP AS Title_JP,
  20. tg.Year,
  21. tg.Studio,
  22. tg.Series,
  23. tg.CatalogueNumber,
  24. tg.Pages,
  25. tg.DLSiteID,
  26. tg.WikiImage AS Image,
  27. tg.WikiBody AS GroupDescription
  28. FROM torrents_group AS tg
  29. LEFT JOIN torrents AS t ON t.GroupID = tg.ID
  30. WHERE tg.ID = '.$_GET['groupid'].'
  31. GROUP BY tg.ID');
  32. if ($DB->has_results()) {
  33. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  34. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  35. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  36. $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
  37. $DB->query("
  38. SELECT
  39. GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
  40. FROM torrents_tags AS tt
  41. JOIN tags ON tags.ID = tt.TagID
  42. WHERE tt.GroupID = '$_GET[groupid]'");
  43. list($Properties['TagList']) = $DB->next_record();
  44. } else {
  45. unset($_GET['groupid']);
  46. }
  47. if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
  48. $Properties['RequestID'] = $_GET['requestid'];
  49. }
  50. } elseif (empty($Properties) && isset($_GET['requestid']) && is_number($_GET['requestid'])) {
  51. $DB->query('
  52. SELECT
  53. ID AS RequestID,
  54. CategoryID,
  55. Title AS Title,
  56. TitleJP AS TitleJP,
  57. CatalogueNumber,
  58. DLSiteID,
  59. Image
  60. FROM requests
  61. WHERE ID = '.$_GET['requestid']);
  62. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  63. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  64. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  65. $Properties['Artists'] = Requests::get_artists($_GET['requestid']);
  66. $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
  67. }
  68. if (!empty($ArtistForm)) {
  69. $Properties['Artists'] = $ArtistForm;
  70. }
  71. require(SERVER_ROOT.'/classes/torrent_form.class.php');
  72. $TorrentForm = new TORRENT_FORM($Properties ?? false, $Err ?? false);
  73. $GenreTags = $Cache->get_value('genre_tags');
  74. if (!$GenreTags) {
  75. $DB->query("
  76. SELECT Name
  77. FROM tags
  78. WHERE TagType = 'genre'
  79. ORDER BY Name");
  80. $GenreTags = $DB->collect('Name');
  81. $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
  82. }
  83. $DB->query('
  84. SELECT
  85. Name,
  86. Comment,
  87. Time
  88. FROM do_not_upload
  89. ORDER BY Sequence');
  90. $DNU = $DB->to_array();
  91. $DB->query('SELECT MAX(Time) FROM do_not_upload');
  92. list($Updated) = $DB->next_record();
  93. $DB->query("
  94. SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
  95. FROM torrents
  96. WHERE UserID = ".$LoggedUser['ID']);
  97. list($NewDNU) = $DB->next_record();
  98. $HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU;
  99. //DNU list disabled in below CSS
  100. ?>
  101. <div class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>" style="margin: 0px auto; width: 700px; display: none;">
  102. <h3 id="dnu_header">Do Not Upload List</h3>
  103. <p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
  104. <p>The following releases are currently forbidden from being uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comment.
  105. <? if ($HideDNU) { ?>
  106. <span id="showdnu"><a toggle-target="#dnulist" toggle-replace="Hide" class="brackets">Show</a></span>
  107. <? } ?>
  108. </p>
  109. <table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">
  110. <tr class="colhead">
  111. <td width="50%"><strong>Name</strong></td>
  112. <td><strong>Comment</strong></td>
  113. </tr>
  114. <? $TimeDiff = strtotime('-1 month', strtotime('now'));
  115. foreach ($DNU as $BadUpload) {
  116. list($Name, $Comment, $Updated) = $BadUpload;
  117. ?>
  118. <tr>
  119. <td>
  120. <?=Text::full_format($Name) . "\n" ?>
  121. <? if ($TimeDiff < strtotime($Updated)) { ?>
  122. <strong class="important_text">(New!)</strong>
  123. <? } ?>
  124. </td>
  125. <td><?=Text::full_format($Comment)?></td>
  126. </tr>
  127. <? } ?>
  128. </table>
  129. </div><?=($HideDNU ? '<br />' : '')?>
  130. <?
  131. $TorrentForm->head();
  132. switch ($UploadForm) {
  133. case 'Movies':
  134. $TorrentForm->movies_form($GenreTags);
  135. break;
  136. case 'Anime':
  137. $TorrentForm->anime_form($Properties['CategoryID']);
  138. break;
  139. case 'Manga':
  140. $TorrentForm->manga_form();
  141. break;
  142. case 'Games':
  143. $TorrentForm->game_form($Properties['CategoryID']);
  144. break;
  145. case 'Other':
  146. $TorrentForm->simple_form($Properties['CategoryID']);
  147. break;
  148. default:
  149. $TorrentForm->movies_form($GenreTags);
  150. }
  151. $TorrentForm->foot();
  152. ?>
  153. <script type="text/javascript">
  154. //Format();
  155. //Bitrate();
  156. </script>
  157. <?
  158. View::show_footer();
  159. ?>