Minor improvements (#1281)

This commit is contained in:
Roman Kelesidis 2023-12-29 08:32:54 +07:00 committed by GitHub
commit 0204cd0047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 272 additions and 265 deletions

View file

@ -352,6 +352,9 @@ if (!defined('IN_TRACKER')) {
define('PEERS_LIST_PREFIX', 'peers_list_'); define('PEERS_LIST_PREFIX', 'peers_list_');
define('SCRAPE_LIST_PREFIX', 'scrape_list_'); define('SCRAPE_LIST_PREFIX', 'scrape_list_');
// Init tracker
require_once BB_PATH . '/bt/includes/init_tr.php';
header('Content-Type: text/plain'); header('Content-Type: text/plain');
header('Pragma: no-cache'); header('Pragma: no-cache');
@ -361,7 +364,4 @@ if (!defined('IN_TRACKER')) {
dummy_exit(random_int(60, 2400)); dummy_exit(random_int(60, 2400));
} }
} }
// Init tracker
require_once BB_PATH . '/bt/includes/init_tr.php';
} }

View file

@ -1195,10 +1195,10 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
/** /**
* Get user's torrent client string * Get user's torrent client string
* *
* @param string $peerId * @param string $peer_id
* @return mixed|string * @return string
*/ */
function get_user_torrent_client(string $peer_id): mixed function get_user_torrent_client(string $peer_id): string
{ {
static $clients = [ static $clients = [
'-AG' => 'Ares', '-AZ' => 'Vuze', '-A~' => 'Ares', '-BC' => 'BitComet', '-AG' => 'Ares', '-AZ' => 'Vuze', '-A~' => 'Ares', '-BC' => 'BitComet',
@ -1258,7 +1258,14 @@ function get_user_torrent_client(string $peer_id): mixed
return $peer_id; return $peer_id;
} }
function render_flag($code) { /**
* Returns country flag by country code
*
* @param string $code
* @return string
*/
function render_flag(string $code): string
{
static $iconExtension = '.svg'; static $iconExtension = '.svg';
static $country_codes = [ static $country_codes = [
'AD' => 'Andorra', 'AD' => 'Andorra',

View file

@ -514,7 +514,6 @@ $lang['AVATAR_PANEL'] = 'Avatar control panel';
$lang['WEBSITE'] = 'Website'; $lang['WEBSITE'] = 'Website';
$lang['LOCATION'] = 'Location'; $lang['LOCATION'] = 'Location';
$lang['LOCATION_FLAGS'] = 'Flag images are rendered by country codes:';
$lang['CONTACT'] = 'Contact'; $lang['CONTACT'] = 'Contact';
$lang['EMAIL_ADDRESS'] = 'E-mail address'; $lang['EMAIL_ADDRESS'] = 'E-mail address';
$lang['SEND_PRIVATE_MESSAGE'] = 'Send private message'; $lang['SEND_PRIVATE_MESSAGE'] = 'Send private message';

View file

@ -514,6 +514,7 @@ $lang['AVATAR_PANEL'] = 'Avatar control panel';
$lang['WEBSITE'] = 'Website'; $lang['WEBSITE'] = 'Website';
$lang['LOCATION'] = 'Location'; $lang['LOCATION'] = 'Location';
$lang['LOCATION_FLAGS'] = 'Flag images are rendered by country codes:';
$lang['CONTACT'] = 'Contact'; $lang['CONTACT'] = 'Contact';
$lang['EMAIL_ADDRESS'] = 'E-mail address'; $lang['EMAIL_ADDRESS'] = 'E-mail address';
$lang['SEND_PRIVATE_MESSAGE'] = 'Send private message'; $lang['SEND_PRIVATE_MESSAGE'] = 'Send private message';