indvdum@0: add_lang('posting'); indvdum@0: indvdum@0: $post_id = request_var('p', 0); indvdum@0: $start = request_var('start', 0); indvdum@0: indvdum@0: // Get post data indvdum@0: $post_info = get_post_data(array($post_id), false, true); indvdum@0: indvdum@0: add_form_key('mcp_post_details'); indvdum@0: indvdum@0: if (!sizeof($post_info)) indvdum@0: { indvdum@0: trigger_error('POST_NOT_EXIST'); indvdum@0: } indvdum@0: indvdum@0: $post_info = $post_info[$post_id]; indvdum@0: $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); indvdum@0: indvdum@0: switch ($action) indvdum@0: { indvdum@0: case 'whois': indvdum@0: indvdum@0: if ($auth->acl_get('m_info', $post_info['forum_id'])) indvdum@0: { indvdum@0: $ip = request_var('ip', ''); indvdum@0: include($phpbb_root_path . 'includes/functions_user.' . $phpEx); indvdum@0: indvdum@0: $template->assign_vars(array( indvdum@0: 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), indvdum@0: 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id"), indvdum@0: 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), indvdum@0: 'WHOIS' => user_ipwhois($ip), indvdum@0: )); indvdum@0: } indvdum@0: indvdum@0: // We're done with the whois page so return indvdum@0: return; indvdum@0: indvdum@0: break; indvdum@0: indvdum@0: case 'chgposter': indvdum@0: case 'chgposter_ip': indvdum@0: indvdum@0: if ($action == 'chgposter') indvdum@0: { indvdum@0: $username = request_var('username', '', true); indvdum@0: $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $new_user_id = request_var('u', 0); indvdum@0: $sql_where = 'user_id = ' . $new_user_id; indvdum@0: } indvdum@0: indvdum@0: $sql = 'SELECT * indvdum@0: FROM ' . USERS_TABLE . ' indvdum@0: WHERE ' . $sql_where; indvdum@0: $result = $db->sql_query($sql); indvdum@0: $row = $db->sql_fetchrow($result); indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (!$row) indvdum@0: { indvdum@0: trigger_error('NO_USER'); indvdum@0: } indvdum@0: indvdum@0: if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) indvdum@0: { indvdum@0: if (check_form_key('mcp_post_details')) indvdum@0: { indvdum@0: change_poster($post_info, $row); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: trigger_error('FORM_INVALID'); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: break; indvdum@0: } indvdum@0: indvdum@0: // Set some vars indvdum@0: $users_ary = $usernames_ary = array(); indvdum@0: $attachments = $extensions = array(); indvdum@0: $post_id = $post_info['post_id']; indvdum@0: $topic_tracking_info = array(); indvdum@0: indvdum@0: // Get topic tracking info indvdum@0: if ($config['load_db_lastread']) indvdum@0: { indvdum@0: $tmp_topic_data = array($post_info['topic_id'] => $post_info); indvdum@0: $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time'])); indvdum@0: unset($tmp_topic_data); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']); indvdum@0: } indvdum@0: indvdum@0: $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; indvdum@0: indvdum@0: // Process message, leave it uncensored indvdum@0: $message = $post_info['post_text']; indvdum@0: indvdum@0: if ($post_info['bbcode_bitfield']) indvdum@0: { indvdum@0: include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); indvdum@0: $bbcode = new bbcode($post_info['bbcode_bitfield']); indvdum@0: $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); indvdum@0: } indvdum@0: indvdum@0: $message = bbcode_nl2br($message); indvdum@0: $message = smiley_text($message); indvdum@0: indvdum@0: if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) indvdum@0: { indvdum@0: $extensions = $cache->obtain_attach_extensions($post_info['forum_id']); indvdum@0: indvdum@0: $sql = 'SELECT * indvdum@0: FROM ' . ATTACHMENTS_TABLE . ' indvdum@0: WHERE post_msg_id = ' . $post_id . ' indvdum@0: AND in_message = 0 indvdum@0: ORDER BY filetime DESC, post_msg_id ASC'; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $attachments[] = $row; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (sizeof($attachments)) indvdum@0: { indvdum@0: $update_count = array(); indvdum@0: parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); indvdum@0: } indvdum@0: indvdum@0: // Display not already displayed Attachments for this post, we already parsed them. ;) indvdum@0: if (!empty($attachments)) indvdum@0: { indvdum@0: $template->assign_var('S_HAS_ATTACHMENTS', true); indvdum@0: indvdum@0: foreach ($attachments as $attachment) indvdum@0: { indvdum@0: $template->assign_block_vars('attachment', array( indvdum@0: 'DISPLAY_ATTACHMENT' => $attachment) indvdum@0: ); indvdum@0: } indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $template->assign_vars(array( indvdum@0: 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters indvdum@0: 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters indvdum@0: 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), indvdum@0: indvdum@0: 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), indvdum@0: 'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']), indvdum@0: 'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']), indvdum@0: 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), indvdum@0: indvdum@0: 'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false, indvdum@0: 'S_POST_UNAPPROVED' => (!$post_info['post_approved']) ? true : false, indvdum@0: 'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false, indvdum@0: 'S_USER_NOTES' => true, indvdum@0: 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, indvdum@0: indvdum@0: 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', indvdum@0: 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_chgposter&field=username&select_single=true'), indvdum@0: 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), indvdum@0: 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), indvdum@0: 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), indvdum@0: 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', indvdum@0: 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), indvdum@0: 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), indvdum@0: indvdum@0: 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), indvdum@0: indvdum@0: 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '", ''), indvdum@0: 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '', ''), indvdum@0: 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), indvdum@0: 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), indvdum@0: 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), indvdum@0: 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), indvdum@0: indvdum@0: 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: indvdum@0: 'POST_PREVIEW' => $message, indvdum@0: 'POST_SUBJECT' => $post_info['post_subject'], indvdum@0: 'POST_DATE' => $user->format_date($post_info['post_time']), indvdum@0: 'POST_IP' => $post_info['poster_ip'], indvdum@0: 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', indvdum@0: 'POST_ID' => $post_info['post_id'], indvdum@0: indvdum@0: 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '', indvdum@0: 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '', indvdum@0: )); indvdum@0: indvdum@0: // Get User Notes indvdum@0: $log_data = array(); indvdum@0: $log_count = false; indvdum@0: view_log('user', $log_data, $log_count, $config['posts_per_page'], 0, 0, 0, $post_info['user_id']); indvdum@0: indvdum@0: if (!empty($log_data)) indvdum@0: { indvdum@0: $template->assign_var('S_USER_NOTES', true); indvdum@0: indvdum@0: foreach ($log_data as $row) indvdum@0: { indvdum@0: $template->assign_block_vars('usernotes', array( indvdum@0: 'REPORT_BY' => $row['username_full'], indvdum@0: 'REPORT_AT' => $user->format_date($row['time']), indvdum@0: 'ACTION' => $row['action'], indvdum@0: 'ID' => $row['id']) indvdum@0: ); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: // Get Reports indvdum@0: if ($auth->acl_get('m_report', $post_info['forum_id'])) indvdum@0: { indvdum@0: $sql = 'SELECT r.*, re.*, u.user_id, u.username indvdum@0: FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re indvdum@0: WHERE r.post_id = $post_id indvdum@0: AND r.reason_id = re.reason_id indvdum@0: AND u.user_id = r.user_id indvdum@0: ORDER BY r.report_time DESC"; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: if ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $template->assign_var('S_SHOW_REPORTS', true); indvdum@0: indvdum@0: do indvdum@0: { indvdum@0: // If the reason is defined within the language file, we will use the localized version, else just use the database entry... indvdum@0: if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) indvdum@0: { indvdum@0: $row['reson_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; indvdum@0: $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; indvdum@0: } indvdum@0: indvdum@0: $template->assign_block_vars('reports', array( indvdum@0: 'REPORT_ID' => $row['report_id'], indvdum@0: 'REASON_TITLE' => $row['reason_title'], indvdum@0: 'REASON_DESC' => $row['reason_description'], indvdum@0: 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], indvdum@0: 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '', indvdum@0: 'USER_NOTIFY' => ($row['user_notify']) ? true : false, indvdum@0: 'REPORT_TIME' => $user->format_date($row['report_time']), indvdum@0: 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), indvdum@0: )); indvdum@0: } indvdum@0: while ($row = $db->sql_fetchrow($result)); indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: } indvdum@0: indvdum@0: // Get IP indvdum@0: if ($auth->acl_get('m_info', $post_info['forum_id'])) indvdum@0: { indvdum@0: $rdns_ip_num = request_var('rdns', ''); indvdum@0: indvdum@0: if ($rdns_ip_num != 'all') indvdum@0: { indvdum@0: $template->assign_vars(array( indvdum@0: 'U_LOOKUP_ALL' => "$url&i=main&mode=post_details&rdns=all") indvdum@0: ); indvdum@0: } indvdum@0: indvdum@0: // Get other users who've posted under this IP indvdum@0: $sql = 'SELECT poster_id, COUNT(poster_id) as postings indvdum@0: FROM ' . POSTS_TABLE . " indvdum@0: WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "' indvdum@0: GROUP BY poster_id indvdum@0: ORDER BY postings DESC"; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: // Fill the user select list with users who have posted under this IP indvdum@0: if ($row['poster_id'] != $post_info['poster_id']) indvdum@0: { indvdum@0: $users_ary[$row['poster_id']] = $row; indvdum@0: } indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (sizeof($users_ary)) indvdum@0: { indvdum@0: // Get the usernames indvdum@0: $sql = 'SELECT user_id, username indvdum@0: FROM ' . USERS_TABLE . ' indvdum@0: WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary)); indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $users_ary[$row['user_id']]['username'] = $row['username']; indvdum@0: $usernames_ary[utf8_clean_string($row['username'])] = $users_ary[$row['user_id']]; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: foreach ($users_ary as $user_id => $user_row) indvdum@0: { indvdum@0: $template->assign_block_vars('userrow', array( indvdum@0: 'USERNAME' => ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'], indvdum@0: 'NUM_POSTS' => $user_row['postings'], indvdum@0: 'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], indvdum@0: indvdum@0: 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id), indvdum@0: 'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics')) indvdum@0: ); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: // Get other IP's this user has posted under indvdum@0: indvdum@0: // A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot, indvdum@0: // but the extra size is only valuable if there are persons having more than a thousands posts. indvdum@0: // This is better left to the really really big forums. indvdum@0: indvdum@0: $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings indvdum@0: FROM ' . POSTS_TABLE . ' indvdum@0: WHERE poster_id = ' . $post_info['poster_id'] . " indvdum@0: GROUP BY poster_ip indvdum@0: ORDER BY postings DESC"; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : ''; indvdum@0: indvdum@0: $template->assign_block_vars('iprow', array( indvdum@0: 'IP' => $row['poster_ip'], indvdum@0: 'HOSTNAME' => $hostname, indvdum@0: 'NUM_POSTS' => $row['postings'], indvdum@0: 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], indvdum@0: indvdum@0: 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip", indvdum@0: 'U_WHOIS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) indvdum@0: ); indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: $user_select = ''; indvdum@0: indvdum@0: if (sizeof($usernames_ary)) indvdum@0: { indvdum@0: ksort($usernames_ary); indvdum@0: indvdum@0: foreach ($usernames_ary as $row) indvdum@0: { indvdum@0: $user_select .= '\n"; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $template->assign_var('S_USER_SELECT', $user_select); indvdum@0: } indvdum@0: indvdum@0: } indvdum@0: indvdum@0: /** indvdum@0: * Change a post's poster indvdum@0: */ indvdum@0: function change_poster(&$post_info, $userdata) indvdum@0: { indvdum@0: global $auth, $db, $config, $phpbb_root_path, $phpEx; indvdum@0: indvdum@0: if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) indvdum@0: { indvdum@0: return; indvdum@0: } indvdum@0: indvdum@0: $post_id = $post_info['post_id']; indvdum@0: indvdum@0: $sql = 'UPDATE ' . POSTS_TABLE . " indvdum@0: SET poster_id = {$userdata['user_id']} indvdum@0: WHERE post_id = $post_id"; indvdum@0: $db->sql_query($sql); indvdum@0: indvdum@0: // Resync topic/forum if needed indvdum@0: if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id) indvdum@0: { indvdum@0: sync('topic', 'topic_id', $post_info['topic_id'], false, false); indvdum@0: sync('forum', 'forum_id', $post_info['forum_id'], false, false); indvdum@0: } indvdum@0: indvdum@0: // Adjust post counts... only if the post is approved (else, it was not added the users post count anyway) indvdum@0: if ($post_info['post_postcount'] && $post_info['post_approved']) indvdum@0: { indvdum@0: $sql = 'UPDATE ' . USERS_TABLE . ' indvdum@0: SET user_posts = user_posts - 1 indvdum@0: WHERE user_id = ' . $post_info['user_id'] .' indvdum@0: AND user_posts > 0'; indvdum@0: $db->sql_query($sql); indvdum@0: indvdum@0: $sql = 'UPDATE ' . USERS_TABLE . ' indvdum@0: SET user_posts = user_posts + 1 indvdum@0: WHERE user_id = ' . $userdata['user_id']; indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: indvdum@0: // Add posted to information for this topic for the new user indvdum@0: markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']); indvdum@0: indvdum@0: // Remove the dotted topic option if the old user has no more posts within this topic indvdum@0: if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) indvdum@0: { indvdum@0: $sql = 'SELECT topic_id indvdum@0: FROM ' . POSTS_TABLE . ' indvdum@0: WHERE topic_id = ' . $post_info['topic_id'] . ' indvdum@0: AND poster_id = ' . $post_info['user_id']; indvdum@0: $result = $db->sql_query_limit($sql, 1); indvdum@0: $topic_id = (int) $db->sql_fetchfield('topic_id'); indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (!$topic_id) indvdum@0: { indvdum@0: $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' indvdum@0: WHERE user_id = ' . $post_info['user_id'] . ' indvdum@0: AND topic_id = ' . $post_info['topic_id']; indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: // change the poster_id within the attachments table, else the data becomes out of sync and errors displayed because of wrong ownership indvdum@0: if ($post_info['post_attachment']) indvdum@0: { indvdum@0: $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' indvdum@0: SET poster_id = ' . $userdata['user_id'] . ' indvdum@0: WHERE poster_id = ' . $post_info['user_id'] . ' indvdum@0: AND post_msg_id = ' . $post_info['post_id'] . ' indvdum@0: AND topic_id = ' . $post_info['topic_id']; indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: indvdum@0: // refresh search cache of this post indvdum@0: $search_type = basename($config['search_type']); indvdum@0: indvdum@0: if (file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) indvdum@0: { indvdum@0: require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); indvdum@0: indvdum@0: // We do some additional checks in the module to ensure it can actually be utilised indvdum@0: $error = false; indvdum@0: $search = new $search_type($error); indvdum@0: indvdum@0: if (!$error && method_exists($search, 'destroy_cache')) indvdum@0: { indvdum@0: $search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id'])); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $from_username = $post_info['username']; indvdum@0: $to_username = $userdata['username']; indvdum@0: indvdum@0: // Renew post info indvdum@0: $post_info = get_post_data(array($post_id), false, true); indvdum@0: indvdum@0: if (!sizeof($post_info)) indvdum@0: { indvdum@0: trigger_error('POST_NOT_EXIST'); indvdum@0: } indvdum@0: indvdum@0: $post_info = $post_info[$post_id]; indvdum@0: indvdum@0: // Now add log entry indvdum@0: add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username); indvdum@0: } indvdum@0: indvdum@0: ?>