diff --git a/sections/ajax/browse.php b/sections/ajax/browse.php index b9a6ad58..39b97971 100644 --- a/sections/ajax/browse.php +++ b/sections/ajax/browse.php @@ -518,14 +518,14 @@ $JsonGroup = $Data; } $JsonGroups[] = array( - 'groupId' => $GroupID, + 'groupId' => (int) $GroupID, 'groupName' => $GroupName, 'tags' => $TagList, - 'torrentId' => $TorrentID, - 'categoryId' => $Categories[$CategoryID-1], - 'totalSnatched' => $TotalSnatched, - 'totalSeeders' => $TotalSeeders, - 'totalLeechers' => $TotalLeechers, + 'torrentId' => (int) $TorrentID, + 'categoryId' => (int) $Categories[$CategoryID-1], + 'totalSnatched' => (int) $TotalSnatched, + 'totalSeeders' => (int) $TotalSeeders, + 'totalLeechers' => (int) $TotalLeechers, 'group' => $JsonGroup ); } @@ -542,4 +542,4 @@ ) ); -?> \ No newline at end of file +?> diff --git a/sections/ajax/index.php b/sections/ajax/index.php index 7f194246..a112c1cc 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -47,6 +47,8 @@ case 'top10': require(SERVER_ROOT.'/sections/ajax/top10/index.php'); break; + case 'browse': + require(SERVER_ROOT.'/sections/ajax/browse.php'); case 'usersearch': require(SERVER_ROOT.'/sections/ajax/usersearch.php'); break; @@ -78,6 +80,9 @@ case 'notifications': require(SERVER_ROOT.'/sections/ajax/notifications.php'); break; + case 'request': + require(SERVER_ROOT.'/sections/ajax/request.php'); + break; default: // If they're screwing around with the query string print json_encode(array('status' => 'failure')); diff --git a/sections/ajax/user.php b/sections/ajax/user.php index fbcff70f..4f0f5002 100644 --- a/sections/ajax/user.php +++ b/sections/ajax/user.php @@ -1,6 +1,10 @@ query("SELECT COUNT(ID) FROM torrents WHERE UserID='$UserID'"); list($Uploads) = $DB->next_record(); } else { - $Uploads = 0; + $Uploads = null; } if (check_paranoia_here('artistsadded')) { @@ -115,22 +118,34 @@ function check_paranoia_here($Setting) { if (check_paranoia_here('uploaded')) { $UploadedRank = $Rank->get_rank('uploaded', $Uploaded); +} else { + $UploadedRank = null; } if (check_paranoia_here('downloaded')) { $DownloadedRank = $Rank->get_rank('downloaded', $Downloaded); +} else { + $DownloadedRank = null; } if (check_paranoia_here('uploads+')) { $UploadsRank = $Rank->get_rank('uploads', $Uploads); +} else { + $UploadsRank = null; } if (check_paranoia_here('requestsfilled_count')) { $RequestRank = $Rank->get_rank('requests', $RequestsFilled); +} else { + $RequestRank = null; } $PostRank = $Rank->get_rank('posts', $ForumPosts); if (check_paranoia_here('requestsvoted_bounty')) { $BountyRank = $Rank->get_rank('bounty', $TotalSpent); +} else { + $BountyRank = null; } if (check_paranoia_here('artistsadded')) { $ArtistsRank = $Rank->get_rank('artists', $ArtistsAdded); +} else { + $ArtistsRank = null; } if($Downloaded == 0) { @@ -140,13 +155,17 @@ function check_paranoia_here($Setting) { } else { $Ratio = round($Uploaded/$Downloaded, 2); } -if (!check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { - $OverallRank = $Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio); +if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { + $OverallRank = floor($Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio)); +} else { + $OverallRank = null; } // Community section +if(check_paranoia_here(array('snatched', 'snatched+'))) { $DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'"); list($Snatched, $UniqueSnatched) = $DB->next_record(); +} if (check_paranoia_here(array('torrentcomments', 'torrentcomments+'))) { $DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'"); @@ -189,21 +208,21 @@ function check_paranoia_here($Setting) { } if (!$OwnProfile) { - unset($torrent_pass); + $torrent_pass = ""; } // Run through some paranoia stuff to decide what we can send out. if (!check_paranoia_here('lastseen')) { - unset($LastAccess); + $LastAccess = ""; } if (!check_paranoia_here('uploaded')) { - unset($Uploaded); + $Uploaded = null; } if (!check_paranoia_here('downloaded')) { - unset($Downloaded); + $Downloaded = null; } if (isset($RequiredRatio) && !check_paranoia_here('requiredratio')) { - unset($RequiredRatio); + $RequiredRatio = null; } if($ParanoiaLevel == 0) { $ParanoiaLevelText = 'Off'; @@ -224,13 +243,14 @@ function check_paranoia_here($Setting) { 'username' => $Username, 'avatar' => $Avatar, 'isFriend' => $Friend, + 'profileText' => $Text->full_format($Info), 'stats' => array( 'joinedDate' => $JoinDate, 'lastAccess' => $LastAccess, - 'uploaded' => $Uploaded, - 'downloaded' => $Downloaded, + 'uploaded' => $Uploaded == null ? null : (int) $Uploaded, + 'downloaded' => $Downloaded == null ? null: (int) $Downloaded, 'ratio' => $Ratio, - 'requiredRatio' => $RequiredRatio + 'requiredRatio' => $RequiredRatio == null ? null : (float) $RequiredRatio ), 'ranks' => array( 'uploaded' => $UploadedRank, @@ -240,32 +260,34 @@ function check_paranoia_here($Setting) { 'bounty' => $BountyRank, 'posts' => $PostRank, 'artists' => $ArtistsRank, - 'overall' => $OverallRank + 'overall' => $OverallRank == null ? 0 : $OverallRank ), 'personal' => array( 'class' => $ClassLevels[$Class]['Name'], 'paranoia' => $ParanoiaLevel, 'paranoiaText' => $ParanoiaLevelText, - 'donor' => $Donor, - 'warned' => ($Warned!='0000-00-00 00:00:00'), + 'donor' => $Donor == 1, + 'warned' => ($Warned != '0000-00-00 00:00:00'), 'enabled' => ($Enabled == '1' || $Enabled == '0' || !$Enabled), 'passkey' => $torrent_pass ), 'community' => array( - 'posts' => $ForumPosts, - 'torrentComments' => $NumComments, - 'collagesStarted' => $NumCollages, - 'collagesContrib' => $NumCollageContribs, - 'requestsFilled' => $RequestsFilled, - 'requestsVoted' => $RequestsVoted, - 'uploaded' => $Uploads, - 'groups' => $UniqueGroups, - 'seeding' => $Seeding, - 'leeching' => $Leeching, - 'snatched' => $Snatched, - 'invited' => $Invited - ) + 'posts' => (int) $ForumPosts, + 'torrentComments' => (int)$NumComments, + 'collagesStarted' => $NumCollages == null ? null : (int) $NumCollages, + 'collagesContrib' => $NumCollageContribs == null ? null : (int) $NumCollageContribs, + 'requestsFilled' => $RequestsFilled == null ? null : (int) $RequestsFilled, + 'requestsVoted' => $RequestsVoted == null ? null : (int) $RequestsVoted, + 'perfectFlacs' => $PerfectFLACs == null ? null : (int) $PerfectFlacs, + 'uploaded' => $Uploads == null ? null : (int) $Uploads, + 'groups' => $UniqueGroups == null ? null : (int) $UniqueGroups, + 'seeding' => $Seeding == null ? null : (int) $Seeding, + 'leeching' => $Leeching == null ? null : (int) $Leeching, + 'snatched' => $Snatched == null ? null : (int) $Snatched, + 'invited' => $Invited == null ? null : (int) $Invited + ) ) ) ); // <- He's sad. ?> + diff --git a/sections/staffpm/assign.php b/sections/staffpm/assign.php index f87c7472..60353a7a 100644 --- a/sections/staffpm/assign.php +++ b/sections/staffpm/assign.php @@ -50,6 +50,7 @@ } else { // Assign to user $DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', AssignedToUser=$NewLevel WHERE ID=$ConvID"); + } echo '1';