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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. file_put_contents(TORRENT_STORE.$ExtraTorrentID.'torrent', $ExtraTorrent['TorEnc']);
  25. Misc::write_log("Torrent $ExtraTorrentID ($LogName) (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB) was uploaded by ' . $LoggedUser['Username']);
  26. Torrents::write_group_log($GroupID, $ExtraTorrentID, $LoggedUser['ID'], 'uploaded (' . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB)', 0);
  27. Torrents::update_hash($GroupID);
  28. // IRC
  29. $Announce = '';
  30. $Announce .= Artists::display_artists($ArtistForm, false);
  31. $Announce .= trim($Properties['Title']) . ' ';
  32. $Announce .= '[' . trim($Properties['Year']) . ']';
  33. if (($Properties['ReleaseType'] > 0)) {
  34. $Announce .= ' [' . $ReleaseTypes[$Properties['ReleaseType']] . ']';
  35. }
  36. $Announce .= ' - ';
  37. $Announce .= trim(str_replace("'", '', $ExtraTorrent['Format'])) . ' / ' . trim(str_replace("'", '', $ExtraTorrent['Encoding']));
  38. $Announce .= ' / ' . trim($Properties['Media']);
  39. if ($T['FreeLeech'] == '1') {
  40. $Announce .= ' / Freeleech!';
  41. }
  42. $Announce .= ' - https://' . SITE_DOMAIN . "/torrents.php?id=$GroupID / https://" . SITE_DOMAIN . "/torrents.php?action=download&id=$ExtraTorrentID";
  43. $Announce .= ' - ' . trim($Properties['TagList']);
  44. // ENT_QUOTES is needed to decode single quotes/apostrophes
  45. send_irc('PRIVMSG ' . BOT_ANNOUNCE_CHAN . ' :' . html_entity_decode($Announce, ENT_QUOTES));
  46. }
  47. ?>