Empty commit

This commit is contained in:
Git 2012-02-23 08:00:18 +00:00
parent 5d9b6c6406
commit e28f670791
10 changed files with 119 additions and 86 deletions

View File

@ -896,8 +896,8 @@ CREATE TABLE `torrents_artists` (
`ArtistID` int(10) NOT NULL,
`AliasID` int(10) NOT NULL,
`UserID` int(10) unsigned NOT NULL DEFAULT '0',
`Importance` enum('1','2','3','4','5','6','7') DEFAULT NULL,
PRIMARY KEY (`GroupID`,`AliasID`),
`Importance` enum('1','2','3','4','5','6','7') NOT NULL DEFAULT '1',
PRIMARY KEY (`GroupID`,`ArtistID`,`Importance`),
KEY `ArtistID` (`ArtistID`),
KEY `AliasID` (`AliasID`),
KEY `Importance` (`Importance`),

View File

@ -102,7 +102,7 @@ function compare($X, $Y){
$LastReleaseType = 0;
if(empty($Importances) || empty($TorrentList)) {
$DB->query("SELECT
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
WHERE ta.ArtistID='$ArtistID'
@ -110,7 +110,8 @@ function compare($X, $Y){
tg.Year DESC, tg.Name DESC");
$GroupIDs = $DB->collect('GroupID');
$Importances = $DB->to_array('GroupID', MYSQLI_BOTH, false);
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
if(count($GroupIDs)>0) {
$TorrentList = get_groups($GroupIDs, true,true);
$TorrentList = $TorrentList['matches'];
@ -128,26 +129,39 @@ function compare($X, $Y){
//Get list of used release types
$UsedReleases = array();
foreach($TorrentList as $GroupID=>$Group) {
if($Importances[$GroupID]['Importance'] == '2') {
$TorrentList[$GroupID]['ReleaseType'] = 1024;
$GuestAlbums = true;
}
if($Importances[$GroupID]['Importance'] == '3') {
$TorrentList[$GroupID]['ReleaseType'] = 1023;
$RemixerAlbums = true;
}
if($Importances[$GroupID]['Importance'] == '4') {
$TorrentList[$GroupID]['ReleaseType'] = 1022;
$ComposerAlbums = true;
}
if($Importances[$GroupID]['Importance'] == '7') {
$TorrentList[$GroupID]['ReleaseType'] = 1021;
$ProducerAlbums = true;
}
if(!in_array($TorrentList[$GroupID]['ReleaseType'], $UsedReleases)) {
$UsedReleases[] = $TorrentList[$GroupID]['ReleaseType'];
foreach($Importances as $ID=>$Group) {
switch ($Importances[$ID]['Importance']) {
case '2':
$Importances[$ID]['ReleaseType'] = 1024;
//$TorrentList[$GroupID]['ReleaseType'] = 1024;
$GuestAlbums = true;
break;
case '3':
$Importances[$ID]['ReleaseType'] = 1023;
//$TorrentList[$GroupID]['ReleaseType'] = 1023;
$RemixerAlbums = true;
break;
case '4':
$Importances[$ID]['ReleaseType'] = 1022;
//$TorrentList[$GroupID]['ReleaseType'] = 1022;
$ComposerAlbums = true;
break;
case '7':
$Importances[$ID]['ReleaseType'] = 1021;
//$TorrentList[$GroupID]['ReleaseType'] = 1021;
$ProducerAlbums = true;
break;
default:
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
}
if(!in_array($Importances[$ID]['ReleaseType'], $UsedReleases)) {
$UsedReleases[] = $Importances[$ID]['ReleaseType'];
}
}
if(!empty($GuestAlbums)) {
@ -208,10 +222,20 @@ function compare($X, $Y){
$OpenTable = false;
$ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0;
$HideTorrents = ($ShowGroups ? '' : ' hidden');
$OldGroupID = 0;
$ReleaseType = 0;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($Group);
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
foreach ($Importances as $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($TorrentList[$Group['GroupID']]);
$ReleaseType = $Group['ReleaseType'];
$GroupVanityHouse = $Group['VanityHouse'];
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
continue;
} else {
$OldGroupID = $GroupID;
$OldReleaseType = $ReleaseType;
}
$TagList = explode(' ',str_replace('_','.',$TagList));

View File

@ -110,9 +110,11 @@
}
}*/
//WEB has no ripping log.
$WEBOverride = ((strpos($MediaList, "WEB") !== false) && $Media == "WEB");
if($Format == "FLAC" && $LogCue && !$WEBOverride) {
//WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD
//$WEBOverride = ((strpos($MediaList, "WEB") !== false) && $Media == "WEB");
//$VinylOverride = ((strpos($MediaList, "Vinyl") !== false) && $Media == "Vinyl");
//if($Format == "FLAC" && $LogCue && !$WEBOverride && !$VinylOverride) {
if($Format == "FLAC" && $LogCue && $Media == 'CD') {
if(strpos($LogCue, "Log") && !$HasLog) {
$Err = "This request requires a log";
}

View File

@ -41,15 +41,13 @@
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
list($ArtistName) = $DB->next_record();
$DB->query("SELECT AliasID FROM torrents_artists WHERE GroupID='$GroupID' AND ArtistID='$ArtistID'");
if($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO torrents_artists
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
('$GroupID', '$ArtistID', '$AliasID', '$Importance', '$UserID')");
if ($DB->affected_rows()) {
$Changed = true;
$DB->query("INSERT INTO torrents_artists
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
('$GroupID', '$ArtistID', '$AliasID', '$Importance', '$UserID')");
$DB->query("INSERT INTO torrents_group (ID, NumArtists)
SELECT ta.GroupID, COUNT(ta.ArtistID)
FROM torrents_artists AS ta
@ -59,14 +57,8 @@
ON DUPLICATE KEY UPDATE
NumArtists=VALUES(NumArtists);");
write_log("Artist ".$ArtistID." (".$ArtistName.") was added to the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "added artist ".$ArtistName, 0);
} else {
list($OldAliasID) = $DB->next_record();
if($OldAliasID == 0) {
$Changed = true;
$DB->query('UPDATE torrents_artists SET AliasID='.$AliasID.' WHERE GroupID='.$GroupID.' AND ArtistID='.$ArtistID);
}
write_log("Artist ".$ArtistID." (".$ArtistName.") was added to the group ".$GroupID." (".$GroupName.") as ".$ArtistTypes[$Importance]." by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "added artist ".$ArtistName." as ".$ArtistTypes[$Importance], 0);
}
}
}

View File

@ -1,15 +1,16 @@
<?
$ArtistID = db_string($_GET['artistid']);
$GroupID = db_string($_GET['groupid']);
$Importance = db_string($_GET['importance']);
if(!is_number($ArtistID) || !is_number($GroupID)) {
if(!is_number($ArtistID) || !is_number($GroupID) || !is_number($Importance)) {
error(404);
}
if(!check_perms('torrents_edit')) {
error(403);
}
$DB->query("DELETE FROM torrents_artists WHERE GroupID='$GroupID' AND ArtistID='$ArtistID'");
$DB->query("DELETE FROM torrents_artists WHERE GroupID='$GroupID' AND ArtistID='$ArtistID' AND Importance='$Importance'");
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
list($ArtistName) = $DB->next_record();
@ -48,8 +49,8 @@
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
write_log("Artist ".$ArtistID." (".$ArtistName.") was removed from the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist ".$ArtistName, 0);
write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistName.") was removed from the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist ".$ArtistName." (".$ArtistTypes[$Importance].")", 0);
update_hash($GroupID);

View File

@ -151,7 +151,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=4');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<? }
@ -170,7 +170,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=6');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?
@ -192,7 +192,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=1');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?
@ -211,7 +211,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=2');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?
@ -231,7 +231,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=5');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?
@ -251,7 +251,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=3');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?
@ -271,7 +271,7 @@ function compare($X, $Y){
}
?>
&nbsp;(<?=$AliasID?>)&nbsp;
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<span class="remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=7');this.parentNode.parentNode.style.display = 'none';">[X]</a></span>
<? } ?>
</li>
<?

View File

@ -14,6 +14,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
return implode(' | ',$PageLinks);
}
// This gets used in a few places
$ArtistTypes = array(1 => 'Main', 2 => 'Guest', 3 => 'Remixer', 4 => 'Composer', 5 => 'Conductor', 6 => 'DJ/Compiler', 7 => 'Producer');
if(!empty($_REQUEST['action'])) {
switch($_REQUEST['action']){
case 'edit':

View File

@ -7,27 +7,35 @@
}
authorize();
$Artists = explode(',', $_POST['artists']);
foreach($Artists as &$Artist) {
if(!is_number($Artist)) {
unset($Artist);
} else {
$Cache->delete_value('artist_'.$Artist);
$GroupID = $_POST['groupid'];
$Artists = explode(',',$_POST['artists']);
$CleanArtists = array();
$ArtistIDs = array();
$ArtistsString = '0';
foreach($Artists as $i => $Artist) {
list($Importance, $ArtistID) = explode(';',$Artist);
if(is_number($ArtistID) && is_number($Importance)) {
$Cache->delete_value('artist_'.$ArtistID);
$CleanArtists[] = array($Importance, $ArtistID);
$ArtistsString .= ",$ArtistID";
$ArtistIDs[] = $ArtistID;
}
}
$ArtistsString = implode(',', $Artists);
if(count($Artists) > 0) {
if(count($CleanArtists) > 0) {
if($_POST['manager_action'] == 'delete') {
$DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'");
list($GroupName) = $DB->next_record();
$DB->query("SELECT ArtistID, Name FROM artists_group WHERE ArtistID IN (".$ArtistsString.")");
$ArtistNames = $DB->to_array('ArtistID');
foreach($ArtistNames as $ArtistID => $ArtistInfo) {
write_log("Artist ".$ArtistID." (".$ArtistInfo['Name'].") was removed from the group ".$_POST['groupid']." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
print_r($ArtistNames);
foreach ($CleanArtists AS $Artist) {
list($Importance,$ArtistID) = $Artist;
write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistNames[$ArtistID]['Name'].") was removed from the group ".$_POST['groupid']." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_group_log($GroupID, 0, $LoggedUser['ID'], "Removed artist ".$ArtistNames[$ArtistID]['Name']." (".$ArtistTypes[$Importance].")", 0);
$DB->query("DELETE FROM torrents_artists WHERE GroupID = '$GroupID' AND ArtistID = '$ArtistID' AND Importance = '$Importance'");
}
$DB->query("DELETE FROM torrents_artists WHERE GroupID = '".$_POST['groupid']."' AND ArtistID IN (".$ArtistsString.")");
$DB->query("SELECT ArtistID
FROM requests_artists
WHERE ArtistID IN (".$ArtistsString.")
@ -35,14 +43,14 @@
FROM torrents_artists
WHERE ArtistID IN (".$ArtistsString.")");
$Items = $DB->collect('ArtistID');
$EmptyArtists = array_diff($Artists, $Items);
$EmptyArtists = array_diff($ArtistIDs, $Items);
foreach($EmptyArtists as $ArtistID) {
delete_artist($ArtistID);
}
} else {
$DB->query("UPDATE torrents_artists SET Importance = '".$_POST['importance']."' WHERE GroupID = '".$_POST['groupid']."' AND ArtistID IN (".$ArtistsString.")");
$DB->query("UPDATE IGNORE torrents_artists SET Importance = '".$_POST['importance']."' WHERE GroupID = '$GroupID' AND ArtistID IN (".$ArtistsString.")");
}
$Cache->delete_value('groups_artists_'.$_POST['groupid']);
header("Location: torrents.php?id=".$_POST['groupid']);
$Cache->delete_value('groups_artists_'.$GroupID);
header("Location: torrents.php?id=".$GroupID);
}
?>

View File

@ -28,21 +28,24 @@
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
WHERE tg.ID=".$_GET['groupid']."
GROUP BY tg.ID");
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID']-1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID']-1];
$Properties['Artists'] = get_artist($_GET['groupid']);
$DB->query("SELECT
GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
FROM torrents_tags AS tt JOIN tags ON tags.ID=tt.TagID
WHERE tt.GroupID='$_GET[groupid]'");
list($Properties['TagList']) = $DB->next_record();
if ($DB->record_count()) {
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID']-1];
$Properties['CategoryName'] = $Categories[$Properties['CategoryID']-1];
$Properties['Artists'] = get_artist($_GET['groupid']);
$DB->query("SELECT
GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList
FROM torrents_tags AS tt JOIN tags ON tags.ID=tt.TagID
WHERE tt.GroupID='$_GET[groupid]'");
list($Properties['TagList']) = $DB->next_record();
} else {
unset($_GET['groupid']);
}
if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
$Properties['RequestID'] = $_GET['requestid'];
}
}
} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
include(SERVER_ROOT.'/sections/requests/functions.php');
$DB->query("SELECT

View File

@ -64,7 +64,7 @@ function ArtistManager() {
elBox.type = 'checkbox';
elBox.id = 'artistmanager_box'+(i-importance+1);
elBox.name = 'artistmanager_box';
elBox.value = importance+','+ArtistID;
elBox.value = importance+';'+ArtistID;
elBox.onclick = function(e) { SelectArtist(e,this); };
elArtistList.children[i].insertBefore(elBox, elArtistList.children[i].children[0]);
if(importance == 1 || importance == 4 || importance == 6) {
@ -182,7 +182,7 @@ function ArtistManagerSubmit() {
var MainSelectionCount = 0;
for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) {
if(boxes.raw(i).checked) {
Selection.push(boxes.raw(i).value.substr(2));
Selection.push(boxes.raw(i).value);
if(boxes.raw(i).value.substr(0,1) == '1') {
MainSelectionCount++;
}