Gazelle/sections/upload/insert_extra_torrents.php

68 lines
3.1 KiB
PHP
Raw Normal View History

2012-11-14 08:00:19 +00:00
<?
foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
2013-02-25 21:16:55 +00:00
$ExtraHasLog = 0;
$ExtraHasCue = 0;
$LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
2012-11-14 08:00:19 +00:00
// Torrent
$DB->query("
INSERT INTO torrents
2013-02-22 08:00:24 +00:00
(GroupID, UserID, Media, Format, Encoding,
Remastered, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber,
2012-11-14 08:00:19 +00:00
HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
2013-02-22 08:00:24 +00:00
Description, LogScore, FreeTorrent, FreeLeechType)
2012-11-14 08:00:19 +00:00
VALUES
2013-07-05 08:00:39 +00:00
($GroupID, $LoggedUser[ID], $T[Media], '$ExtraTorrent[Format]', '$ExtraTorrent[Encoding]',
$T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber],
$ExtraHasLog, $ExtraHasCue, '".db_string($ExtraTorrent['InfoHash'])."', $ExtraTorrent[NumFiles],
'$ExtraTorrent[FileString]', '$ExtraTorrent[FilePath]', $ExtraTorrent[TotalSize], '".sqltime()."',
'$ExtraTorrent[TorrentDescription]', $LogScore, '$T[FreeLeech]', '$T[FreeLeechType]')");
2012-11-14 08:00:19 +00:00
$Cache->increment('stats_torrent_count');
$ExtraTorrentID = $DB->inserted_id();
Tracker::update_tracker('add_torrent', array('id' => $ExtraTorrentID, 'info_hash' => rawurlencode($ExtraTorrent['InfoHash']), 'freetorrent' => $T['FreeLeech']));
2013-05-16 16:15:57 +00:00
2012-11-14 08:00:19 +00:00
//******************************************************************************//
//--------------- Write torrent file -------------------------------------------//
2013-07-05 08:00:39 +00:00
$DB->query("
INSERT INTO torrents_files
(TorrentID, File)
VALUES
($ExtraTorrentID, '$ExtraTorrent[TorEnc]')");
2012-11-14 08:00:19 +00:00
2013-07-05 08:00:39 +00:00
Misc::write_log("Torrent $ExtraTorrentID ($LogName) (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB) was uploaded by ' . $LoggedUser['Username']);
Torrents::write_group_log($GroupID, $ExtraTorrentID, $LoggedUser['ID'], 'uploaded (' . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . ' MB)', 0);
2012-11-14 08:00:19 +00:00
Torrents::update_hash($GroupID);
2012-11-15 08:00:19 +00:00
2013-07-05 08:00:39 +00:00
// IRC
2013-04-24 08:00:23 +00:00
$Announce = '';
2012-11-15 08:00:19 +00:00
$Announce .= Artists::display_artists($ArtistForm, false);
2013-04-24 08:00:23 +00:00
$Announce .= trim($Properties['Title']) . ' ';
2012-11-15 08:00:19 +00:00
$Announce .= '[' . trim($Properties['Year']) . ']';
if (($Properties['ReleaseType'] > 0)) {
$Announce .= ' [' . $ReleaseTypes[$Properties['ReleaseType']] . ']';
}
2013-04-24 08:00:23 +00:00
$Announce .= ' - ';
$Announce .= trim(str_replace("'", '', $ExtraTorrent['Format'])) . ' / ' . trim(str_replace("'", '', $ExtraTorrent['Encoding']));
$Announce .= ' / ' . trim($Properties['Media']);
if ($T['FreeLeech'] == '1') {
$Announce .= ' / Freeleech!';
2012-11-15 08:00:19 +00:00
}
2013-04-24 08:00:23 +00:00
$AnnounceSSL = $Announce . ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$Announce .= ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
2012-11-15 08:00:19 +00:00
2013-04-24 08:00:23 +00:00
$AnnounceSSL .= ' - ' . trim($Properties['TagList']);
$Announce .= ' - ' . trim($Properties['TagList']);
2012-11-15 08:00:19 +00:00
2013-04-26 08:00:25 +00:00
// ENT_QUOTES is needed to decode single quotes/apostrophes
send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce, ENT_QUOTES));
send_irc('PRIVMSG #' . SSL_SITE_URL . '-announce-ssl :' . html_entity_decode($AnnounceSSL, ENT_QUOTES));
2012-11-15 08:00:19 +00:00
2012-11-14 08:00:19 +00:00
}
2013-04-24 08:00:23 +00:00
?>