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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?
  2. //**********************************************************************//
  3. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Upload form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
  4. // This page relies on the TorrentForm 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.NameRJ AS TitleRJ,
  20. tg.NameJP AS TitleJP,
  21. tg.Year,
  22. tg.Studio,
  23. tg.Series,
  24. tg.CatalogueNumber,
  25. tg.Pages,
  26. tg.DLSiteID,
  27. tg.WikiImage AS Image,
  28. tg.WikiBody AS GroupDescription
  29. FROM torrents_group AS tg
  30. LEFT JOIN torrents AS t ON t.GroupID = tg.ID
  31. WHERE tg.ID = '.$_GET['groupid'].'
  32. GROUP BY tg.ID');
  33. if ($DB->has_results()) {
  34. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  35. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  36. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  37. $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
  38. $DB->query("
  39. SELECT
  40. GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
  41. FROM torrents_tags AS tt
  42. JOIN tags ON tags.ID = tt.TagID
  43. WHERE tt.GroupID = '$_GET[groupid]'");
  44. list($Properties['TagList']) = $DB->next_record();
  45. } else {
  46. unset($_GET['groupid']);
  47. }
  48. if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
  49. $Properties['RequestID'] = $_GET['requestid'];
  50. }
  51. } elseif (empty($Properties) && isset($_GET['requestid']) && is_number($_GET['requestid'])) {
  52. $DB->query('
  53. SELECT
  54. ID AS RequestID,
  55. CategoryID,
  56. Title AS Title,
  57. TitleJP AS TitleJP,
  58. CatalogueNumber,
  59. DLSiteID,
  60. Image
  61. FROM requests
  62. WHERE ID = '.$_GET['requestid']);
  63. list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
  64. $UploadForm = $Categories[$Properties['CategoryID'] - 1];
  65. $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
  66. $Properties['Artists'] = Requests::get_artists($_GET['requestid']);
  67. $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
  68. }
  69. if (!empty($ArtistForm)) {
  70. $Properties['Artists'] = $ArtistForm;
  71. }
  72. require_once(SERVER_ROOT.'/classes/torrent_form.class.php');
  73. $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
  74. $GenreTags = $Cache->get_value('genre_tags');
  75. if (!$GenreTags) {
  76. $DB->query("
  77. SELECT Name
  78. FROM tags
  79. WHERE TagType = 'genre'
  80. ORDER BY Name");
  81. $GenreTags = $DB->collect('Name');
  82. $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
  83. }
  84. $DB->query('
  85. SELECT
  86. Name,
  87. Comment,
  88. Time
  89. FROM do_not_upload
  90. ORDER BY Sequence');
  91. $DNU = $DB->to_array();
  92. $DB->query('SELECT MAX(Time) FROM do_not_upload');
  93. list($Updated) = $DB->next_record();
  94. $DB->query("
  95. SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
  96. FROM torrents
  97. WHERE UserID = ".$LoggedUser['ID']);
  98. list($NewDNU) = $DB->next_record();
  99. $HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU;
  100. //DNU list disabled in below CSS
  101. ?>
  102. <div class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>" style="margin: 0px auto; width: 700px; display: none;">
  103. <h3 id="dnu_header">Do Not Upload List</h3>
  104. <p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
  105. <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.
  106. <? if ($HideDNU) { ?>
  107. <span id="showdnu"><a data-toggle-target="#dnulist" data-toggle-replace="Hide" class="brackets">Show</a></span>
  108. <? } ?>
  109. </p>
  110. <table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">
  111. <tr class="colhead">
  112. <td width="50%"><strong>Name</strong></td>
  113. <td><strong>Comment</strong></td>
  114. </tr>
  115. <? $TimeDiff = strtotime('-1 month', strtotime('now'));
  116. foreach ($DNU as $BadUpload) {
  117. list($Name, $Comment, $Updated) = $BadUpload;
  118. ?>
  119. <tr>
  120. <td>
  121. <?=Text::full_format($Name) . "\n" ?>
  122. <? if ($TimeDiff < strtotime($Updated)) { ?>
  123. <strong class="important_text">(New!)</strong>
  124. <? } ?>
  125. </td>
  126. <td><?=Text::full_format($Comment)?></td>
  127. </tr>
  128. <? } ?>
  129. </table>
  130. </div><?=($HideDNU ? '<br />' : '')?>
  131. <?
  132. $TorrentForm->upload_form();
  133. View::show_footer();
  134. ?>