diff --git a/admin/admin_ug_auth.php b/admin/admin_ug_auth.php
index 4f3adfb7d..0e13ae4a5 100644
--- a/admin/admin_ug_auth.php
+++ b/admin/admin_ug_auth.php
@@ -92,7 +92,7 @@ if ($submit && $mode == 'user') {
bb_die('Could not update admin status');
}
- DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . ADMIN . " WHERE user_id = $user_id LIMIT 1");
+ DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . ADMIN . " WHERE user_id = $user_id");
// Delete any entries in auth_access, they are not required if user is becoming an admin
delete_permissions($group_id, $user_id);
@@ -109,7 +109,7 @@ if ($submit && $mode == 'user') {
bb_die('Could not update admin status
Could not change yourself from an admin to user');
}
// Update users level, reset to USER
- DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . USER . " WHERE user_id = $user_id LIMIT 1");
+ DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . USER . " WHERE user_id = $user_id");
delete_permissions($group_id, $user_id);
diff --git a/callseed.php b/callseed.php
index f79092c2e..308ab0cd9 100644
--- a/callseed.php
+++ b/callseed.php
@@ -81,7 +81,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 LIMIT 1");
+DB()->query("UPDATE " . BB_BT_TORRENTS . " SET call_seed_time = " . TIMENOW . " WHERE topic_id = $topic_id");
meta_refresh(TOPIC_URL . $topic_id);
bb_die($lang['CALLSEED_MSG_OK']);
diff --git a/group_edit.php b/group_edit.php
index 0e6cac066..d0990f191 100644
--- a/group_edit.php
+++ b/group_edit.php
@@ -61,7 +61,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 LIMIT 1");
+ DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id");
}
}
diff --git a/library/ajax/avatar.php b/library/ajax/avatar.php
index d8547488f..df4abaa76 100644
--- a/library/ajax/avatar.php
+++ b/library/ajax/avatar.php
@@ -50,7 +50,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 LIMIT 1");
+DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id");
cache_rm_user_sessions($user_id);
diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php
index 2959884c6..8c30c7a86 100644
--- a/library/ajax/change_tor_status.php
+++ b/library/ajax/change_tor_status.php
@@ -84,7 +84,7 @@ switch ($mode) {
if (!IS_ADMIN) {
$this->verify_mod_rights($tor['forum_id']);
}
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE topic_id = {$tor['topic_id']} LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE topic_id = {$tor['topic_id']}");
} else {
$this->verify_mod_rights($tor['forum_id']);
}
diff --git a/library/ajax/change_user_opt.php b/library/ajax/change_user_opt.php
index 50617ea06..5deac58c5 100644
--- a/library/ajax/change_user_opt.php
+++ b/library/ajax/change_user_opt.php
@@ -46,7 +46,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 LIMIT 1");
+DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id");
// Удаляем данные из кеша
cache_rm_user_sessions($user_id);
diff --git a/library/ajax/change_user_rank.php b/library/ajax/change_user_rank.php
index 78d3f8174..6ba2da1f2 100644
--- a/library/ajax/change_user_rank.php
+++ b/library/ajax/change_user_rank.php
@@ -40,7 +40,7 @@ if ($rank_id != 0 && !isset($ranks[$rank_id])) {
$this->ajax_die("invalid rank_id: $rank_id");
}
-DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1");
+DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id");
cache_rm_user_sessions($user_id);
diff --git a/library/ajax/edit_group_profile.php b/library/ajax/edit_group_profile.php
index da4556659..af99033b1 100644
--- a/library/ajax/edit_group_profile.php
+++ b/library/ajax/edit_group_profile.php
@@ -70,4 +70,4 @@ switch ($mode) {
}
$value_sql = DB()->escape($value, true);
-DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id LIMIT 1");
+DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id");
diff --git a/library/ajax/edit_user_profile.php b/library/ajax/edit_user_profile.php
index ed7aeb90c..665042ee9 100644
--- a/library/ajax/edit_user_profile.php
+++ b/library/ajax/edit_user_profile.php
@@ -174,7 +174,7 @@ switch ($field) {
}
$value_sql = DB()->escape($value, true);
-DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id LIMIT 1");
+DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id");
cache_rm_user_sessions($user_id);
diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php
index 5768facf9..20ac9c93a 100644
--- a/library/ajax/index_data.php
+++ b/library/ajax/index_data.php
@@ -104,7 +104,7 @@ switch ($mode) {
}
if ($tz != $bb_cfg['board_timezone']) {
// Set current user timezone
- DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id'] . " LIMIT 1");
+ DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']);
$bb_cfg['board_timezone'] = $tz;
cache_rm_user_sessions($userdata['user_id']);
}
diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php
index c78e40dc8..9a073ad5f 100644
--- a/library/ajax/mod_action.php
+++ b/library/ajax/mod_action.php
@@ -69,7 +69,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 LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id");
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
diff --git a/library/ajax/posts.php b/library/ajax/posts.php
index 2bf306fa8..733ae3d56 100644
--- a/library/ajax/posts.php
+++ b/library/ajax/posts.php
@@ -151,9 +151,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 LIMIT 1");
+ DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id");
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 LIMIT 1");
+ DB()->query("UPDATE " . BB_POSTS . " SET post_edit_time = '" . TIMENOW . "', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id");
}
$s_text = str_replace('\n', "\n", $text);
$s_topic_title = str_replace('\n', "\n", $post['topic_title']);
diff --git a/library/ajax/topic_tpl.php b/library/ajax/topic_tpl.php
index 97b1feb24..2e31acbd4 100644
--- a/library/ajax/topic_tpl.php
+++ b/library/ajax/topic_tpl.php
@@ -131,7 +131,7 @@ switch ($mode) {
$new_tpl_id = $tpl_id;
$this->response['msg'] = "Включен шаблон $tpl_name";
}
- DB()->query("UPDATE " . BB_FORUMS . " SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id LIMIT 1");
+ DB()->query("UPDATE " . BB_FORUMS . " SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id");
break;
// сохранение изменений
@@ -142,7 +142,7 @@ switch ($mode) {
$msg .= 'Шаблон был отредактирован: ' . html_entity_decode($last_edit_by_username) . ', ' . delta_time($tpl_data['tpl_last_edit_tm']) . " назад\n\n";
$this->ajax_die($msg);
}
- $sql = "UPDATE " . BB_TOPIC_TPL . " SET " . DB()->build_array('UPDATE', $sql_args) . " WHERE tpl_id = $tpl_id LIMIT 1";
+ $sql = "UPDATE " . BB_TOPIC_TPL . " SET " . DB()->build_array('UPDATE', $sql_args) . " WHERE tpl_id = $tpl_id";
if (!@DB()->query($sql)) {
$sql_error = DB()->sql_error();
}
diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php
index 5b3b926af..7d5256350 100644
--- a/library/includes/bbcode.php
+++ b/library/includes/bbcode.php
@@ -464,5 +464,5 @@ function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
function update_post_html($postrow)
{
- DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_id = " . (int)$postrow['post_id'] . " LIMIT 1");
+ DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_id = " . (int)$postrow['post_id']);
}
diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php
index b665f9fde..28e2326a1 100644
--- a/library/includes/functions_post.php
+++ b/library/includes/functions_post.php
@@ -159,7 +159,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
if ($update_post_time && $mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) {
$edited_sql .= ", post_time = $current_time ";
//lpt
- DB()->sql_query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = $current_time WHERE topic_id = $topic_id LIMIT 1");
+ DB()->sql_query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = $current_time WHERE topic_id = $topic_id");
}
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, poster_rg_id, attach_rg_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '" . USER_IP . "', $poster_rg_id, $attach_rg_sig)" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . ", poster_rg_id = $poster_rg_id, attach_rg_sig = $attach_rg_sig WHERE post_id = $post_id";
diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php
index 3f932411f..9efe1716d 100644
--- a/library/includes/functions_torrent.php
+++ b/library/includes/functions_torrent.php
@@ -116,7 +116,7 @@ function tracker_unregister($attach_id, $mode = '')
// Unset DL-Type for topic
if ($bb_cfg['bt_unset_dltype_on_tor_unreg'] && $topic_id) {
- $sql = "UPDATE " . BB_TOPICS . " SET topic_dl_type = " . TOPIC_DL_TYPE_NORMAL . " WHERE topic_id = $topic_id LIMIT 1";
+ $sql = "UPDATE " . BB_TOPICS . " SET topic_dl_type = " . TOPIC_DL_TYPE_NORMAL . " WHERE topic_id = $topic_id";
if (!$result = DB()->sql_query($sql)) {
bb_die('Could not update topics table #1');
@@ -146,7 +146,7 @@ function tracker_unregister($attach_id, $mode = '')
}
// Update tracker_status
- $sql = "UPDATE " . BB_ATTACHMENTS_DESC . " SET tracker_status = 0 WHERE attach_id = $attach_id LIMIT 1";
+ $sql = "UPDATE " . BB_ATTACHMENTS_DESC . " SET tracker_status = 0 WHERE attach_id = $attach_id";
if (!DB()->sql_query($sql)) {
bb_die('Could not update torrent status #1');
@@ -226,7 +226,7 @@ function change_tor_type($attach_id, $tor_status_gold)
$tor_status_gold = (int)$tor_status_gold;
$info_hash = null;
- DB()->query("UPDATE " . BB_BT_TORRENTS . " SET tor_type = $tor_status_gold WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_BT_TORRENTS . " SET tor_type = $tor_status_gold WHERE topic_id = $topic_id");
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
@@ -356,7 +356,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
}
// update tracker status for this attachment
- $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . " SET tracker_status = 1 WHERE attach_id = $attach_id LIMIT 1";
+ $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . " SET tracker_status = 1 WHERE attach_id = $attach_id";
if (!DB()->sql_query($sql)) {
bb_die('Could not update torrent status #2');
@@ -364,7 +364,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
// set DL-Type for topic
if ($bb_cfg['bt_set_dltype_on_tor_reg']) {
- $sql = 'UPDATE ' . BB_TOPICS . ' SET topic_dl_type = ' . TOPIC_DL_TYPE_DL . " WHERE topic_id = $topic_id LIMIT 1";
+ $sql = 'UPDATE ' . BB_TOPICS . ' SET topic_dl_type = ' . TOPIC_DL_TYPE_DL . " WHERE topic_id = $topic_id";
if (!$result = DB()->sql_query($sql)) {
bb_die('Could not update topics table #2');
@@ -372,7 +372,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
}
if ($bb_cfg['tracker']['tor_topic_up']) {
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = GREATEST(topic_last_post_time, " . (TIMENOW - 3 * 86400) . ") WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = GREATEST(topic_last_post_time, " . (TIMENOW - 3 * 86400) . ") WHERE topic_id = $topic_id");
}
if ($reg_mode == 'request' || $reg_mode == 'newtopic') {
@@ -557,7 +557,7 @@ function generate_passkey($user_id, $force_generate = false)
return $passkey_val;
}
// Update
- DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id LIMIT 1");
+ DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id");
if (DB()->affected_rows() == 1) {
// Ocelot
diff --git a/library/includes/posting_tpl.php b/library/includes/posting_tpl.php
index 63e41ed5b..855923711 100644
--- a/library/includes/posting_tpl.php
+++ b/library/includes/posting_tpl.php
@@ -65,7 +65,7 @@ if ($tpl_data) {
if ($tpl_data['tpl_rules_post_id']) {
if (!$tpl_rules_html = bbcode2html(DB()->fetch_row("SELECT post_text FROM " . BB_POSTS_TEXT . " WHERE post_id = " . $tpl_data['tpl_rules_post_id'], 'post_text'))) {
$tpl_data['tpl_rules_post_id'] = 0;
- DB()->query("UPDATE " . BB_TOPIC_TPL . " SET tpl_rules_post_id = 0 WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPIC_TPL . " SET tpl_rules_post_id = 0 WHERE tpl_id = {$f_data['forum_tpl_id']}");
}
}
diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php
index 767cd51aa..a80be37c7 100644
--- a/library/includes/ucp/register.php
+++ b/library/includes/ucp/register.php
@@ -650,7 +650,7 @@ if ($submit && !$errors) {
$sql_args = DB()->build_array('UPDATE', $db_data);
- DB()->query("UPDATE " . BB_USERS . " SET $sql_args WHERE user_id = {$pr_data['user_id']} LIMIT 1");
+ DB()->query("UPDATE " . BB_USERS . " SET $sql_args WHERE user_id = {$pr_data['user_id']}");
if ($pr_data['user_id'] != $userdata['user_id']) {
if ($pr_data['user_level'] == MOD && !empty($db_data['username'])) {
diff --git a/poll.php b/poll.php
index 06a396635..faf0b48c6 100644
--- a/poll.php
+++ b/poll.php
@@ -109,7 +109,7 @@ switch ($mode) {
if (!$t_data['topic_vote']) {
bb_die($lang['POST_HAS_NO_POLL']);
}
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 1 WHERE topic_id = $topic_id");
bb_die($lang['NEW_POLL_START']);
break;
@@ -118,7 +118,7 @@ switch ($mode) {
if (!$t_data['topic_vote']) {
bb_die($lang['POST_HAS_NO_POLL']);
}
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = " . POLL_FINISHED . " WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = " . POLL_FINISHED . " WHERE topic_id = $topic_id");
bb_die($lang['NEW_POLL_END']);
break;
diff --git a/src/Legacy/Poll.php b/src/Legacy/Poll.php
index a9643b59e..3d9f0dcd1 100644
--- a/src/Legacy/Poll.php
+++ b/src/Legacy/Poll.php
@@ -95,7 +95,7 @@ class Poll
DB()->query("REPLACE INTO " . BB_POLL_VOTES . $sql_args);
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 1 WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 1 WHERE topic_id = $topic_id");
}
/**
@@ -105,7 +105,7 @@ class Poll
*/
public function delete_poll($topic_id)
{
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 0 WHERE topic_id = $topic_id LIMIT 1");
+ DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 0 WHERE topic_id = $topic_id");
$this->delete_votes_data($topic_id);
}