diff --git a/sections/user/takemoderate.php b/sections/user/takemoderate.php index 425298b7..638c7c16 100644 --- a/sections/user/takemoderate.php +++ b/sections/user/takemoderate.php @@ -181,6 +181,7 @@ $UpdateSet = array(); $EditSummary = array(); +$TrackerUserUpdates = array('passkey' => $Cur['torrent_pass']); if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) { $DB->query(" @@ -418,6 +419,7 @@ $UpdateSet[] = "Visible = '$Visible'"; $EditSummary[] = 'visibility changed'; $LightUpdates['Visible'] = $Visible; + $TrackerUserUpdates['visible'] = $Visible; } if ($Uploaded != $Cur['Uploaded'] && $Uploaded != $_POST['OldUploaded'] && (check_perms('users_edit_ratio') @@ -541,7 +543,7 @@ if (!empty($UserReason)) { Misc::send_pm($UserID, 0, 'Your leeching privileges have been disabled', "Your leeching privileges have been disabled. The reason given was: [quote]{$UserReason}[/quote] If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&name=IRC+-+How+to+join]here[/url].'); } - Tracker::update_tracker('update_user', array('passkey' => $Cur['torrent_pass'], 'can_leech' => $DisableLeech)); + $TrackerUserUpdates['can_leech'] = $DisableLeech; } if ($DisableInvites != $Cur['DisableInvites'] && check_perms('users_disable_any')) { @@ -635,9 +637,11 @@ $EnableStr = 'account '.translateUserStatus($Cur['Enabled']).'->'.translateUserStatus($EnableUser); if ($EnableUser == '2') { Tools::disable_users($UserID, '', 1); + $TrackerUserUpdates = array(); } elseif ($EnableUser == '1') { $Cache->increment('stats_user_count'); - Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'])); + $VisibleTrIP = $Visible && $Cur['IP'] != '127.0.0.1' ? '1' : '0'; + Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP)); if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) { $UpdateSet[] = "i.RatioWatchEnds = '0000-00-00 00:00:00'"; $CanLeech = 1; @@ -650,7 +654,7 @@ $UpdateSet[] = "i.RatioWatchDownload = m.Downloaded"; $CanLeech = 0; } - Tracker::update_tracker('update_user', array('passkey' => $Cur['torrent_pass'], 'can_leech' => '0')); + $TrackerUserUpdates['can_leech'] = 0; } $UpdateSet[] = "Enabled = '1'"; $LightUpdates['Enabled'] = 1; @@ -664,6 +668,7 @@ $UpdateSet[] = "torrent_pass = '$Passkey'"; $EditSummary[] = 'passkey reset'; $HeavyUpdates['torrent_pass'] = $Passkey; + $TrackerUserUpdates['passkey'] = $Passkey; $Cache->delete_value('user_'.$Cur['torrent_pass']); //MUST come after the case for updating can_leech. @@ -756,6 +761,10 @@ } } +if (count($TrackerUserUpdates) > 1) { + Tracker::update_tracker('update_user', $TrackerUserUpdates); +} + if ($DeleteKeys) { $Cache->delete_value("user_info_$UserID"); $Cache->delete_value("user_info_heavy_$UserID");