From c0aedcc467086221dcb1c2da684cc2d7d8823b6e Mon Sep 17 00:00:00 2001 From: Ludovic Arnaud Date: Thu, 10 Apr 2003 00:56:23 +0000 Subject: [PATCH] IP information moved to Post Details git-svn-id: file:///svn/phpbb/trunk@3803 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/mcp.php | 176 ++++++------------------ phpBB/templates/subSilver/mcp_post.html | 10 +- phpBB/viewtopic.php | 2 +- 3 files changed, 46 insertions(+), 142 deletions(-) diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 371db5951a..eda852f101 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -1395,20 +1395,20 @@ switch ($mode) AND p.poster_id = u.user_id"; $result = $db->sql_query($sql); - if (!$row = $db->sql_fetchrow($result)) + if (!$post_info = $db->sql_fetchrow($result)) { trigger_error('POST_NOT_EXIST'); } else { - $poster = (!empty($row['username'])) ? $row['username'] : ((!$row['post_username']) ? $user->lang['Guest'] : $row['post_username']); + $poster = (!empty($post_info['username'])) ? $post_info['username'] : ((!$post_info['post_username']) ? $user->lang['Guest'] : $post_info['post_username']); - $message = $row['post_text']; - $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_data['topic_title']; + $message = $post_info['post_text']; + $post_subject = ($post_info['post_subject'] != '') ? $post_info['post_subject'] : $topic_data['topic_title']; // If the board has HTML off but the post has HTML // on then we process it, else leave it alone - if (!$config['allow_html'] && $row['enable_html']) + if (!$config['allow_html'] && $post_info['enable_html']) { $message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message); } @@ -1419,46 +1419,17 @@ switch ($mode) 'S_CAN_VIEWIP' => $auth->acl_get('m_viewip', $forum_id), 'POSTER_NAME' => $poster, - 'POST_DATE' => $user->format_date($row['post_time']), - 'POST_IP' => $row['poster_ip'], + 'POST_DATE' => $user->format_date($post_info['post_time']), + 'POST_IP' => $post_info['poster_ip'] . ' (' . @gethostbyaddr($post_info['poster_ip']) . ')', 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, - 'SEARCH_IMG' => $user->img('icon_search', $user->lang['SEARCH']) + 'U_LOOKUP_ALL' => $mcp_url . '&mode=post_details&rdns=all#ip', + + 'SEARCH_IMG' => $user->img('btn_search', 'SEARCH_USER_POSTS') )); } - // Get other IP's this user has posted under - $sql = 'SELECT poster_ip, COUNT(*) AS postings - FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $post_info['poster_id'] . ' - GROUP BY poster_ip - ORDER BY postings DESC'; - $result = $db->sql_query($sql); - - $i = 0; - while ($iprow = $db->sql_fetchrow($result)) - { - if ($iprow['poster_ip'] == $row['poster_ip']) - { - $template->assign_vars(array( - 'POSTS' => $iprow['postings'] . ' ' . (($iprow['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']) - )); - continue; - } - - $ip = $iprow['poster_ip']; - $ip = ($rdns_ip_num == $iprow['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; - - $template->assign_block_vars('userrow', array( - 'S_ROW_COUNT' => $i++, - 'IP' => $ip, - 'POSTS' => $iprow['postings'] . ' ' . (($iprow['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS']), - 'U_LOOKUP_IP' => $mcp_url . '&mode=post_details&rdns=' . $iprow['poster_ip'] - )); - } - $db->sql_freeresult($result); - // Get other users who've posted under this IP $sql = "SELECT u.user_id, u.username, COUNT(*) as postings FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p @@ -1471,21 +1442,42 @@ switch ($mode) $i = 0; while ($row = $db->sql_fetchrow($result)) { - $id = $row['user_id']; - $username = (!$id) ? $user->lang['Guest'] : $row['username']; - $template->assign_block_vars('userrow', array( - 'USERNAME' => $username, - 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']), - 'L_SEARCH_POSTS' => sprintf($user->lang['Search_user_posts'], $username), + 'S_ROW_COUNT' => $i++, - 'U_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=$id", - 'U_SEARCHPOSTS' => "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=topics") - ); + 'USERNAME' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'], + 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS']), + + 'U_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'], + 'U_SEARCHPOSTS' => "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=topics" + )); $i++; } $db->sql_freeresult($result); + + // Get other IP's this user has posted under + $sql = 'SELECT poster_ip, COUNT(*) AS postings + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $post_info['poster_id'] . ' + GROUP BY poster_ip + ORDER BY postings DESC'; + $result = $db->sql_query($sql); + + $i = 0; + $rdns_ip_num = (!empty($_GET['rdns'])) ? $_GET['rdns'] : ''; + while ($row = $db->sql_fetchrow($result)) + { + $ip = ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? @gethostbyaddr($row['poster_ip']) . ' (' . $row['poster_ip'] . ')' : $row['poster_ip']; + + $template->assign_block_vars('iprow', array( + 'S_ROW_COUNT' => $i++, + 'IP' => $ip, + 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS']), + 'U_LOOKUP_IP' => $mcp_url . '&mode=post_details&rdns=' . $row['poster_ip'] . '#ip' + )); + } + $db->sql_freeresult($result); break; case 'lock': @@ -1616,94 +1608,6 @@ switch ($mode) trigger_error($user->lang['TOPIC_SPLIT'] . $return_url . $return_mcp); break; - case 'ip': - mcp_header('mcp_viewip.html'); - - $rdns_ip_num = (isset($_GET['rdns'])) ? $_GET['rdns'] : ''; - - if (!$post_id) - { - trigger_error('POST_NOT_EXIST'); - } - - $ip_this_post = $post_info['poster_ip']; - $ip_this_post = ($rdns_ip_num == $ip_this_post) ? @gethostbyaddr($ip_this_post) : $ip_this_post; - - $template->assign_vars(array( - 'L_IP_INFO' => $user->lang['IP_info'], - 'L_THIS_POST_IP' => $user->lang['This_posts_IP'], - 'L_OTHER_IPS' => $user->lang['Other_IP_this_user'], - 'L_OTHER_USERS' => $user->lang['Users_this_IP'], - 'L_LOOKUP_IP' => $user->lang['Lookup_IP'], - 'L_SEARCH' => $user->lang['Search'], - - 'SEARCH_IMG' => $images['icon_search'], - - 'IP' => $ip_this_post, - - 'U_LOOKUP_IP' => $mcp_url . '&mode=ip&rdns=' . $ip_this_post - )); - - // Get other IP's this user has posted under - $sql = 'SELECT poster_ip, COUNT(*) AS postings - FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $post_info['poster_id'] . ' - GROUP BY poster_ip - ORDER BY postings DESC'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['poster_ip'] == $post_info['poster_ip']) - { - $template->assign_vars(array( - 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']) - )); - continue; - } - - $ip = $row['poster_ip']; - $ip = ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; - - $template->assign_block_vars('iprow', array( - 'IP' => $ip, - 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']), - - 'U_LOOKUP_IP' => $mcp_url . '&mode=ip&rdns=' . $row['poster_ip']) - ); - } - $db->sql_freeresult($result); - - // Get other users who've posted under this IP - $sql = "SELECT u.user_id, u.username, COUNT(*) as postings - FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p - WHERE p.poster_id = u.user_id - AND p.poster_ip = '" . $post_info['poster_ip'] . "' - GROUP BY u.user_id, u.username - ORDER BY postings DESC"; - $result = $db->sql_query($sql); - - $i = 0; - while ($row = $db->sql_fetchrow($result)) - { - $id = $row['user_id']; - $username = (!$id) ? $user->lang['Guest'] : $row['username']; - - $template->assign_block_vars('userrow', array( - 'USERNAME' => $username, - 'POSTS' => $row['postings'] . ' ' . (($row['postings'] == 1) ? $user->lang['Post'] : $user->lang['Posts']), - 'L_SEARCH_POSTS' => sprintf($user->lang['Search_user_posts'], $username), - - 'U_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=$id", - 'U_SEARCHPOSTS' => "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=topics") - ); - - $i++; - } - $db->sql_freeresult($result); - break; - - case 'select_topic': case 'forum_view': mcp_header('mcp_forum.html', 'm_', TRUE); diff --git a/phpBB/templates/subSilver/mcp_post.html b/phpBB/templates/subSilver/mcp_post.html index dd50e456ea..440de15577 100644 --- a/phpBB/templates/subSilver/mcp_post.html +++ b/phpBB/templates/subSilver/mcp_post.html @@ -46,12 +46,12 @@ {userrow.USERNAME} [ {userrow.POSTS} ] - {SEARCH_IMG} + {SEARCH_IMG} - - {L_OTHER_IPS} + {L_OTHER_IPS} + [ {L_LOOKUP_ALL} ] @@ -59,8 +59,8 @@ - {iprow.USERNAME} [ {iprow.POSTS} ] - {SEARCH_IMG} + {iprow.IP} [ {iprow.POSTS} ] + [ {L_LOOKUP_IP} ] diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3cf8e48672..7df4d6bc8b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -699,7 +699,7 @@ if ($row = $db->sql_fetchrow($result)) if ($auth->acl_get('m_ip', $forum_id)) { - $temp_url = "mcp.$phpEx?sid=" . $user->session_id . "&mode=ip&p=" . $row['post_id'] . "&t=" . $topic_id; + $temp_url = "mcp.$phpEx?sid=" . $user->session_id . "&mode=post_details&p=" . $row['post_id'] . "&t=$topic_id#ip"; $ip_img = '' . $user->img('btn_ip', $user->lang['VIEW_IP']) . ''; $ip = '' . $user->lang['VIEW_IP'] . ''; }