123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- #declare(strict_types=1);
-
- //**********************************************************************//
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Upload form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
- // This page relies on the TorrentForm class. All it does is call //
- // the necessary functions. //
- //----------------------------------------------------------------------//
- // $Properties, $Err and $UploadForm are set in takeupload.php, and //
- // are only used when the form doesn't validate and this page must be //
- // called again. //
- //**********************************************************************//
-
- ini_set('max_file_uploads', '100');
- View::show_header(
- 'Upload',
- 'upload,bbcode,vendor/easymde.min',
- 'vendor/easymde.min'
- );
-
- if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
- $DB->query('
- SELECT
- tg.ID as GroupID,
- tg.CategoryID,
- tg.Name AS Title,
- tg.Title2,
- tg.NameJP AS TitleJP,
- tg.Year,
- tg.Studio,
- tg.Series,
- tg.CatalogueNumber,
- tg.WikiImage AS Image,
- tg.WikiBody AS GroupDescription
- FROM torrents_group AS tg
- LEFT JOIN torrents AS t ON t.GroupID = tg.ID
- WHERE tg.ID = '.$_GET['groupid'].'
- GROUP BY tg.ID');
-
- if ($DB->has_results()) {
- list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
- $UploadForm = $Categories[$Properties['CategoryID'] - 1];
- $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
- $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
-
- $DB->query("
- SELECT
- GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
- FROM torrents_tags AS tt
- JOIN tags ON tags.ID = tt.TagID
- WHERE tt.GroupID = '$_GET[groupid]'");
- list($Properties['TagList']) = $DB->next_record();
- } else {
- unset($_GET['groupid']);
- }
-
- if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
- $Properties['RequestID'] = $_GET['requestid'];
- }
- } elseif (empty($Properties) && isset($_GET['requestid']) && is_number($_GET['requestid'])) {
- $DB->query('
- SELECT
- ID AS RequestID,
- CategoryID,
- Title AS Title,
- Title2,
- TitleJP AS TitleJP,
- CatalogueNumber,
- Image
- FROM requests
- WHERE ID = '.$_GET['requestid']);
-
- list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
- $UploadForm = $Categories[$Properties['CategoryID'] - 1];
- $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
- $Properties['Artists'] = Requests::get_artists($_GET['requestid']);
- $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
- }
-
- if (!empty($ArtistForm)) {
- $Properties['Artists'] = $ArtistForm;
- }
-
- /**
- * TorrentForm
- */
- require_once SERVER_ROOT.'/classes/torrent_form.class.php';
- $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
-
- /**
- * Genre tags
- */
- $GenreTags = $Cache->get_value('genre_tags');
- if (!$GenreTags) {
- $DB->query("
- SELECT Name
- FROM tags
- WHERE TagType = 'genre'
- ORDER BY Name");
-
- $GenreTags = $DB->collect('Name');
- $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
- }
-
- /**
- * Do Not Upload
- */
- $DB->query('
- SELECT
- Name,
- Comment,
- Time
- FROM do_not_upload
- ORDER BY Sequence');
-
- $DNU = $DB->to_array();
- $DB->query('SELECT MAX(Time) FROM do_not_upload');
- list($Updated) = $DB->next_record();
-
- $DB->query("
- SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
- FROM torrents
- WHERE UserID = ".$LoggedUser['ID']);
-
- list($NewDNU) = $DB->next_record();
- $HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU; ?>
- <div
- class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>"
- style="margin: 0px auto; width: 700px;">
-
- <h3 id="dnu_header">Do Not Upload List</h3>
- <p>
- <?=$NewDNU ? '<strong class="important_text">' : '' ?>
- Last updated:
- <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?>
- </p>
-
- <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.
- <?php if ($HideDNU) { ?>
- <span id="showdnu">
- <a data-toggle-target="#dnulist" data-toggle-replace="Hide" class="brackets">Show</a>
- </span>
- <?php } ?>
- </p>
-
- <table id="dnulist"
- class="<?=($HideDNU ? 'hidden' : '')?>">
-
- <tr class="colhead">
- <td width="50%"><strong>Name</strong></td>
- <td><strong>Comment</strong></td>
- </tr>
-
- <?php $TimeDiff = strtotime('-1 month', strtotime('now'));
- foreach ($DNU as $BadUpload) {
- list($Name, $Comment, $Updated) = $BadUpload; ?>
- <tr>
- <td>
- <?=display_str($Name) . "\n" ?>
- <?php if ($TimeDiff < strtotime($Updated)) { ?>
- <strong class="important_text">(New!)</strong>
- <?php } ?>
- </td>
- <td>
- <?=Text::full_format($Comment)?>
- </td>
- </tr>
- <?php
- } ?>
- </table>
- </div>
- <?=($HideDNU ? '<br />' : '')?>
-
- <?php
- # Page contents (DNU should be a TorrentForm function)
- echo $TorrentForm->uploadNotice();
- echo $TorrentForm->announceSource();
- echo $TorrentForm->error();
-
- # Stuff inside the table layout
- echo $TorrentForm->head();
- echo $TorrentForm->basicInfo();
- echo $TorrentForm->upload_form();
- View::show_footer();
|