diff --git a/CHANGELOG.md b/CHANGELOG.md
index 212346939..1d0d5ed4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,7 +26,7 @@
- Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky))
- Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky))
- Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
-- Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122), [\#1123](https://github.com/torrentpier/torrentpier/pull/1123) ([belomaxorka](https://github.com/belomaxorka))
+- Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122), [\#1123](https://github.com/torrentpier/torrentpier/pull/1123), [\#1125](https://github.com/torrentpier/torrentpier/pull/1125) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101) ([Exileum](https://github.com/Exileum))
## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14)
diff --git a/group_edit.php b/group_edit.php
index 3b3cdaf18..681415157 100644
--- a/group_edit.php
+++ b/group_edit.php
@@ -44,7 +44,7 @@ if ($is_moderator) {
bb_die(implode($upload->errors));
}
- DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id");
+ DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
}
}
diff --git a/library/ajax/avatar.php b/library/ajax/avatar.php
index 4040bf9cc..49c2fc4db 100644
--- a/library/ajax/avatar.php
+++ b/library/ajax/avatar.php
@@ -36,7 +36,7 @@ switch ($mode) {
$this->ajax_die('Invalid mode');
}
-DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id");
+DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");
\TorrentPier\Sessions::cache_rm_user_sessions($user_id);
diff --git a/library/ajax/callseed.php b/library/ajax/callseed.php
index a9279f6f5..dc929c686 100644
--- a/library/ajax/callseed.php
+++ b/library/ajax/callseed.php
@@ -65,7 +65,7 @@ if ($user_list) {
send_pm($t_data['poster_id'], $subject, $message, BOT_UID);
}
-DB()->query("UPDATE " . BB_BT_TORRENTS . " SET call_seed_time = " . TIMENOW . " WHERE topic_id = $topic_id");
+DB()->query("UPDATE " . BB_BT_TORRENTS . " SET call_seed_time = " . TIMENOW . " WHERE topic_id = $topic_id LIMIT 1");
function topic_info($topic_id)
{
diff --git a/library/ajax/change_user_opt.php b/library/ajax/change_user_opt.php
index 76d0969bd..3c6ae7064 100644
--- a/library/ajax/change_user_opt.php
+++ b/library/ajax/change_user_opt.php
@@ -30,7 +30,7 @@ foreach ($bf['user_opt'] as $opt_name => $opt_bit) {
}
}
-DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id");
+DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
// Удаляем данные из кеша
\TorrentPier\Sessions::cache_rm_user_sessions($user_id);
diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php
index 7c1b52521..7ae4292e3 100644
--- a/library/ajax/mod_action.php
+++ b/library/ajax/mod_action.php
@@ -55,7 +55,7 @@ switch ($mode) {
$topic_title_sql = DB()->escape($new_title);
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
diff --git a/library/ajax/posts.php b/library/ajax/posts.php
index 8d5b80535..15612e9c4 100644
--- a/library/ajax/posts.php
+++ b/library/ajax/posts.php
@@ -135,9 +135,9 @@ switch ($this->request['type']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
}
}
- DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id");
+ DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id']) {
- DB()->query("UPDATE " . BB_POSTS . " SET post_edit_time = '" . TIMENOW . "', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id");
+ DB()->query("UPDATE " . BB_POSTS . " SET post_edit_time = '" . TIMENOW . "', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1");
}
$s_text = str_replace('\n', "\n", $text);
$s_topic_title = str_replace('\n', "\n", $post['topic_title']);
@@ -229,7 +229,7 @@ switch ($this->request['type']) {
$message = prepare_message($message);
// Flood control
- $where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
+ $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
if ($row = DB()->fetch_row($sql) and $row['last_post_time']) {
diff --git a/library/ajax/user_register.php b/library/ajax/user_register.php
index 1baba2474..964d63159 100644
--- a/library/ajax/user_register.php
+++ b/library/ajax/user_register.php
@@ -42,7 +42,7 @@ switch ($mode) {
if ($err = \TorrentPier\Validate::password($pass, $pass_confirm)) {
$html = ' ' . $err . '';
} else {
- $text = (IS_GUEST) ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
+ $text = IS_GUEST ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
$html = '
' . $text . '';
}
break;
diff --git a/library/includes/functions.php b/library/includes/functions.php
index a265810f6..ac4f9bf22 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -1025,7 +1025,7 @@ function make_jumpbox()
$jumpbox = $datastore->get('jumpbox');
}
- $template->assign_vars(['JUMPBOX' => (IS_GUEST) ? DB()->escape($jumpbox['guest']) : DB()->escape($jumpbox['user'])]);
+ $template->assign_vars(['JUMPBOX' => IS_GUEST ? DB()->escape($jumpbox['guest']) : DB()->escape($jumpbox['user'])]);
}
// $mode: array(not_auth_forum1,not_auth_forum2,..) or (string) 'mode'
diff --git a/library/includes/page_header.php b/library/includes/page_header.php
index 46be0facd..078d81614 100644
--- a/library/includes/page_header.php
+++ b/library/includes/page_header.php
@@ -119,7 +119,7 @@ $template->assign_vars([
'USER_LANG' => $userdata['user_lang'],
'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']),
- 'USER_OPTIONS_JS' => (IS_GUEST) ? '{}' : json_encode($user->opt_js, JSON_THROW_ON_ERROR),
+ 'USER_OPTIONS_JS' => IS_GUEST ? '{}' : json_encode($user->opt_js, JSON_THROW_ON_ERROR),
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
diff --git a/search.php b/search.php
index a08438f8b..602ab7e09 100644
--- a/search.php
+++ b/search.php
@@ -90,7 +90,7 @@ $url = basename(__FILE__);
$anon_id = GUEST_UID;
$user_id = $userdata['user_id'];
-$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit'];
+$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
$search_id = (isset($_GET['id']) && verify_id($_GET['id'], SEARCH_ID_LENGTH)) ? $_GET['id'] : '';
$session_id = $userdata['session_id'];
@@ -800,11 +800,11 @@ else {
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id,
- 'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'],
+ 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
- 'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
+ 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'],
diff --git a/src/Legacy/Post.php b/src/Legacy/Post.php
index 9a9662d5c..4f2725c78 100644
--- a/src/Legacy/Post.php
+++ b/src/Legacy/Post.php
@@ -101,7 +101,7 @@ class Post
// Flood control
$row = null;
- $where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
+ $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
if ($mode == 'newtopic' || $mode == 'reply') {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php
index f43bd1f7c..a52048c66 100644
--- a/src/Legacy/Torrent.php
+++ b/src/Legacy/Torrent.php
@@ -645,7 +645,7 @@ class Torrent
}
} else {
// Update exists passkey
- DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id");
+ DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id LIMIT 1");
if (DB()->affected_rows() == 1) {
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
diff --git a/styles/templates/default/usercp_viewprofile.tpl b/styles/templates/default/usercp_viewprofile.tpl
index a44008ac3..8e61e1357 100644
--- a/styles/templates/default/usercp_viewprofile.tpl
+++ b/styles/templates/default/usercp_viewprofile.tpl
@@ -246,20 +246,15 @@ ajax.callback.index_data = function(data) {