diff --git a/classes/script_start.php b/classes/script_start.php index 9ff601c3..931ff714 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -1650,12 +1650,13 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Esc $link .= display_artist($Composers[0], $MakeLink, $Escape).$ampersand.display_artist($Composers[1], $MakeLink, $Escape); break; } - $ComposerStr .= $link; if ((count($Composers) > 0) && (count($Composers) < 3) && (count($MainArtists) > 0)) { $link .= ' performed by '; } + $ComposerStr .= $link; + switch(count($MainArtists)) { case 0: break; @@ -1697,9 +1698,9 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Esc } if ((count($Composers) > 0) && (count($MainArtists) + count($Conductors) > 3) && (count($MainArtists) > 1) && (count($Conductors) > 1)) { - $link = $ComposerStr . ' performed by Various Artists'; + $link = $ComposerStr . 'Various Artists'; } - + // DJs override everything else switch(count($DJs)) { case 0: diff --git a/sections/ajax/announcements.php b/sections/ajax/announcements.php new file mode 100644 index 00000000..5c74ceba --- /dev/null +++ b/sections/ajax/announcements.php @@ -0,0 +1,89 @@ +get_value('news')) { + $DB->query("SELECT + ID, + Title, + Body, + Time + FROM news + ORDER BY Time DESC + LIMIT 5"); + $News = $DB->to_array(false,MYSQLI_NUM,false); + $Cache->cache_value('news',$News,3600*24*30); + $Cache->cache_value('news_latest_id', $News[0][0], 0); +} + +if ($LoggedUser['LastReadNews'] != $News[0][0]) { + $Cache->begin_transaction('user_info_heavy_'.$UserID); + $Cache->update_row(false, array('LastReadNews' => $News[0][0])); + $Cache->commit_transaction(0); + $DB->query("UPDATE users_info SET LastReadNews = '".$News[0][0]."' WHERE UserID = ".$UserID); + $LoggedUser['LastReadNews'] = $News[0][0]; +} + +if(($Blog = $Cache->get_value('blog')) === false) { + $DB->query("SELECT + b.ID, + um.Username, + b.Title, + b.Body, + b.Time, + b.ThreadID + FROM blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID + ORDER BY Time DESC + LIMIT 20"); + $Blog = $DB->to_array(); + $Cache->cache_value('blog',$Blog,1209600); +} + +$JsonBlog = array(); +for ($i = 0; $i < $Limit; $i++) { + list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; + $JsonBlog[] = array( + 'blogId' => (int) $BlogID, + 'author' => $Author, + 'title' => $Title, + 'body' => $Text->full_format($Body), + 'blogTime' => $BlogTime, + 'threadId' => (int) $ThreadID + ); +} + +$JsonAnnouncements = array(); +$Count = 0; +foreach ($News as $NewsItem) { + list($NewsID,$Title,$Body,$NewsTime) = $NewsItem; + if (strtotime($NewsTime) > time()) { + continue; + } + + $JsonAnnouncements[] = array( + 'newsId' => (int) $NewsID, + 'title' => $Title, + 'body' => $Text->full_format($Body), + 'newsTime' => $NewsTime + ); + + if (++$Count > 4) { + break; + } +} + +print + json_encode( + array( + 'status' => 'success', + 'response' => array( + 'announcements' => $JsonAnnouncements, + 'blogPosts' => $JsonBlog + ) + ) + ); + +?> \ No newline at end of file diff --git a/sections/ajax/bookmarks.php b/sections/ajax/bookmarks.php index 056ee087..1d794322 100644 --- a/sections/ajax/bookmarks.php +++ b/sections/ajax/bookmarks.php @@ -197,39 +197,39 @@ function compare($X, $Y){ $JsonTorrents = array(); foreach ($Torrent['Torrents'] as $GroupTorrents) { $JsonTorrents[] = array( - 'id' => $GroupTorrents['ID'], - 'groupId' => $GroupTorrents['GroupID'], + 'id' => (int) $GroupTorrents['ID'], + 'groupId' => (int) $GroupTorrents['GroupID'], 'media' => $GroupTorrents['Media'], 'format' => $GroupTorrents['Format'], 'encoding' => $GroupTorrents['Encoding'], 'remasterYear' => $GroupTorrents['RemasterYear'], - 'remastered' => $GroupTorrents['Remastered'], + 'remastered' => $GroupTorrents['Remastered'] == 1, 'remasterTitle' => $GroupTorrents['RemasterTitle'], 'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'], 'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'], - 'scene' => $GroupTorrents['Scene'], - 'hasLog' => $GroupTorrents['HasLog'], - 'hasCue' => $GroupTorrents['HasCue'], - 'logScore' => $GroupTorrents['LogScore'], - 'fileCount' => $GroupTorrents['FileCount'], - 'freeTorrent' => $GroupTorrents['FreeTorrent'], - 'size' => $GroupTorrents['Size'], - 'leechers' => $GroupTorrents['Leechers'], - 'seeders' => $GroupTorrents['Seeders'], - 'snatched' => $GroupTorrents['Snatched'], + 'scene' => $GroupTorrents['Scene'] == 1, + 'hasLog' => $GroupTorrents['HasLog'] == 1, + 'hasCue' => $GroupTorrents['HasCue'] == 1, + 'logScore' => (float) $GroupTorrents['LogScore'], + 'fileCount' => (int) $GroupTorrents['FileCount'], + 'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1, + 'size' => (float) $GroupTorrents['Size'], + 'leechers' => (int) $GroupTorrents['Leechers'], + 'seeders' => (int) $GroupTorrents['Seeders'], + 'snatched' => (int) $GroupTorrents['Snatched'], 'time' => $GroupTorrents['Time'], - 'hasFile' => $GroupTorrents['HasFile'] + 'hasFile' => (int) $GroupTorrents['HasFile'] ); } $JsonBookmarks[] = array( - 'id' => $Torrent['ID'], + 'id' => (int) $Torrent['ID'], 'name' => $Torrent['Name'], 'year' => $Torrent['Year'], 'recordLabel' => $Torrent['RecordLabel'], 'catalogueNumber' => $Torrent['CatalogueNumber'], 'tagList' => $Torrent['TagList'], 'releaseType' => $Torrent['ReleaseType'], - 'vanityHouse' => $Torrent['VanityHouse'], + 'vanityHouse' => $Torrent['VanityHouse'] == 1, 'torrents' => $JsonTorrents ); } diff --git a/sections/ajax/forum/forum.php b/sections/ajax/forum/forum.php index 67b65794..5e2c506b 100644 --- a/sections/ajax/forum/forum.php +++ b/sections/ajax/forum/forum.php @@ -1,6 +1,6 @@ $ThreadIDs, + 'threadId' => (int) $ThreadIDs, 'thread' => $Thread['Title'] ); } @@ -124,19 +124,19 @@ } $JsonTopics[] = array( - 'topicId' => $TopicID, + 'topicId' => (int) $TopicID, 'title' => $Title, - 'authorId' => $AuthorID, + 'authorId' => (int) $AuthorID, 'authorName' => $AuthorName, - 'locked' => $Locked, - 'sticky' => $Sticky, - 'postCount' => $PostCount, - 'lastID' => $LastID, + 'locked' => $Locked == 1, + 'sticky' => $Sticky == 1, + 'postCount' => (int) $PostCount, + 'lastID' => $LastID == null ? 0 : (int) $LastID, 'lastTime' => $LastTime, - 'lastAuthorId' => $LastAuthorID, - 'lastAuthorName' => $LastAuthorName, - 'lastReadPage' => $LastRead[$TopicID]['Page'], - 'lastReadPostId' => $LastRead[$TopicID]['PostID'] + 'lastAuthorId' => $LastAuthorID == null ? 0 : (int) $LastAuthorID, + 'lastAuthorName' => $LastAuthorName == null ? "" : $LastAuthorName, + 'lastReadPage' => $LastRead[$TopicID]['Page'] == null ? 0 : (int) $LastRead[$TopicID]['Page'], + 'lastReadPostId' => $LastRead[$TopicID]['PostID'] == null ? 0 : (int) $LastRead[$TopicID]['PostID'] ); } @@ -147,11 +147,11 @@ 'response' => array( 'forumName' => $Forums[$ForumID]['Name'], 'specificRules' => $JsonSpecificRules, - 'currentPage' => intval($Page), + 'currentPage' => (int) $Page, 'pages' => ceil($Forums[$ForumID]['NumTopics']/TOPICS_PER_PAGE), 'threads' => $JsonTopics ) ) ); } -?> \ No newline at end of file +?> diff --git a/sections/ajax/forum/index.php b/sections/ajax/forum/index.php index 77bbd50f..9bea5044 100644 --- a/sections/ajax/forum/index.php +++ b/sections/ajax/forum/index.php @@ -2,8 +2,6 @@ // Already done in /sections/ajax/index.php //enforce_login(); -authorize(true); - if (!empty($LoggedUser['DisableForums'])) { print json_encode(array('status' => 'failure')); } diff --git a/sections/ajax/forum/main.php b/sections/ajax/forum/main.php index 35fb493d..820a8fd9 100644 --- a/sections/ajax/forum/main.php +++ b/sections/ajax/forum/main.php @@ -1,6 +1,6 @@ $CategoryID, + 'categoryID' => (int) $CategoryID, 'categoryName' => $ForumCats[$CategoryID] ); $JsonForums = array(); @@ -65,21 +65,21 @@ } $JsonForums[] = array( - 'forumId' => $ForumID, + 'forumId' => (int) $ForumID, 'forumName' => $ForumName, 'forumDescription' => $ForumDescription, - 'numTopics' => $NumTopics, - 'numPosts' => $NumPosts, - 'lastPostId' => $LastPostID, - 'lastAuthorId' => $LastAuthorID, + 'numTopics' => (float) $NumTopics, + 'numPosts' => (float) $NumPosts, + 'lastPostId' => (float) $LastPostID, + 'lastAuthorId' => (float) $LastAuthorID, 'lastPostAuthorName' => $LastPostAuthorName, - 'lastTopicId' => $LastTopicID, + 'lastTopicId' => (float) $LastTopicID, 'lastTime' => $LastTime, 'specificRules' => $SpecificRules, 'lastTopic' => $LastTopic, - 'read' => $Read, - 'locked' => $Locked, - 'sticky' => $Sticky + 'read' => $Read == 1, + 'locked' => $Locked == 1, + 'sticky' => $Sticky == 1 ); } diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index 1de527f0..24aad056 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -1,6 +1,6 @@ $PostID, + 'postId' => (int) $PostID, 'addedTime' => $AddedTime, 'body' => $Text->full_format($Body), - 'editedUserId' => $EditedUserID, + 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, 'editedUsername' => $EditedUsername, 'author' => array( - 'authorId' => $AuthorID, + 'authorId' => (int) $AuthorID, 'authorName' => $Username, 'paranoia' => $Paranoia, - 'artist' => $Artist, - 'donor' => $Donor, - 'warned' => $Warned, + 'artist' => $Artist == 1, + 'donor' => $Donor == 1, + 'warned' => $Warned == 1, 'avatar' => $Avatar, 'enabled' => $Enabled == 2 ? false : true, 'userTitle' => $UserTitle @@ -241,16 +241,16 @@ array( 'status' => 'success', 'response' => array( - 'forumId' => $ForumID, + 'forumId' => (int) $ForumID, 'forumName' => $Forums[$ForumID]['Name'], - 'threadId' => $ThreadID, + 'threadId' => (int) $ThreadID, 'threadTitle' => $ThreadInfo['Title'], 'subscribed' => in_array($ThreadID, $UserSubscriptions), - 'locked' => $ThreadInfo['IsLocked'], - 'sticky' => $ThreadInfo['IsSticky'], - 'currentPage' => intval($Page), + 'locked' => $ThreadInfo['IsLocked'] == 1, + 'sticky' => $ThreadInfo['IsSticky'] == 1, + 'currentPage' => (int) $Page, 'pages' => ceil($ThreadInfo['Posts']/$PerPage), - 'poll' => $JsonPoll, + 'poll' => empty($JsonPoll) ? null : $JsonPoll, 'posts' => $JsonPosts ) ) diff --git a/sections/ajax/inbox/inbox.php b/sections/ajax/inbox/inbox.php index 8e3a613d..7f92f215 100644 --- a/sections/ajax/inbox/inbox.php +++ b/sections/ajax/inbox/inbox.php @@ -82,16 +82,16 @@ $JsonMessages = array(); while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) { $JsonMessage = array( - 'convId' => $ConvID, + 'convId' => (int) $ConvID, 'subject' => $Subject, - 'unread' => $Unread, - 'sticky' => $Sticky, - 'forwardedId' => $ForwardedID, + 'unread' => $Unread == 1, + 'sticky' => $Sticky == 1, + 'forwardedId' => (int) $ForwardedID, 'forwardedName' => $ForwardedName, - 'senderId' => $SenderID, + 'senderId' => (int) $SenderID, 'username' => $Username, - 'donor' => $Donor, - 'warned' => $Warned, + 'donor' => $Donor == 1, + 'warned' => $Warned == 1, 'enabled' => ($Enabled == 2 ? false : true), 'date' => $Date ); @@ -103,7 +103,7 @@ array( 'status' => 'success', 'response' => array( - 'currentPage' => intval($Page), + 'currentPage' => (int) $Page, 'pages' => ceil($NumResults/MESSAGES_PER_PAGE), 'messages' => $JsonMessages ) diff --git a/sections/ajax/inbox/viewconv.php b/sections/ajax/inbox/viewconv.php index e889714e..b49aec47 100644 --- a/sections/ajax/inbox/viewconv.php +++ b/sections/ajax/inbox/viewconv.php @@ -68,8 +68,8 @@ $JsonMessages = array(); while(list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) { $JsonMessage = array( - 'messageId' => $MessageID, - 'senderId' => $SenderID, + 'messageId' => (int) $MessageID, + 'senderId' => (int) $SenderID, 'senderName' => $Users[(int)$SenderID]['Username'], 'sentDate' => $SentDate, 'body' => $Text->full_format($Body) @@ -82,10 +82,11 @@ array( 'status' => 'success', 'response' => array( - 'convId' => $ConvID, + 'convId' => (int) $ConvID, 'subject' => $Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':''), - 'sticky' => $Sticky, + 'sticky' => $Sticky == 1, 'messages' => $JsonMessages ) ) - ); \ No newline at end of file + ); +?> diff --git a/sections/ajax/index.php b/sections/ajax/index.php index 19c6232c..e4c2f1ce 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -65,9 +65,15 @@ case 'bookmarks': require(SERVER_ROOT.'/sections/ajax/bookmarks.php'); break; + case 'announcements': + require(SERVER_ROOT.'/sections/ajax/announcements.php'); + break; + case 'notifications': + require(SERVER_ROOT.'/sections/ajax/notifications.php'); + break; default: // If they're screwing around with the query string - error(403); + print json_encode(array('status' => 'failure')); } ?> diff --git a/sections/ajax/info.php b/sections/ajax/info.php index 2056f065..9acbc183 100644 --- a/sections/ajax/info.php +++ b/sections/ajax/info.php @@ -42,10 +42,10 @@ 'authkey'=>$AuthKey, 'passkey'=>$torrent_pass, 'userstats' => array( - 'uploaded' => $Uploaded, - 'downloaded' => $Downloaded, - 'ratio' => $Ratio, - 'requiredratio' => $RequiredRatio, + 'uploaded' => (int) $Uploaded, + 'downloaded' => (int) $Downloaded, + 'ratio' => (float) $Ratio, + 'requiredratio' => (float) $RequiredRatio, //'class' => $Class 'class' => $ClassLevels[$Class]['Name'] ), diff --git a/sections/ajax/notifications.php b/sections/ajax/notifications.php new file mode 100644 index 00000000..59d0bfa9 --- /dev/null +++ b/sections/ajax/notifications.php @@ -0,0 +1,145 @@ + 'failure' + ) + ); + die(); +} + +define('NOTIFICATIONS_PER_PAGE', 50); +list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE); + +$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID); +if (empty($TokenTorrents)) { + $DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE"); + $TokenTorrents = $DB->collect('TorrentID'); + $Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents); +} + +$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS + t.ID, + g.ID, + g.Name, + g.CategoryID, + g.TagList, + t.Size, + t.FileCount, + t.Format, + t.Encoding, + t.Media, + t.Scene, + t.RemasterYear, + g.Year, + t.RemasterYear, + t.RemasterTitle, + t.Snatched, + t.Seeders, + t.Leechers, + t.Time, + t.HasLog, + t.HasCue, + t.LogScore, + t.FreeTorrent, + tln.TorrentID AS LogInDB, + unt.UnRead, + unt.FilterID, + unf.Label + FROM users_notify_torrents AS unt + JOIN torrents AS t ON t.ID=unt.TorrentID + JOIN torrents_group AS g ON g.ID = t.GroupID + LEFT JOIN users_notify_filters AS unf ON unf.ID=unt.FilterID + LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID + WHERE unt.UserID='$LoggedUser[ID]' + GROUP BY t.ID + ORDER BY t.ID DESC LIMIT $Limit"); +$DB->query('SELECT FOUND_ROWS()'); +list($TorrentCount) = $DB->next_record(); + +// Only clear the alert if they've specified to. +if (isset($_GET['clear']) && $_GET['clear'] == "1") { + //Clear before header but after query so as to not have the alert bar on this page load + $DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']); + $Cache->delete_value('notifications_new_'.$LoggedUser['ID']); +} + +$DB->set_query_id($Results); + +$Pages=get_pages($Page,$TorrentCount,NOTIFICATIONS_PER_PAGE,9); + +$JsonNotifications = array(); +$NumNew = 0; + +$FilterGroups = array(); +while($Result = $DB->next_record()) { + if(!$Result['FilterID']) { + $Result['FilterID'] = 0; + } + if(!isset($FilterGroups[$Result['FilterID']])) { + $FilterGroups[$Result['FilterID']] = array(); + $FilterGroups[$Result['FilterID']]['FilterLabel'] = ($Result['FilterID'] && !empty($Result['Label']) ? $Result['Label'] : 'unknown filter'.($Result['FilterID']?' ['.$Result['FilterID'].']':'')); + } + array_push($FilterGroups[$Result['FilterID']], $Result); +} +unset($Result); + +foreach($FilterGroups as $ID => $FilterResults) { + unset($FilterResults['FilterLabel']); + foreach($FilterResults as $Result) { + list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $TorrentTags, $Size, $FileCount, $Format, $Encoding, + $Media, $Scene, $RemasterYear, $GroupYear, $RemasterYear, $RemasterTitle, $Snatched, $Seeders, + $Leechers, $NotificationTime, $HasLog, $HasCue, $LogScore, $FreeTorrent, $LogInDB, $UnRead) = $Result; + + $Artists = get_artist($GroupID); + + if ($Unread) $NumNew++; + + $JsonNotifications[] = array( + 'torrentId' => (int) $TorrentID, + 'groupId' => (int) $GroupID, + 'groupName' => $GroupName, + 'groupCategoryId' => (int) $GroupCategoryID, + 'torrentTags' => $TorrentTags, + 'size' => (float) $Size, + 'fileCount' => (int) $FileCount, + 'format' => $Format, + 'encoding' => $Encoding, + 'media' => $Media, + 'scene' => $Scene == 1, + 'remasterYear' => $RemasterYear, + 'groupYear' => $GroupYear, + 'remasterYear' => $RemasterYear, + 'remasterTitle' => $RemasterTitle, + 'snatched' => (int) $Snatched, + 'seeders' => (int) $Seeders, + 'leechers' => (int) $Leechers, + 'notificationTime' => $NotificationTime, + 'hasLog' => $HasLog == 1, + 'hasCue' => $HasCue == 1, + 'logScore' => (float) $LogScore, + 'freeTorrent' => $FreeTorrent == 1, + 'logInDb' => $LogInDB, + 'unread' => $UnRead == 1 + ); + } +} + +print + json_encode( + array( + 'status' => 'success', + 'response' => array( + 'currentPages' => intval($Page), + 'pages' => ceil($TorrentCount/NOTIFICATIONS_PER_PAGE), + 'numNew' => $NumNew, + 'results' => $JsonNotifications + ) + ) + ); + +?> \ No newline at end of file diff --git a/sections/ajax/subscriptions.php b/sections/ajax/subscriptions.php index 6ef2b599..061df3a3 100644 --- a/sections/ajax/subscriptions.php +++ b/sections/ajax/subscriptions.php @@ -98,13 +98,13 @@ $JsonPosts = array(); while(list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()){ $JsonPost = array( - 'forumId' => $ForumID, + 'forumId' => (int) $ForumID, 'forumName' => $ForumName, - 'threadId' => $TopicID, + 'threadId' => (int) $TopicID, 'threadTitle' => $ThreadTitle, - 'postId' => $PostID, - 'lastPostId' => $LastPostID, - 'locked' => $Locked, + 'postId' => (int) $PostID, + 'lastPostId' => (int) $LastPostID, + 'locked' => $Locked == 1, 'new' => ($PostID<$LastPostID && !$Locked) ); $JsonPosts[] = $JsonPost; @@ -115,7 +115,7 @@ array( 'status' => 'success', 'response' => array( - 'posts' => $JsonPosts + 'threads' => $JsonPosts ) ) ); diff --git a/sections/ajax/usersearch.php b/sections/ajax/usersearch.php index d96ed933..e926835a 100644 --- a/sections/ajax/usersearch.php +++ b/sections/ajax/usersearch.php @@ -38,10 +38,10 @@ list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result; $JsonUsers[] = array( - 'userId' => $UserID, + 'userId' => (int) $UserID, 'username' => $Username, - 'donor' => $Donor, - 'warned' => $Warned, + 'donor' => $Donor == 1, + 'warned' => $Warned == 1, 'enabled' => ($Enabled == 2 ? false : true), 'class' => make_class_string($PermissionID) ); @@ -52,7 +52,7 @@ array( 'status' => 'success', 'response' => array( - 'currentPage' => $Page, + 'currentPage' => (int) $Page, 'pages' => ceil($NumResults/USERS_PER_PAGE), 'results' => $JsonUsers ) diff --git a/sections/collages/manage_handle.php b/sections/collages/manage_handle.php index dff8bcc2..a1cfd716 100644 --- a/sections/collages/manage_handle.php +++ b/sections/collages/manage_handle.php @@ -14,7 +14,8 @@ if($_POST['submit'] == 'Remove') { $DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'"); - $DB->query("UPDATE collages SET NumTorrents=NumTorrents-1 WHERE ID='$CollageID'"); + $Rows = $DB->affected_rows(); + $DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'"); $Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value('torrent_collages_'.$GroupID); } else {