diff --git a/bt/announce.php b/bt/announce.php index c4d7329c2..436e3c5b3 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -68,7 +68,8 @@ if (!isset($info_hash)) { // Store info hash in hex format $info_hash_hex = bin2hex($info_hash); - +// Store peer id +$peer_id_sql = rtrim(DB()->escape(substr($peer_id, 0, 10)), ' '); // Check info_hash version if (strlen($info_hash) === 32) { $is_bt_v2 = true; @@ -189,7 +190,7 @@ if ($lp_info) { $tor_type = $row['tor_type']; // Check hybrid torrents - if (!empty($row['info_hash'], $row['info_hash_v2'])) { + if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) { // Helpful dev variables $is_hybrid = true; $hybrid_v1_hash = &$row['info_hash']; @@ -316,6 +317,7 @@ if (isset($hybrid_tor_update) || !isset($is_hybrid)) { // Update statistics only $sql .= ", speed_down = $speed_down"; $sql .= ", complete = $complete"; + $sql .= ", peer_id = '$peer_id_sql'"; $sql .= " WHERE peer_hash = '$peer_hash'"; $sql .= " LIMIT 1"; @@ -326,8 +328,8 @@ if (isset($hybrid_tor_update) || !isset($is_hybrid)) { // Update statistics only } if (!$lp_info || !$peer_info_updated) { - $columns = 'peer_hash, topic_id, user_id, ip, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete'; - $values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete"; + $columns = 'peer_hash, topic_id, user_id, ip, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete, peer_id'; + $values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete, '$peer_id_sql'"; DB()->query("REPLACE INTO " . BB_BT_TRACKER . " ($columns) VALUES ($values)"); } diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index b037baa23..1b096562d 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -263,6 +263,7 @@ if ($tor_reged && $tor_info) { 'sup' => 'tr.speed_up', 'sdown' => 'tr.speed_down', 'time' => 'tr.update_time' + 'peer_id' => 'tr.peer_id', ]; foreach ($peer_orders as $get_key => $order_by_value) { @@ -288,7 +289,7 @@ if ($tor_reged && $tor_info) { LIMIT $show_peers_limit"; } else { $sql = "SELECT - tr.user_id, tr.ip, tr.port, tr.uploaded, tr.downloaded, tr.remain, + tr.user_id, tr.ip, tr.port, tr.peer_id, tr.uploaded, tr.downloaded, tr.remain, tr.seeder, tr.releaser, tr.speed_up, tr.speed_down, tr.update_time, tr.complete_percent, u.username, u.user_rank FROM " . BB_BT_TRACKER . " tr @@ -443,6 +444,7 @@ if ($tor_reged && $tor_info) { $template->assign_block_vars("$x_full.$x_row", [ 'ROW_BGR' => $row_bgr, 'NAME' => ($peer['update_time']) ? $name : "$name", + 'PEER_ID' => isset($peer['peer_id']) ? get_user_client($peer['peer_id']) : 'unknown', 'COMPL_PRC' => $compl_perc, 'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "$up_tot" : $up_tot, 'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "$down_tot" : $down_tot, diff --git a/library/includes/functions.php b/library/includes/functions.php index 5d600a619..2ff674ee4 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -1173,6 +1173,161 @@ function bb_date($gmepoch, $format = false, $friendly_date = true) return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date; } +// Get user's torrent client string +function get_user_client($peer_id) +{ + static $clients = [ + ///'-AD' => 'Advanced Download Manager', + '-AG' => 'Ares', + //'-AR' => 'Arctic', + //'-AT' => 'Artemis', + //'-AV' => 'Avicora', + //'-AX' => 'BitPump', + '-AZ' => 'Vuze', + '-A~' => 'Ares', + //'-BB' => 'BitBuddy', + '-BC' => 'BitComet', + '-BE' => 'BitTorrent SDK', + //'-BF' => 'BitFlu', + //'-BG' => 'BTGetit', + //'-BH' => 'BitZilla', + '-BI' => 'BiglyBT', + '-BL' => 'BitLord', + //'-BM' => 'BitMagnet', + //'-BN' => 'Baidu Netdisk', + //'-BOW' => 'Bits on Wheels', + //'-BP' => 'BitTorrent Pro (Azureus + Spyware)', + //'-BR' => 'BitRocket', + //'-BS' => 'BTSlave', + '-BT' => 'BitTorrent', + //'-BW' => 'BitTorrent Web', + //'-BX' => 'BittorrentX', + //'-CD' => 'Enhanced CTorrent', + '-CT' => 'CTorrent', + '-DE' => 'Deluge', + //'-DP' => 'Propagate Data Client', + //'-EB' => 'EBit', + //'-ES' => 'Electric Sheep', + //'-FC' => 'FileCroc', + '-FD' => 'Free Download Manager', + 'FD6' => 'Free Download Manager', + '-FG' => 'FlashGet', + '-FL' => 'Folx', + //'-FT' => 'FoxTorrent/RedSwoosh', + //'-FW' => 'FrostWire', + //'-FX' => 'Freebox', + //'-G3' => 'G3 Torrent', + //'-GR' => 'GetRight', + //'-GS' => 'GSTorrent', + //'-HK' => 'Hekate', + '-HL' => 'Halite', + //'-HN' => 'Hydranode', + '-KG' => 'KGet', + '-KT' => 'KTorrent', + //'-LC' => 'LeechCraft', + //'-LH' => 'LH-ABC', + //'-LP' => 'Lphant', + '-LT' => 'libTorrent', + //'-LW' => 'LimeWire', + '-Lr' => 'LibreTorrent', + '-MG' => 'MediaGet', + //'-MK' => 'Meerkat', + //'-ML' => 'MLDonkey', + //'-MO' => 'MonoTorrent', + //'-MP' => 'MooPolice', + //'-MR' => 'Miro', + //'-MT' => 'Moonlight', + //'-NE' => 'BT Next Evolution', + //'-NX' => 'Net Transport', + //'-OS' => 'OneSwarm', + //'-OT' => 'OmegaTorrent', + //'-PD' => 'Pando', + ///'-PI' => 'PicoTorrent', + //'-QD' => 'QQDownload', + //'-QT' => 'QT 4 Torrent example', + //'-RS' => 'Rufus', + //'-RT' => 'Retriever', + //'-RZ' => 'RezTorrent', + //'-SB' => 'Swiftbit', + ///'-SD' => 'Thunder', + //'-SM' => 'SoMud', + ///'-SP' => 'BitSpirit', + //'-SS' => 'SwarmScope', + //'-ST' => 'SymTorrent', + //'-SZ' => 'Shareaza', + //'-S~' => 'Shareaza', + //'-TB' => 'Torch Browser', + //'-TN' => 'Torrent .NET', + '-TR' => 'Transmission', + //'-TS' => 'Torrentstorm', + //'-TT' => 'TuoTu', + '-tT' => 'tTorrent', + //'-UE' => "uTorrent Embedded", + //'-UL' => 'uLeecher!', + '-UM' => "uTorrent Mac", + '-UT' => "uTorrent", + '-UW' => "uTorrent Web", + //'-VG' => 'Vagaa', + //'-WS' => 'HTTP Seed', + //'-WT' => 'BitLet', + //'-WT-' => 'BitLet', + '-WW' => 'WebTorrent', + '-WD' => 'WebTorrent', + //'-WY' => 'FireTorrent', + //'-XC' => 'Xtorrent', + //'-XF' => 'Xfplay', + '-XL' => 'Xunlei', + //'-XS' => 'XSwifter', + //'-XT' => 'XanTorrent', + //'-XX' => 'Xtorrent', + ///'-ZO' => 'Zona', + //'-ZT' => 'Zip Torrent', + //'-bk' => 'BitKitten (libtorrent)', + //'-lt' => 'libTorrent (Rakshasa)', + //'-pb' => 'pbTorrent', + '-PI' => 'PicoTorrent', + '-qB' => 'qBittorrent', + //'-st' => 'SharkTorrent', + //'346-' => 'TorrentTopia', + //'AZ2500BT' => 'BitTyrant (Azureus Mod)', + //'BLZ' => 'Blizzard Downloader', + //'DNA' => 'BitTorrent DNA', + //'FD6' => 'Free Download Manager 6', + //'LIME' => 'Limewire', + 'M' => 'BitTorrent', + 'MG' => 'MediaGet', + //'Mbrst' => 'burst!', + 'OP' => 'Opera', + //'Pando' => 'Pando', + //'Plus' => 'Plus!', + //'Q' => 'Queen Bee', + //'QVOD' => 'QVOD', + ///'S3' => 'Amazon S3', + 'TIX' => 'Tixati', + 'aria2-' => 'Aria2', + 'A2' => 'Aria2', + //'btpd' => 'BT Protocol Daemon', + //'eX' => 'eXeem', + //'martini' => 'Martini Man', + ]; + + $bestMatchLength = 0; + $peer_id = htmlCHR($peer_id); + foreach ($clients as $key => $clientName) { + if (str_starts_with($peer_id, $key) !== false && strlen($key) > $bestMatchLength) { + $bestMatch = $clientName; + $bestMatchLength = strlen($key); + } + } + + if (!empty($bestMatch)) { + return '' . $bestMatch . ''; + } + else { + return $peer_id; + } +} + function birthday_age($date) { global $bb_cfg; diff --git a/library/includes/ucp/viewprofile.php b/library/includes/ucp/viewprofile.php index 674c6f466..053d79179 100644 --- a/library/includes/ucp/viewprofile.php +++ b/library/includes/ucp/viewprofile.php @@ -77,6 +77,7 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) { $template->assign_vars([ 'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']), 'USERNAME' => $profiledata['username'], + 'PROFILE_USER_ID' => $profiledata['user_id'], 'PROFILE_USER' => $profile_user_id, 'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false), @@ -90,7 +91,6 @@ $template->assign_vars([ 'ICQ' => $profiledata['user_icq'], 'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (!$profile_user_id && bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'], 'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (!$profile_user_id && bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'], - 'USER_ACTIVE' => $profiledata['user_active'], 'LOCATION' => $profiledata['user_from'], 'OCCUPATION' => $profiledata['user_occ'], diff --git a/library/language/source/main.php b/library/language/source/main.php index 037d234ad..f1b8bfdef 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1542,6 +1542,7 @@ $lang['DL_DL'] = 'DL'; $lang['DL_UL_SPEED'] = 'UL speed'; $lang['DL_DL_SPEED'] = 'DL speed'; $lang['DL_PORT'] = 'Port'; +$lang['DL_CLIENT'] = 'Client'; $lang['DL_FORMULA'] = 'Formula: Uploaded/TorrentSize'; $lang['DL_ULR'] = 'URL'; $lang['DL_STOPPED'] = 'stopped'; diff --git a/styles/images/clients/Ares.png b/styles/images/clients/Ares.png new file mode 100644 index 000000000..ba2738b56 Binary files /dev/null and b/styles/images/clients/Ares.png differ diff --git a/styles/images/clients/Aria2.png b/styles/images/clients/Aria2.png new file mode 100644 index 000000000..b561ac015 Binary files /dev/null and b/styles/images/clients/Aria2.png differ diff --git a/styles/images/clients/BiglyBT.png b/styles/images/clients/BiglyBT.png new file mode 100644 index 000000000..58603f508 Binary files /dev/null and b/styles/images/clients/BiglyBT.png differ diff --git a/styles/images/clients/BitComet.png b/styles/images/clients/BitComet.png new file mode 100644 index 000000000..4dd89215c Binary files /dev/null and b/styles/images/clients/BitComet.png differ diff --git a/styles/images/clients/BitLord.png b/styles/images/clients/BitLord.png new file mode 100644 index 000000000..f97f1d88a Binary files /dev/null and b/styles/images/clients/BitLord.png differ diff --git a/styles/images/clients/BitSpirit.png b/styles/images/clients/BitSpirit.png new file mode 100644 index 000000000..23770d688 Binary files /dev/null and b/styles/images/clients/BitSpirit.png differ diff --git a/styles/images/clients/BitTorrent SDK.png b/styles/images/clients/BitTorrent SDK.png new file mode 100644 index 000000000..1fed0f676 Binary files /dev/null and b/styles/images/clients/BitTorrent SDK.png differ diff --git a/styles/images/clients/BitTorrent.png b/styles/images/clients/BitTorrent.png new file mode 100644 index 000000000..88c79e24b Binary files /dev/null and b/styles/images/clients/BitTorrent.png differ diff --git a/styles/images/clients/Blackberry.png b/styles/images/clients/Blackberry.png new file mode 100644 index 000000000..509ebbb09 Binary files /dev/null and b/styles/images/clients/Blackberry.png differ diff --git a/styles/images/clients/CTorrent.png b/styles/images/clients/CTorrent.png new file mode 100644 index 000000000..3ad1f0689 Binary files /dev/null and b/styles/images/clients/CTorrent.png differ diff --git a/styles/images/clients/Deluge.png b/styles/images/clients/Deluge.png new file mode 100644 index 000000000..938d30c76 Binary files /dev/null and b/styles/images/clients/Deluge.png differ diff --git a/styles/images/clients/FakeUT.png b/styles/images/clients/FakeUT.png new file mode 100644 index 000000000..329e0dbcd Binary files /dev/null and b/styles/images/clients/FakeUT.png differ diff --git a/styles/images/clients/FlashGet.png b/styles/images/clients/FlashGet.png new file mode 100644 index 000000000..86653d50d Binary files /dev/null and b/styles/images/clients/FlashGet.png differ diff --git a/styles/images/clients/Folx.png b/styles/images/clients/Folx.png new file mode 100644 index 000000000..9209dce0f Binary files /dev/null and b/styles/images/clients/Folx.png differ diff --git a/styles/images/clients/Free Download Manager.png b/styles/images/clients/Free Download Manager.png new file mode 100644 index 000000000..10310f856 Binary files /dev/null and b/styles/images/clients/Free Download Manager.png differ diff --git a/styles/images/clients/Freebox.png b/styles/images/clients/Freebox.png new file mode 100644 index 000000000..de8dd1b7f Binary files /dev/null and b/styles/images/clients/Freebox.png differ diff --git a/styles/images/clients/Halite.png b/styles/images/clients/Halite.png new file mode 100644 index 000000000..f9e37f0ec Binary files /dev/null and b/styles/images/clients/Halite.png differ diff --git a/styles/images/clients/KGet.png b/styles/images/clients/KGet.png new file mode 100644 index 000000000..4ca0ef2a9 Binary files /dev/null and b/styles/images/clients/KGet.png differ diff --git a/styles/images/clients/KTorrent.png b/styles/images/clients/KTorrent.png new file mode 100644 index 000000000..e016330aa Binary files /dev/null and b/styles/images/clients/KTorrent.png differ diff --git a/styles/images/clients/LibreTorrent.png b/styles/images/clients/LibreTorrent.png new file mode 100644 index 000000000..dc8aea961 Binary files /dev/null and b/styles/images/clients/LibreTorrent.png differ diff --git a/styles/images/clients/MLDonkey.png b/styles/images/clients/MLDonkey.png new file mode 100644 index 000000000..92e16cdd6 Binary files /dev/null and b/styles/images/clients/MLDonkey.png differ diff --git a/styles/images/clients/MediaGet.png b/styles/images/clients/MediaGet.png new file mode 100644 index 000000000..33875a798 Binary files /dev/null and b/styles/images/clients/MediaGet.png differ diff --git a/styles/images/clients/Monsoon.png b/styles/images/clients/Monsoon.png new file mode 100644 index 000000000..d6af57326 Binary files /dev/null and b/styles/images/clients/Monsoon.png differ diff --git a/styles/images/clients/Opera.png b/styles/images/clients/Opera.png new file mode 100644 index 000000000..da963ea20 Binary files /dev/null and b/styles/images/clients/Opera.png differ diff --git a/styles/images/clients/PicoTorrent.png b/styles/images/clients/PicoTorrent.png new file mode 100644 index 000000000..5af8e6170 Binary files /dev/null and b/styles/images/clients/PicoTorrent.png differ diff --git a/styles/images/clients/Tixati.png b/styles/images/clients/Tixati.png new file mode 100644 index 000000000..b586e44c0 Binary files /dev/null and b/styles/images/clients/Tixati.png differ diff --git a/styles/images/clients/TorrentStream.png b/styles/images/clients/TorrentStream.png new file mode 100644 index 000000000..9b13bd612 Binary files /dev/null and b/styles/images/clients/TorrentStream.png differ diff --git a/styles/images/clients/Transmission.png b/styles/images/clients/Transmission.png new file mode 100644 index 000000000..41864263f Binary files /dev/null and b/styles/images/clients/Transmission.png differ diff --git a/styles/images/clients/Ttorrent.png b/styles/images/clients/Ttorrent.png new file mode 100644 index 000000000..20d9b6228 Binary files /dev/null and b/styles/images/clients/Ttorrent.png differ diff --git a/styles/images/clients/Vuze.png b/styles/images/clients/Vuze.png new file mode 100644 index 000000000..259546892 Binary files /dev/null and b/styles/images/clients/Vuze.png differ diff --git a/styles/images/clients/WebTorrent.png b/styles/images/clients/WebTorrent.png new file mode 100644 index 000000000..cb944c030 Binary files /dev/null and b/styles/images/clients/WebTorrent.png differ diff --git a/styles/images/clients/Xunlei.png b/styles/images/clients/Xunlei.png new file mode 100644 index 000000000..68660a992 Binary files /dev/null and b/styles/images/clients/Xunlei.png differ diff --git a/styles/images/clients/libTorrent.png b/styles/images/clients/libTorrent.png new file mode 100644 index 000000000..21f4b99fe Binary files /dev/null and b/styles/images/clients/libTorrent.png differ diff --git a/styles/images/clients/qBittorrent.png b/styles/images/clients/qBittorrent.png new file mode 100644 index 000000000..fac170b0c Binary files /dev/null and b/styles/images/clients/qBittorrent.png differ diff --git a/styles/images/clients/uTorrent Mac.png b/styles/images/clients/uTorrent Mac.png new file mode 100644 index 000000000..b33ad8daa Binary files /dev/null and b/styles/images/clients/uTorrent Mac.png differ diff --git a/styles/images/clients/uTorrent Web.png b/styles/images/clients/uTorrent Web.png new file mode 100644 index 000000000..ef54ff6bd Binary files /dev/null and b/styles/images/clients/uTorrent Web.png differ diff --git a/styles/images/clients/uTorrent.png b/styles/images/clients/uTorrent.png new file mode 100644 index 000000000..9d9966b2b Binary files /dev/null and b/styles/images/clients/uTorrent.png differ diff --git a/styles/templates/default/viewtopic_torrent.tpl b/styles/templates/default/viewtopic_torrent.tpl index 691eb6f93..a5e2288ca 100644 --- a/styles/templates/default/viewtopic_torrent.tpl +++ b/styles/templates/default/viewtopic_torrent.tpl @@ -154,6 +154,7 @@ ajax.callback.callseed = function (data) { {L_DL_PORT} + {L_DL_CLIENT} @@ -170,6 +171,7 @@ ajax.callback.callseed = function (data) { {sfull.srow.port.PORT} + {sfull.srow.PEER_ID} @@ -202,7 +204,8 @@ ajax.callback.callseed = function (data) { {L_DL_PORT} - + + {L_DL_CLIENT} @@ -219,6 +222,7 @@ ajax.callback.callseed = function (data) { {lfull.lrow.port.PORT} + {lfull.lrow.PEER_ID}