} if ($FormatList && $FormatList != 'Any' && !Misc::search_joined_string($FormatList, $Format)) { $Err = "{$Format} is not an allowed format for this request."; } if ($MediaList && $MediaList != 'Any' && !Misc::search_joined_string($MediaList, $Media)) { $Err = "{$Media} is not allowed media for this request."; } } // Fill request if (!empty($Err)) { error($Err); } //We're all good! Fill! $DB->query("\n\tUPDATE requests\n\tSET FillerID = {$FillerID},\n\t\tTorrentID = {$TorrentID},\n\t\tTimeFilled = '" . sqltime() . "'\n\tWHERE ID = {$RequestID}"); if ($CategoryName === 'Music') { $ArtistForm = Requests::get_artists($RequestID); $ArtistName = Artists::display_artists($ArtistForm, false, true); $FullName = $ArtistName . $Title; } else { $FullName = $Title; } $DB->query("\n\tSELECT UserID\n\tFROM requests_votes\n\tWHERE RequestID = {$RequestID}"); $UserIDs = $DB->to_array(); foreach ($UserIDs as $User) { list($VoterID) = $User; Misc::send_pm($VoterID, 0, "The request \"{$FullName}\" has been filled", 'One of your requests — [url=' . site_url() . "requests.php?action=view&id={$RequestID}]{$FullName}" . '[/url] — has been filled. You can view it here: [url]' . site_url() . "torrents.php?torrentid={$TorrentID}" . '[/url]'); } $RequestVotes = Requests::get_votes_array($RequestID); Misc::write_log("Request {$RequestID} ({$FullName}) was filled by user {$FillerID} ({$FillerUsername}) with the torrent {$TorrentID} for a " . Format::get_size($RequestVotes['TotalBounty']) . ' bounty.'); // Give bounty $DB->query("\n\tUPDATE users_main\n\tSET Uploaded = (Uploaded + " . $RequestVotes['TotalBounty'] . ")\n\tWHERE ID = {$FillerID}");
$DB->query(' SELECT ID AS RequestID, CategoryID, Title AS Title, Year, RecordLabel, CatalogueNumber, ReleaseType, Image FROM requests WHERE ID = ' . $_GET['requestid']); list($Properties) = $DB->to_array(false, MYSQLI_BOTH); $UploadForm = $Categories[$Properties['CategoryID'] - 1]; $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1]; $Properties['Artists'] = Requests::get_artists($_GET['requestid']); $Properties['TagList'] = implode(', ', Requests::get_tags($_GET['requestid'])[$_GET['requestid']]); } if (!empty($ArtistForm)) { $Properties['Artists'] = $ArtistForm; } require SERVER_ROOT . '/classes/torrent_form.class.php'; $TorrentForm = new TORRENT_FORM($Properties, $Err); $GenreTags = $Cache->get_value('genre_tags'); if (!$GenreTags) { $DB->query("\n\t\tSELECT Name\n\t\tFROM tags\n\t\tWHERE TagType = 'genre'\n\t\tORDER BY Name"); $GenreTags = $DB->collect('Name'); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6); } $DB->query(' SELECT
$JumpLink = 'artist.php?id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'collages': $Links = 'Collage: <a href="collages.php?id=' . $Result['PageID'] . '">' . display_str($Result['CollageName']) . '</a>'; $JumpLink = 'collages.php?action=comments&collageid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'requests': if (!isset($Requests[$Result['PageID']])) { // Deleted request continue 2; } $Request = $Requests[$Result['PageID']]; $CategoryName = $Categories[$Request['CategoryID'] - 1]; $Links = 'Request: '; if ($CategoryName == 'Music') { $Links .= Artists::display_artists(Requests::get_artists($Result['PageID'])) . '<a href="requests.php?action=view&id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>"; } elseif ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") { $Links .= '<a href="requests.php?action=view&id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>"; } else { $Links .= '<a href="requests.php?action=view&id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a>"; } $JumpLink = 'requests.php?action=view&id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'torrents': if (!isset($TorrentGroups[$Result['PageID']])) { // Deleted or moved torrent group continue 2; } $GroupInfo = $TorrentGroups[$Result['PageID']]; $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '" dir="ltr">' . $GroupInfo['Name'] . '</a>'; if ($GroupInfo['Year'] > 0) {
$Join[] = "JOIN comments ON comments.Page = '{$Action}' AND comments.PageID = {$Field1}"; $Join = implode("\n\t\t", $Join); $Conditions = implode(" AND ", $Conditions); $Conditions = $Conditions ? 'WHERE ' . $Conditions : ''; $SQL = "\n\tSELECT\n\t\tSQL_CALC_FOUND_ROWS\n\t\tcomments.AuthorID,\n\t\tcomments.Page,\n\t\tcomments.PageID,\n\t\t{$Field2},\n\t\tcomments.ID,\n\t\tcomments.Body,\n\t\tcomments.AddedTime,\n\t\tcomments.EditedTime,\n\t\tcomments.EditedUserID\n\tFROM {$Table}\n\t\t{$Join}\n\t{$Conditions}\n\tGROUP BY comments.ID\n\tORDER BY comments.ID DESC\n\tLIMIT {$Limit}"; $Comments = $DB->query($SQL); $Count = $DB->record_count(); $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); $Pages = Format::get_pages($Page, $Results, $PerPage, 11); $DB->set_query_id($Comments); if ($Action == 'requests') { $RequestIDs = array_flip(array_flip($DB->collect('PageID'))); $Artists = array(); foreach ($RequestIDs as $RequestID) { $Artists[$RequestID] = Requests::get_artists($RequestID); } $DB->set_query_id($Comments); } elseif ($Action == 'torrents') { $GroupIDs = array_flip(array_flip($DB->collect('PageID'))); $Artists = Artists::get_artists($GroupIDs); $DB->set_query_id($Comments); } $LinkID = !$Self ? '&id=' . $UserID : ''; $ActionLinks = $TypeLinks = array(); if ($Action != 'artist') { $ActionLinks[] = '<a href="comments.php?action=artist' . $LinkID . '" class="brackets">Artist comments</a>'; } if ($Action != 'collages') { $ActionLinks[] = '<a href="comments.php?action=collages' . $LinkID . '" class="brackets">Collage comments</a>'; }