Gazelle/sections/upload/upload.php

167 lines
5.0 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-02-07 08:00:47 +00:00
//**********************************************************************//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Upload form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// This page relies on the TORRENT_FORM 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. //
//**********************************************************************//
2011-03-28 14:21:28 +00:00
2013-07-04 08:00:56 +00:00
ini_set('max_file_uploads', '100');
View::show_header('Upload', 'upload,validate_upload,valid_tags,musicbrainz,multiformat_uploader');
2011-03-28 14:21:28 +00:00
2013-04-24 08:00:23 +00:00
if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$DB->query('
SELECT
tg.ID as GroupID,
tg.CategoryID,
tg.Name AS Title,
tg.Year,
tg.RecordLabel,
tg.CatalogueNumber,
tg.WikiImage AS Image,
tg.WikiBody AS GroupDescription,
tg.ReleaseType,
tg.VanityHouse
2011-03-28 14:21:28 +00:00
FROM torrents_group AS tg
2013-04-24 08:00:23 +00:00
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
2013-07-04 08:00:56 +00:00
WHERE tg.ID = '.$_GET['groupid'].'
2013-04-24 08:00:23 +00:00
GROUP BY tg.ID');
2013-07-10 00:08:53 +00:00
if ($DB->has_results()) {
2013-04-24 08:00:23 +00:00
list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID'] - 1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
2012-10-11 08:00:15 +00:00
$Properties['Artists'] = Artists::get_artist($_GET['groupid']);
2013-02-22 08:00:24 +00:00
2013-04-24 08:00:23 +00:00
$DB->query("
SELECT
GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
FROM torrents_tags AS tt
2013-07-04 08:00:56 +00:00
JOIN tags ON tags.ID = tt.TagID
WHERE tt.GroupID = '$_GET[groupid]'");
2013-02-22 08:00:24 +00:00
2012-02-23 08:00:18 +00:00
list($Properties['TagList']) = $DB->next_record();
} else {
unset($_GET['groupid']);
}
2012-02-04 08:00:25 +00:00
if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
$Properties['RequestID'] = $_GET['requestid'];
2013-02-22 08:00:24 +00:00
}
2012-02-04 08:00:25 +00:00
} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
2013-04-24 08:00:23 +00:00
$DB->query('
SELECT
2013-11-17 08:00:47 +00:00
ID AS RequestID,
CategoryID,
Title AS Title,
Year,
RecordLabel,
CatalogueNumber,
ReleaseType,
Image
FROM requests
WHERE ID = '.$_GET['requestid']);
2013-02-22 08:00:24 +00:00
2013-07-04 08:00:56 +00:00
list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
2013-04-24 08:00:23 +00:00
$UploadForm = $Categories[$Properties['CategoryID'] - 1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
2013-05-13 08:00:33 +00:00
$Properties['Artists'] = Requests::get_artists($_GET['requestid']);
2013-09-14 08:00:52 +00:00
$Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]);
2011-03-28 14:21:28 +00:00
}
2013-04-24 08:00:23 +00:00
if (!empty($ArtistForm)) {
2011-03-28 14:21:28 +00:00
$Properties['Artists'] = $ArtistForm;
}
2013-05-27 08:00:58 +00:00
require(SERVER_ROOT.'/classes/torrent_form.class.php');
2011-03-28 14:21:28 +00:00
$TorrentForm = new TORRENT_FORM($Properties, $Err);
$GenreTags = $Cache->get_value('genre_tags');
2013-04-24 08:00:23 +00:00
if (!$GenreTags) {
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT Name
FROM tags
WHERE TagType = 'genre'
ORDER BY Name");
2013-02-07 08:00:47 +00:00
$GenreTags = $DB->collect('Name');
2013-04-24 08:00:23 +00:00
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
2011-03-28 14:21:28 +00:00
}
2011-12-01 08:00:22 +00:00
2013-04-24 08:00:23 +00:00
$DB->query('
SELECT
2013-11-17 08:00:47 +00:00
Name,
Comment,
Time
FROM do_not_upload
ORDER BY Sequence');
2011-12-01 08:00:22 +00:00
$DNU = $DB->to_array();
2013-11-17 08:00:47 +00:00
$DB->query('SELECT MAX(Time) FROM do_not_upload');
list($Updated) = $DB->next_record();
2013-04-24 08:00:23 +00:00
$DB->query("
2013-11-17 08:00:47 +00:00
SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
FROM torrents
2013-04-24 08:00:23 +00:00
WHERE UserID = ".$LoggedUser['ID']);
2011-12-01 08:00:22 +00:00
list($NewDNU) = $DB->next_record();
$HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU;
2011-03-28 14:21:28 +00:00
?>
2013-04-24 08:00:23 +00:00
<div class="<?=(check_perms('torrents_hide_dnu') ? 'box pad' : '')?>" style="margin: 0px auto; width: 700px;">
2013-11-09 08:00:57 +00:00
<h3 id="dnu_header">Do Not Upload List</h3>
2013-04-24 08:00:23 +00:00
<p><?=$NewDNU ? '<strong class="important_text">' : '' ?>Last updated: <?=time_diff($Updated)?><?=$NewDNU ? '</strong>' : '' ?></p>
2011-10-29 08:00:15 +00:00
<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.
2013-07-04 08:00:56 +00:00
<? if ($HideDNU) { ?>
2013-06-17 08:01:02 +00:00
<span id="showdnu"><a href="#" onclick="$('#dnulist').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a></span>
2013-07-04 08:00:56 +00:00
<? } ?>
2011-10-18 08:00:10 +00:00
</p>
2013-04-24 08:00:23 +00:00
<table id="dnulist" class="<?=($HideDNU ? 'hidden' : '')?>">
2011-03-28 14:21:28 +00:00
<tr class="colhead">
<td width="50%"><strong>Name</strong></td>
<td><strong>Comment</strong></td>
</tr>
2012-07-28 08:00:17 +00:00
<? $TimeDiff = strtotime('-1 month', strtotime('now'));
2013-04-24 08:00:23 +00:00
foreach ($DNU as $BadUpload) {
2011-12-01 08:00:22 +00:00
list($Name, $Comment, $Updated) = $BadUpload;
2013-02-22 08:00:24 +00:00
?>
2011-03-28 14:21:28 +00:00
<tr>
2013-06-27 08:01:06 +00:00
<td>
2013-12-12 08:01:01 +00:00
<?=Text::full_format($Name) . "\n" ?>
2013-04-24 08:00:23 +00:00
<? if ($TimeDiff < strtotime($Updated)) { ?>
2013-06-27 08:01:06 +00:00
<strong class="important_text">(New!)</strong>
<? } ?>
2012-07-28 08:00:17 +00:00
</td>
2013-12-12 08:01:01 +00:00
<td><?=Text::full_format($Comment)?></td>
2011-03-28 14:21:28 +00:00
</tr>
<? } ?>
</table>
2013-04-24 08:00:23 +00:00
</div><?=($HideDNU ? '<br />' : '')?>
2011-03-28 14:21:28 +00:00
<?
$TorrentForm->head();
switch ($UploadForm) {
case 'Music':
$TorrentForm->music_form($GenreTags);
break;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
case 'Audiobooks':
case 'Comedy':
$TorrentForm->audiobook_form();
break;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
case 'Applications':
case 'Comics':
case 'E-Books':
case 'E-Learning Videos':
$TorrentForm->simple_form($Properties['CategoryID']);
break;
default:
$TorrentForm->music_form($GenreTags);
}
$TorrentForm->foot();
?>
<script type="text/javascript">
Format();
Bitrate();
</script>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>