BioTorrents.de’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.

get_extra_torrents.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. #declare(strict_types=1);
  3. // Extra torrent files
  4. $ExtraTorrents = [];
  5. $DupeNames = [];
  6. $DupeNames[] = $_FILES['file_input']['name'];
  7. if (isset($_POST['extra_format']) && isset($_POST['extra_bitrate'])) {
  8. for ($i = 1; $i <= 5; $i++) {
  9. if (isset($_FILES["extra_file_$i"])) {
  10. $ExtraFile = $_FILES["extra_file_$i"];
  11. $ExtraTorrentName = $ExtraFile['tmp_name'];
  12. if (!is_uploaded_file($ExtraTorrentName) || !filesize($ExtraTorrentName)) {
  13. $Err = 'No extra torrent file uploaded, or file is empty.';
  14. } elseif (substr(strtolower($ExtraFile['name']), strlen($ExtraFile['name']) - strlen('.torrent')) !== '.torrent') {
  15. $Err = 'You seem to have put something other than an extra torrent file into the upload field. (' . $ExtraFile['name'] . ').';
  16. } elseif (in_array($ExtraFile['name'], $DupeNames)) {
  17. $Err = 'One or more torrents has been entered into the form twice.';
  18. } else {
  19. $j = $i - 1;
  20. $ExtraTorrents[$ExtraTorrentName]['Name'] = $ExtraTorrentName;
  21. $ExtraFormat = $_POST['extra_format'][$j];
  22. if (empty($ExtraFormat)) {
  23. $Err = 'Missing format for extra torrent.';
  24. break;
  25. } else {
  26. $ExtraTorrents[$ExtraTorrentName]['Format'] = db_string(trim($ExtraFormat));
  27. }
  28. $ExtraBitrate = $_POST['extra_bitrate'][$j];
  29. if (empty($ExtraBitrate)) {
  30. $Err = 'Missing bitrate for extra torrent.';
  31. break;
  32. } else {
  33. $ExtraTorrents[$ExtraTorrentName]['Encoding'] = db_string(trim($ExtraBitrate));
  34. }
  35. $ExtraReleaseDescription = $_POST['extra_release_desc'][$j];
  36. $ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = db_string(trim($ExtraReleaseDescription));
  37. $DupeNames[] = $ExtraFile['name'];
  38. }
  39. }
  40. }
  41. }