<?php require_once "../includes/inc.includes.php"; // Include necessary files $search = $_GET['search']; $value = html_entity_decode(stripslashes($_GET['value']), ENT_COMPAT, "UTF-8"); $limit = 10; if ($search == "artist") { $json = json_decode(get_artists("tracks")); if ($json) { foreach ($json as $result) { $results['artist'][] = html_entity_decode($result->artist, ENT_COMPAT, "UTF-8"); } } } if ($search == "title") { $json = json_decode(get_tracks()); if ($json) { foreach ($json as $result) { $results['title'][] = html_entity_decode($result->title, ENT_COMPAT, "UTF-8"); } } } if ($search == "album") { $json = json_decode(get_albums()); if ($json) { foreach ($json as $result) { $results['albums'][] = html_entity_decode($result->title, ENT_COMPAT, "UTF-8"); } } }
if($NewGroupID == $GroupID) { error('Old group ID is the same as new group ID!'); } $DB->query("SELECT ID FROM torrents_group WHERE ID='$NewGroupID'"); if($DB->record_count()==0) { error('Target group does not exist.'); } //Everything is legit, let's just confim they're not retarded if(empty($_POST['confirm'])) { $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID); list($Name) = $DB->next_record(); $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$NewGroupID); list($NewName) = $DB->next_record(); $Artists = get_artists(array($GroupID, $NewGroupID)); show_header(); ?> <div class="center thin"> <h2>Merge Confirm!</h2> <div class="box pad"> <form action="torrents.php" method="post"> <input type="hidden" name="action" value="merge" /> <input type="hidden" name="confirm" value="true" /> <input type="hidden" name="groupid" value="<?php echo $GroupID; ?> " /> <input type="hidden" name="targetgroupid" value="<?php echo $NewGroupID;
function get_groups($GroupIDs, $Return = true, $GetArtists = true) { global $DB, $Cache; $Found = array_flip($GroupIDs); $NotFound = array_flip($GroupIDs); foreach($GroupIDs as $GroupID) { $Data = $Cache->get_value('torrent_group_'.$GroupID); if(!empty($Data)) { unset($NotFound[$GroupID]); $Found[$GroupID] = $Data; } } $IDs = implode(',',array_flip($NotFound)); /* Changing any of these attributes returned will cause very large, very dramatic site-wide chaos. Do not change what is returned or the order thereof without updating: torrents, artists, collages, bookmarks, better, the front page, and anywhere else the get_groups function is used. */ if(count($NotFound)>0) { $DB->query("SELECT g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType FROM torrents_group AS g WHERE g.ID IN ($IDs)"); while($Group = $DB->next_record(MYSQLI_ASSOC, true)) { unset($NotFound[$Group['ID']]); $Found[$Group['ID']] = $Group; $Found[$Group['ID']]['Torrents'] = array(); $Found[$Group['ID']]['Artists'] = array(); } $DB->query("SELECT ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time FROM torrents WHERE GroupID IN($IDs) ORDER BY GroupID, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Format, Encoding"); while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) { $Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent; $Cache->cache_value('torrent_group_'.$Torrent['GroupID'], $Found[$Torrent['GroupID']], 0); } } if($GetArtists) { $Artists = get_artists($GroupIDs); } else { $Artists = array(); } if($Return) { // If we're interested in the data, and not just caching it foreach($Artists as $GroupID=>$Data) { if(array_key_exists(1, $Data)) { $Found[$GroupID]['Artists']=$Data[1]; // Only use main artists } } $Matches = array('matches'=>$Found, 'notfound'=>array_flip($NotFound)); return $Matches; } }
<?php } ?> </tr> </table> <?php } if (!isset($Uploads)) { $Uploads = 0; } if ($Uploads > 4 && check_paranoia_here('uploads')) { $RecentUploads = $Cache->get_value('recent_uploads_' . $UserID); if (!is_array($RecentUploads)) { $DB->query("SELECT \n\t\tg.ID,\n\t\tg.Name,\n\t\tg.WikiImage\n\t\tFROM torrents_group AS g\n\t\tINNER JOIN torrents AS t ON t.GroupID=g.ID\n\t\tWHERE t.UserID='{$UserID}'\n\t\tAND g.WikiImage <> ''\n\t\tGROUP BY g.ID\n\t\tORDER BY t.Time DESC\n\t\tLIMIT 5"); $RecentUploads = $DB->to_array(); $Artists = get_artists($DB->collect('ID')); foreach ($RecentUploads as $Key => $UploadInfo) { $RecentUploads[$Key]['Artist'] = display_artists($Artists[$UploadInfo['ID']], false, true); } $Cache->cache_value('recent_uploads_' . $UserID, $RecentUploads, 0); //inf cache } ?> <table class="recent" cellpadding="0" cellspacing="0" border="0"> <tr class="colhead"> <td colspan="5">Recent Uploads</td> <tr> <?php foreach ($RecentUploads as $RU) { ?> <td>
if (!is_array($Recommend) || !is_array($Recommend_artists)) { $DB->query("SELECT tr.GroupID, tr.UserID, u.Username, tg.Name FROM torrents_recommended AS tr JOIN torrents_group AS tg ON tg.ID=tr.GroupID LEFT JOIN users_main AS u ON u.ID=tr.UserID ORDER BY tr.Time DESC LIMIT 10 "); $Recommend = $DB->to_array(); $Cache->cache_value('recommend',$Recommend,1209600); $Recommend_artists = get_artists($DB->collect('GroupID')); $Cache->cache_value('recommend_artists',$Recommend_artists,1209600); } if (count($Recommend) >= 4) { $Cache->increment('usage_index'); ?> <script type="text/javascript"> var runonce = false; function log_hit() { if (runonce) { return; } runonce = true; ajax.get('index.php?action=browsers'); } </script> <div class="box" id="recommended">
$Query.=' @(groupname,artistname,yearfulltext) '.$_GET['search']; } $SS->SetFilter('logscore', array(100)); $SS->limit(0, TORRENTS_PER_PAGE); $SS->set_index('what delta'); $Results = $SS->search($Query, 'torrent_group', 0, array(), '', ''); if(count($Results) == 0) { error('No results found!'); } // If some were fetched from memcached, get their artists if(!empty($Results['matches'])) { // Fetch the artists for groups $GroupIDs = array_keys($Results['matches']); $Artists = get_artists($GroupIDs); foreach($Artists as $GroupID=>$Data) { if(!empty($Data[1])) { $Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists } ksort($Results['matches'][$GroupID]); } } // These ones were not found in the cache, run SQL if(!empty($Results['notfound'])) { $SQLResults = get_groups($Results['notfound']); if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results reset($SQLResults['notfound']);
write_alphabet("browse.php?level0=tr-ti&level1=", $level1); print "<div class='results'>\n"; print "<div class='searchresults'>\n"; $tracklist = json_decode(get_tracks()); write_tracklist($tracklist, null, $level1); print "</div>\n"; print "</div>\n"; } /// Albums by Artist if (strcmp($level0, "al-ar") == 0) { $trackrow_param->artist = FALSE; write_alphabet("browse.php?level0=al-ar&level1=", $level1); // print alphabet into container print "<div class='results'>\n"; print "<div class='searchresults'>\n"; $json = json_decode(get_artists("albums", $level1)); print "<table borders=\"0\">\n"; print "<th class='brslist_level2'>Artists</th>"; if ($json) { foreach ($json as $artist) { print "<tr><td class='brslist_level1'>\n"; write_artistlink("browse.php?level0=al-ar&level1={$level1}&level2=", html_entity_decode($artist->artist, ENT_COMPAT, "UTF-8"), $level2); print "</td></tr>\n"; } } print "</table>\n"; print "</div>\n"; if (isset($level0) && $level2 == "" && $level1 == "" || $level2 != "") { # artist / level 2 specified? print "<div class='searchresults border-left'>\n"; print "<table borders=\"0\">\n";
} //Everything is legit, let's just confim they're not retarded if(empty($_POST['confirm'])) { $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$OldGroupID); if($DB->record_count() < 1) { //Trying to move to an empty group? I think not! set_message("That group doesn't exist!"); header('Location: '.$_SERVER['HTTP_REFERER']); die(); } list($Name) = $DB->next_record(); $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID); list($NewName) = $DB->next_record(); $Artists = get_artists(array($OldGroupID, $GroupID)); show_header(); ?> <div class="center thin"> <h2>Change Group Confirm!</h2> <div class="box pad"> <form action="torrents.php" method="post"> <input type="hidden" name="action" value="editgroupid" /> <input type="hidden" name="confirm" value="true" /> <input type="hidden" name="torrentid" value="<?php echo $TorrentID; ?> " /> <input type="hidden" name="oldgroupid" value="<?php echo $OldGroupID;
$DB->query("SELECT DATE_FORMAT(t.Time,'%b \'%y') AS Month, t.GroupID, t.Media, t.Format, t.Encoding, IF(t.RemasterYear=0,tg.Year,t.RemasterYear), tg.Name, t.Size, f.File FROM torrents as t JOIN torrents_group AS tg ON t.GroupID=tg.ID LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID ".$SQL); $Downloads = $DB->to_array(false,MYSQLI_NUM,false); $Artists = get_artists($DB->collect('GroupID')); list($UserID, $Username) = array_values(user_info($UserID)); $Zip = new ZIP($Username.'\'s '.ucfirst($_GET['type'])); foreach($Downloads as $Download) { list($Month, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download; $Artist = display_artists($Artists[$GroupID],false); $Contents = unserialize(base64_decode($Contents)); $Tor = new TORRENT($Contents, true); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); unset($Tor->Val['announce-list']); $Zip->add_file($Tor->enc(), file_string($Month).'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent'); } $Zip->close_stream();