aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Atkinson <thefinn@users.sourceforge.net>2001-09-07 22:56:50 +0000
committerJames Atkinson <thefinn@users.sourceforge.net>2001-09-07 22:56:50 +0000
commitd51c14ea0a1235e4e30fca83f80a7ce9593c7215 (patch)
tree33109eca285492d8e66f6a3e1650b56541f3e8f7
parent60e3f50b612f08ee7654004f2bbd68b3041ab6df (diff)
downloadforums-d51c14ea0a1235e4e30fca83f80a7ce9593c7215.tar
forums-d51c14ea0a1235e4e30fca83f80a7ce9593c7215.tar.gz
forums-d51c14ea0a1235e4e30fca83f80a7ce9593c7215.tar.bz2
forums-d51c14ea0a1235e4e30fca83f80a7ce9593c7215.tar.xz
forums-d51c14ea0a1235e4e30fca83f80a7ce9593c7215.zip
View IP code in
git-svn-id: file:///svn/phpbb/trunk@1008 89ea8834-ac86-4346-8a33-228a782c2dd0
-rwxr-xr-xphpBB/language/lang_english.php6
-rw-r--r--phpBB/modcp.php57
-rwxr-xr-xphpBB/templates/PSO/modcp_viewip.tpl38
-rw-r--r--phpBB/viewtopic.php98
4 files changed, 131 insertions, 68 deletions
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) . "&amp;f=all&amp;b=0&amp;d=DESC&amp;c=100&amp;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 @@
+
+<table width="98%" cellspacing="0" cellpadding="4" border="0" align="center">
+ <tr>
+ <td align="left"><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></span></td>
+ </tr>
+</table>
+
+<table width="98%" cellpadding="1" cellspacing="0" border="0" align="center">
+ <tr>
+ <td class="tablebg"><table width="100%" cellpadding="3" cellspacing="1" border="0">
+ <tr>
+ <th class="cat" colspan="2"><span class="cattitle"><b>{L_IPINFO}</b></span></th>
+ </tr>
+ <tr>
+ <td class="row1" width="15%"><span class="gen">{L_IPTHISPOST}</span></td>
+ <td class="row2"><span class="gen">{IP}</td>
+ </tr>
+ <tr>
+ <th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERUSERS}</b></span></th>
+ </tr>
+ <!-- BEGIN userrow -->
+ <tr>
+ <td class="row1" colspan="2"><span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a> [<a href="{userrow.U_SEARCHPOSTS}">{L_SEARCHPOSTS}</a>]</td>
+ </tr>
+ <!-- END userrow -->
+ <tr>
+ <th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERIPS}</b></span></th>
+ </tr>
+ <!-- BEGIN iprow -->
+ <tr>
+ <td class="row1" colspan="2"><span class="gen">{iprow.IP}</td>
+ </tr>
+ <!-- END iprow -->
+ </table></td>
+ </tr>
+</table>
+
+<br clear="all" />
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&amp;postdays=$post_days&amp;postorder=$post_order&amp;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 = "<a href=\"" . append_sid("modcp.$phpEx?mode=viewip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
+ $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
$delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
}
@@ -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'],