mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Fixed sql. Remove limit from update.
This commit is contained in:
parent
d78be79c7b
commit
3cf76c97f9
20 changed files with 31 additions and 31 deletions
|
@ -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<br /><br />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);
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
@ -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']));
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
4
poll.php
4
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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue