query("SELECT CategoryID, Name FROM torrents_group WHERE ID='$NewGroupID'"); if($DB->record_count()==0) { error('Target group does not exist.'); } list($CategoryID, $NewName) = $DB->next_record(); if($Categories[$CategoryID-1] != 'Music') { error('Only music groups can be merged.'); } $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID); list($Name) = $DB->next_record(); //Everything is legit, let's just confim they're not retarded if(empty($_POST['confirm'])) { $Artists = get_artists(array($GroupID, $NewGroupID)); show_header(); ?>

Merge Confirm!

You are attempting to merge the group:

  • -

Into the group:

  • -
query("UPDATE torrents SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'"); $DB->query("UPDATE wiki_torrents SET PageID='$NewGroupID' WHERE PageID='$GroupID'"); $DB->query("UPDATE torrents_comments SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'"); delete_group($GroupID); write_group_log($NewGroupID, 0, $LoggedUser['ID'], "Merged Group ".$GroupID." (".$Name.") to ".$NewGroupID." (".$NewName.")", 0); $DB->query("UPDATE group_log SET GroupID = ".$NewGroupID." WHERE GroupID = ".$GroupID); $GroupID=$NewGroupID; //Collages $DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$OldGroupID'"); //Select all collages that contain edited group while(list($CollageID) = $DB->next_record()) { $DB->query("UPDATE IGNORE collages_torrents SET GroupID='$NewGroupID' WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'"); //Change collage groupid to new ID $DB->query("DELETE FROM collages_torrents WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'"); $Cache->delete_value('collage_'.$CollageID); } //Requests $DB->query("SELECT ID FROM requests WHERE GroupID='$OldGroupID'"); $Requests = $DB->collect('ID'); $DB->query("UPDATE requests SET GroupID = 'NewGroupID' WHERE GroupID = '$OldGroupID'"); foreach ($Requests as $RequestID) { $Cache->delete_value('request_'.$RequestID); } $DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'"); while(list($TorrentID) = $DB->next_record()) { $Cache->delete_value('torrent_download_'.$TorrentID); } $Cache->delete_value('torrents_details_'.$GroupID); $DB->query("SELECT DISTINCT ArtistID FROM torrents_artists WHERE GroupID IN ('$GroupID', '$OldGroupID')"); while(list($ArtistID) = $DB->next_record()) { $Cache->delete_value('artist_'.$ArtistID); } $Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0'); $Cache->delete_value('groups_artists_'.$GroupID); update_hash($GroupID); header('Location: torrents.php?id='.$GroupID); } ?>