diff --git a/classes/script_start.php b/classes/script_start.php index f9b6c76d..efb14a0a 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -1351,7 +1351,7 @@ function update_hash($GroupID) { GROUP_CONCAT(DISTINCT t.Format SEPARATOR ' ') AS Format, GROUP_CONCAT(DISTINCT t.Encoding SEPARATOR ' ') AS Encoding, GROUP_CONCAT(DISTINCT t.RemasterTitle SEPARATOR ' ') AS RemasterTitle, - GROUP_CONCAT(REPLACE(REPLACE(REPLACE(FileList, '|||', '\n '), '_', ' '), '.', ' ') SEPARATOR '\n ') AS FileList + GROUP_CONCAT(REPLACE(REPLACE(FileList, '|||', '\n '), '_', ' ') SEPARATOR '\n ') AS FileList FROM torrents AS t JOIN torrents_group AS g ON g.ID=t.GroupID WHERE g.ID=$GroupID @@ -2158,7 +2158,7 @@ function in_array_partial($Needle, $Haystack) { * @param int $FreeLeechType 0 = Unknown, 1 = Staff picks, 2 = Perma-FL (Toolbox, etc.), 3 = Vanity House */ function freeleech_torrents($TorrentIDs, $FreeNeutral = 1, $FreeLeechType = 0) { - global $DB, $Cache; + global $DB, $Cache, $LoggedUser; if(!is_array($TorrentIDs)) { $TorrentIDs = array($TorrentIDs); diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index 2129b461..9b7ec306 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -92,7 +92,7 @@ function compare($X, $Y){ FROM requests AS r LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID - WHERE ra.ArtistID = '$ArtistID' + WHERE ra.ArtistID = ".$ArtistID." AND r.TorrentID = 0 GROUP BY r.ID ORDER BY Votes DESC"); @@ -228,7 +228,7 @@ function compare($X, $Y){ 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], - 'remasterYear' => $Torrent['RemasterYear'], + 'remasterYear' => (int) $Torrent['RemasterYear'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], @@ -247,20 +247,16 @@ function compare($X, $Y){ ); } $JsonTorrents[] = array( - 'groupId' => $GroupID, + 'groupId' => (int) $GroupID, 'groupName' => $GroupName, - 'groupYear' => $GroupYear, + 'groupYear' => (int) $GroupYear, 'groupRecordLabel' => $GroupRecordLabel, 'groupCatalogueNumber' => $GroupCatalogueNumber, 'tags' => $TagList, 'releaseType' => (int) $ReleaseType, 'groupVanityHouse' => $GroupVanityHouse == 1, 'hasBookmarked' => $hasBookmarked = has_bookmarked('torrent', $GroupID), - 'torrent' => $InnerTorrents, - 'releaseType' => $ReleaseType, - 'groupVanityHouse' => $GroupVanityHouse, - 'hasBookmarked' => $hasBookmarked = has_bookmarked('torrent', $GroupID), - 'torrent' => array_values($Torrents) + 'torrent' => $InnerTorrents ); } @@ -288,11 +284,7 @@ function compare($X, $Y){ 'artistId' => (int) $Similar['ArtistID'], 'name' => $Similar['Name'], 'score' => (int) $Similar['Score'], - 'similarId' => (int) $Similar['SimilarID'], - 'artistId' => $Similar['ArtistID'], - 'name' => $Similar['Name'], - 'score' => $Similar['Score'], - 'similarId' => $Similar['SimilarID'] + 'similarId' => (int) $Similar['SimilarID'] ); } $NumSimilar = count($SimilarArray); @@ -305,17 +297,10 @@ function compare($X, $Y){ 'requestId' => (int) $RequestID, 'categoryId' => (int) $CategoryID, 'title' => $Title, - 'year' => $Year, + 'year' => (int) $Year, 'timeAdded' => $TimeAdded, 'votes' => (int) $Votes, - 'bounty' => (int) $Bounty, - 'requestId' => $RequestID, - 'categoryId' => $CategoryID, - 'title' => $Title, - 'year' => $Year, - 'timeAdded' => $TimeAdded, - 'votes' => $Votes, - 'bounty' => $Bounty + 'bounty' => (int) $Bounty ); } @@ -340,13 +325,13 @@ function compare($X, $Y){ array( 'status' => 'success', 'response' => array( - 'id' => $ArtistID, + 'id' => (int) $ArtistID, 'name' => $Name, 'notificationsEnabled' => $notificationsEnabled, 'hasBookmarked' => has_bookmarked('artist', $ArtistID), 'image' => $Image, 'body' => $Text->full_format($Body), - 'vanityHouse' => $VanityHouseArtist, + 'vanityHouse' => $VanityHouseArtist == 1, 'tags' => array_values($Tags), 'similarArtists' => $JsonSimilar, 'statistics' => array( diff --git a/sections/ajax/better/single.php b/sections/ajax/better/single.php index 4026661f..b0a3a494 100644 --- a/sections/ajax/better/single.php +++ b/sections/ajax/better/single.php @@ -30,11 +30,11 @@ if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } $JsonResults[] = array( - 'torrentId' => $FlacID, - 'groupId' => $GroupID, + 'torrentId' => (int) $FlacID, + 'groupId' => (int) $GroupID, 'artist' => $Artists, 'groupName' => $GroupName, - 'groupYear' => $GroupYear, + 'groupYear' => (int) $GroupYear, 'downloadUrl' => 'torrents.php?action=download&id='.$FlacID.'&authkey='.$LoggedUser['AuthKey'].'&torrent_pass='.$LoggedUser['torrent_pass'] ); } @@ -44,4 +44,4 @@ 'status' => 'success', 'response' => $JsonResults ) -); \ No newline at end of file +); diff --git a/sections/ajax/better/transcode.php b/sections/ajax/better/transcode.php index 02743e3e..9fc67bd2 100644 --- a/sections/ajax/better/transcode.php +++ b/sections/ajax/better/transcode.php @@ -91,11 +91,11 @@ } $JsonResults[] = array( - 'torrentId' => $TorrentID, - 'groupId' => $GroupID, + 'torrentId' => (int) $TorrentID, + 'groupId' => (int) $GroupID, 'artist' => $DisplayName, 'groupName' => $GroupName, - 'groupYear' => $GroupYear, + 'groupYear' => (int) $GroupYear, 'missingV2' => $MissingEncodings['V2 (VBR)'] == 0, 'missingV0' => $MissingEncodings['V0 (VBR)'] == 0, 'missing320' => $MissingEncodings['320'] == 0, diff --git a/sections/ajax/index.php b/sections/ajax/index.php index 555721b0..7f194246 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -47,6 +47,12 @@ case 'top10': require(SERVER_ROOT.'/sections/ajax/top10/index.php'); break; + case 'usersearch': + require(SERVER_ROOT.'/sections/ajax/usersearch.php'); + break; + case 'artist': + require(SERVER_ROOT.'/sections/ajax/artist.php'); + break; case 'requests': require(SERVER_ROOT.'/sections/ajax/requests.php'); case 'bookmarks': @@ -69,15 +75,9 @@ 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; - case 'better': - require(SERVER_ROOT.'/sections/ajax/better/index.php'); - break; default: // If they're screwing around with the query string print json_encode(array('status' => 'failure')); diff --git a/sections/ajax/notifications.php b/sections/ajax/notifications.php index 59d0bfa9..3274a83e 100644 --- a/sections/ajax/notifications.php +++ b/sections/ajax/notifications.php @@ -111,9 +111,8 @@ 'encoding' => $Encoding, 'media' => $Media, 'scene' => $Scene == 1, - 'remasterYear' => $RemasterYear, - 'groupYear' => $GroupYear, - 'remasterYear' => $RemasterYear, + 'groupYear' => (int) $GroupYear, + 'remasterYear' => (int) $RemasterYear, 'remasterTitle' => $RemasterTitle, 'snatched' => (int) $Snatched, 'seeders' => (int) $Seeders, @@ -142,4 +141,4 @@ ) ); -?> \ No newline at end of file +?> diff --git a/sections/ajax/request.php b/sections/ajax/request.php new file mode 100644 index 00000000..faebbf1c --- /dev/null +++ b/sections/ajax/request.php @@ -0,0 +1,253 @@ + 'failure' + ) + ); + die(); +} + +$RequestID = $_GET['id']; + +//First things first, lets get the data for the request. + +$Request = get_requests(array($RequestID)); +$Request = $Request['matches'][$RequestID]; +if(empty($Request)) { + print + json_encode( + array( + 'status' => 'failure' + ) + ); + die(); +} + +list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType, + $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request; + +//Convenience variables +$IsFilled = !empty($TorrentID); +$CanVote = (empty($TorrentID) && check_perms('site_vote')); + +if($CategoryID == 0) { + $CategoryName = "Unknown"; +} else { + $CategoryName = $Categories[$CategoryID - 1]; +} + +//Do we need to get artists? +if($CategoryName == "Music") { + $ArtistForm = get_request_artists($RequestID); + $ArtistName = display_artists($ArtistForm, false, true); + $ArtistLink = display_artists($ArtistForm, true, true); + + if($IsFilled) { + $DisplayLink = $ArtistLink."".$Title." [".$Year."]"; + } else { + $DisplayLink = $ArtistLink.$Title." [".$Year."]"; + } + $FullName = $ArtistName.$Title." [".$Year."]"; + + if($BitrateList != "") { + $BitrateString = implode(", ", explode("|", $BitrateList)); + $FormatString = implode(", ", explode("|", $FormatList)); + $MediaString = implode(", ", explode("|", $MediaList)); + } else { + $BitrateString = "Unknown, please read the description."; + $FormatString = "Unknown, please read the description."; + $MediaString = "Unknown, please read the description."; + } + + if(empty($ReleaseType)) { + $ReleaseName = "Unknown"; + } else { + $ReleaseName = $ReleaseTypes[$ReleaseType]; + } + +} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") { + $FullName = $Title." [".$Year."]"; + $DisplayLink = $Title." [".$Year."]"; +} else { + $FullName = $Title; + $DisplayLink = $Title; +} + +//Votes time +$RequestVotes = get_votes_array($RequestID); +$VoteCount = count($RequestVotes['Voters']); +$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))); +$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2); +$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests')); + +$JsonMusicInfo = array(); +if ($CategoryName == "Music") { + $JsonMusicInfo = array( + /*'composers' => $ArtistForm[4] != null ? $ArtistForm[4] : array(), + 'dj' => $ArtistForm[6] != null ? $ArtistForm[6] : array(), + 'artists' => $ArtistForm[1] != null ? $ArtistForm[1] : array(), + 'with' => $ArtistForm[2] != null ? $ArtistForm[2] : array(), + 'conductor' => $ArtistForm[5] != null ? $ArtistForm[5] : array(), + 'remixedBy' => $ArtistForm[3] != null ? $ArtistForm[3] : array()*/ + 'composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), + 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), + 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), + 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), + 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), + 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]) + ); +} + +$JsonTopContributors = array(); +$VoteMax = ($VoteCount < 5 ? $VoteCount : 5); +for($i = 0; $i < $VoteMax; $i++) { + $User = array_shift($RequestVotes['Voters']); + $JsonTopContributors[] = array( + 'userId' => (int) $User['UserID'], + 'userName' => $User['Username'], + 'bounty' => (int) $User['Bounty'] + ); +} +reset($RequestVotes['Voters']); + +$Results = $Cache->get_value('request_comments_'.$RequestID); +if($Results === false) { + $DB->query("SELECT + COUNT(c.ID) + FROM requests_comments as c + WHERE c.RequestID = '$RequestID'"); + list($Results) = $DB->next_record(); + $Cache->cache_value('request_comments_'.$RequestID, $Results, 0); +} + +list($Page,$Limit) = page_limit(TORRENT_COMMENTS_PER_PAGE,$Results); + +//Get the cache catalogue +$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE); +$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE; + +//---------- Get some data to start processing + +// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page +$Catalogue = $Cache->get_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID); +if($Catalogue === false) { + $DB->query("SELECT + c.ID, + c.AuthorID, + c.AddedTime, + c.Body, + c.EditedUserID, + c.EditedTime, + u.Username + FROM requests_comments as c + LEFT JOIN users_main AS u ON u.ID=c.EditedUserID + WHERE c.RequestID = '$RequestID' + ORDER BY c.ID + LIMIT $CatalogueLimit"); + $Catalogue = $DB->to_array(false,MYSQLI_ASSOC); + $Cache->cache_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID, $Catalogue, 0); +} + +//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue +$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true); + +$JsonRequestComments = array(); +foreach($Thread as $Key => $Post){ + list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post); + list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID)); + $JsonRequestComments[] = array( + 'postId' => (int) $PostID, + 'authorId' => (int) $AuthorID, + 'name' => $Username, + 'donor' => $Donor == 1, + 'warned' => ($Warned!='0000-00-00 00:00:00'), + 'enabled' => ($Enabled == 2 ? false : true), + 'class' => make_class_string($PermissionID), + 'addedTime' => $AddedTime, + 'avatar' => $Avatar, + 'comment' => $Text->full_format($Body), + 'editedUserId' => (int) $EditedUserID, + 'editedUsername' => $EditedUsername, + 'editedTime' => $EditedTime + ); +} + +$JsonTags = array(); +foreach($Request['Tags'] as $Tag) { + $JsonTags[] = $Tag; +} + +print + json_encode( + array( + 'status' => 'success', + 'response' => array( + 'requestId' => (int) $RequestID, + 'requestorId' => (int) $RequestorID, + 'requestorName' => $RequestorName, + 'requestTax' => $RequestTax, + 'timeAdded' => $TimeAdded, + 'canEdit' => $CanEdit, + 'canVote' => $CanVote, + 'minimumVote' => $MinimumVote, + 'voteCount' => $VoteCount, + 'lastVote' => $LastVote, + 'topContributors' => $JsonTopContributors, + 'totalBounty' => (int) $RequestVotes['TotalBounty'], + 'categoryId' => (int) $CategoryID, + 'categoryName' => $CategoryName, + 'title' => $Title, + 'year' => (int) $Year, + 'image' => $Image, + 'description' => $Text->full_format($Description), + 'musicInfo' => $JsonMusicInfo, + 'catalogueNumber' => $CatalogueNumber, + 'releaseType' => (int) $ReleaseType, + 'releaseName' => $ReleaseName, + 'bitrateList' => $BitrateList, + 'formatList' => $FormatList, + 'mediaList' => $MediaList, + 'logCue' => $LogCue, + 'isFilled' => $IsFilled, + 'fillerId' => (int) $FillerID, + 'fillerName' => $FillerName, + 'torrentId' => (int) $TorrentID, + 'timeFilled' => $TimeFilled, + 'tags' => $JsonTags, + 'comments' => $JsonRequestComments, + 'commentPage' => (int) $Page, + 'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE) + ) + ) + ); + +function pullmediainfo($Array) { + $NewArray = array(); + foreach ($Array as $Item) { + $NewArray[] = array( + 'id' => (int) $Item['id'], + 'name' => $Item['name'] + ); + } + return $NewArray; +} +?> diff --git a/sections/ajax/torrentgroup.php b/sections/ajax/torrentgroup.php index ecf285dc..1b89fd6d 100644 --- a/sections/ajax/torrentgroup.php +++ b/sections/ajax/torrentgroup.php @@ -1,9 +1,12 @@ $Text->full_format($TorrentDetails['WikiBody']), + 'wikiImage' => $TorrentDetails['WikiImage'], + 'id' => (int) $TorrentDetails['ID'], + 'name' => $TorrentDetails['Name'], + 'year' => (int) $TorrentDetails['Year'], + 'recordLabel' => $TorrentDetails['RecordLabel'], + 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], + 'releaseType' => (int) $TorrentDetails['ReleaseType'], + 'categoryId' => (int) $TorrentDetails['CategoryID'], + 'time' => $TorrentDetails['Time'], + 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, +); $TorrentList = array(); foreach ($TorrentCache[1] as $Torrent) { $TorrentList[] = filter_by_key($Torrent, $TorrentAllowed); } +$JsonTorrentList = array(); +foreach ($TorrentList as $Torrent) { + $JsonTorrentList[] = array( + 'id' => (int) $Torrent['ID'], + 'media' => $Torrent['Media'], + 'format' => $Torrent['Format'], + 'encoding' => $Torrent['Encoding'], + 'remastered' => $Torrent['Remastered'] == 1, + 'remasterYear' => (int) $Torrent['RemasterYear'], + 'remasterTitle' => $Torrent['RemasterTitle'], + 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], + 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], + 'scene' => $Torrent['Scene'] == 1, + 'hasLog' => $Torrent['HasLog'] == 1, + 'hasCue' => $Torrent['HasCue'] == 1, + 'logScore' => (int) $Torrent['LogScore'], + 'fileCount' => (int) $Torrent['FileCount'], + 'size' => (int) $Torrent['Size'], + 'seeders' => (int) $Torrent['Seeders'], + 'leechers' => (int) $Torrent['Leechers'], + 'snatched' => (int) $Torrent['Snatched'], + 'freeTorrent' => $Torrent['FreeTorrent'] == 1, + 'time' => $Torrent['Time'], + 'description' => $Torrent['Description'], + 'fileList' => $Torrent['FileList'], + 'filePath' => $Torrent['FilePath'], + 'userId' => (int) $Torrent['UserID'], + 'username' => $Torrent['Username'] + ); +} -header('Content-Type: text/plain; charset=utf-8'); - -print json_encode(array('status' => 'success', 'response' => array('group' => $TorrentDetails, 'torrents' => $TorrentList))); +print json_encode(array('status' => 'success', 'response' => array('group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList))); diff --git a/sections/ajax/usersearch.php b/sections/ajax/usersearch.php index e926835a..46d5c5d0 100644 --- a/sections/ajax/usersearch.php +++ b/sections/ajax/usersearch.php @@ -41,7 +41,7 @@ 'userId' => (int) $UserID, 'username' => $Username, 'donor' => $Donor == 1, - 'warned' => $Warned == 1, + 'warned' => ($Warned!='0000-00-00 00:00:00'), 'enabled' => ($Enabled == 2 ? false : true), 'class' => make_class_string($PermissionID) ); @@ -57,4 +57,4 @@ 'results' => $JsonUsers ) ) - ); \ No newline at end of file + ); diff --git a/sections/log/index.php b/sections/log/index.php index 4976c887..493db7cb 100644 --- a/sections/log/index.php +++ b/sections/log/index.php @@ -89,40 +89,43 @@ } switch ($MessageParts[$i]) { case "Torrent": - $TorrentID = $MessageParts[++$i]; + case "torrent": + $TorrentID = $MessageParts[$i + 1]; if (is_numeric($TorrentID)) { - $Message = $Message.' Torrent '.$TorrentID.''; + $Message = $Message.' '.$MessageParts[$i].' '.$TorrentID.''; + $i++; } else { - $Message = $Message.' Torrent '.$TorrentID; + $Message = $Message.' '.$MessageParts[$i]; } break; case "Request": - $RequestID = $MessageParts[++$i]; + $RequestID = $MessageParts[$i + 1]; if (is_numeric($RequestID)) { - $Message = $Message.' Request '.$RequestID.''; + $Message = $Message.' '.$MessageParts[$i].' '.$RequestID.''; + $i++; } else { - $Message = $Message.' Request '.$RequestID; + $Message = $Message.' '.$MessageParts[$i]; } break; case "Artist": - $ArtistID = $MessageParts[++$i]; + case "artist": + $ArtistID = $MessageParts[$i + 1]; if (is_numeric($ArtistID)) { - $Message = $Message.' Artist '.$ArtistID.''; + $Message = $Message.' '.$MessageParts[$i].' '.$ArtistID.''; + $i++; } else { - $Message = $Message.' Artist '.$ArtistID; + $Message = $Message.' '.$MessageParts[$i]; } break; case "group": - $GroupID = $MessageParts[++$i]; - $Message = $Message.' group '.$GroupID.''; - break; - case "torrent": - $TorrentID = substr($MessageParts[++$i], 0, strlen($MessageParts[$i]) - 1); - if (is_numeric($TorrentID)) { - $Message = $Message.' torrent '.$TorrentID.','; + case "Group": + $GroupID = $MessageParts[$i + 1]; + if (is_numeric($GroupID)) { + $Message = $Message.' '.$MessageParts[$i].' '.$GroupID.''; } else { - $Message = $Message.' torrent '.$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; } + $i++; break; case "by": $UserID = 0; @@ -143,7 +146,7 @@ if(!isset($Usernames[$User])) { $DB->query("SELECT ID FROM users_main WHERE Username = '".$User."'"); list($UserID) = $DB->next_record(); - $Usernames[$User] = $UserID; + $Usernames[$User] = $UserID ? $UserID : ''; } else { $UserID = $Usernames[$User]; } @@ -176,6 +179,32 @@ } $Message = $Message." ".$MessageParts[$i]; break; + case "marked": + if ($i == 1) { + $User = $MessageParts[$i - 1]; + if(!isset($Usernames[$User])) { + $DB->query("SELECT ID FROM users_main WHERE Username = '".$User."'"); + list($UserID) = $DB->next_record(); + $Usernames[$User] = $UserID ? $UserID : ''; + $DB->set_query_id($Log); + } else { + $UserID = $Usernames[$User]; + } + $URL = $Usernames[$User] ? ''.$User."" : $User; + $Message = $URL." ".$MessageParts[$i]; + } else { + $Message = $Message.' '.$MessageParts[$i]; + } + break; + case "Collage": + $CollageID = $MessageParts[$i + 1]; + if (is_numeric($CollageID)) { + $Message = $Message.' '.$MessageParts[$i].' '.$CollageID.''; + $i++; + } else { + $Message = $Message.' '.$MessageParts[$i]; + } + break; default: $Message = $Message." ".$MessageParts[$i]; } diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php index e81b7d2c..e032d0c6 100644 --- a/sections/torrents/browse2.php +++ b/sections/torrents/browse2.php @@ -193,7 +193,7 @@ function header_link($SortKey,$DefaultWay="desc") { if(!empty($_GET[$Search])) { $_GET[$Search] = str_replace(array('%'), '', $_GET[$Search]); if($Search == 'filelist') { - $Queries[]='@filelist "'.$SS->EscapeString(strtr($_GET['filelist'], '.', " ")).'"~20'; + $Queries[]='@filelist "'.$SS->EscapeString($_GET['filelist']).'"~20'; } else { $Words = explode(' ', $_GET[$Search]); foreach($Words as $Key => &$Word) {