$ban_insert_array = array('ban_userid' => $poster_id, 'ban_by_userid' => $user->data['user_id'], 'ban_start' => time()); $sql = "INSERT INTO " . BANLIST_TABLE . " " . $db->sql_build_insert_update($ban_insert_array, true); $result = $db->sql_query($sql); // update the user table with new status $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = "' . $config['max_user_bancard'] . '", user_active = "0" WHERE user_id="' . $poster_id . '"'; $result = $db->sql_query($sql); // Better kill all the sessions! $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id="' . $poster_id . '"'; $result = $db->sql_query($sql); $message = $lang['Ban_update_red']; $e_temp = 'ban_block'; //$e_subj = $lang['Card_banned']; // Delete notifications for user if (!class_exists('class_notifications')) { include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT; $class_notifications = new class_notifications(); } $class_notifications->delete_user_notifications($poster_id); } else { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = "' . $config['max_user_bancard'] . '", user_active = "0" WHERE user_id="' . $poster_id . '"'; $result = $db->sql_query($sql); $no_error = false; $already_banned = true; } } elseif ($mode == 'warn') { $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id(); if ($user->data['user_level'] != ADMIN && !$is_auth['auth_ban'] || $poster_id == $founder_id) { message_die(GENERAL_ERROR, $lang['Not_Authorized']); } // Get user basic data $sql = 'SELECT user_active, user_warnings, user_level FROM ' . USERS_TABLE . ' WHERE user_id="' . $poster_id . '"';
if ($mode != 'editpost') { $user_id = (($mode == 'reply') || ($mode == 'newtopic')) ? $user->data['user_id'] : $post_data['poster_id']; if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT); if (empty($class_mcp)) $class_mcp = new class_mcp(); $class_mcp->sync_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); } $attachment_mod['posting']->insert_attachment($post_id); if (($error_msg == '') && ($mode != 'poll_delete')) { // Forum Notification - BEGIN if (!class_exists('class_notifications')) { include(IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT); $class_notifications = new class_notifications(); } $post_data['subject'] = $subject; $post_data['username'] = ($user->data['user_id'] == ANONYMOUS) ? $username : $user->data['username']; $post_data['message'] = $message; if ($post_data['first_post']) { // fetch topic title $sql = "SELECT topic_title, topic_id FROM " . TOPICS_TABLE . " WHERE topic_id = " . $topic_id; $result = $db->sql_query($sql); if ($topic_info = $db->sql_fetchrow($result)) { $class_notifications->send_notifications('newtopic', $post_data, $topic_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
$sql = ''; for ($i = 0; $i < sizeof($forum_auth_fields); $i++) { $value = intval($_POST[$forum_auth_fields[$i]]); if ($forum_auth_fields[$i] == 'auth_vote') { if ($_POST['auth_vote'] == AUTH_ALL) { $value = AUTH_REG; } } $sql .= ($sql != '' ? ', ' : '') . $forum_auth_fields[$i] . ' = ' . $value; } $sql = "UPDATE " . FORUMS_TABLE . "\n\t\t\t\t\t\tSET {$sql}\n\t\t\t\t\t\tWHERE forum_id IN ('" . $forums_to_auth . "')"; $db->sql_query($sql); // Delete notifications for not auth users if (!class_exists('class_notifications')) { include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT; $class_notifications = new class_notifications(); } $class_notifications->delete_not_auth_notifications($data['forums']); } // End of submit cache_tree(true); $redirect_url = append_sid(ADM . '/admin_forumauth_adv.' . PHP_EXT); meta_refresh(3, $redirect_url); $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid('admin_forumauth_adv.' . PHP_EXT) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } // Get required information, either all forums if no id was specified or just the requsted if it was // Output the authorization details if an id was specified $template->set_filenames(array('body' => ADM_TPL . 'auth_forum_adv_body.tpl')); $forumlist = get_tree_option_optg('', true, false); // Output values of individual fields
for ($j = 0; $j < sizeof($forum_auth_fields); $j++) { $value = $_POST[$forum_auth_fields[$j]][$forum_id]; if ($forum_auth_fields[$j] == 'auth_vote') { if ($_POST['auth_vote'][$forum_id] == AUTH_ALL) { $value = AUTH_REG; } } $sql .= ($sql != '' ? ', ' : '') . $forum_auth_fields[$j] . ' = ' . $value; } $sql = "UPDATE " . FORUMS_TABLE . " SET {$sql} WHERE forum_id = {$forum_id}"; $db->sql_query($sql); } // Delete notifications for not auth users if (!class_exists('class_notifications')) { include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT; $class_notifications = new class_notifications(); } $class_notifications->delete_not_auth_notifications(); cache_tree(true); $redirect_url = append_sid(ADM . '/admin_forumauth_list.' . PHP_EXT); meta_refresh(3, $redirect_url); $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid('admin_forumauth_list.' . PHP_EXT) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } // Default page $colspan = sizeof($forum_auth_fields) + 2; // Output the authorization details $template->set_filenames(array('body' => ADM_TPL . 'auth_forum_list_body.tpl')); $template->assign_vars(array('L_AUTH_LIST_TITLE' => $lang['Auth_list_Control_Forum'], 'L_AUTH_LIST_EXPLAIN' => $lang['Forum_auth_list_explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'COLSPAN' => $colspan, 'S_FORM_ACTION' => append_sid('admin_forumauth_list.' . PHP_EXT))); $template->assign_block_vars('forum_auth_titles', array('CELL_TITLE' => $lang['Forum'])); for ($i = 0; $i < sizeof($forum_auth_fields); $i++) {
} else { for ($i = 0; $i < sizeof($forum_auth_fields); $i++) { $value = intval($_POST[$forum_auth_fields[$i]]); if ($forum_auth_fields[$i] == 'auth_vote') { if ($_POST['auth_vote'] == AUTH_ALL) { $value = AUTH_REG; } } $sql .= ($sql != '' ? ', ' : '') . $forum_auth_fields[$i] . ' = ' . $value; } $sql = "UPDATE " . FORUMS_TABLE . " SET {$sql} WHERE forum_id = {$forum_id}"; } // Delete notifications for not auth users if (!class_exists('class_notifications')) { include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT; $class_notifications = new class_notifications(); } $class_notifications->delete_not_auth_notifications($forum_id); if ($sql != '') { $db->sql_query($sql); } $forum_sql = ''; $adv = 0; } cache_tree(true); $redirect_url = append_sid(ADM . '/admin_forumauth.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $forum_id); meta_refresh(3, $redirect_url); $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid('admin_forumauth.' . PHP_EXT) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } // End of submit
} } if (!$in_banlist && $user_list[$i] != ANONYMOUS && $user_list[$i] != $founder_id) { $kill_session_sql .= ($kill_session_sql != '' ? ' OR ' : '') . "session_user_id = " . $user_list[$i]; $ban_insert_array = array('ban_userid' => $user_list[$i], 'ban_by_userid' => $user->data['user_id'], 'ban_start' => time()); $sql = "INSERT INTO " . BANLIST_TABLE . " " . $db->sql_build_insert_update($ban_insert_array, true); $db->sql_query($sql); $sql = "UPDATE " . USERS_TABLE . " SET user_warnings = " . $config['max_user_bancard'] . " WHERE user_id = " . $user_list[$i]; $db->sql_query($sql); } } if (!empty($user_list)) { // Delete notifications for banned users if (!class_exists('class_notifications')) { include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT; $class_notifications = new class_notifications(); } $class_notifications->delete_user_notifications($user_list); } for ($i = 0; $i < sizeof($ip_list); $i++) { $in_banlist = false; for ($j = 0; $j < sizeof($current_banlist); $j++) { if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) { $in_banlist = true; } } if (!$in_banlist) { // Mighty Gorgon: we don't use this replacement any more... /* if (preg_match('/(255\.)|(\.255)/is', $ip_list[$i])) {
VALUES (' . $topic_id . ', "' . $user_id . '", "' . time() . '", "1")'; $db->sql_query($sql); } } // Who viewed a topic - END if (!empty($post_id)) { $start = floor(($forum_topic_data['prev_posts'] - 1) / intval($config['posts_per_page'])) * intval($config['posts_per_page']); } // Is user watching this thread? if (!class_exists('class_notifications')) { include(IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT); $class_notifications = new class_notifications(); } $watch = request_var('watch', ''); $unwatch = request_var('unwatch', ''); if($user->data['session_logged_in'] && !$user->data['is_bot']) { $can_watch_topic = true; $sql = "SELECT notify_status FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = " . $topic_id . " AND user_id = " . $user->data['user_id'] . " LIMIT 1"; $result = $db->sql_query($sql);