mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-19 21:03:54 -07:00
feat: Added ability to hide peer country in peer list (#1891)
* feat: Added ability to hide peer country in peer list * Update displaying_torrent.php * Update displaying_torrent.php * Updated * Update usercp_register.tpl * Update main.php * Update functions.php
This commit is contained in:
parent
f5d65b8911
commit
2555ebce47
5 changed files with 30 additions and 3 deletions
|
@ -462,11 +462,22 @@ if ($tor_reged && $tor_info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$peerCountry = $lang['UNKNOWN'];
|
||||||
|
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_peer_country')) {
|
||||||
|
if ($port !== false && $ip !== false) {
|
||||||
|
if ($infoByIP = infoByIP($ip, $port)) {
|
||||||
|
if (isset($infoByIP['countryCode'])) {
|
||||||
|
$peerCountry = render_flag($infoByIP['countryCode']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_block_vars("$x_full.$x_row", [
|
$template->assign_block_vars("$x_full.$x_row", [
|
||||||
'ROW_BGR' => $row_bgr,
|
'ROW_BGR' => $row_bgr,
|
||||||
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
|
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
|
||||||
'PEER_ID' => $peerTorrentClient,
|
'PEER_ID' => $peerTorrentClient,
|
||||||
'COUNTRY' => render_flag(infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])['countryCode'], false),
|
'COUNTRY' => $peerCountry,
|
||||||
'COMPL_PRC' => $compl_perc,
|
'COMPL_PRC' => $compl_perc,
|
||||||
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,
|
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,
|
||||||
'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "<b>$down_tot</b>" : $down_tot,
|
'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "<b>$down_tot</b>" : $down_tot,
|
||||||
|
|
|
@ -197,7 +197,8 @@ $bf['user_opt'] = [
|
||||||
'dis_post_edit' => 13, // [PROHIBITIONS] Block editing own posts / topics
|
'dis_post_edit' => 13, // [PROHIBITIONS] Block editing own posts / topics
|
||||||
'user_dls' => 14, // [SETTINGS] Hide list of "Current downloads" in my profile
|
'user_dls' => 14, // [SETTINGS] Hide list of "Current downloads" in my profile
|
||||||
'user_retracker' => 15, // [SETTINGS] Add my retracker into downloaded torrent files
|
'user_retracker' => 15, // [SETTINGS] Add my retracker into downloaded torrent files
|
||||||
'user_hide_torrent_client' => 16 // [SETTINGS] Option to hide user's torrent client in peer list
|
'user_hide_torrent_client' => 16, // [SETTINGS] Option to hide user's torrent client in peer list
|
||||||
|
'user_hide_peer_country' => 17 // [SETTINGS] Option to hide user's country name in peer list
|
||||||
];
|
];
|
||||||
|
|
||||||
function bit2dec($bit_num)
|
function bit2dec($bit_num)
|
||||||
|
@ -602,7 +603,13 @@ function bt_show_ip($ip, $port = '')
|
||||||
|
|
||||||
if (IS_AM) {
|
if (IS_AM) {
|
||||||
$ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($ip);
|
$ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($ip);
|
||||||
$ip .= ($port) ? ":$port" : '';
|
|
||||||
|
// Wrap IPv6 address in square brackets
|
||||||
|
if ($port && str_contains($ip, ':')) {
|
||||||
|
$ip = "[$ip]";
|
||||||
|
}
|
||||||
|
$ip .= $port ? ":$port" : '';
|
||||||
|
|
||||||
return $ip;
|
return $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,6 +366,7 @@ foreach ($profile_fields as $field => $can_edit) {
|
||||||
'user_callseed' => $reg_mode ? true : true,
|
'user_callseed' => $reg_mode ? true : true,
|
||||||
'user_retracker' => $reg_mode ? true : true,
|
'user_retracker' => $reg_mode ? true : true,
|
||||||
'user_hide_torrent_client' => $reg_mode ? true : true,
|
'user_hide_torrent_client' => $reg_mode ? true : true,
|
||||||
|
'user_hide_peer_country' => $reg_mode ? true : true,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($update_user_opt as $opt => $can_change_opt) {
|
foreach ($update_user_opt as $opt => $can_change_opt) {
|
||||||
|
|
|
@ -1880,6 +1880,7 @@ $lang['DL_STOPPED'] = 'stopped';
|
||||||
$lang['DL_UPD'] = 'upd: ';
|
$lang['DL_UPD'] = 'upd: ';
|
||||||
$lang['DL_INFO'] = 'shows data <i><b>only for the current session</b></i>';
|
$lang['DL_INFO'] = 'shows data <i><b>only for the current session</b></i>';
|
||||||
$lang['HIDE_PEER_TORRENT_CLIENT'] = 'Hide my BitTorrent client name in peer list';
|
$lang['HIDE_PEER_TORRENT_CLIENT'] = 'Hide my BitTorrent client name in peer list';
|
||||||
|
$lang['HIDE_PEER_COUNTRY_NAME'] = 'Hide my country name in peer list';
|
||||||
|
|
||||||
// Post PIN
|
// Post PIN
|
||||||
$lang['POST_PIN'] = 'Pin first post';
|
$lang['POST_PIN'] = 'Pin first post';
|
||||||
|
|
|
@ -326,6 +326,13 @@
|
||||||
<label><input type="radio" name="user_hide_torrent_client" value="0" <!-- IF not USER_HIDE_TORRENT_CLIENT -->checked<!-- ENDIF --> />{L_NO}</label>
|
<label><input type="radio" name="user_hide_torrent_client" value="0" <!-- IF not USER_HIDE_TORRENT_CLIENT -->checked<!-- ENDIF --> />{L_NO}</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="prof-title">{L_HIDE_PEER_COUNTRY_NAME}:</td>
|
||||||
|
<td>
|
||||||
|
<label><input type="radio" name="user_hide_peer_country" value="1" <!-- IF USER_HIDE_PEER_COUNTRY -->checked<!-- ENDIF --> />{L_YES}</label>
|
||||||
|
<label><input type="radio" name="user_hide_peer_country" value="0" <!-- IF not USER_HIDE_PEER_COUNTRY -->checked<!-- ENDIF --> />{L_NO}</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">{L_AVATAR_PANEL}</th>
|
<th colspan="2">{L_AVATAR_PANEL}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue