Empty commit

This commit is contained in:
Git 2012-11-20 08:00:19 +00:00
parent a1e0638548
commit 4c60acb4c3
21 changed files with 128 additions and 231 deletions

View File

@ -243,6 +243,7 @@ public static function delete_artist($ArtistID) {
$DB->query('DELETE FROM artists_tags WHERE ArtistID='.$ArtistID);
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artist_groups_'.$ArtistID);
// Record in log
if(!empty($LoggedUser['Username'])) {

View File

@ -1,6 +1,5 @@
<?
define('LASTFM_API_URL', 'http://ws.audioscrobbler.com/2.0/?method=');
class LastFM {
public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
@ -14,12 +13,15 @@ public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
}
private static function lastfm_request($Method, $Args) {
if (!defined('LASTFM_API_KEY')) {
return false;
}
$Url = LASTFM_API_URL.$Method;
if(is_array($Args)) {
foreach ($Args as $Key => $Value) {
$Url .= "&".$Key."=".urlencode($Value);
}
$Url .= "&format=json&api_key=".LASTFM_KEY;
$Url .= "&format=json&api_key=".LASTFM_API_KEY;
$Curl=curl_init();
curl_setopt($Curl,CURLOPT_HEADER,0);

View File

@ -210,14 +210,6 @@ public static function delete_torrent($ID, $GroupID=0, $OcelotReason=-1) {
Torrents::delete_group($GroupID);
} else {
Torrents::update_hash($GroupID);
//Artists
$DB->query("SELECT ArtistID
FROM torrents_artists
WHERE GroupID = ".$GroupID);
$ArtistIDs = $DB->collect('ArtistID');
foreach ($ArtistIDs as $ArtistID) {
$Cache->delete_value('artist_'.$ArtistID);
}
}
// Torrent notifications
@ -316,7 +308,7 @@ public static function delete_group($GroupID) {
Artists::delete_artist($ArtistID);
} else {
//Not the only group, still need to clear cache
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artist_groups_'.$ArtistID);
}
}
@ -416,7 +408,7 @@ public static function update_hash($GroupID) {
$ArtistInfo = Artists::get_artist($GroupID);
foreach ($ArtistInfo as $Importances => $Importance) {
foreach ($Importance as $Artist) {
$Cache->delete_value('artist_'.$Artist['id']); //Needed for at least freeleech change, if not others.
$Cache->delete_value('artist_groups_'.$Artist['id']); //Needed for at least freeleech change, if not others.
}
}

View File

@ -169,7 +169,7 @@
$Cache->cache_value('subscriptions_user_new_'.$LoggedUser['ID'], $NewSubscriptions, 0);
} ?>
<ul id="userinfo_minor">
<ul id="userinfo_minor"<?=$NewSubscriptions ? ' class="highlite"' : ''?>>
<li id="nav_inbox"<?=Format::add_class($PageID, array('inbox'), 'active', true)?>>
<a onmousedown="Stats('inbox');" href="inbox.php">Inbox</a>
</li>

View File

@ -1,5 +1,4 @@
<?
//For sorting tags
function compare($X, $Y){
return($Y['count'] - $X['count']);
@ -32,15 +31,19 @@ function compare($X, $Y){
if(!empty($_GET['revisionid'])) { // if they're viewing an old revision
$RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)){ error(0); }
if (!is_number($RevisionID)) {
error(0);
}
$Data = $Cache->get_value("artist_$ArtistID"."_revision_$RevisionID");
} else { // viewing the live version
$Data = $Cache->get_value('artist_'.$ArtistID);
$RevisionID = false;
}
if($Data) {
$Data = unserialize($Data);
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, $TorrentList, $Importances)) = each($Data);
if (!is_array($Data)) {
$Data = unserialize($Data);
}
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, , , $VanityHouseArtist)) = each($Data);
} else {
if ($RevisionID) {
@ -65,18 +68,16 @@ function compare($X, $Y){
$sql .= " GROUP BY a.ArtistID";
$DB->query($sql);
if($DB->record_count()==0) {
if($DB->record_count() == 0) {
print json_encode(array('status' => 'failure'));
}
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
}
ob_start();
// Requests
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
if(!is_array($Requests)) {
if (!is_array($Requests)) {
$DB->query("SELECT
r.ID,
r.CategoryID,
@ -102,25 +103,28 @@ function compare($X, $Y){
}
$NumRequests = count($Requests);
$LastReleaseType = 0;
if(empty($Importances) || empty($TorrentList)) {
if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) {
$DB->query("SELECT
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
WHERE ta.ArtistID='$ArtistID'
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),ta.Importance, 1),
tg.ReleaseType ASC, tg.Year DESC, tg.Name DESC");
ORDER BY tg.Year DESC, tg.Name DESC");
$GroupIDs = $DB->collect('GroupID');
$Importances = $DB->to_array('GroupID', MYSQLI_BOTH, false);
if(count($GroupIDs)>0) {
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
$Cache->cache_value('artist_groups_'.$ArtistID, $Importances, 0);
} else {
$GroupIDs = array();
foreach ($Importances as $Group) {
$GroupIDs[] = $Group['GroupID'];
}
}
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
$NumGroups = count($TorrentList);
//Get list of used release types
@ -163,6 +167,7 @@ function compare($X, $Y){
reset($TorrentList);
$JsonTorrents = array();
$Tags = array();
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($Group);
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
@ -177,86 +182,13 @@ function compare($X, $Y){
$Tags[$Tag]['count']++;
}
}
$DisplayName ='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if(check_perms('users_mod')) {
$DisplayName .= ' [<a href="torrents.php?action=fix_group&amp;groupid='.$GroupID.'&amp;artistid='.$ArtistID.'&amp;auth='.$LoggedUser['AuthKey'].'">Fix</a>]';
}
switch($ReleaseType){
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
case 1024:
case 1021:
case 8:
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
} elseif(count($GroupArtists)>0) {
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
}
break;
case 1022: // Show performers on composer pages
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) {
unset($ExtendedArtists[4]);
unset($ExtendedArtists[3]);
unset($ExtendedArtists[6]);
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
} elseif(count($GroupArtists)>0) {
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
}
break;
default: // Show composers otherwise
if (!empty($ExtendedArtists[4])) {
$DisplayName = Artists::display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
}
}
if($GroupYear>0) { $DisplayName = $GroupYear. ' - '.$DisplayName; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<tr class="releases_<?=$ReleaseType?> group discog<?=$HideDiscog?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
</td>
</tr>
<?
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
$InnerTorrents = array();
foreach ($Torrents as $TorrentID => $Torrent) {
$NumTorrents++;
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
$NumSeeders+=$Torrent['Seeders'];
$NumLeechers+=$Torrent['Leechers'];
$NumSnatches+=$Torrent['Snatched'];
}
foreach ($Torrents as $Torrent) {
$NumTorrents++;
$NumSeeders += $Torrent['Seeders'];
$NumLeechers += $Torrent['Leechers'];
$NumSnatches += $Torrent['Snatched'];
$InnerTorrents[] = array(
'id' => (int) $Torrent['ID'],
'groupId' => (int) $Torrent['GroupID'],
@ -295,8 +227,6 @@ function compare($X, $Y){
);
}
$TorrentDisplayList = ob_get_clean();
$JsonSimilar = array();
if(empty($SimilarArray)) {
$DB->query("
@ -340,21 +270,20 @@ function compare($X, $Y){
}
//notifications disabled by default
$notificationsEnabled = False;
$notificationsEnabled = false;
if (check_perms('site_torrents_notify')) {
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC, false);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
if (stripos($Notify['Artists'], '|'.$Name.'|') === false) {
$notificationsEnabled = False;
} else {
$notificationsEnabled = True;
}
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC, false);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
if (stripos($Notify['Artists'], '|'.$Name.'|') === false) {
$notificationsEnabled = false;
} else {
$notificationsEnabled = true;
}
}
print
json_encode(
array(
@ -380,5 +309,17 @@ function compare($X, $Y){
'requests' => $JsonRequests
)
)
)
);
// Cache page for later use
if ($RevisionID) {
$Key = "artist_$ArtistID"."_revision_$RevisionID";
} else {
$Key = 'artist_'.$ArtistID;
}
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
$Cache->cache_value($Key, $Data, 3600);
?>

View File

@ -101,17 +101,23 @@ function compare($X, $Y){
$NumRequests = count($Requests);
$LastReleaseType = 0;
$DB->query("SELECT
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
WHERE ta.ArtistID='$ArtistID'
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),1000 + ta.Importance, tg.ReleaseType) ASC,
tg.Year DESC, tg.Name DESC");
$GroupIDs = $DB->collect('GroupID');
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
if(count($GroupIDs)>0) {
if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) {
$DB->query("SELECT
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
WHERE ta.ArtistID='$ArtistID'
ORDER BY tg.Year DESC, tg.Name DESC");
$GroupIDs = $DB->collect('GroupID');
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
$Cache->cache_value('artist_groups_'.$ArtistID, $Importances, 0);
} else {
$GroupIDs = array();
foreach ($Importances as $Group) {
$GroupIDs[] = $Group['GroupID'];
}
}
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
$TorrentList = $TorrentList['matches'];
} else {
@ -119,7 +125,7 @@ function compare($X, $Y){
}
$NumGroups = count($TorrentList);
if(!empty($TorrentList)) {
if (!empty($TorrentList)) {
?>
<div id="discog_table">
<?
@ -127,7 +133,7 @@ function compare($X, $Y){
//Get list of used release types
$UsedReleases = array();
foreach($Importances as $ID=>$Group) {
foreach ($Importances as $ID => $Group) {
switch ($Importances[$ID]['Importance']) {
case '2':
$Importances[$ID]['ReleaseType'] = 1024;
@ -157,44 +163,49 @@ function compare($X, $Y){
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
}
if(!in_array($Importances[$ID]['ReleaseType'], $UsedReleases)) {
$UsedReleases[] = $Importances[$ID]['ReleaseType'];
if (!isset($UsedReleases[$Importances[$ID]['ReleaseType']])) {
$UsedReleases[$Importances[$ID]['ReleaseType']] = true;
}
$Importances[$ID]['Sort'] = $ID;
}
if(!empty($GuestAlbums)) {
if (!empty($GuestAlbums)) {
$ReleaseTypes[1024] = "Guest Appearance";
}
if(!empty($RemixerAlbums)) {
if (!empty($RemixerAlbums)) {
$ReleaseTypes[1023] = "Remixed By";
}
if(!empty($ComposerAlbums)) {
if (!empty($ComposerAlbums)) {
$ReleaseTypes[1022] = "Composition";
}
if(!empty($ProducerAlbums)) {
if (!empty($ProducerAlbums)) {
$ReleaseTypes[1021] = "Produced By";
}
//Custom sorting for releases
if(!empty($LoggedUser['SortHide'])) {
$SortOrder = array_keys($LoggedUser['SortHide']);
uasort($Importances, function ($a, $b) {
global $SortOrder;
// global $Debug;
// $Debug->log_var($a);
$c = array_search($a['ReleaseType'], $SortOrder);
$d = array_search($b['ReleaseType'], $SortOrder);
if ($c == $d) {
if ($a['Year'] == $b['Year']) {
return 0;
} else {
return ($a['Year'] > $b['Year']) ? -1 : 1;
}
}
return $c < $d ? -1 : 1;
});
if (!empty($LoggedUser['SortHide'])) {
$SortOrder = array_flip(array_keys($LoggedUser['SortHide']));
} else {
$SortOrder = $ReleaseTypes;
}
// If the $SortOrder array doesn't have all release types, put the missing ones at the end
if (count($SortOrder) != count($ReleaseTypes)) {
$MaxOrder = max($SortOrder);
foreach (array_keys(array_diff_key($ReleaseTypes, $SortOrder)) as $Missing) {
$SortOrder[$Missing] = ++$MaxOrder;
}
}
uasort($Importances, function ($A, $B) use ($SortOrder) {
if ($SortOrder[$A['ReleaseType']] == $SortOrder[$B['ReleaseType']]) {
return $A['Sort'] < $B['Sort'] ? -1 : 1;
}
return $SortOrder[$A['ReleaseType']] < $SortOrder[$B['ReleaseType']] ? -1 : 1;
});
// Sort the anchors at the top of the page the same way as release types
$UsedReleases = array_flip(array_intersect_key($SortOrder, $UsedReleases));
reset($TorrentList);
if(!empty($UsedReleases)) { ?>
if (!empty($UsedReleases)) { ?>
<div class="box center">
<?
foreach($UsedReleases as $ReleaseID) {
@ -272,6 +283,7 @@ function compare($X, $Y){
$HideTorrents = ($ShowGroups ? '' : ' hidden');
$OldGroupID = 0;
$ReleaseType = 0;
$LastReleaseType = 0;
foreach ($Importances as $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($TorrentList[$Group['GroupID']]);

View File

@ -112,6 +112,8 @@
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artist_'.$NewArtistID);
$Cache->delete_value('artist_groups_'.$ArtistID);
$Cache->delete_value('artist_groups_'.$NewArtistID);
// Delete the old artist
$DB->query("DELETE FROM artists_group WHERE ArtistID = $ArtistID");

View File

@ -66,7 +66,7 @@
$DB->query("DELETE FROM requests_artists WHERE AliasID='$OldAliasID'");
if(!empty($Requests)) {
foreach($Requests as $RequestID) {
$Cache->delete_value('request_artists_'.$RequestID); // Delete group artist cache
$Cache->delete_value('request_artists_'.$RequestID); // Delete request artist cache
Requests::update_sphinx_requests($RequestID);
}
}
@ -129,8 +129,6 @@
}
}
$Cache->delete_value('artist_'.$ArtistID);
// Clear torrent caches
$DB->query("SELECT GroupID FROM torrents_artists WHERE ArtistID='$ArtistID'");
while(list($GroupID) = $DB->next_record()) {

View File

@ -399,7 +399,6 @@
$AliasID = $Redirect;
}
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
$Cache->delete_value('artist_'.$ArtistID);
break;
}
}
@ -455,7 +454,6 @@
Artists::delete_artist($ArtistID);
} else {
//Not the only group, still need to clear cache
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artists_requests_'.$ArtistID);
}
}

View File

@ -73,7 +73,6 @@
if(!empty($ArtistForm)) {
foreach($ArtistForm as $ArtistType) {
foreach($ArtistType as $Artist) {
$Cache->delete_value('artist_'.$Artist['id']);
$Cache->delete_value('artists_requests_'.$Artist['id']);
}
}

View File

@ -6,31 +6,31 @@
$Importances = $_POST['importance'];
$AliasNames = $_POST['aliasname'];
if(!is_number($GroupID) || !$GroupID) {
if (!is_number($GroupID) || !$GroupID) {
error(0);
}
$Changed = false;
for($i = 0; $i < count($AliasNames); $i++) {
for ($i = 0; $i < count($AliasNames); $i++) {
$AliasName = Artists::normalise_artist_name($AliasNames[$i]);
$Importance = $Importances[$i];
if($Importance!='1' && $Importance!='2' && $Importance!='3' && $Importance!='4' && $Importance!='5' && $Importance!='6' && $Importance!='7') {
if ($Importance!='1' && $Importance!='2' && $Importance!='3' && $Importance!='4' && $Importance!='5' && $Importance!='6' && $Importance!='7') {
break;
}
if(strlen($AliasName) > 0) {
if (strlen($AliasName) > 0) {
$DB->query("SELECT AliasID, ArtistID, Redirect, Name FROM artists_alias WHERE Name = '".db_string($AliasName)."'");
while(list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($AliasName, $FoundAliasName)) {
if($Redirect) {
while (list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
if (!strcasecmp($AliasName, $FoundAliasName)) {
if ($Redirect) {
$AliasID = $Redirect;
}
break;
}
}
if(!$AliasID) {
if (!$AliasID) {
$AliasName = db_string($AliasName);
$DB->query("INSERT INTO artists_group (Name) VALUES ('$AliasName')");
$ArtistID = $DB->inserted_id();
@ -66,10 +66,9 @@
}
}
if($Changed) {
if ($Changed) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
$Cache->delete_value('artist_'.$ArtistID);
Torrents::update_hash($GroupID);
}

View File

@ -33,9 +33,6 @@
if(($ReqCount + $GroupCount) == 0) {
//The only group to use this artist
Artists::delete_artist($ArtistID);
} else {
//Not the only group, still need to clear cache
$Cache->delete_value('artist_'.$ArtistID);
}
$DB->query("INSERT INTO torrents_group (ID, NumArtists)
@ -53,6 +50,7 @@
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist ".$ArtistName." (".$ArtistTypes[$Importance].")", 0);
Torrents::update_hash($GroupID);
$Cache->delete_value('artist_groups_'.$ArtistID);
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -126,7 +126,6 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" name="oldgroupid" value="<?=$Properties['GroupID']?>" />
<input type="hidden" name="oldartistid" value="<?=$Properties['ArtistID']?>" />
<table class="layout">
<tr>
<td class="label">Artist</td>

View File

@ -81,12 +81,6 @@
}
Torrents::update_hash($GroupID);
// Clear artist caches
$DB->query("SELECT DISTINCT ArtistID FROM torrents_artists WHERE GroupID IN ('$GroupID', '$OldGroupID')");
while(list($ArtistID) = $DB->next_record()) {
$Cache->delete_value('artist_'.$ArtistID);
}
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']); // TODO: this is probably broken
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "merged group ".$OldGroupID, 0);
$DB->query("UPDATE group_log SET GroupID = ".$GroupID." WHERE GroupID = ".$OldGroupID);

View File

@ -16,25 +16,24 @@
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;
}
}
if(count($CleanArtists) > 0) {
$ArtistsString = implode(',', $ArtistIDs);;
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', MYSQLI_ASSOC, false);
print_r($ArtistNames);
foreach ($CleanArtists AS $Artist) {
foreach ($CleanArtists as $Artist) {
list($Importance,$ArtistID) = $Artist;
Misc::write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistNames[$ArtistID]['Name'].") was removed from the group ".$_POST['groupid']." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
Torrents::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'");
$Cache->delete_value('artist_groups_'.$ArtistID);
}
$DB->query("SELECT ArtistID
FROM requests_artists
@ -51,6 +50,7 @@
$DB->query("UPDATE IGNORE torrents_artists SET Importance = '".$_POST['importance']."' WHERE GroupID = '$GroupID' AND ArtistID IN (".$ArtistsString.")");
}
$Cache->delete_value('groups_artists_'.$GroupID);
Torrents::update_hash($GroupID);
header("Location: torrents.php?id=".$GroupID);
}
?>

View File

@ -119,12 +119,6 @@
$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('torrent_comments_'.$GroupID);
$Cache->delete_value('groups_artists_'.$GroupID);

View File

@ -19,11 +19,6 @@
$DB->query("UPDATE torrents_group SET Name='".db_string($NewName)."' WHERE ID='$GroupID'");
$Cache->delete_value('torrents_details_'.$GroupID);
$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID='$GroupID'");
while(list($ArtistID) = $DB->next_record()) {
$Cache->delete_value('artist_'.$ArtistID);
}
Torrents::update_hash($GroupID);
Misc::write_log("Torrent Group ".$GroupID." (".$OldName.") was renamed to '".$NewName."' by ".$LoggedUser['Username']);

View File

@ -428,12 +428,6 @@
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_download_'.$TorrentID);
$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID = ".$GroupID);
$Artists = $DB->collect('ArtistID');
foreach($Artists as $ArtistID) {
$Cache->delete_value('artist_'.$ArtistID);
}
Torrents::update_hash($GroupID);
// All done!

View File

@ -62,13 +62,6 @@
$DB->query("UPDATE torrents_group SET ReleaseType='$ReleaseType' WHERE ID='$GroupID'");
Torrents::update_hash($GroupID);
$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID = ".$GroupID);
$Artists = $DB->collect('ArtistID');
foreach($Artists as $ArtistID) {
$Cache->delete_value('artist_'.$ArtistID);
}
}
else { // revert
$DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'");
@ -100,7 +93,6 @@
// There we go, all done!
//$Cache->delete_value("artist_".$GroupID); // Delete artist cache
$Cache->delete_value('torrents_details_'.$GroupID);
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'");
if($DB->record_count()>0) {

View File

@ -15,8 +15,6 @@
$Year = trim($_POST['year']);
$SearchText = db_string(trim($_POST['artist']) . ' ' . trim($_POST['title']) . ' ' . trim($_POST['year']));
$OldArtistID = (int)$_POST['oldartistid']; // Doesn't hit the database, so we don't have to be especially paranoid
if(!is_number($OldGroupID) || !is_number($TorrentID) || !is_number($Year) || !$OldGroupID || !$TorrentID || !$Year || empty($Title) || empty($ArtistName)) {
error(0);
}
@ -60,8 +58,6 @@
Torrents::update_hash($GroupID);
$Cache->delete_value('torrent_download_'.$TorrentID);
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artist_'.$OldArtistID);
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']);

View File

@ -550,8 +550,6 @@
$AliasID = $DB->inserted_id();
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $Artist['name']);
} else {
$Cache->delete_value('artist_'.$Artist['id']);
}
}
}
@ -935,13 +933,6 @@
// Clear Cache
$Cache->delete('torrents_details_'.$GroupID);
foreach($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) {
if(!empty($Artist['id'])) {
$Cache->delete('artist_'.$Artist['id']);
}
}
}
if (!$Private) {
View::show_header("Warning");