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.

insert_extra_torrents.php 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?
  2. foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
  3. $ExtraHasLog = 0;
  4. $ExtraHasCue = 0;
  5. $LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
  6. // Torrent
  7. $DB->query("
  8. INSERT INTO torrents
  9. (GroupID, UserID, Media, Format, Encoding,
  10. Remastered, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber,
  11. HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
  12. Description, LogScore, FreeTorrent, FreeLeechType)
  13. VALUES
  14. ($GroupID, $LoggedUser[ID], $T[Media], '$ExtraTorrent[Format]', '$ExtraTorrent[Encoding]',
  15. $T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber],
  16. $ExtraHasLog, $ExtraHasCue, '".db_string($ExtraTorrent['InfoHash'])."', $ExtraTorrent[NumFiles],
  17. '$ExtraTorrent[FileString]', '$ExtraTorrent[FilePath]', $ExtraTorrent[TotalSize], '".sqltime()."',
  18. '$ExtraTorrent[TorrentDescription]', $LogScore, '$T[FreeLeech]', '$T[FreeLeechType]')");
  19. $Cache->increment('stats_torrent_count');
  20. $ExtraTorrentID = $DB->inserted_id();
  21. Tracker::update_tracker('add_torrent', array('id' => $ExtraTorrentID, 'info_hash' => rawurlencode($ExtraTorrent['InfoHash']), 'freetorrent' => $T['FreeLeech']));
  22. //******************************************************************************//
  23. //--------------- Write torrent file -------------------------------------------//
  24. $DB->query("
  25. INSERT INTO torrents_files
  26. (TorrentID, File)
  27. VALUES
  28. ($ExtraTorrentID, '$ExtraTorrent[TorEnc]')");
  29. Misc::write_log("Torrent $ExtraTorrentID ($LogName) (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB) was uploaded by ' . $LoggedUser['Username']);
  30. Torrents::write_group_log($GroupID, $ExtraTorrentID, $LoggedUser['ID'], 'uploaded (' . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB)', 0);
  31. Torrents::update_hash($GroupID);
  32. // IRC
  33. $Announce = '';
  34. $Announce .= Artists::display_artists($ArtistForm, false);
  35. $Announce .= trim($Properties['Title']) . ' ';
  36. $Announce .= '[' . trim($Properties['Year']) . ']';
  37. if (($Properties['ReleaseType'] > 0)) {
  38. $Announce .= ' [' . $ReleaseTypes[$Properties['ReleaseType']] . ']';
  39. }
  40. $Announce .= ' - ';
  41. $Announce .= trim(str_replace("'", '', $ExtraTorrent['Format'])) . ' / ' . trim(str_replace("'", '', $ExtraTorrent['Encoding']));
  42. $Announce .= ' / ' . trim($Properties['Media']);
  43. if ($T['FreeLeech'] == '1') {
  44. $Announce .= ' / Freeleech!';
  45. }
  46. $Announce .= ' - https://' . SITE_DOMAIN . "/torrents.php?id=$GroupID / https://" . SITE_DOMAIN . "/torrents.php?action=download&id=$ExtraTorrentID";
  47. $Announce .= ' - ' . trim($Properties['TagList']);
  48. // ENT_QUOTES is needed to decode single quotes/apostrophes
  49. send_irc('PRIVMSG ' . BOT_ANNOUNCE_CHAN . ' :' . html_entity_decode($Announce, ENT_QUOTES));
  50. }
  51. ?>