$DB->set_query_id($Results); $JsonNotifications = array(); $NumNew = 0; $FilterGroups = array(); while ($Result = $DB->next_record(MYSQLI_ASSOC)) { if (!$Result['FilterID']) { $Result['FilterID'] = 0; } if (!isset($FilterGroups[$Result['FilterID']])) { $FilterGroups[$Result['FilterID']] = array(); $FilterGroups[$Result['FilterID']]['FilterLabel'] = $Result['Label'] ? $Result['Label'] : false; } array_push($FilterGroups[$Result['FilterID']], $Result); } unset($Result); foreach ($FilterGroups as $FilterID => $FilterResults) { unset($FilterResults['FilterLabel']); foreach ($FilterResults as $Result) { $TorrentID = $Result['TorrentID']; // $GroupID = $Result['GroupID']; $GroupInfo = $TorrentGroups[$Result['GroupID']]; extract(Torrents::array_group($GroupInfo)); // all group data $TorrentInfo = $GroupInfo['Torrents'][$TorrentID]; if ($Result['UnRead'] == 1) { $NumNew++; } $JsonNotifications[] = array('torrentId' => (int) $TorrentID, 'groupId' => (int) $GroupID, 'groupName' => $GroupName, 'groupCategoryId' => (int) $GroupCategoryID, 'wikiImage' => $WikiImage, 'torrentTags' => $TagList, 'size' => (double) $TorrentInfo['Size'], 'fileCount' => (int) $TorrentInfo['FileCount'], 'format' => $TorrentInfo['Format'], 'encoding' => $TorrentInfo['Encoding'], 'media' => $TorrentInfo['Media'], 'scene' => $TorrentInfo['Scene'] == 1, 'groupYear' => (int) $GroupYear, 'remasterYear' => (int) $TorrentInfo['RemasterYear'], 'remasterTitle' => $TorrentInfo['RemasterTitle'], 'snatched' => (int) $TorrentInfo['Snatched'], 'seeders' => (int) $TorrentInfo['Seeders'], 'leechers' => (int) $TorrentInfo['Leechers'], 'notificationTime' => $TorrentInfo['Time'], 'hasLog' => $TorrentInfo['HasLog'] == 1, 'hasCue' => $TorrentInfo['HasCue'] == 1, 'logScore' => (double) $TorrentInfo['LogScore'], 'freeTorrent' => $TorrentInfo['FreeTorrent'] == 1, 'logInDb' => $TorrentInfo['HasLog'] == 1, 'unread' => $Result['UnRead'] == 1); } } json_print("success", array('currentPages' => intval($Page), 'pages' => ceil($TorrentCount / NOTIFICATIONS_PER_PAGE), 'numNew' => $NumNew, 'results' => $JsonNotifications));
?> _box .images').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets"><?php echo $FirstCol ? 'Hide' : 'Show'; ?> </a> </span> </td> </tr> <tr class="images<?php echo $FirstCol ? '' : ' hidden'; ?> "> <?php foreach ($Collage as $C) { $Group = Torrents::get_groups(array($C['GroupID']), true, true, false); extract(Torrents::array_group($Group[$C['GroupID']])); $Name = ''; $Name .= Artists::display_artists(array('1' => $Artists), false, true); $Name .= $GroupName; ?> <td> <a href="torrents.php?id=<?php echo $GroupID; ?> "> <img class="tooltip" title="<?php echo $Name; ?> " src="<?php echo ImageTools::process($C['WikiImage'], true); ?>
<?php $TorrentID = (int) $_GET['torrentid']; $DB->query("\n\tSELECT last_action, LastReseedRequest, UserID, Time, GroupID\n\tFROM torrents\n\tWHERE ID = '{$TorrentID}'"); list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime, $GroupID) = $DB->next_record(); if (!check_perms('users_mod')) { if (time() - strtotime($LastReseedRequest) < 864000) { error('There was already a re-seed request for this torrent within the past 10 days.'); } if ($LastActive == '0000-00-00 00:00:00' || time() - strtotime($LastActive) < 345678) { error(403); } } $DB->query("\n\tUPDATE torrents\n\tSET LastReseedRequest = NOW()\n\tWHERE ID = '{$TorrentID}'"); $Group = Torrents::get_groups(array($GroupID)); extract(Torrents::array_group($Group[$GroupID])); $Name = Artists::display_artists(array('1' => $Artists), false, true); $Name .= $GroupName; $usersToNotify = array(); $DB->query("\n\tSELECT s.uid AS id, MAX(s.tstamp) AS tstamp\n\tFROM xbt_snatched as s\n\tINNER JOIN users_main as u\n\tON s.uid = u.ID\n\tWHERE s.fid = '{$TorrentID}'\n\tAND u.Enabled = '1'\n\tGROUP BY s.uid\n ORDER BY tstamp DESC\n\tLIMIT 100"); if ($DB->has_results()) { $Users = $DB->to_array(); foreach ($Users as $User) { $UserID = $User['id']; $TimeStamp = $User['tstamp']; $usersToNotify[$UserID] = array("snatched", $TimeStamp); } } $usersToNotify[$UploaderID] = array("uploaded", strtotime($UploadedTime)); foreach ($usersToNotify as $UserID => $info) { $Username = Users::user_info($UserID)['Username'];
<a href="better.php?method=tags&filter=all" class="brackets">Show all</a> <?php } ?> </div> </div> <div class="thin box pad"> <h3>There are <?php echo number_format(count($TorrentsInfo)); ?> torrents remaining</h3> <table class="torrent_table"> <?php foreach ($TorrentsInfo as $TorrentID => $Info) { extract(Torrents::array_group($Results[$Info['GroupID']])); $TorrentTags = new Tags($TagList); if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { unset($ExtendedArtists[2]); unset($ExtendedArtists[3]); $DisplayName = Artists::display_artists($ExtendedArtists); } else { $DisplayName = ''; } $DisplayName .= "<a href=\"torrents.php?id={$GroupID}&torrentid={$TorrentID}#torrent{$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>"; if ($GroupYear > 0) { $DisplayName .= " [{$GroupYear}]"; } if ($ReleaseType > 0) { $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']'; }
<a href="<?php echo header_link('Leechers'); ?> "> <img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/leechers.png" class="tooltip" alt="Leechers" title="Leechers" /> </a> </td> </tr> <?php $PageSize = 0; foreach ($TorrentsInfo as $TorrentID => $Info) { list($GroupID, , $Time) = array_values($Info); extract(Torrents::array_group($Results[$GroupID])); $Torrent = $Torrents[$TorrentID]; $TorrentTags = new Tags($TagList); if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) { unset($ExtendedArtists[2]); unset($ExtendedArtists[3]); $DisplayName = Artists::display_artists($ExtendedArtists); } elseif (!empty($Artists)) { $DisplayName = Artists::display_artists(array(1 => $Artists)); } else { $DisplayName = ''; } $DisplayName .= '<a href="torrents.php?id=' . $GroupID . '&torrentid=' . $TorrentID . '" class="tooltip" title="View torrent" dir="ltr">' . $GroupName . '</a>'; if ($GroupYear > 0) { $DisplayName .= " [{$GroupYear}]"; }
$NumTorrents++; $Torrent['Seeders'] = (int) $Torrent['Seeders']; $Torrent['Leechers'] = (int) $Torrent['Leechers']; $Torrent['Snatched'] = (int) $Torrent['Snatched']; $NumSeeders += $Torrent['Seeders']; $NumLeechers += $Torrent['Leechers']; $NumSnatches += $Torrent['Snatched']; } } $OpenTable = false; $ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0; $HideTorrents = $ShowGroups ? '' : ' hidden'; $OldGroupID = 0; $LastReleaseType = 0; foreach ($Importances as $Group) { extract(Torrents::array_group($TorrentList[$Group['GroupID']]), EXTR_OVERWRITE); $ReleaseType = $Group['ReleaseType']; if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) { continue; } else { $OldGroupID = $GroupID; $OldReleaseType = $ReleaseType; } /* if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) { $HideDiscog = ' hidden'; } else { $HideDiscog = ''; } */ if (!empty($LoggedUser['DiscogView']) || isset($LoggedUser['SortHide']) && array_key_exists($ReleaseType, $LoggedUser['SortHide']) && $LoggedUser['SortHide'][$ReleaseType] == 1) { $HideDiscog = ' hidden'; } else {
$CommentList = null; $SetCache = true; } // TODO: Cache this $DB->query("\n\tSELECT GroupID\n\tFROM collages_torrents\n\tWHERE CollageID = {$CollageID}"); $TorrentGroups = $DB->collect('GroupID'); $JSON = array('id' => (int) $CollageID, 'name' => $Name, 'description' => Text::full_format($Description), 'creatorID' => (int) $CreatorID, 'deleted' => (bool) $Deleted, 'collageCategoryID' => (int) $CollageCategoryID, 'collageCategoryName' => $CollageCats[(int) $CollageCategoryID], 'locked' => (bool) $Locked, 'maxGroups' => (int) $MaxGroups, 'maxGroupsPerUser' => (int) $MaxGroupsPerUser, 'hasBookmarked' => Bookmarks::has_bookmarked('collage', $CollageID), 'subscriberCount' => (int) $Subscribers, 'torrentGroupIDList' => $TorrentGroups); if ($CollageCategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) { // torrent collage $TorrentGroups = array(); $DB->query("\n\t\tSELECT\n\t\t\tct.GroupID\n\t\tFROM collages_torrents AS ct\n\t\t\tJOIN torrents_group AS tg ON tg.ID = ct.GroupID\n\t\tWHERE ct.CollageID = '{$CollageID}'\n\t\tORDER BY ct.Sort"); $GroupIDs = $DB->collect('GroupID'); $GroupList = Torrents::get_groups($GroupIDs); foreach ($GroupIDs as $GroupID) { if (!empty($GroupList[$GroupID])) { $GroupDetails = Torrents::array_group($GroupList[$GroupID]); if ($GroupDetails['GroupCategoryID'] > 0 && $Categories[$GroupDetails['GroupCategoryID'] - 1] == 'Music') { $ArtistForm = $GroupDetails['ExtendedArtists']; $JsonMusicInfo = array('composers' => isset($ArtistForm[4]) ? pullmediainfo($ArtistForm[4]) : array(), 'dj' => isset($ArtistForm[6]) ? pullmediainfo($ArtistForm[6]) : array(), 'artists' => isset($ArtistForm[1]) ? pullmediainfo($ArtistForm[1]) : array(), 'with' => isset($ArtistForm[2]) ? pullmediainfo($ArtistForm[2]) : array(), 'conductor' => isset($ArtistForm[5]) ? pullmediainfo($ArtistForm[5]) : array(), 'remixedBy' => isset($ArtistForm[3]) ? pullmediainfo($ArtistForm[3]) : array(), 'producer' => isset($ArtistForm[7]) ? pullmediainfo($ArtistForm[7]) : array()); } else { $JsonMusicInfo = null; } $TorrentList = array(); foreach ($GroupDetails['Torrents'] as $Torrent) { $TorrentList[] = array('torrentid' => (int) $Torrent['ID'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => count(Torrents::get_reports((int) $Torrent['ID'])) > 0, 'time' => $Torrent['Time']); } $TorrentGroups[] = array('id' => $GroupDetails['GroupID'], 'name' => $GroupDetails['GroupName'], 'year' => $GroupDetails['GroupYear'], 'categoryId' => $GroupDetails['GroupCategoryID'], 'recordLabel' => $GroupDetails['GroupRecordLabel'], 'catalogueNumber' => $GroupDetails['GroupCatalogueNumber'], 'vanityHouse' => $GroupDetails['GroupVanityHouse'], 'tagList' => $GroupDetails['TagList'], 'releaseType' => $GroupDetails['ReleaseType'], 'wikiImage' => $GroupDetails['WikiImage'], 'musicInfo' => $JsonMusicInfo, 'torrents' => $TorrentList); } } $JSON['torrentgroups'] = $TorrentGroups; } else {