diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index b3183053dd..1af1c45fbf 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -629,8 +629,10 @@ $lang['Topic_split'] = "The selected topic has been split successfully"; $lang['Too_many_error'] = "You have selected too many posts. You can only select one post to split a topic after!"; $lang['New_forum'] = "New forum"; $lang['None_selected'] = "You have no selected any topics to preform this operation on. Please go back and select at least one."; - - +$lang['IP_on_this_post'] = "IP for this post"; +$lang['Other_IPS_this_user'] = "Other IP's this user has posted from"; +$lang['Other_users_this_IP'] = "Other users who have used this IP"; +$lang['IP_info'] = "IP Information"; // // Timezones ... for display on each page // diff --git a/phpBB/modcp.php b/phpBB/modcp.php index e0ce70d9d5..dadc3a21b4 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -115,6 +115,7 @@ include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( "body" => "modcp_body.tpl", "confirm" => "confirm_body.tpl", + "viewip" => "modcp_viewip.tpl", "split_body" => "split_body.tpl") ); @@ -756,43 +757,65 @@ switch($mode) } // Look up relevent data for this post - $sql = "SELECT poster_ip, poster_id, post_username FROM ".POSTS_TABLE." WHERE post_id = $post_id"; + $sql = "SELECT poster_ip, poster_id FROM ".POSTS_TABLE." WHERE post_id = $post_id"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql); } $post_row = $db->sql_fetchrow($result); + $ip_this_post = decode_ip($post_row['poster_ip']); + $poster_id = $post_row['poster_id']; + $template->assign_vars(array("L_IPINFO" => $lang['IP_info'], + "L_IPTHISPOST" => $lang['IP_on_this_post'], + "L_OTHERIPS" => $lang['Other_IPS_this_user'], + "L_OTHERUSERS" => $lang['Other_users_this_IP'], + "L_SEARCHPOSTS" => $lang['Search_user_posts'], + "IP" => $ip_this_post)); + + // + // Get other IP's this user has posted under + // + $sql = "SELECT DISTINCT poster_ip FROM " . POSTS_TABLE . " WHERE poster_id = $poster_id AND poster_ip <> '".$post_row['poster_ip']."'"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Could not get IP information for this user", "Error", __LINE__, __FILE__, $sql); + } + + $poster_ips = $db->sql_fetchrowset($result); + for($i = 0; $i < count($poster_ips); $i++) + { + $ip = decode_ip($poster_ips[$i]['poster_ip']); + $template->assign_block_vars("iprow", array("IP" => $ip)); + } + + // // Get other users who've posted under this IP - $sql = "SELECT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'"; + // + $sql = "SELECT DISTINCT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql); } $poster_ids = $db->sql_fetchrowset($result); - sort($poster_ids); - - $posts = 0; - while(list($null, $userdata) = each($poster_ids)) + for($i = 0; $i < count($poster_ids); $i++) { - $username = $userdata['username']; - $user_id = $userdata['user_id']; + $id = $poster_ids[$i]['user_id']; + $username = $poster_ids[$i]['username']; - if($username != $last_username && !empty($last_username)) + if($id == ANONYMOUS) { - $other_users[] = array("username" => "$last_username", "user_id" => "$last_user_id", "posts" => "$posts"); - $posts = 1; + $username = $lang['Guest']; } - else - { - $posts += 1; - } - $last_username = $username; - $last_user_ip = $user_id; + + $template->assign_block_vars("userrow", array("U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"), + "USERNAME" => $username, + "U_SEARCHPOSTS" => append_sid("search.$phpEx?a=" . urlencode($username) . "&f=all&b=0&d=DESC&c=100&dosearch=1"))); } + $template->pparse("viewip"); break; default: diff --git a/phpBB/templates/PSO/modcp_viewip.tpl b/phpBB/templates/PSO/modcp_viewip.tpl new file mode 100755 index 0000000000..b4ed0f0ce6 --- /dev/null +++ b/phpBB/templates/PSO/modcp_viewip.tpl @@ -0,0 +1,38 @@ + + + + + +
{SITENAME} {L_INDEX}
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
{L_IPINFO}
{L_IPTHISPOST}{IP}
{L_OTHERUSERS}
{userrow.USERNAME} [{L_SEARCHPOSTS}]
{L_OTHERIPS}
{iprow.IP}
+ +
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index dacd7bb926..30fc84669d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -11,14 +11,14 @@ * ***************************************************************************/ -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); @@ -164,7 +164,7 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_read']) // // -// Is user watching this thread? This could potentially +// Is user watching this thread? This could potentially // be combined into the above query but the LEFT JOIN causes // a number of problems which will probably end up in this // solution being practically as fast and certainly simpler! @@ -173,9 +173,9 @@ if($userdata['user_id'] != ANONYMOUS) { $can_watch_topic = TRUE; - $sql = "SELECT notify_status - FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $topic_id + $sql = "SELECT notify_status + FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -190,8 +190,8 @@ if($userdata['user_id'] != ANONYMOUS) $is_watching_topic = 0; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " - WHERE topic_id = $topic_id + $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -208,9 +208,9 @@ if($userdata['user_id'] != ANONYMOUS) if( $watch_data['notify_status'] ) { $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " - SET notify_status = 0 - WHERE topic_id = $topic_id + $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " + SET notify_status = 0 + WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -228,7 +228,7 @@ if($userdata['user_id'] != ANONYMOUS) $is_watching_topic = TRUE; $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; - $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) + $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; if( !$result = $db->sql_query($sql) ) { @@ -385,7 +385,7 @@ $template->assign_vars(array( "L_GO" => $lang['Go'], "L_JUMP_TO" => $lang['Jump_to'], "L_SELECT_FORUM" => $lang['Select_forum'], - + "S_JUMPBOX_LIST" => $jumpbox, "S_JUMPBOX_ACTION" => append_sid("viewforum.$phpEx")) ); @@ -397,8 +397,8 @@ $template->assign_vars(array( "TOPIC_ID" => $topic_id, "TOPIC_TITLE" => $topic_title, - "L_DISPLAY_POSTS" => $lang['Display_posts'], - "L_RETURN_TO_TOP" => $lang['Return_to_top'], + "L_DISPLAY_POSTS" => $lang['Display_posts'], + "L_RETURN_TO_TOP" => $lang['Return_to_top'], "S_SELECT_POST_DAYS" => $select_post_days, "S_SELECT_POST_ORDER" => $select_post_order, @@ -456,10 +456,10 @@ $template->assign_vars(array( // if( !empty($forum_row['topic_vote']) ) { - $sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result - FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr - WHERE vd.topic_id = $topic_id - AND vr.vote_id = vd.vote_id + $sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result + FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr + WHERE vd.topic_id = $topic_id + AND vr.vote_id = vd.vote_id ORDER BY vr.vote_option_id ASC"; if( !$result = $db->sql_query($sql) ) { @@ -473,9 +473,9 @@ if( !empty($forum_row['topic_vote']) ) $vote_id = $vote_info[0]['vote_id']; $vote_title = $vote_info[0]['vote_text']; - $sql = "SELECT vote_id - FROM " . VOTE_USERS_TABLE . " - WHERE vote_id = $vote_id + $sql = "SELECT vote_id + FROM " . VOTE_USERS_TABLE . " + WHERE vote_id = $vote_id AND vote_user_id = " . $userdata['user_id']; if( !$result = $db->sql_query($sql) ) { @@ -519,18 +519,18 @@ if( !empty($forum_row['topic_vote']) ) $vote_graphic_img = $images['voting_graphic'][$vote_graphic]; $vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0; - + if( count($orig_word) ) { $vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']); } $template->assign_block_vars("poll_option", array( - "POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'], - "POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'], - "POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)), + "POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'], + "POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'], + "POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)), - "POLL_OPTION_IMG" => $vote_graphic_img, + "POLL_OPTION_IMG" => $vote_graphic_img, "POLL_OPTION_IMG_WIDTH" => $vote_graphic_length) ); } @@ -554,7 +554,7 @@ if( !empty($forum_row['topic_vote']) ) } $template->assign_block_vars("poll_option", array( - "POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'], + "POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'], "POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text']) ); } @@ -562,7 +562,7 @@ if( !empty($forum_row['topic_vote']) ) $template->assign_vars(array( "L_SUBMIT_VOTE" => $lang['Submit_vote'], "L_VIEW_RESULTS" => $lang['View_results'], - + "U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult")) ); @@ -575,9 +575,9 @@ if( !empty($forum_row['topic_vote']) ) } $template->assign_vars(array( - "POLL_QUESTION" => $vote_title, - - "S_HIDDEN_FIELDS" => $s_hidden_fields, + "POLL_QUESTION" => $vote_title, + + "S_HIDDEN_FIELDS" => $s_hidden_fields, "S_VOTE_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id")) ); @@ -720,7 +720,7 @@ for($i = 0; $i < $total_posts; $i++) if( $is_auth['auth_mod'] ) { - $ip_img = "\"""; + $ip_img = "\"""; $delpost_img = "\"""; } @@ -729,7 +729,7 @@ for($i = 0; $i < $total_posts; $i++) $ip_img = ""; $delpost_img = ""; } - + $message = $postrow[$i]['post_text']; $post_subject = ( $postrow[$i]['post_subject'] != "" ) ? $postrow[$i]['post_subject'] : $topic_title; @@ -741,7 +741,7 @@ for($i = 0; $i < $total_posts; $i++) // If the board has HTML off but the post has HTML // on then we process it, else leave it alone // - if( !$board_config['allow_html'] ) + if( !$board_config['allow_html'] ) { if( $user_sig != "" && $postrow[$i]['enable_sig'] ) { @@ -903,15 +903,15 @@ $template->assign_vars(array( "ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ), "TOTAL_PAGES" => ceil( $total_replies / $board_config['posts_per_page'] ), - "S_AUTH_LIST" => $s_auth_can, - "S_AUTH_READ_IMG" => $s_auth_read_img, - "S_AUTH_POST_IMG" => $s_auth_post_img, - "S_AUTH_REPLY_IMG" => $s_auth_reply_img, - "S_AUTH_EDIT_IMG" => $s_auth_edit_img, + "S_AUTH_LIST" => $s_auth_can, + "S_AUTH_READ_IMG" => $s_auth_read_img, + "S_AUTH_POST_IMG" => $s_auth_post_img, + "S_AUTH_REPLY_IMG" => $s_auth_reply_img, + "S_AUTH_EDIT_IMG" => $s_auth_edit_img, "S_AUTH_MOD_IMG" => $s_auth_mod_img, - "S_TOPIC_ADMIN" => $topic_mod, - "S_WATCH_TOPIC" => $s_watching_topic, - "S_WATCH_TOPIC_IMG" => $s_watching_topic_img, + "S_TOPIC_ADMIN" => $topic_mod, + "S_WATCH_TOPIC" => $s_watching_topic, + "S_WATCH_TOPIC_IMG" => $s_watching_topic_img, "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'],