Code re-formatting (#1059)

This commit is contained in:
Cønstantine Kovalensky 2023-11-08 11:39:17 +04:00 committed by GitHub
commit 3ed64ab494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,18 +75,21 @@ foreach ($rowset as $cnt => $row) {
$peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : ''); $peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : '');
} }
// Detailed statistics for peer clients
$clients = []; $clients = [];
$client_count = 0; $client_count = 0;
$client_list = '';
$rowset = DB()->fetch_rowset('SELECT peer_id AS client FROM ' . TMP_TRACKER_TABLE); $rowset = DB()->fetch_rowset('SELECT peer_id AS client FROM ' . TMP_TRACKER_TABLE);
foreach ($rowset as $cnt => $row) { if (!empty($rowset)) {
$clientString = substr($row['client'], 0, 3); foreach ($rowset as $cnt => $row) {
if (!isset($clients[$clientString])) { $clientString = substr($row['client'], 0, 3);
$clients[$clientString] = 1; if (!isset($clients[$clientString])) {
} $clients[$clientString] = 1;
else { }
$clients[$clientString]++; else {
} $clients[$clientString]++;
$client_count++; }
$client_count++;
} }
foreach ($clients as $value => $count) { foreach ($clients as $value => $count) {
@ -94,7 +97,8 @@ foreach ($clients as $value => $count) {
$clients_percentage[] = get_user_torrent_client($value) . " ($count) => $percentage%"; $clients_percentage[] = get_user_torrent_client($value) . " ($count) => $percentage%";
} }
$clients = implode('<br>', $clients_percentage); $client_list = implode('<br>', $clients_percentage);
}
function commify_callback($matches) function commify_callback($matches)
{ {
@ -139,7 +143,7 @@ echo "\n
<tr><td align=center> clients: </td> <tr><td align=center> clients: </td>
<td align=center> <td align=center>
&nbsp; &nbsp;
$clients $client_list
</td></tr> </td></tr>
\n"; \n";
echo '</table>'; echo '</table>';