?> &importance=3'); this.parentNode.parentNode.style.display = 'none';" class="brackets tooltip" title="Remove artist">X</a></span> <?php } ?> </li> <?php } } if (!empty($Artists[7]) && count($Artists[7]) > 0) { print ' <li class="artists_producer"><strong class="artists_label">Produced by:</strong></li>'; foreach ($Artists[7] as $Artist) { ?> <li class="artists_producer"> <?php echo Artists::display_artist($Artist) . ' ‎'; if (check_perms('torrents_edit')) { $DB->query("\n\t\t\t\t\tSELECT AliasID\n\t\t\t\t\tFROM artists_alias\n\t\t\t\t\tWHERE ArtistID = " . $Artist['id'] . "\n\t\t\t\t\t\tAND ArtistID != AliasID\n\t\t\t\t\t\tAND Name = '" . db_string($Artist['name']) . "'"); list($AliasID) = $DB->next_record(); if (empty($AliasID)) { $AliasID = $Artist['id']; } ?> (<span class="tooltip" title="Artist alias ID"><?php echo $AliasID; ?> </span>) <span class="remove remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&auth=' + authkey + '&groupid=<?php echo $GroupID; ?> &artistid=<?php
<?php echo Artists::display_artist($Artist); ?> </li> <?php } } if (!empty($ArtistForm[7]) && count($ArtistForm[7]) > 0) { ?> <li class="artists_producer"><strong>Produced by:</strong></li> <?php foreach ($ArtistForm[7] as $Artist) { ?> <li class="artists_remix"> <?php echo Artists::display_artist($Artist); ?> </li> <?php } } ?> </ul> </div> <?php } ?> <div class="box box_tags"> <div class="head"><strong>Tags</strong></div> <ul class="stats nobullet"> <?php
/** * Format an array of artists for display. * TODO: Revisit the logic of this, see if we can helper-function the copypasta. * * @param array Artists an array of the form output by get_artists * @param boolean $MakeLink if true, the artists will be links, if false, they will be text. * @param boolean $IncludeHyphen if true, appends " - " to the end. * @param $Escape if true, output will be escaped. Think carefully before setting it false. */ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Escape = true) { if (!empty($Artists)) { $ampersand = $Escape ? ' & ' : ' & '; $link = ''; $MainArtists = isset($Artists[1]) ? $Artists[1] : null; $Guests = isset($Artists[2]) ? $Artists[2] : null; $Composers = isset($Artists[4]) ? $Artists[4] : null; $Conductors = isset($Artists[5]) ? $Artists[5] : null; $DJs = isset($Artists[6]) ? $Artists[6] : null; if (count($MainArtists) + count($Conductors) + count($DJs) == 0 && count($Composers) == 0) { return ''; } // Various Composers is not needed and is ugly and should die switch (count($Composers)) { case 0: break; case 1: $link .= Artists::display_artist($Composers[0], $MakeLink, $Escape); break; case 2: $link .= Artists::display_artist($Composers[0], $MakeLink, $Escape) . $ampersand . Artists::display_artist($Composers[1], $MakeLink, $Escape); break; } if (count($Composers) > 0 && count($Composers) < 3 && count($MainArtists) > 0) { $link .= ' performed by '; } $ComposerStr = $link; switch (count($MainArtists)) { case 0: break; case 1: $link .= Artists::display_artist($MainArtists[0], $MakeLink, $Escape); break; case 2: $link .= Artists::display_artist($MainArtists[0], $MakeLink, $Escape) . $ampersand . Artists::display_artist($MainArtists[1], $MakeLink, $Escape); break; default: $link .= 'Various Artists'; } /*if (!empty($Guests) && (count($MainArtists) + count($Composers) > 0) && (count($MainArtists) + count($Composers) + count($Conductors) < 3)) { switch (count($Guests)) { case 1: $link .= ' with '.Artists::display_artist($Guests[0], $MakeLink, $Escape); break; case 2: $link .= ' with '.Artists::display_artist($Guests[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($Guests[1], $MakeLink, $Escape); break; } }*/ if (count($Conductors) > 0 && count($MainArtists) + count($Composers) > 0 && (count($Composers) < 3 || count($MainArtists) > 0)) { $link .= ' under '; } switch (count($Conductors)) { case 0: break; case 1: $link .= Artists::display_artist($Conductors[0], $MakeLink, $Escape); break; case 2: $link .= Artists::display_artist($Conductors[0], $MakeLink, $Escape) . $ampersand . Artists::display_artist($Conductors[1], $MakeLink, $Escape); break; default: $link .= ' Various Conductors'; } if (count($Composers) > 0 && count($MainArtists) + count($Conductors) > 3 && count($MainArtists) > 1 && count($Conductors) > 1) { $link = $ComposerStr . 'Various Artists'; } elseif (count($Composers) > 2 && count($MainArtists) + count($Conductors) == 0) { $link = 'Various Composers'; } // DJs override everything else switch (count($DJs)) { case 0: break; case 1: $link = Artists::display_artist($DJs[0], $MakeLink, $Escape); break; case 2: $link = Artists::display_artist($DJs[0], $MakeLink, $Escape) . $ampersand . Artists::display_artist($DJs[1], $MakeLink, $Escape); break; default: $link = 'Various DJs'; } return $link . ($IncludeHyphen ? ' - ' : ''); } else { return ''; } }