2012-11-14 08:00:19 +00:00
|
|
|
<?
|
|
|
|
//extra torrent files
|
|
|
|
$ExtraTorrents = array();
|
|
|
|
$DupeNames = array();
|
|
|
|
$DupeNames[] = $_FILES['file_input']['name'];
|
|
|
|
|
|
|
|
if (isset($_POST['extra_format']) && isset($_POST['extra_bitrate'])) {
|
|
|
|
for ($i = 1; $i <= 5; $i++) {
|
2013-07-05 08:00:39 +00:00
|
|
|
if (isset($_FILES["extra_file_$i"])) {
|
|
|
|
$ExtraFile = $_FILES["extra_file_$i"];
|
2012-11-14 08:00:19 +00:00
|
|
|
$ExtraTorrentName = $ExtraFile['tmp_name'];
|
|
|
|
if (!is_uploaded_file($ExtraTorrentName) || !filesize($ExtraTorrentName)) {
|
|
|
|
$Err = 'No extra torrent file uploaded, or file is empty.';
|
2013-04-24 08:00:23 +00:00
|
|
|
} elseif (substr(strtolower($ExtraFile['name']), strlen($ExtraFile['name']) - strlen('.torrent')) !== '.torrent') {
|
|
|
|
$Err = 'You seem to have put something other than an extra torrent file into the upload field. (' . $ExtraFile['name'] . ').';
|
|
|
|
} elseif (in_array($ExtraFile['name'], $DupeNames)) {
|
|
|
|
$Err = 'One or more torrents has been entered into the form twice.';
|
2012-11-14 08:00:19 +00:00
|
|
|
} else {
|
|
|
|
$j = $i - 1;
|
|
|
|
$ExtraTorrents[$ExtraTorrentName]['Name'] = $ExtraTorrentName;
|
|
|
|
$ExtraFormat = $_POST['extra_format'][$j];
|
|
|
|
if (empty($ExtraFormat)) {
|
2013-04-24 08:00:23 +00:00
|
|
|
$Err = 'Missing format for extra torrent.';
|
2012-11-14 08:00:19 +00:00
|
|
|
break;
|
|
|
|
} else {
|
2013-02-25 21:16:55 +00:00
|
|
|
$ExtraTorrents[$ExtraTorrentName]['Format'] = db_string(trim($ExtraFormat));
|
2012-11-14 08:00:19 +00:00
|
|
|
}
|
|
|
|
$ExtraBitrate = $_POST['extra_bitrate'][$j];
|
|
|
|
if (empty($ExtraBitrate)) {
|
2013-04-24 08:00:23 +00:00
|
|
|
$Err = 'Missing bitrate for extra torrent.';
|
2012-11-14 08:00:19 +00:00
|
|
|
break;
|
|
|
|
} else {
|
2013-02-25 21:16:55 +00:00
|
|
|
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = db_string(trim($ExtraBitrate));
|
2012-11-14 08:00:19 +00:00
|
|
|
}
|
|
|
|
$ExtraReleaseDescription = $_POST['extra_release_desc'][$j];
|
2013-02-25 21:16:55 +00:00
|
|
|
$ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = db_string(trim($ExtraReleaseDescription));
|
2012-11-14 08:00:19 +00:00
|
|
|
$DupeNames[] = $ExtraFile['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-24 08:00:23 +00:00
|
|
|
?>
|