2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
/************************************************************************
|
|
|
|
||------------|| Delete artist ||--------------------------------------||
|
|
|
|
|
|
|
|
This is a very powerful page - it deletes an artist, and all associated
|
|
|
|
requests and torrents. It is called when $_GET['action'] == 'delete'.
|
|
|
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
authorize();
|
|
|
|
|
|
|
|
$ArtistID = $_GET['artistid'];
|
|
|
|
if(!is_number($ArtistID) || empty($ArtistID)) { error(0); }
|
|
|
|
|
|
|
|
if(!check_perms('site_delete_artist') || !check_perms('torrents_delete')) { error(403); }
|
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Artist deleted');
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
|
|
|
|
list($Name) = $DB->next_record();
|
|
|
|
|
2013-02-22 08:00:24 +00:00
|
|
|
$DB->query('SELECT tg.Name,
|
|
|
|
tg.ID
|
|
|
|
FROM torrents_group AS tg
|
|
|
|
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
|
2011-03-28 14:21:28 +00:00
|
|
|
WHERE ta.ArtistID='.$ArtistID);
|
|
|
|
$Count = $DB->record_count();
|
|
|
|
if($DB->record_count() > 0) {
|
|
|
|
?>
|
|
|
|
<div class="thin">
|
2012-09-23 08:00:25 +00:00
|
|
|
There are still torrents that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
|
|
|
Please remove the artist from these torrents manually before attempting to delete.<br />
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="box pad">
|
|
|
|
<ul>
|
|
|
|
<?
|
|
|
|
while(list($GroupName, $GroupID) = $DB->next_record(MYSQLI_NUM, true)) {
|
|
|
|
?>
|
|
|
|
<li>
|
|
|
|
<a href="torrents.php?id=<?=$GroupID?>" title="View Torrent"><?=$GroupName?></a>
|
|
|
|
</li>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
|
2013-02-22 08:00:24 +00:00
|
|
|
$DB->query('SELECT r.Title,
|
|
|
|
r.ID
|
2011-03-28 14:21:28 +00:00
|
|
|
FROM requests AS r
|
2013-02-22 08:00:24 +00:00
|
|
|
LEFT JOIN requests_artists AS ra ON ra.RequestID=r.ID
|
2011-03-28 14:21:28 +00:00
|
|
|
WHERE ra.ArtistID='.$ArtistID);
|
|
|
|
$Count += $DB->record_count();
|
|
|
|
if($DB->record_count() > 0) {
|
|
|
|
?>
|
|
|
|
<div class="thin">
|
2012-09-23 08:00:25 +00:00
|
|
|
There are still requests that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
|
|
|
Please remove the artist from these requests manually before attempting to delete.<br />
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="box pad">
|
|
|
|
<ul>
|
|
|
|
<?
|
|
|
|
while(list($RequestName, $RequestID) = $DB->next_record(MYSQLI_NUM, true)) {
|
|
|
|
?>
|
|
|
|
<li>
|
|
|
|
<a href="requests.php?action=view&id=<?=$RequestID?>" title="View Torrent"><?=$RequestName?></a>
|
|
|
|
</li>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
|
|
|
|
if($Count == 0) {
|
2012-10-11 08:00:15 +00:00
|
|
|
Artists::delete_artist($ArtistID);
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<div class="thin">Artist deleted!</div>
|
|
|
|
<?
|
|
|
|
}
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_footer();?>
|