Skip to content

Commit

Permalink
增加对peer的ipv4校内外/ipv6的前端提示
Browse files Browse the repository at this point in the history
  • Loading branch information
nova2018 committed May 16, 2019
1 parent 0c14ff9 commit f04eade
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5698,8 +5698,9 @@ function salary($total_num, $total_size, $standard_num, $standard_size)
// ***********************************************//判断TJUIP
function check_tjuip($nip)
{
static $nontjuip = null;
global $Cache;
$nontjuip = $Cache->get_value('nontjuip');
empty($nontjuip) && $nontjuip = $Cache->get_value('nontjuip');
if (!$nontjuip) {
$nontjuip = array();
$res = sql_query("SELECT * FROM nontjuip");
Expand Down
6 changes: 6 additions & 0 deletions lang/chs/lang_viewpeerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@

'col_client' => "客户端",

'text_ipv4_in' => '校内IPV4',

'text_ipv4_out' => '校外IPV4',

'text_ipv6' => 'IPV4',

'text_anonymous' => "匿名",

'text_unknown' => "(未知)",
Expand Down
3 changes: 3 additions & 0 deletions lang/cht/lang_viewpeerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
'col_connected' => "連接時間",
'col_idle' => "最近匯報",
'col_client' => "用戶端",
'text_ipv4_in' => '校內IPV4',
'text_ipv4_out' => '校外IPV4',
'text_ipv6' => 'IPV6',
'text_anonymous' => "匿名",
'text_unknown' => "(未知)",
'text_seeders' => "做種者",
Expand Down
3 changes: 3 additions & 0 deletions lang/en/lang_viewpeerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
'col_connected' => "Connected",
'col_idle' => "Idle",
'col_client' => "Client",
'text_ipv4_in' => 'IPV4(School)',
'text_ipv4_out' => 'IPV4',
'text_ipv6' => 'IPV6',
'text_anonymous' => "Anonymous",
'text_unknown' => "(unknown)",
'text_seeders' => "Seeders",
Expand Down
17 changes: 15 additions & 2 deletions viewpeerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function dltable($name, $arr, $torrent)
/* ($enablelocation_tweak == 'yes' || get_user_class() >= $userprofile_class ? "<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_location']."</td>" : "<td class=colhead align=center width=1%>".$lang_viewpeerlist['ip_type']."</td>").*/
($enablelocation_tweak == 'yes' || get_user_class() >= $userprofile_class ? "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_location'] . "</td>" : "") .

// "<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_connectable']."</td>".
"<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_connectable'] . "</td>".

"<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_uploaded'] . "</td>" .

Expand Down Expand Up @@ -123,8 +123,21 @@ function dltable($name, $arr, $torrent)
}*/

$arrConn = [];
if (!empty($e["ipv4"])){
if (check_tjuip($e["ipv4"])){
$arrConn[] = $lang_viewpeerlist['text_ipv4_in'];
}else{
$arrConn[] = $lang_viewpeerlist['text_ipv4_out'];
}
}
if (!empty($e["ipv6"])){
$arrConn[] = $lang_viewpeerlist['text_ipv6'];
}
empty($arrConn) && $arrConn[] = $lang_viewpeerlist['text_unknown'];


// $s .= "<td class=rowfollow align=center width=1%><nobr>" .$lang_viewpeerlist[$e['connectable']] . "</nobr></td>\n";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . implode('/', $arrConn) . "</nobr></td>\n";

$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";

Expand Down

0 comments on commit f04eade

Please sign in to comment.