Minor improvements (#167)

This commit is contained in:
Roman Kelesidis 2023-05-10 23:10:25 +07:00 committed by GitHub
parent a9e9d3007c
commit 3d17119e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 34 additions and 27 deletions

View File

@ -1,5 +1,12 @@
# Change Log # Change Log
## [v2.1.5-2023.05](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.05) (2023-06-04) (В разработке)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.04...v2.1.5-2023.05)
**Merged pull requests:**
- Minor improvements [\#167](https://github.com/torrentpier/torrentpier-lts/pull/167) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.04](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.04) (2023-05-04) ## [v2.1.5-2023.04](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.04) (2023-05-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.03...v2.1.5-2023.04) [Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.03...v2.1.5-2023.04)

View File

@ -200,7 +200,7 @@ if ($mode != '')
} }
else else
{ {
bb_die('Invalid mode'); bb_die('Invalid mode: ' . htmlCHR($mode));
} }
} }
else else

View File

@ -244,7 +244,7 @@ else
break; break;
default: default:
bb_die('Invalid mode'); bb_die('Invalid mode: ' . htmlCHR($mode));
} }
$base_url = 'admin_user_search.php?dosearch=true'; $base_url = 'admin_user_search.php?dosearch=true';

View File

@ -76,31 +76,31 @@ $passkey = isset($$passkey_key) ? $$passkey_key : null;
// Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey) // Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey)
if (!isset($info_hash) || strlen($info_hash) != 20) if (!isset($info_hash) || strlen($info_hash) != 20)
{ {
msg_die('Invalid info_hash'); msg_die('Invalid info_hash: ' . htmlCHR($info_hash));
} }
if (!isset($peer_id) || strlen($peer_id) != 20) if (!isset($peer_id) || strlen($peer_id) != 20)
{ {
msg_die('Invalid peer_id'); msg_die('Invalid peer_id: ' . htmlCHR($peer_id));
} }
if (!isset($port) || $port < 0 || $port > 0xFFFF) if (!isset($port) || $port < 0 || $port > 0xFFFF)
{ {
msg_die('Invalid port'); msg_die('Invalid port: ' . htmlCHR($port));
} }
if (!isset($uploaded) || $uploaded < 0 || $uploaded > $max_up_down_val || $uploaded == 1844674407370) if (!isset($uploaded) || $uploaded < 0 || $uploaded > $max_up_down_val || $uploaded == 1844674407370)
{ {
msg_die('Invalid uploaded value'); msg_die('Invalid uploaded value: ' . htmlCHR($uploaded));
} }
if (!isset($downloaded) || $downloaded < 0 || $downloaded > $max_up_down_val || $downloaded == 1844674407370) if (!isset($downloaded) || $downloaded < 0 || $downloaded > $max_up_down_val || $downloaded == 1844674407370)
{ {
msg_die('Invalid downloaded value'); msg_die('Invalid downloaded value: ' . htmlCHR($downloaded));
} }
if (!isset($left) || $left < 0 || $left > $max_left_val) if (!isset($left) || $left < 0 || $left > $max_left_val)
{ {
msg_die('Invalid left value'); msg_die('Invalid left value: ' . htmlCHR($left));
} }
if (!verify_id($passkey, BT_AUTH_KEY_LENGTH)) if (!verify_id($passkey, BT_AUTH_KEY_LENGTH))
{ {
msg_die('Invalid passkey'); msg_die('Invalid passkey: ' . htmlCHR($passkey));
} }
// IP // IP

View File

@ -14,7 +14,7 @@ if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
if (!isset($_GET['info_hash']) || strlen($_GET['info_hash']) != 20) if (!isset($_GET['info_hash']) || strlen($_GET['info_hash']) != 20)
{ {
msg_die('Invalid info_hash'); msg_die('Invalid info_hash: ' . htmlCHR($_GET['info_hash']));
} }
$info_hash = $_GET['info_hash']; $info_hash = $_GET['info_hash'];

View File

@ -36,7 +36,7 @@ switch ($req_mode)
break; break;
default: default:
bb_simple_die('Invalid request'); bb_simple_die('Invalid request: ' . htmlCHR($req_mode));
} }
$require = file_exists($html_dir . $info['src']) ? $html_dir . $info['src'] : $html_dir . 'not_found.html'; $require = file_exists($html_dir . $info['src']) ? $html_dir . $info['src'] : $html_dir . 'not_found.html';

View File

@ -9,7 +9,7 @@ $user_id = (int) $this->request['user_id'];
if (!$user_id OR !$u_data = get_userdata($user_id)) if (!$user_id OR !$u_data = get_userdata($user_id))
{ {
$this->ajax_die('Invalid user_id'); $this->ajax_die('Invalid user_id: ' . htmlCHR($user_id));
} }
if (!IS_ADMIN && $user_id != $user->id) if (!IS_ADMIN && $user_id != $user->id)
@ -25,7 +25,7 @@ switch ($mode)
$response = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" />'; $response = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" />';
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
DB()->query("UPDATE ". BB_USERS ." SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE ". BB_USERS ." SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");

View File

@ -9,12 +9,12 @@ $new_opt = Zend\Json\Json::decode($this->request['user_opt'], Zend\Json\Json::TY
if (!$user_id OR !$u_data = get_userdata($user_id)) if (!$user_id OR !$u_data = get_userdata($user_id))
{ {
$this->ajax_die('invalid user_id'); $this->ajax_die('invalid user_id: ' . htmlCHR($user_id));
} }
if (!is_array($new_opt)) if (!is_array($new_opt))
{ {
$this->ajax_die('invalid new_opt'); $this->ajax_die('invalid new_opt: ' . htmlCHR($new_opt));
} }
foreach ($bf['user_opt'] as $opt_name => $opt_bit) foreach ($bf['user_opt'] as $opt_name => $opt_bit)

View File

@ -65,5 +65,5 @@ switch ($mode)
break; break;
default: default:
$this->ajax_die("invalid mode: $mode"); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }

View File

@ -132,7 +132,7 @@ switch($mode)
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
$this->response['html'] = $html; $this->response['html'] = $html;

View File

@ -113,7 +113,7 @@ switch ($mode)
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
$this->response['mode'] = $mode; $this->response['mode'] = $mode;

View File

@ -81,7 +81,7 @@ switch ($mode)
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
$this->response['mode'] = $mode; $this->response['mode'] = $mode;

View File

@ -129,5 +129,5 @@ switch ($mode)
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }

View File

@ -39,7 +39,7 @@ switch ($mode)
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
$this->response['html'] = $html; $this->response['html'] = $html;

View File

@ -154,7 +154,7 @@ switch ($mode)
// ошибочный $mode // ошибочный $mode
default: default:
$this->ajax_die("invalid mode: $mode"); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
// возможный дубль названия шаблона // возможный дубль названия шаблона

View File

@ -68,7 +68,7 @@ switch($mode)
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode: ' . htmlCHR($mode));
} }
$this->response['html'] = $html; $this->response['html'] = $html;

View File

@ -840,7 +840,7 @@ switch ($mode)
break; break;
default: default:
bb_die('invalid action'); bb_die('Invalid action: ' . htmlCHR($mode));
break; break;
} }

View File

@ -20,11 +20,11 @@ $poll = new bb_poll();
// проверка валидности $topic_id // проверка валидности $topic_id
if (!$topic_id) if (!$topic_id)
{ {
bb_die('Invalid topic_id'); bb_die($lang['INVALID_TOPIC_ID']);
} }
if (!$t_data = DB()->fetch_row("SELECT * FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1")) if (!$t_data = DB()->fetch_row("SELECT * FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1"))
{ {
bb_die('Topic not found'); bb_die($lang['INVALID_TOPIC_ID_DB']);
} }
// проверка прав // проверка прав

View File

@ -46,5 +46,5 @@ switch ($mode)
break; break;
default: default:
bb_die('Invalid mode'); bb_die('Invalid mode: ' . htmlCHR($mode));
} }