Empty commit

This commit is contained in:
Git 2013-05-14 08:00:34 +00:00
parent 6cbf7e6beb
commit bdb2e4fe12
40 changed files with 441 additions and 370 deletions

View File

@ -61,7 +61,7 @@ public static function get_group_votes($GroupID) {
} else { } else {
$GroupVotes = $DB->next_record(MYSQLI_ASSOC, false); $GroupVotes = $DB->next_record(MYSQLI_ASSOC, false);
} }
$Cache->cache_value('votes_'.$GroupID, $GroupVotes, 259200); $Cache->cache_value('votes_'.$GroupID, $GroupVotes, 259200); // 3 days
} }
return $GroupVotes; return $GroupVotes;
} }
@ -211,7 +211,7 @@ public static function get_rank_all($GroupID) {
while (list($GID) = $DB->next_record()) { while (list($GID) = $DB->next_record()) {
$Rankings[$GID] = ++$i; $Rankings[$GID] = ++$i;
} }
$Cache->cache_value('voting_ranks_overall', $Rankings, 259200); $Cache->cache_value('voting_ranks_overall', $Rankings, 259200); // 3 days
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;
@ -246,7 +246,7 @@ public static function get_rank_year($GroupID, $Year) {
while (list($GID) = $DB->next_record()) { while (list($GID) = $DB->next_record()) {
$Rankings[$GID] = ++$i; $Rankings[$GID] = ++$i;
} }
$Cache->cache_value('voting_ranks_year_'.$Year , $Rankings, 259200); $Cache->cache_value('voting_ranks_year_'.$Year , $Rankings, 259200); // 3 days
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;
@ -286,7 +286,7 @@ public static function get_rank_decade($GroupID, $Year) {
while (list($GID) = $DB->next_record()) { while (list($GID) = $DB->next_record()) {
$Rankings[$GID] = ++$i; $Rankings[$GID] = ++$i;
} }
$Cache->cache_value('voting_ranks_decade_'.$Year , $Rankings, 259200); $Cache->cache_value('voting_ranks_decade_'.$Year , $Rankings, 259200); // 3 days
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;

View File

@ -102,13 +102,13 @@ function check_perms($PermissionName, $MinClass = 0) {
*/ */
function json_die($Status, $Message) { function json_die($Status, $Message) {
if ($Status == "success" && $Message) { if ($Status == "success" && $Message) {
print json_encode(array('status' => $Status, 'response' => $Message)); print json_encode(array('status' => $Status, 'response' => $Message));
} else if ($Message) { } else if ($Message) {
print json_encode(array('status' => $Status, 'error' => $Message)); print json_encode(array('status' => $Status, 'error' => $Message));
} else { } else {
print json_encode(array('status' => $Status)); print json_encode(array('status' => $Status));
} }
die(); die();
} }
?> ?>

View File

@ -75,8 +75,8 @@
} }
json_die("success", array( json_die("success", array(
'announcements' => $JsonAnnouncements, 'announcements' => $JsonAnnouncements,
'blogPosts' => $JsonBlog 'blogPosts' => $JsonBlog
)); ));
?> ?>

View File

@ -8,12 +8,12 @@ function compare($X, $Y) {
$Text = new TEXT; $Text = new TEXT;
if ($_GET['id'] && $_GET['artistname']) { if ($_GET['id'] && $_GET['artistname']) {
json_die("failure", "bad parameters"); json_die("failure", "bad parameters");
} }
$ArtistID = $_GET['id']; $ArtistID = $_GET['id'];
if ($ArtistID && !is_number($ArtistID)) { if ($ArtistID && !is_number($ArtistID)) {
json_die("failure"); json_die("failure");
} }
if (empty($ArtistID)) { if (empty($ArtistID)) {
@ -21,8 +21,7 @@ function compare($X, $Y) {
$Name = db_string(trim($_GET['artistname'])); $Name = db_string(trim($_GET['artistname']));
$DB->query("SELECT ArtistID FROM artists_alias WHERE Name LIKE '$Name'"); $DB->query("SELECT ArtistID FROM artists_alias WHERE Name LIKE '$Name'");
if (!(list($ArtistID) = $DB->next_record(MYSQLI_NUM, false))) { if (!(list($ArtistID) = $DB->next_record(MYSQLI_NUM, false))) {
//if (list($ID) = $DB->next_record(MYSQLI_NUM, false)) { json_die("failure");
json_die("failure");
} }
// If we get here, we got the ID! // If we get here, we got the ID!
} }
@ -70,7 +69,7 @@ function compare($X, $Y) {
$DB->query($sql); $DB->query($sql);
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
json_die("failure"); json_die("failure");
} }
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0)); list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
@ -260,8 +259,8 @@ function compare($X, $Y) {
} }
$NumSimilar = count($SimilarArray); $NumSimilar = count($SimilarArray);
} else { } else {
//If data already exists, use it //If data already exists, use it
foreach ($SimilarArray as $Similar) { foreach ($SimilarArray as $Similar) {
$JsonSimilar[] = array( $JsonSimilar[] = array(
'artistId' => (int) $Similar['ArtistID'], 'artistId' => (int) $Similar['ArtistID'],
'name' => $Similar['Name'], 'name' => $Similar['Name'],
@ -313,24 +312,24 @@ function compare($X, $Y) {
$Cache->cache_value($Key, $Data, 3600); $Cache->cache_value($Key, $Data, 3600);
json_die("success", array( json_die("success", array(
'id' => (int) $ArtistID, 'id' => (int) $ArtistID,
'name' => $Name, 'name' => $Name,
'notificationsEnabled' => $notificationsEnabled, 'notificationsEnabled' => $notificationsEnabled,
'hasBookmarked' => Bookmarks::has_bookmarked('artist', $ArtistID), 'hasBookmarked' => Bookmarks::has_bookmarked('artist', $ArtistID),
'image' => $Image, 'image' => $Image,
'body' => $Text->full_format($Body), 'body' => $Text->full_format($Body),
'vanityHouse' => $VanityHouseArtist == 1, 'vanityHouse' => $VanityHouseArtist == 1,
'tags' => array_values($Tags), 'tags' => array_values($Tags),
'similarArtists' => $JsonSimilar, 'similarArtists' => $JsonSimilar,
'statistics' => array( 'statistics' => array(
'numGroups' => $NumGroups, 'numGroups' => $NumGroups,
'numTorrents' => $NumTorrents, 'numTorrents' => $NumTorrents,
'numSeeders' => $NumSeeders, 'numSeeders' => $NumSeeders,
'numLeechers' => $NumLeechers, 'numLeechers' => $NumLeechers,
'numSnatches' => $NumSnatches 'numSnatches' => $NumSnatches
), ),
'torrentgroup' => $JsonTorrents, 'torrentgroup' => $JsonTorrents,
'requests' => $JsonRequests 'requests' => $JsonRequests
)); ));
?> ?>

View File

@ -3,7 +3,7 @@
$DB->query(" $DB->query("
SELECT SELECT
t.ID AS TorrentID, t.ID AS TorrentID,
t.GroupID AS GroupID t.GroupID AS GroupID
FROM xbt_files_users AS x FROM xbt_files_users AS x
JOIN torrents AS t ON t.ID=x.fid JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC' WHERE t.Format='FLAC'

View File

@ -515,10 +515,10 @@ function header_link($SortKey,$DefaultWay = 'desc') {
} }
json_die("success", array( json_die("success", array(
'results' => array(), 'results' => array(),
'youMightLike' => $JsonYouMightLike 'youMightLike' => $JsonYouMightLike
)); ));
} }
$Bookmarks = Bookmarks::all_bookmarks('torrent'); $Bookmarks = Bookmarks::all_bookmarks('torrent');
@ -710,7 +710,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
} }
json_die("success", array( json_die("success", array(
'currentPage' => intval($Page), 'currentPage' => intval($Page),
'pages' => ceil($TorrentCount / TORRENTS_PER_PAGE), 'pages' => ceil($TorrentCount / TORRENTS_PER_PAGE),
'results' => $JsonGroups 'results' => $JsonGroups
)); ));

View File

@ -60,16 +60,16 @@
} }
if (!isset($Forums[$ForumID])) { if (!isset($Forums[$ForumID])) {
json_die("failure"); json_die("failure");
} }
// Make sure they're allowed to look at the page // Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) { if (!check_perms('site_moderate_forums')) {
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
json_die("failure", "unsufficient permissions to view page"); json_die("failure", "unsufficient permissions to view page");
} }
} }
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
json_die("failure", "unsufficient permissions to view page"); json_die("failure", "unsufficient permissions to view page");
} }
$ForumName = display_str($Forums[$ForumID]['Name']); $ForumName = display_str($Forums[$ForumID]['Name']);

View File

@ -24,7 +24,7 @@
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]"); $DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
list($ThreadID) = $DB->next_record(); list($ThreadID) = $DB->next_record();
if ($ThreadID) { if ($ThreadID) {
//Redirect postid to threadid when necessary. //Redirect postid to threadid when necessary.
header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]"); header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]");
die(); die();
} else { } else {

View File

@ -16,7 +16,7 @@
$Limited_Pages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup'); $Limited_Pages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup');
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
// Enforce rate limiting everywhere except info.php // Enforce rate limiting everywhere except info.php
if (isset($_GET['action']) && in_array($_GET['action'],$Limited_Pages)) { if (isset($_GET['action']) && in_array($_GET['action'],$Limited_Pages)) {
if (!$userrequests = $Cache->get_value('ajax_requests_'.$UserID)) { if (!$userrequests = $Cache->get_value('ajax_requests_'.$UserID)) {

View File

@ -92,24 +92,24 @@
} }
json_die("success", array( json_die("success", array(
'username' => $LoggedUser['Username'], 'username' => $LoggedUser['Username'],
'id' => (int) $LoggedUser['ID'], 'id' => (int) $LoggedUser['ID'],
'authkey' => $LoggedUser['AuthKey'], 'authkey' => $LoggedUser['AuthKey'],
'passkey' => $LoggedUser['torrent_pass'], 'passkey' => $LoggedUser['torrent_pass'],
'notifications' => array( 'notifications' => array(
'messages' => (int) $NewMessages, 'messages' => (int) $NewMessages,
'notifications' => (int) $NewNotifications, 'notifications' => (int) $NewNotifications,
'newAnnouncement' => $MyNews < $CurrentNews, 'newAnnouncement' => $MyNews < $CurrentNews,
'newBlog' => $MyBlog < $CurrentBlog, 'newBlog' => $MyBlog < $CurrentBlog,
'newSubscriptions' => $NewSubscriptions == 1 'newSubscriptions' => $NewSubscriptions == 1
), ),
'userstats' => array( 'userstats' => array(
'uploaded' => (int) $LoggedUser['BytesUploaded'], 'uploaded' => (int) $LoggedUser['BytesUploaded'],
'downloaded' => (int) $LoggedUser['BytesDownloaded'], 'downloaded' => (int) $LoggedUser['BytesDownloaded'],
'ratio' => (float) $Ratio, 'ratio' => (float) $Ratio,
'requiredratio' => (float) $LoggedUser['RequiredRatio'], 'requiredratio' => (float) $LoggedUser['RequiredRatio'],
'class' => $ClassLevels[$LoggedUser['Class']]['Name'] 'class' => $ClassLevels[$LoggedUser['Class']]['Name']
) )
)); ));
?> ?>

View File

@ -1,6 +1,6 @@
<? <?
if (!check_perms('site_torrents_notify')) { if (!check_perms('site_torrents_notify')) {
json_die("failure"); json_die("failure");
} }
define('NOTIFICATIONS_PER_PAGE', 50); define('NOTIFICATIONS_PER_PAGE', 50);
@ -101,8 +101,8 @@
} }
json_die("success", array( json_die("success", array(
'currentPages' => intval($Page), 'currentPages' => intval($Page),
'pages' => ceil($TorrentCount / NOTIFICATIONS_PER_PAGE), 'pages' => ceil($TorrentCount / NOTIFICATIONS_PER_PAGE),
'numNew' => $NumNew, 'numNew' => $NumNew,
'results' => $JsonNotifications 'results' => $JsonNotifications
)); ));

View File

@ -101,7 +101,7 @@
'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]) 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7])
); );
} else { } else {
$JsonMusicInfo = new stdClass; //json_encodes into an empty object: {} $JsonMusicInfo = new stdClass; //json_encodes into an empty object: {}
} }
$JsonTopContributors = array(); $JsonTopContributors = array();
@ -185,42 +185,42 @@
} }
json_die("success", array( json_die("success", array(
'requestId' => (int) $RequestID, 'requestId' => (int) $RequestID,
'requestorId' => (int) $RequestorID, 'requestorId' => (int) $RequestorID,
'requestorName' => $RequestorName, 'requestorName' => $RequestorName,
'isBookmarked' => Bookmarks::has_bookmarked('request', $RequestID), 'isBookmarked' => Bookmarks::has_bookmarked('request', $RequestID),
'requestTax' => $RequestTax, 'requestTax' => $RequestTax,
'timeAdded' => $TimeAdded, 'timeAdded' => $TimeAdded,
'canEdit' => $CanEdit, 'canEdit' => $CanEdit,
'canVote' => $CanVote, 'canVote' => $CanVote,
'minimumVote' => $MinimumVote, 'minimumVote' => $MinimumVote,
'voteCount' => $VoteCount, 'voteCount' => $VoteCount,
'lastVote' => $LastVote, 'lastVote' => $LastVote,
'topContributors' => $JsonTopContributors, 'topContributors' => $JsonTopContributors,
'totalBounty' => (int) $RequestVotes['TotalBounty'], 'totalBounty' => (int) $RequestVotes['TotalBounty'],
'categoryId' => (int) $CategoryID, 'categoryId' => (int) $CategoryID,
'categoryName' => $CategoryName, 'categoryName' => $CategoryName,
'title' => $Title, 'title' => $Title,
'year' => (int) $Year, 'year' => (int) $Year,
'image' => $Image, 'image' => $Image,
'description' => $Text->full_format($Description), 'description' => $Text->full_format($Description),
'musicInfo' => $JsonMusicInfo, 'musicInfo' => $JsonMusicInfo,
'catalogueNumber' => $CatalogueNumber, 'catalogueNumber' => $CatalogueNumber,
'releaseType' => (int) $ReleaseType, 'releaseType' => (int) $ReleaseType,
'releaseName' => $ReleaseName, 'releaseName' => $ReleaseName,
'bitrateList' => $BitrateList, 'bitrateList' => $BitrateList,
'formatList' => $FormatList, 'formatList' => $FormatList,
'mediaList' => $MediaList, 'mediaList' => $MediaList,
'logCue' => $LogCue, 'logCue' => $LogCue,
'isFilled' => $IsFilled, 'isFilled' => $IsFilled,
'fillerId' => (int) $FillerID, 'fillerId' => (int) $FillerID,
'fillerName' => $FillerName, 'fillerName' => $FillerName,
'torrentId' => (int) $TorrentID, 'torrentId' => (int) $TorrentID,
'timeFilled' => $TimeFilled, 'timeFilled' => $TimeFilled,
'tags' => $JsonTags, 'tags' => $JsonTags,
'comments' => $JsonRequestComments, 'comments' => $JsonRequestComments,
'commentPage' => (int) $Page, 'commentPage' => (int) $Page,
'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE) 'commentPages' => (int) ceil($Results / TORRENT_COMMENTS_PER_PAGE)
)); ));
?> ?>

View File

@ -28,7 +28,7 @@
if (!empty($_GET['userid'])) { if (!empty($_GET['userid'])) {
if (is_number($_GET['userid'])) { if (is_number($_GET['userid'])) {
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
json_die("failure"); json_die("failure");
} }
$Title = "Requests voted for by ".$UserInfo['Username']; $Title = "Requests voted for by ".$UserInfo['Username'];
$SS->set_filter('voter', array($_GET['userid'])); $SS->set_filter('voter', array($_GET['userid']));
@ -290,11 +290,11 @@
$Requests = $SphinxResults['matches']; $Requests = $SphinxResults['matches'];
if ($NumResults == 0) { if ($NumResults == 0) {
json_die("success", array( json_die("success", array(
'currentPage' => 1, 'currentPage' => 1,
'pages' => 1, 'pages' => 1,
'results' => array() 'results' => array()
)); ));
} else { } else {
$JsonResults = array(); $JsonResults = array();
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18 $TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
@ -353,10 +353,10 @@
'timeFilled' => $TimeFilled == 0 ? '' : $TimeFilled 'timeFilled' => $TimeFilled == 0 ? '' : $TimeFilled
); );
} }
json_die("success", array( json_die("success", array(
'currentPage' => intval($Page), 'currentPage' => intval($Page),
'pages' => ceil($NumResults / REQUESTS_PER_PAGE), 'pages' => ceil($NumResults / REQUESTS_PER_PAGE),
'results' => $JsonResults 'results' => $JsonResults
)); ));
} }
?> ?>

View File

@ -4,7 +4,7 @@
*/ */
if (!empty($LoggedUser['DisableForums'])) { if (!empty($LoggedUser['DisableForums'])) {
json_die('failure'); json_die('failure');
} }
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
@ -104,6 +104,6 @@
} }
json_die('success', array( json_die('success', array(
'threads' => $JsonPosts 'threads' => $JsonPosts
)); ));
?> ?>

View File

@ -23,10 +23,12 @@
echo 'badvote'; echo 'badvote';
die(); die();
} }
$Type = ($_REQUEST['vote'] == 'up')?"Up":"Down"; $Type = ($_REQUEST['vote'] == 'up') ? 'Up' : 'Down';
// Update the two votes tables if needed // Update the two votes tables if needed
$DB->query("INSERT IGNORE INTO users_votes (UserID, GroupID, Type) VALUES ($UserID, $GroupID, '$Type')"); $DB->query("
INSERT IGNORE INTO users_votes (UserID, GroupID, Type)
VALUES ($UserID, $GroupID, '$Type')");
if ($DB->affected_rows() == 0) { if ($DB->affected_rows() == 0) {
echo 'noaction'; echo 'noaction';
die(); die();
@ -34,7 +36,7 @@
// Update the group's cache key // Update the group's cache key
$GroupVotes['Total'] += 1; $GroupVotes['Total'] += 1;
if ($Type == "Up") { if ($Type == 'Up') {
$GroupVotes['Ups'] += 1; $GroupVotes['Ups'] += 1;
} }
$Cache->cache_value('votes_'.$GroupID, $GroupVotes); $Cache->cache_value('votes_'.$GroupID, $GroupVotes);
@ -43,10 +45,10 @@
// so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE... // so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE...
// to accomplish both in one query // to accomplish both in one query
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score) $DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
VALUES ($GroupID, 1, ".($Type=='Up'?1:0).", 0) VALUES ($GroupID, 1, ".($Type == 'Up' ? 1 : 0).", 0)
ON DUPLICATE KEY UPDATE Total = Total + 1, ON DUPLICATE KEY UPDATE Total = Total + 1,
Score = IFNULL(binomial_ci(Ups".($Type=='Up'?'+1':'').",Total),0)". Score = IFNULL(binomial_ci(Ups".($Type == 'Up' ? '+1' : '').",Total),0)".
($Type=='Up'?', Ups = Ups+1':'')); ($Type == 'Up' ? ', Ups = Ups+1' : ''));
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type); $UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
@ -72,8 +74,8 @@
} }
} else { } else {
$VotePairs[$Vote['GroupID']] = array('GroupID'=>$Vote['GroupID'], $VotePairs[$Vote['GroupID']] = array('GroupID'=>$Vote['GroupID'],
'Total' => 1, 'Total' => 1,
'Ups'=>($Type == 'Up')?1:0); 'Ups'=>($Type == 'Up') ? 1 : 0);
} }
} }
} }
@ -101,8 +103,8 @@
} }
} else { } else {
$VotePairs[$GroupID] = array('GroupID' => $GroupID, $VotePairs[$GroupID] = array('GroupID' => $GroupID,
'Total' => 1, 'Total' => 1,
'Ups'=>($Type == 'Up')?1:0); 'Ups'=>($Type == 'Up') ? 1 : 0);
} }
$Cache->cache_value('vote_pairs_'.$VGID, $VotePairs); $Cache->cache_value('vote_pairs_'.$VGID, $VotePairs);
} }
@ -117,7 +119,10 @@
} }
$Type = $UserVotes[$GroupID]['Type']; $Type = $UserVotes[$GroupID]['Type'];
$DB->query("DELETE FROM users_votes WHERE UserID=$UserID AND GroupID=$GroupID"); $DB->query("
DELETE FROM users_votes
WHERE UserID=$UserID
AND GroupID=$GroupID");
// Update personal cache key // Update personal cache key
unset($UserVotes[$GroupID]); unset($UserVotes[$GroupID]);
@ -125,15 +130,17 @@
// Update the group's cache key // Update the group's cache key
$GroupVotes['Total'] -= 1; $GroupVotes['Total'] -= 1;
if ($Type == "Up") { if ($Type == 'Up') {
$GroupVotes['Ups'] -= 1; $GroupVotes['Ups'] -= 1;
} }
$Cache->cache_value('votes_'.$GroupID, $GroupVotes); $Cache->cache_value('votes_'.$GroupID, $GroupVotes);
$DB->query("UPDATE torrents_votes SET Total = GREATEST(0, Total - 1), $DB->query("
Score = IFNULL(binomial_ci(GREATEST(0,Ups".($Type == 'Up' ? '-1' : '')."),GREATEST(0, Total)),0)". UPDATE torrents_votes
($Type == 'Up' ? ', Ups = GREATEST(0, Ups - 1)' : '')." SET Total = GREATEST(0, Total - 1),
WHERE GroupID=$GroupID"); Score = IFNULL(binomial_ci(GREATEST(0,Ups".($Type == 'Up' ? '-1' : '')."),GREATEST(0, Total)),0)".
($Type == 'Up' ? ', Ups = GREATEST(0, Ups - 1)' : '')."
WHERE GroupID=$GroupID");
// Update paired cache keys // Update paired cache keys
// First update this album's paired votes. If this keys is magically not set, // First update this album's paired votes. If this keys is magically not set,
// our life just got a bit easier. We're only tracking paired votes on upvotes. // our life just got a bit easier. We're only tracking paired votes on upvotes.

View File

@ -86,7 +86,7 @@
} }
json_die("success", array( json_die("success", array(
'page' => (int) $Page, 'page' => (int) $Page,
'pages' => ceil($Results / TORRENT_COMMENTS_PER_PAGE), 'pages' => ceil($Results / TORRENT_COMMENTS_PER_PAGE),
'comments' => $JsonComments 'comments' => $JsonComments
)); ));

View File

@ -10,34 +10,34 @@
$TorrentHash = (string)$_GET['hash']; $TorrentHash = (string)$_GET['hash'];
if ($TorrentID && $TorrentHash) { if ($TorrentID && $TorrentHash) {
json_die("failure", "bad parameters"); json_die("failure", "bad parameters");
} }
if ($TorrentHash) { if ($TorrentHash) {
if (!is_valid_torrenthash($TorrentHash)) { if (!is_valid_torrenthash($TorrentHash)) {
json_die("failure", "bad hash parameter"); json_die("failure", "bad hash parameter");
} else { } else {
$TorrentID = (int)torrenthash_to_torrentid($TorrentHash); $TorrentID = (int)torrenthash_to_torrentid($TorrentHash);
if (!$TorrentID) { if (!$TorrentID) {
json_die("failure", "bad hash parameter"); json_die("failure", "bad hash parameter");
} }
} }
} }
if ($TorrentID <= 0) { if ($TorrentID <= 0) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
$TorrentCache = get_torrent_info($TorrentID, true, 0, true, true); $TorrentCache = get_torrent_info($TorrentID, true, 0, true, true);
if (!$TorrentCache) { if (!$TorrentCache) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
list($TorrentDetails, $TorrentList) = $TorrentCache; list($TorrentDetails, $TorrentList) = $TorrentCache;
if (!isset($TorrentList[$TorrentID])) { if (!isset($TorrentList[$TorrentID])) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
$GroupID = $TorrentDetails['ID']; $GroupID = $TorrentDetails['ID'];
@ -85,37 +85,37 @@
// Convert file list back to the old format // Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']); $FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) { foreach ($FileList as &$File) {
$File = Torrents::filelist_old_format($File); $File = Torrents::filelist_old_format($File);
} }
unset($File); unset($File);
$FileList = implode('|||', $FileList); $FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']); $Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array( $JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'], 'id' => (int) $Torrent['ID'],
'media' => $Torrent['Media'], 'media' => $Torrent['Media'],
'format' => $Torrent['Format'], 'format' => $Torrent['Format'],
'encoding' => $Torrent['Encoding'], 'encoding' => $Torrent['Encoding'],
'remastered' => $Torrent['Remastered'] == 1, 'remastered' => $Torrent['Remastered'] == 1,
'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterYear' => (int) $Torrent['RemasterYear'],
'remasterTitle' => $Torrent['RemasterTitle'], 'remasterTitle' => $Torrent['RemasterTitle'],
'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'],
'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
'scene' => $Torrent['Scene'] == 1, 'scene' => $Torrent['Scene'] == 1,
'hasLog' => $Torrent['HasLog'] == 1, 'hasLog' => $Torrent['HasLog'] == 1,
'hasCue' => $Torrent['HasCue'] == 1, 'hasCue' => $Torrent['HasCue'] == 1,
'logScore' => (int) $Torrent['LogScore'], 'logScore' => (int) $Torrent['LogScore'],
'fileCount' => (int) $Torrent['FileCount'], 'fileCount' => (int) $Torrent['FileCount'],
'size' => (int) $Torrent['Size'], 'size' => (int) $Torrent['Size'],
'seeders' => (int) $Torrent['Seeders'], 'seeders' => (int) $Torrent['Seeders'],
'leechers' => (int) $Torrent['Leechers'], 'leechers' => (int) $Torrent['Leechers'],
'snatched' => (int) $Torrent['Snatched'], 'snatched' => (int) $Torrent['Snatched'],
'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'freeTorrent' => $Torrent['FreeTorrent'] == 1,
'time' => $Torrent['Time'], 'time' => $Torrent['Time'],
'description' => $Torrent['Description'], 'description' => $Torrent['Description'],
'fileList' => $FileList, 'fileList' => $FileList,
'filePath' => $Torrent['FilePath'], 'filePath' => $Torrent['FilePath'],
'userId' => (int) $Torrent['UserID'], 'userId' => (int) $Torrent['UserID'],
'username' => $Userinfo['Username'] 'username' => $Userinfo['Username']
); );
json_die("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList))); json_die("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));

View File

@ -12,28 +12,28 @@
$TorrentHash = (string)$_GET['hash']; $TorrentHash = (string)$_GET['hash'];
if ($GroupID && $TorrentHash) { if ($GroupID && $TorrentHash) {
json_die("failure", "bad parameters"); json_die("failure", "bad parameters");
} }
if ($TorrentHash) { if ($TorrentHash) {
if (!is_valid_torrenthash($TorrentHash)) { if (!is_valid_torrenthash($TorrentHash)) {
json_die("failure", "bad hash parameter"); json_die("failure", "bad hash parameter");
} else { } else {
$GroupID = (int)torrenthash_to_groupid($TorrentHash); $GroupID = (int)torrenthash_to_groupid($TorrentHash);
if (!$GroupID) { if (!$GroupID) {
json_die("failure", "bad hash parameter"); json_die("failure", "bad hash parameter");
} }
} }
} }
if ($GroupID <= 0) { if ($GroupID <= 0) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
$TorrentCache = get_group_info($GroupID, true, 0, true, true); $TorrentCache = get_group_info($GroupID, true, 0, true, true);
if (!$TorrentCache) { if (!$TorrentCache) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
list($TorrentDetails, $TorrentList) = $TorrentCache; list($TorrentDetails, $TorrentList) = $TorrentCache;

View File

@ -2,7 +2,9 @@
require(SERVER_ROOT.'/sections/torrents/functions.php'); require(SERVER_ROOT.'/sections/torrents/functions.php');
$GroupID = (int)$_GET['id']; $GroupID = (int)$_GET['id'];
if ($GroupID == 0) { error('bad id parameter', true); } if ($GroupID == 0) {
error('bad id parameter', true);
}
$TorrentDetails = get_group_info($GroupID, true, 0, false); $TorrentDetails = get_group_info($GroupID, true, 0, false);
$TorrentDetails = $TorrentDetails[0]; $TorrentDetails = $TorrentDetails[0];
@ -12,5 +14,5 @@
} }
json_die("success", array( json_die("success", array(
'wikiImage' => $Image 'wikiImage' => $Image
)); ));

View File

@ -4,7 +4,7 @@
$Text = new TEXT; $Text = new TEXT;
if (empty($_GET['id']) || !is_numeric($_GET['id'])) { if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
json_die("failure", "bad id parameter"); json_die("failure", "bad id parameter");
} }
$UserID = $_GET['id']; $UserID = $_GET['id'];
@ -51,7 +51,7 @@
GROUP BY AuthorID"); GROUP BY AuthorID");
if ($DB->record_count() == 0) { // If user doesn't exist if ($DB->record_count() == 0) { // If user doesn't exist
json_die("failure", "no such user"); json_die("failure", "no such user");
} }
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11)); list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11));
@ -249,58 +249,58 @@ function check_paranoia_here($Setting) {
//Bugfix for no access time available //Bugfix for no access time available
if ($LastAccess == '0000-00-00 00:00:00') { if ($LastAccess == '0000-00-00 00:00:00') {
$LastAccess = ''; $LastAccess = '';
} }
header('Content-Type: text/plain; charset=utf-8'); header('Content-Type: text/plain; charset=utf-8');
json_die("success", array( json_die("success", array(
'username' => $Username, 'username' => $Username,
'avatar' => $Avatar, 'avatar' => $Avatar,
'isFriend' => $Friend, 'isFriend' => $Friend,
'profileText' => $Text->full_format($Info), 'profileText' => $Text->full_format($Info),
'stats' => array( 'stats' => array(
'joinedDate' => $JoinDate, 'joinedDate' => $JoinDate,
'lastAccess' => $LastAccess, 'lastAccess' => $LastAccess,
'uploaded' => $Uploaded == null ? null : (int) $Uploaded, 'uploaded' => $Uploaded == null ? null : (int) $Uploaded,
'downloaded' => $Downloaded == null ? null : (int) $Downloaded, 'downloaded' => $Downloaded == null ? null : (int) $Downloaded,
'ratio' => $Ratio, 'ratio' => $Ratio,
'requiredRatio' => $RequiredRatio == null ? null : (float) $RequiredRatio 'requiredRatio' => $RequiredRatio == null ? null : (float) $RequiredRatio
), ),
'ranks' => array( 'ranks' => array(
'uploaded' => $UploadedRank, 'uploaded' => $UploadedRank,
'downloaded' => $DownloadedRank, 'downloaded' => $DownloadedRank,
'uploads' => $UploadsRank, 'uploads' => $UploadsRank,
'requests' => $RequestRank, 'requests' => $RequestRank,
'bounty' => $BountyRank, 'bounty' => $BountyRank,
'posts' => $PostRank, 'posts' => $PostRank,
'artists' => $ArtistsRank, 'artists' => $ArtistsRank,
'overall' => $OverallRank == null ? 0 : $OverallRank 'overall' => $OverallRank == null ? 0 : $OverallRank
), ),
'personal' => array( 'personal' => array(
'class' => $ClassLevels[$Class]['Name'], 'class' => $ClassLevels[$Class]['Name'],
'paranoia' => $ParanoiaLevel, 'paranoia' => $ParanoiaLevel,
'paranoiaText' => $ParanoiaLevelText, 'paranoiaText' => $ParanoiaLevelText,
'donor' => $Donor == 1, 'donor' => $Donor == 1,
'warned' => ($Warned != '0000-00-00 00:00:00'), 'warned' => ($Warned != '0000-00-00 00:00:00'),
'enabled' => ($Enabled == '1' || $Enabled == '0' || !$Enabled), 'enabled' => ($Enabled == '1' || $Enabled == '0' || !$Enabled),
'passkey' => $torrent_pass 'passkey' => $torrent_pass
), ),
'community' => array( 'community' => array(
'posts' => (int) $ForumPosts, 'posts' => (int) $ForumPosts,
'torrentComments' => (int) $NumComments, 'torrentComments' => (int) $NumComments,
'collagesStarted' => $NumCollages == null ? null : (int) $NumCollages, 'collagesStarted' => $NumCollages == null ? null : (int) $NumCollages,
'collagesContrib' => $NumCollageContribs == null ? null : (int) $NumCollageContribs, 'collagesContrib' => $NumCollageContribs == null ? null : (int) $NumCollageContribs,
'requestsFilled' => $RequestsFilled == null ? null : (int) $RequestsFilled, 'requestsFilled' => $RequestsFilled == null ? null : (int) $RequestsFilled,
'requestsVoted' => $RequestsVoted == null ? null : (int) $RequestsVoted, 'requestsVoted' => $RequestsVoted == null ? null : (int) $RequestsVoted,
'perfectFlacs' => $PerfectFLACs == null ? null : (int) $PerfectFLACs, 'perfectFlacs' => $PerfectFLACs == null ? null : (int) $PerfectFLACs,
'uploaded' => $Uploads == null ? null : (int) $Uploads, 'uploaded' => $Uploads == null ? null : (int) $Uploads,
'groups' => $UniqueGroups == null ? null : (int) $UniqueGroups, 'groups' => $UniqueGroups == null ? null : (int) $UniqueGroups,
'seeding' => $Seeding == null ? null : (int) $Seeding, 'seeding' => $Seeding == null ? null : (int) $Seeding,
'leeching' => $Leeching == null ? null : (int) $Leeching, 'leeching' => $Leeching == null ? null : (int) $Leeching,
'snatched' => $Snatched == null ? null : (int) $Snatched, 'snatched' => $Snatched == null ? null : (int) $Snatched,
'invited' => $Invited == null ? null : (int) $Invited 'invited' => $Invited == null ? null : (int) $Invited
) )
)); ));
?> ?>

View File

@ -4,7 +4,7 @@
**********************************************************************/ **********************************************************************/
if (empty($_GET['search'])) { if (empty($_GET['search'])) {
json_die("failure", "no search terms"); json_die("failure", "no search terms");
} else { } else {
$_GET['username'] = $_GET['search']; $_GET['username'] = $_GET['search'];
} }
@ -49,7 +49,7 @@
} }
json_die("success", array( json_die("success", array(
'currentPage' => (int) $Page, 'currentPage' => (int) $Page,
'pages' => ceil($NumResults / USERS_PER_PAGE), 'pages' => ceil($NumResults / USERS_PER_PAGE),
'results' => $JsonUsers 'results' => $JsonUsers
)); ));

View File

@ -10,7 +10,7 @@
} elseif ($_GET['name'] != '') { //Retrieve article ID via alias. } elseif ($_GET['name'] != '') { //Retrieve article ID via alias.
$ArticleID = $Alias->to_id($_GET['name']); $ArticleID = $Alias->to_id($_GET['name']);
} else { } else {
json_die("failure"); json_die("failure");
} }
if (!$ArticleID) { //No article found if (!$ArticleID) { //No article found
@ -29,13 +29,13 @@
$TextBody = $Text->full_format($Body, false); $TextBody = $Text->full_format($Body, false);
json_die("success", array( json_die("success", array(
'title' => $Title, 'title' => $Title,
'bbBody' => $Body, 'bbBody' => $Body,
'body' => $TextBody, 'body' => $TextBody,
'aliases' => $Aliases, 'aliases' => $Aliases,
'authorID' => (int) $AuthorID, 'authorID' => (int) $AuthorID,
'authorName' => $AuthorName, 'authorName' => $AuthorName,
'date' => $Date, 'date' => $Date,
'revision' => (int) $Revision 'revision' => (int) $Revision
)); ));
?> ?>

View File

@ -750,7 +750,7 @@ function compare($X, $Y) {
$Tags = Requests::get_tags($RequestID); $Tags = Requests::get_tags($RequestID);
$ReqTagList = array(); $ReqTagList = array();
foreach ($Tags as $TagID => $TagName) { foreach ($Tags as $TagID => $TagName) {
$ReqTagList[] = "<a href=\"requests.php?tags=".$TagName.'">'.display_str($TagName).'</a>'; $ReqTagList[] = "<a href=\"requests.php?tags=".$TagName.'">'.display_str($TagName).'</a>';
} }
$ReqTagList = implode(', ', $ReqTagList); $ReqTagList = implode(', ', $ReqTagList);
?> ?>

View File

@ -1,5 +1,6 @@
<?php <?php
if (!check_perms('users_warn')) { error(404); if (!check_perms('users_warn')) {
error(404);
} }
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'artistid', 'postid', 'userid')); Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'artistid', 'postid', 'userid'));

View File

@ -1,7 +1,8 @@
<? <?
if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) { if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) {
$DB->query("SELECT t.ID AS TorrentID, $DB->query("SELECT
t.GroupID AS GroupID t.ID AS TorrentID,
t.GroupID AS GroupID
FROM xbt_files_users AS x FROM xbt_files_users AS x
JOIN torrents AS t ON t.ID=x.fid JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC' WHERE t.Format='FLAC'

View File

@ -131,7 +131,9 @@
$SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")"; $SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")";
} }
} else { } else {
if (!check_paranoia('collages', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('collages', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$SQL .= " AND UserID='".$_GET['userid']."'"; $SQL .= " AND UserID='".$_GET['userid']."'";
} }
$Categories[] = 0; $Categories[] = 0;

View File

@ -25,8 +25,14 @@ function btc_address($UserID, $GenAddress = false) {
if (!empty($Addr)) { return $Addr; } if (!empty($Addr)) { return $Addr; }
elseif ($GenAddress) { elseif ($GenAddress) {
if (empty($NewAddr)) { error(0); } if (empty($NewAddr)) {
$DB->query("UPDATE users_info SET BitcoinAddress = '".db_string($NewAddr)."' WHERE UserID = '".$UserID."' AND BitcoinAddress IS NULL"); error(0);
}
$DB->query("
UPDATE users_info
SET BitcoinAddress = '".db_string($NewAddr)."'
WHERE UserID = '$UserID'
AND BitcoinAddress IS NULL");
return $NewAddr; return $NewAddr;
} else { } else {
return false; return false;

View File

@ -331,7 +331,7 @@
if (count($Queries) > 0) { if (count($Queries) > 0) {
$Query = implode(' ',$Queries); $Query = implode(' ',$Queries);
} else { } else {
$Query=''; $Query = '';
} }
$SS->set_index('requests requests_delta'); $SS->set_index('requests requests_delta');
@ -646,11 +646,11 @@
<?=Format::get_size($RequestVotes['TotalBounty'])?> <?=Format::get_size($RequestVotes['TotalBounty'])?>
</td> </td>
<td> <td>
<? if ($IsFilled) { ?> <? if ($IsFilled) { ?>
<a href="torrents.php?<?=(strtotime($TimeFilled) < $TimeCompare ? 'id=' : 'torrentid=').$TorrentID?>"><strong><?=time_diff($TimeFilled)?></strong></a> <a href="torrents.php?<?=(strtotime($TimeFilled) < $TimeCompare ? 'id=' : 'torrentid=').$TorrentID?>"><strong><?=time_diff($TimeFilled)?></strong></a>
<? } else { ?> <? } else { ?>
<strong>No</strong> <strong>No</strong>
<? } ?> <? } ?>
</td> </td>
<td> <td>
<? if ($IsFilled) { ?> <? if ($IsFilled) { ?>

View File

@ -21,45 +21,55 @@
if ($Length != 'verbal') { if ($Length != 'verbal') {
$Time = ((int) $Length) * (7 * 24 * 60 * 60); $Time = ((int) $Length) * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - " . $Reason); Tools::warn_user($UserID, $Time, "$URL - " . $Reason);
$Subject = "You have received a warning"; $Subject = 'You have received a warning';
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage; $PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$WarnTime = time_plus($Time); $WarnTime = time_plus($Time);
$AdminComment = date("Y-m-d") . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n"; $AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} else { } else {
$Subject = "You have received a verbal warning"; $Subject = 'You have received a verbal warning';
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage; $PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n"; $AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} }
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) $DB->query("
. "') INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)"); ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Tools::update_user_notes($UserID, $AdminComment); Tools::update_user_notes($UserID, $AdminComment);
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage); Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
$DB->query("SELECT $DB->query("
rc.Body, SELECT
rc.AuthorID, rc.Body,
rc.RequestID, rc.AuthorID,
rc.AddedTime rc.RequestID,
FROM requests_comments AS rc rc.AddedTime
WHERE rc.ID='".db_string($_POST['post'])."'"); FROM requests_comments AS rc
WHERE rc.ID='".db_string($_POST['post'])."'");
list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record(); list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM requests_comments WHERE RequestID = $GroupID AND ID <= $PostID"); $DB->query("
SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page
FROM requests_comments
WHERE RequestID = $GroupID AND ID <= $PostID");
list($Page) = $DB->next_record(); list($Page) = $DB->next_record();
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); } if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
if ($DB->record_count()==0) { error(404); } error(404);
}
if ($DB->record_count() == 0) {
error(404);
}
// Perform the update // Perform the update
$DB->query("UPDATE requests_comments SET $DB->query("
Body = '" . db_string($Body) . "', UPDATE requests_comments
EditedUserID = '".$LoggedUser['ID']."', SET
EditedTime = '".sqltime()."' Body = '" . db_string($Body) . "',
WHERE ID='".$PostID."'"); EditedUserID = '".$LoggedUser['ID']."',
EditedTime = '".sqltime()."'
WHERE ID='".$PostID."'");
// Update the cache // Update the cache
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE); $CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID); $Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
$Cache->update_row($Key, array( $Cache->update_row($Key, array(
@ -73,8 +83,9 @@
)); ));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body) $DB->query("
VALUES ('requests', ".$PostID.", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')"); INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('requests', $PostID, " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
header("Location: requests.php?id=$GroupID&postid=$PostID#post$PostID"); header("Location: requests.php?id=$GroupID&postid=$PostID#post$PostID");

View File

@ -17,7 +17,7 @@
$Err = 'You forgot to supply a link to the filling torrent'; $Err = 'You forgot to supply a link to the filling torrent';
} else { } else {
$Link = $_POST['link']; $Link = $_POST['link'];
if (preg_match("/".TORRENT_REGEX."/i", $Link, $Matches) < 1) { if (preg_match('/'.TORRENT_REGEX.'/i', $Link, $Matches) < 1) {
$Err = "Your link didn't seem to be a valid torrent link"; $Err = "Your link didn't seem to be a valid torrent link";
} else { } else {
$TorrentID = $Matches[0]; $TorrentID = $Matches[0];
@ -113,7 +113,7 @@
}*/ }*/
//WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD //WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD
//$WEBOverride = ((strpos($MediaList, 'WEB') !== false) && $Media == "WEB"); //$WEBOverride = ((strpos($MediaList, 'WEB') !== false) && $Media == "WEB");
//$VinylOverride = ((strpos($MediaList, 'Vinyl') !== false) && $Media == "Vinyl"); //$VinylOverride = ((strpos($MediaList, 'Vinyl') !== false) && $Media == "Vinyl");
//if ($Format == 'FLAC' && $LogCue && !$WEBOverride && !$VinylOverride) { //if ($Format == 'FLAC' && $LogCue && !$WEBOverride && !$VinylOverride) {
if ($Format == 'FLAC' && $LogCue && $Media == 'CD') { if ($Format == 'FLAC' && $LogCue && $Media == 'CD') {
@ -189,9 +189,10 @@
Misc::write_log("Request $RequestID (".$FullName.") was filled by user $FillerID (".$FillerUsername.") with the torrent $TorrentID for a ".Format::get_size($RequestVotes['TotalBounty']).' bounty.'); 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 // Give bounty
$DB->query("UPDATE users_main $DB->query("
SET Uploaded = (Uploaded + ".$RequestVotes['TotalBounty'].") UPDATE users_main
WHERE ID = $FillerID"); SET Uploaded = (Uploaded + ".$RequestVotes['TotalBounty'].")
WHERE ID = $FillerID");

View File

@ -1,7 +1,11 @@
<? <?
if (!check_perms('site_debug')) { error(403); } if (!check_perms('site_debug')) {
error(403);
}
if (!isset($_GET['case']) || !$Analysis = $Cache->get_value('analysis_'.$_GET['case'])) { error(404); } if (!isset($_GET['case']) || !$Analysis = $Cache->get_value('analysis_'.$_GET['case'])) {
error(404);
}
View::show_header('Case Analysis'); View::show_header('Case Analysis');
?> ?>

View File

@ -1,22 +1,24 @@
<?php <?php
if (!check_perms('admin_manage_ipbans')) { error(403); } if (!check_perms('admin_manage_ipbans')) {
if (isset($_GET['perform'])) { error(403);
$IPA = substr($_GET['ip'], 0, strcspn($_GET['ip'], '.')); }
if ($_GET['perform'] == 'delete') { if (isset($_GET['perform'])) {
if (!is_number($_GET['id']) || $_GET['id'] == '') { $IPA = substr($_GET['ip'], 0, strcspn($_GET['ip'], '.'));
error(0); if ($_GET['perform'] == 'delete') {
} if (!is_number($_GET['id']) || $_GET['id'] == '') {
$DB->query('DELETE FROM ip_bans WHERE ID='.$_GET['id']); error(0);
$Bans = $Cache->delete_value('ip_bans_'.$IPA);
} elseif ($_GET['perform'] == 'create') {
$Notes = db_string($_GET['notes']);
$IP = Tools::ip_to_unsigned($_GET['ip']); //Sanitized by Validation regex
$DB->query("INSERT INTO ip_bans
(FromIP, ToIP, Reason) VALUES
('$IP','$IP', '$Notes')");
$Cache->delete_value('ip_bans_'.$IPA);
} }
$DB->query('DELETE FROM ip_bans WHERE ID='.$_GET['id']);
$Bans = $Cache->delete_value('ip_bans_'.$IPA);
} elseif ($_GET['perform'] == 'create') {
$Notes = db_string($_GET['notes']);
$IP = Tools::ip_to_unsigned($_GET['ip']); //Sanitized by Validation regex
$DB->query("
INSERT INTO ip_bans (FromIP, ToIP, Reason)
VALUES ('$IP','$IP', '$Notes')");
$Cache->delete_value('ip_bans_'.$IPA);
}
} }

View File

@ -2,7 +2,9 @@
ini_set('memory_limit', '5G'); ini_set('memory_limit', '5G');
set_time_limit(0); set_time_limit(0);
//if (!check_perms('site_debug')) { error(403); } //if (!check_perms('site_debug')) {
// error(403);
//}
View::show_header(); View::show_header();
@ -12,32 +14,32 @@
shell_exec('rm GeoLiteCity-latest.zip'); shell_exec('rm GeoLiteCity-latest.zip');
if (($Locations = file("GeoLiteCity_".date('Ym')."07/GeoLiteCity-Location.csv", FILE_IGNORE_NEW_LINES)) === false) { if (($Locations = file("GeoLiteCity_".date('Ym')."07/GeoLiteCity-Location.csv", FILE_IGNORE_NEW_LINES)) === false) {
error("Download or extraction of maxmind database failed"); error('Download or extraction of maxmind database failed');
} }
array_shift($Locations); array_shift($Locations);
array_shift($Locations); array_shift($Locations);
echo "There are ".count($Locations)." locations"; echo 'There are '.count($Locations).' locations';
echo "<br />"; echo '<br />';
$CountryIDs = array(); $CountryIDs = array();
foreach ($Locations as $Location) { foreach ($Locations as $Location) {
$Parts = explode(",", $Location); $Parts = explode(',', $Location);
//CountryIDs[1] = "AP"; //CountryIDs[1] = "AP";
$CountryIDs[trim($Parts[0], '"')] = trim($Parts[1], '"'); $CountryIDs[trim($Parts[0], '"')] = trim($Parts[1], '"');
} }
echo "There are ".count($CountryIDs)." CountryIDs"; echo 'There are '.count($CountryIDs).' CountryIDs';
echo "<br />"; echo '<br />';
if (($Blocks = file("GeoLiteCity_".date('Ym')."07/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) { if (($Blocks = file("GeoLiteCity_".date('Ym')."07/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) {
echo "Error"; echo 'Error';
} }
array_shift($Blocks); array_shift($Blocks);
array_shift($Blocks); array_shift($Blocks);
echo "There are ".count($Blocks)." blocks"; echo 'There are '.count($Blocks).' blocks';
echo "<br />"; echo '<br />';
//Because 4,000,000 rows is a lot for any server to handle, we split it into manageable groups of 10,000 //Because 4,000,000 rows is a lot for any server to handle, we split it into manageable groups of 10,000
$SplitOn = 10000; $SplitOn = 10000;
@ -49,15 +51,19 @@
$StartIP = trim($StartIP, '"'); $StartIP = trim($StartIP, '"');
$EndIP = trim($EndIP, '"'); $EndIP = trim($EndIP, '"');
$CountryID = trim($CountryID, '"'); $CountryID = trim($CountryID, '"');
$Values[] = "('".$StartIP."', '".$EndIP."', '".$CountryIDs[$CountryID]."')"; $Values[] = "('$StartIP', '$EndIP', '".$CountryIDs[$CountryID]."')";
if ($Index % $SplitOn == 0) { if ($Index % $SplitOn == 0) {
$DB->query("INSERT INTO geoip_country (StartIP, EndIP, Code) VALUES ".implode(", ", $Values)); $DB->query('
INSERT INTO geoip_country (StartIP, EndIP, Code)
VALUES '.implode(', ', $Values));
$Values = array(); $Values = array();
} }
} }
if (count($Values) > 0) { if (count($Values) > 0) {
$DB->query("INSERT INTO geoip_country (StartIP, EndIP, Code) VALUES ".implode(", ", $Values)); $DB->query("
INSERT INTO geoip_country (StartIP, EndIP, Code)
VALUES ".implode(', ', $Values));
} }
@ -73,7 +79,7 @@
} }
enforce_login(); enforce_login();
ini_set('memory_limit',1024*1024*1024); ini_set('memory_limit', 1024 * 1024 * 1024);
ini_set('max_execution_time', 3600); ini_set('max_execution_time', 3600);
header('Content-type: text/plain'); header('Content-type: text/plain');

View File

@ -1,6 +1,8 @@
<? <?
$GroupID = $_GET['groupid']; $GroupID = $_GET['groupid'];
if (!is_number($GroupID)) { error(404); } if (!is_number($GroupID)) {
error(404);
}
View::show_header("History for Group $GroupID"); View::show_header("History for Group $GroupID");
@ -27,8 +29,7 @@
<? <?
$Log = $DB->query("SELECT TorrentID, UserID, Info, Time FROM group_log WHERE GroupID = ".$GroupID." ORDER BY Time DESC"); $Log = $DB->query("SELECT TorrentID, UserID, Info, Time FROM group_log WHERE GroupID = ".$GroupID." ORDER BY Time DESC");
$LogEntries = $DB->to_array(false, MYSQL_NUM); $LogEntries = $DB->to_array(false, MYSQL_NUM);
foreach ($LogEntries AS $LogEntry) foreach ($LogEntries AS $LogEntry) {
{
list($TorrentID, $UserID, $Info, $Time) = $LogEntry; list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
?> ?>
<tr class="rowa"> <tr class="rowa">
@ -39,7 +40,7 @@
list($Media, $Format, $Encoding) = $DB->next_record(); list($Media, $Format, $Encoding) = $DB->next_record();
if ($DB->record_count() == 0) { ?> if ($DB->record_count() == 0) { ?>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)</td><? <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)</td><?
} elseif ($Media == "") { ?> } elseif ($Media == '') { ?>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td><? <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td><?
} else { ?> } else { ?>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (<?=$Format?>/<?=$Encoding?>/<?=$Media?>)</td> <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (<?=$Format?>/<?=$Encoding?>/<?=$Media?>)</td>

View File

@ -1,13 +1,13 @@
<? <?
//Show the "This album is number x overall, etc. box for music only // Show the "This album is number x overall", etc. box for the "Music" category only
if ($GroupCategoryID == 1) { if ($GroupCategoryID == 1) {
$Rankings = Votes::get_ranking($GroupID, $GroupYear); $Rankings = Votes::get_ranking($GroupID, $GroupYear);
$LIs = ''; $LIs = '';
// Display information for the return categories of get_ranking() // Display information for the return categories of get_ranking()
$GroupDecade = $GroupYear - ($GroupYear % 10); $GroupDecade = $GroupYear - ($GroupYear % 10);
$names = array('overall'=>'<a href="top10.php?type=votes">overall</a>', $names = array('overall'=>'<a href="top10.php?type=votes">overall</a>',
'decade'=>check_perms('site_advanced_top10') ? 'for the <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupDecade.'&amp;year2='.($GroupDecade+9).'">'.$GroupDecade.'s</a>' : 'for the '.$GroupDecade.'s', 'decade'=>check_perms('site_advanced_top10') ? 'for the <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupDecade.'&amp;year2='.($GroupDecade+9).'">'.$GroupDecade.'s</a>' : 'for the '.$GroupDecade.'s',
'year'=>check_perms('site_advanced_top10') ? 'for <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupYear.'&amp;year2=">'.$GroupYear.'</a>' : "for $GroupYear"); 'year'=>check_perms('site_advanced_top10') ? 'for <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupYear.'&amp;year2=">'.$GroupYear.'</a>' : "for $GroupYear");
foreach ($names as $key => $text) { foreach ($names as $key => $text) {
if ($Rank = $Rankings[$key]) { if ($Rank = $Rankings[$key]) {
@ -19,7 +19,7 @@
$Class = 'vr_top_50'; $Class = 'vr_top_50';
} }
$LIs .= '<li id="vote_rank_'.$key.'" class="'.$Class.'">No. '.$Rank.' '.$text.'</li>'; $LIs .= "<li id=\"vote_rank_$key\" class=\"$Class\">No. $Rank $text</li>";
} }
} }

View File

@ -355,9 +355,9 @@ function checked($Checked) {
<tr> <tr>
<td class="label">Preset</td> <td class="label">Preset</td>
<td> <td>
<button type="button" onclick="ParanoiaResetOff()">Show everything</button> <input type="button" onclick="ParanoiaResetOff()">Show everything</input>
<button type="button" onclick="ParanoiaResetStats()">Show stats only</button> <input type="button" onclick="ParanoiaResetStats()">Show stats only</input>
<!--<button type="button" onclick="ParanoiaResetOn()">Show nothing</button>--> <!--<input type="button" onclick="ParanoiaResetOn()">Show nothing</input>-->
</td> </td>
</tr> </tr>
<tr> <tr>
@ -477,7 +477,7 @@ function checked($Checked) {
<tr> <tr>
<td class="label"><strong>Reset passkey</strong></td> <td class="label"><strong>Reset passkey</strong></td>
<td> <td>
<label><input type="checkbox" name="resetpasskey" /> <label><input type="checkbox" name="resetpasskey" id="resetpasskey" />
Any active torrents must be downloaded again to continue leeching/seeding.</label> <br /> Any active torrents must be downloaded again to continue leeching/seeding.</label> <br />
<a href="wiki.php?action=article&amp;name=Passkey">See this wiki article for more information.</a> <a href="wiki.php?action=article&amp;name=Passkey">See this wiki article for more information.</a>
</td> </td>
@ -509,7 +509,7 @@ function checked($Checked) {
</tr> </tr>
<tr> <tr>
<td colspan="2" class="right"> <td colspan="2" class="right">
<input type="submit" value="Save Profile" /> <input type="button" value="Save Profile" onclick="userform_submit();"/>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -590,8 +590,10 @@
$Cache->delete_value('user_'.$Cur['torrent_pass']); $Cache->delete_value('user_'.$Cur['torrent_pass']);
//MUST come after the case for updating can_leech. //MUST come after the case for updating can_leech.
$DB->query("INSERT INTO users_history_passkeys $DB->query("
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) VALUES INSERT INTO users_history_passkeys
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime)
VALUES
('$UserID', '".$Cur['torrent_pass']."', '$Passkey', '0.0.0.0', '".sqltime()."')"); ('$UserID', '".$Cur['torrent_pass']."', '$Passkey', '0.0.0.0', '".sqltime()."')");
Tracker::update_tracker('change_passkey', array('oldpasskey' => $Cur['torrent_pass'], 'newpasskey' => $Passkey)); Tracker::update_tracker('change_passkey', array('oldpasskey' => $Cur['torrent_pass'], 'newpasskey' => $Passkey));
} }
@ -621,10 +623,17 @@
$DB->query("SELECT ID, Uploaded, Downloaded FROM users_main WHERE Username LIKE '".$MergeStatsFrom."'"); $DB->query("SELECT ID, Uploaded, Downloaded FROM users_main WHERE Username LIKE '".$MergeStatsFrom."'");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
list($MergeID, $MergeUploaded, $MergeDownloaded) = $DB->next_record(); list($MergeID, $MergeUploaded, $MergeDownloaded) = $DB->next_record();
$DB->query("UPDATE users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID SET um.Uploaded = 0, um.Downloaded = 0, ui.AdminComment = CONCAT('".sqltime()." - Stats merged into https://".SSL_SITE_URL."/user.php?id=".$UserID." (".$Cur['Username'].") by ".$LoggedUser['Username']."\n\n', ui.AdminComment) WHERE ID = ".$MergeID); $DB->query("
UPDATE users_main AS um
JOIN users_info AS ui ON um.ID=ui.UserID
SET
um.Uploaded = 0,
um.Downloaded = 0,
ui.AdminComment = CONCAT('".sqltime()." - Stats (Uploaded: ".Format::get_size($MergeUploaded).", Downloaded: ".Format::get_size($MergeDownloaded).", Ratio: ".Format::get_ratio($MergeUploaded, $MergeDownloaded).") merged into https://".SSL_SITE_URL."/user.php?id=".$UserID." (".$Cur['Username'].") by ".$LoggedUser['Username']."\n\n', ui.AdminComment)
WHERE ID = ".$MergeID);
$UpdateSet[] = "Uploaded = Uploaded + '$MergeUploaded'"; $UpdateSet[] = "Uploaded = Uploaded + '$MergeUploaded'";
$UpdateSet[] = "Downloaded = Downloaded + '$MergeDownloaded'"; $UpdateSet[] = "Downloaded = Downloaded + '$MergeDownloaded'";
$EditSummary[] = "stats merged from https://".SSL_SITE_URL."/user.php?id=".$MergeID." (".$MergeStatsFrom.")"; $EditSummary[] = "stats merged from https://".SSL_SITE_URL."/user.php?id=".$MergeID." (".$MergeStatsFrom.") (previous stats: Uploaded: ".Format::get_size($Cur['Uploaded']).", Downloaded: ".Format::get_size($Cur['Downloaded']).", Ratio: ".Format::get_ratio($Cur['Uploaded'], $Cur['Downloaded']).")";
$Cache->delete_value('users_stats_'.$UserID); $Cache->delete_value('users_stats_'.$UserID);
$Cache->delete_value('users_stats_'.$MergeID); $Cache->delete_value('users_stats_'.$MergeID);
} }

View File

@ -13,7 +13,9 @@
} else { } else {
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
} }
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) {
error(404);
}
$UserInfo = Users::user_info($UserID); $UserInfo = Users::user_info($UserID);
$Perms = Permissions::get_permissions($UserInfo['PermissionID']); $Perms = Permissions::get_permissions($UserInfo['PermissionID']);
@ -26,11 +28,15 @@
} }
if (isset($_GET['expire'])) { if (isset($_GET['expire'])) {
if (!check_perms('users_mod')) { error(403); } if (!check_perms('users_mod')) {
error(403);
}
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
$TorrentID = $_GET['torrentid']; $TorrentID = $_GET['torrentid'];
if (!is_number($UserID) || !is_number($TorrentID)) { error(403); } if (!is_number($UserID) || !is_number($TorrentID)) {
error(403);
}
$DB->query("SELECT info_hash FROM torrents where ID = $TorrentID"); $DB->query("SELECT info_hash FROM torrents where ID = $TorrentID");
if (list($InfoHash) = $DB->next_record(MYSQLI_NUM, FALSE)) { if (list($InfoHash) = $DB->next_record(MYSQLI_NUM, FALSE)) {
$DB->query("UPDATE users_freeleeches SET Expired=TRUE WHERE UserID=$UserID AND TorrentID=$TorrentID"); $DB->query("UPDATE users_freeleeches SET Expired=TRUE WHERE UserID=$UserID AND TorrentID=$TorrentID");
@ -44,27 +50,28 @@
list($Page,$Limit) = Format::page_limit(25); list($Page,$Limit) = Format::page_limit(25);
$DB->query("SELECT SQL_CALC_FOUND_ROWS $DB->query("
f.TorrentID, SELECT SQL_CALC_FOUND_ROWS
t.GroupID, f.TorrentID,
f.Time, t.GroupID,
f.Expired, f.Time,
f.Downloaded, f.Expired,
f.Uses, f.Downloaded,
g.Name, f.Uses,
t.Format, g.Name,
t.Encoding t.Format,
FROM users_freeleeches AS f t.Encoding
JOIN torrents AS t ON t.ID = f.TorrentID FROM users_freeleeches AS f
JOIN torrents_group AS g ON g.ID = t.GroupID JOIN torrents AS t ON t.ID = f.TorrentID
WHERE f.UserID = $UserID JOIN torrents_group AS g ON g.ID = t.GroupID
ORDER BY f.Time DESC WHERE f.UserID = $UserID
LIMIT $Limit"); ORDER BY f.Time DESC
LIMIT $Limit");
$Tokens = $DB->to_array(); $Tokens = $DB->to_array();
$DB->query("SELECT FOUND_ROWS()"); $DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record(); list($NumResults) = $DB->next_record();
$Pages=Format::get_pages($Page, $NumResults, 25); $Pages = Format::get_pages($Page, $NumResults, 25);
?> ?>
<div class="header"> <div class="header">
@ -97,10 +104,10 @@
$Name = $ArtistName.$Name; $Name = $ArtistName.$Name;
} }
if ($Format && $Encoding) { if ($Format && $Encoding) {
$Name.=' ['.$Format.' / '.$Encoding.']'; $Name.=" [$Format / $Encoding]";
} }
?> ?>
<tr class="<?=($i?'rowa':'rowb')?>"> <tr class="<?=($i ? 'rowa' : 'rowb')?>">
<td><?=$Name?></td> <td><?=$Name?></td>
<td><?=time_diff($Time)?></td> <td><?=time_diff($Time)?></td>
<td><?=($Expired ? 'Yes' : 'No')?><?=(check_perms('users_mod') && !$Expired)?" <a href=\"userhistory.php?action=token_history&amp;expire=1&amp;userid=$UserID&amp;torrentid=$TorrentID\">(expire)</a>":''?> <td><?=($Expired ? 'Yes' : 'No')?><?=(check_perms('users_mod') && !$Expired)?" <a href=\"userhistory.php?action=token_history&amp;expire=1&amp;userid=$UserID&amp;torrentid=$TorrentID\">(expire)</a>":''?>

View File

@ -19,7 +19,7 @@ function Vote(amount, requestid) {
} }
if (amount > 20*1024*1024) { if (amount > 20*1024*1024) {
upload = $('#current_uploaded').raw().value; upload = $('#current_uploaded').raw().value;
download = $('#current_downloaded').raw().value; download = $('#current_downloaded').raw().value;
rr = $('#current_rr').raw().value; rr = $('#current_rr').raw().value;
if (amount > .3*(upload - rr * download)) { if (amount > .3*(upload - rr * download)) {

View File

@ -155,3 +155,15 @@ function ToggleIdenticons() {
$('#identicons').hide(); $('#identicons').hide();
} }
} }
function userform_submit() {
var userform = jQuery('#userform');
if (jQuery('#resetpasskey').is(':checked')) {
if (confirm('Are you sure you want to reset your passkey?')) {
userform.submit();
}
}
else {
userform.submit();
};
}