Kód:
##############################################################
## MOD Title: Advanced IP Tools Pack
## MOD Author: pentapenguin < pentapenguin@bluebottle.com > (n/a) http://www.pentapenguin.com
## MOD Description: This MOD will save users' IP and hostname information on signup. Includes additional IP features and extensions.
## MOD Version: 0.3.2
##
## Installation Level: Intermediate
## Installation Time: 30 Minutes
## Files To Edit: 15
## admin/admin_db_utilities.php
## common.php
## search.php
## viewonline.php
## viewtopic.php
## language/lang_english/lang_main.php
## includes/constants.php
## includes/functions.php
## includes/page_header.php
## includes/sessions.php
## includes/usercp_register.php
## includes/usercp_viewprofile.php
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/search_body.tpl
## templates/subSilver/viewonline_body.tpl
##
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## Thanks go out to CyberAlien and geocator for their tips.
##
## Support for this MOD may be found at http://www.phpbb.com/phpBB/viewtopic.php?t=234613 or at
## http://www.pentapenguin.com/forum/viewtopic.php?t=138
##
## This MOD is EasyMOD friendly! (http://area51.phpbb.com/phpBB/viewtopic.php?sid=&f=17&t=15391)
##
## Optional step: if you have CyberAlien's eXtreme Styles MOD (http://www.phpbb.com/phpBB/viewtopic.php?t=125251),
## you can copy the file in contrib/admin/advanced_ip_tools_pack.cfg to admin/advanced_ip_tools_pack.cfg and you will
## be automatically notified if there's an update available when you use the "check for updates" function.
##
## Additional style support: I've included instructions on how to MOD other templates.
## Just look in the Styles directory under style_yourstylename.txt for directions.
##############################################################
## MOD History:
## 2005-10-18 Version 0.3.2
## -Security update. Credit for help and discovery goes to AnthraX101
##
## 2005-05-07 Version 0.3.1
## -Full pagination support for the other users registering under this IP, posts, and logins sections
## -Miscellaneus PHP code improvements in includes/usercp_viewprofile.php
## -Added Whois IP address lookup to logins section
## -Added the time of the registration to the other users registering under this IP section
##
## 2005-05-04 Version 0.3.0
## -Added browser recording
## -Added IP and browser information to who's online page
## -Added logins recording
## -Added message if the IP wasn't recorded instead of blank space
## -Added Aphrodite style support
## -Added error message instead of having a blank profile page for wrong user IDs
##
## 2004-12-31 Version 0.2.0
## -Added wildcard searching for IPs
## -Added quick view of IPs
## -Added Profile Control Panel support
## -Added Morpheus eXtreme style to the styles directory
##
## 2004-11-23 Version 0.1.1
## -Updated FIND commands to reflect version 2.0.11 of phpBB.
## -Put MOD in ZIP file along with MOD directions for Cobalt, Morpheus, ff8, and Appalachia
##
## 2004-10-24 - Version 0.1.0
## - First Public Beta
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_users
ADD user_registered_ip VARCHAR(8),
ADD user_registered_hostname VARCHAR(255 );
ALTER TABLE phpbb_sessions
ADD session_user_agent VARCHAR( 255 ) NOT NULL AFTER session_ip;
CREATE TABLE phpbb_logins (
login_id mediumint(8) unsigned NOT NULL auto_increment,
login_userid mediumint(8) NOT NULL default '0',
login_ip varchar(8) NOT NULL default '0',
login_user_agent varchar(255) NOT NULL default 'n/a',
login_time int(11) NOT NULL default '0',
PRIMARY KEY (login_id)
);
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_db_utilities.php
#
#-----[ FIND ]------------------------------------------
#
# Note: actual line is much longer and may slightly vary!
#
$tables = array('auth_access', 'banlist', 'categories',
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$tables[] = 'logins';
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
common.php
#
#-----[ FIND ]------------------------------------------
#
$user_ip = encode_ip($client_ip);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$user_agent = ( !empty($HTTP_SERVER_VARS['HTTP_USER_AGENT']) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : ( !empty($HTTP_ENV_VARS['HTTP_USER_AGENT']) ? $HTTP_ENV_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT') ) );
$user_agent = addslashes($user_agent);
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
viewonline.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'L_WHOSONLINE' => $lang['Who_is_Online'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
'L_WHOIS' => $lang['Whois'],
'L_IP' => $lang['IP'],
'L_BROWSER' => $lang['Browser'],
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
s.session_ip
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, s.session_user_agent
#
#-----[ FIND ]------------------------------------------
#
$row_color = ( $$which_counter % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $$which_counter % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$mode = htmlspecialchars($HTTP_GET_VARS['mode']);
if ( ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) ) && $mode == 'lookup' && isset($HTTP_GET_VARS['ip']) && (decode_ip($row['session_ip']) == $HTTP_GET_VARS['ip']) )
{
$ip = gethostbyaddr( decode_ip($row['session_ip']) );
}
else
{
$ip = decode_ip($row['session_ip']);
$mode = 'ip';
}
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars("$which_row", array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
'IP' => htmlspecialchars($ip),
'USER_AGENT' => htmlspecialchars($row['session_user_agent']),
'U_HOSTNAME_LOOKUP' => ( $mode != 'lookup' ) ? append_sid("viewonline.$phpEx?mode=lookup&ip=" . decode_ip($row['session_ip']) ) : append_sid("viewonline.$phpEx?mode=ip&ip=" . decode_ip($row['session_ip']) ) ,
'U_WHOIS' => 'http://whois.sc/' . decode_ip($row['session_ip']),
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
'U_FORUM_LOCATION' => append_sid($location_url))
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
if ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) )
{
$template->assign_block_vars($which_row . '.switch_user_admin_or_mod', array() );
}
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
#
#-----[ REPLACE WITH ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . ' (' . decode_ip($postrow[$i]['poster_ip']) . ')" title="' . $lang['View_IP'] . ' (' . decode_ip($postrow[$i]['poster_ip']) . ')" border="0" /></a>';
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$search_ip = '';
// For security reasons, we need to make sure the IP lookup is coming from an admin or mod.
if ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) )
{
if ( !empty($HTTP_POST_VARS['search_ip']) || !empty($HTTP_GET_VARS['search_ip']) )
{
$ip_address = ( !empty($HTTP_POST_VARS['search_ip']) ) ? $HTTP_POST_VARS['search_ip'] : $HTTP_GET_VARS['search_ip'];
$ip_address = htmlspecialchars($ip_address);
$ip_address = str_replace("\'", "''", $ip_address);
$ip_pieces = explode('.', $ip_address);
$ip_pieces_count = count($ip_pieces) - 1;
for ($i = 0; $i <= $ip_pieces_count; $i++)
{
$search_ip .= ( $ip_pieces[$i] == '*' ) ? '%' : sprintf('%02x', $ip_pieces[$i]);
}
}
else
{
$search_ip = '';
}
}
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
# Note: full line to find is: else if ( $search_keywords != '' || $search_author != '' || $search_id )
#
$search_keywords != '' || $search_author != '' || $search_id
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$search_id
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
# Important note: there should be a space before the || AND after the != ''
#
|| $search_ip != ''
#
#-----[ FIND ]------------------------------------------
#
#Note: full line to find is: if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
#
$search_id == 'unanswered' || $search_keywords != '' || $search_author != ''
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$search_author != ''
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
# Important note: there should be a space before the || AND after the != ''
#
|| $search_ip != ''
#
#-----[ FIND ]------------------------------------------
#
# Note: full line to find is: if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) )
#
( $search_author != '' && $search_keywords == '' )
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$search_keywords == '' )
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
# Important note: there should be a space before the || AND after the != ''
#
|| $search_ip != ''
#
#-----[ FIND ]------------------------------------------
#
if ( $search_id == 'newposts' )
{
if ( $userdata['session_logged_in'] )
{
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'];
}
else
{
redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=newposts", true));
}
$show_results = 'topics';
$sort_by = 0;
$sort_dir = 'DESC';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
else if ($search_ip != '')
{
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE poster_ip LIKE '$search_ip'";
$show_results = 'posts';
$sort_by = 0;
$sort_dir = 'DESC';
}
//End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
'L_SEARCH_IP' => $lang['Search_ip'],
'L_SEARCH_IP_EXPLAIN' => $lang['Search_ip_explain'],
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# Note: the complete line to find is: $lang['Viewing_user_profile'] = 'Viewing profile :: %s'; // %s is username
#
$lang['Viewing_user_profile']
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$lang['Moderator_ip_information'] = 'IP address information for moderators only';
$lang['Registered_ip_address'] = 'Registered IP address';
$lang['Registered_hostname'] = 'Registered hostname';
$lang['Other_registered_ips'] = 'Other users registering from %s'; //%s is the IP address
$lang['Other_posted_ips'] = 'IP addresses this user has posted from';
$lang['Search_ip'] = 'Search for posts by IP address';
$lang['Search_ip_explain'] = 'Enter a IP address in the format like <u>127.0.0.1</u> -- you may use * as a wildcard for partial matches like <u>127.*.*.1</u>';
$lang['IP'] = 'IP';
$lang['Whois'] = 'Whois';
$lang['Browser'] = 'Browser';
$lang['No_other_registered_ips'] = 'No other users have registered under this IP address.';
$lang['No_other_posted_ips'] = 'This user has not made any posts.';
$lang['Not_recorded'] = 'Not recorded';
$lang['Logins'] = 'Logins';
$lang['No_logins'] = 'No logins have been recorded for this user.';
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
define('LOGINS_TABLE', $table_prefix . 'logins');
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
if ( $db->sql_affectedrows() == 0 )
{
message_die(GENERAL_ERROR, 'User does not exist.');
}
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
function generate_pagination($base_url, $num_items, $per_page,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$add_prevnext_text = TRUE
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $start = 'start'
#
#-----[ FIND ]------------------------------------------
#
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ FIND ]------------------------------------------
#
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ FIND ]------------------------------------------
#
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ FIND ]------------------------------------------
#
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ FIND ]------------------------------------------
#
$page_string = ' <a href="' . append_sid($base_url . "&start=" . ( ( $on_page - 2 ) * $per_page ) ) . '">' . $lang['Previous'] . '</a> ' . $page_string;
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ FIND ]------------------------------------------
#
$page_string .= ' <a href="' . append_sid($base_url . "&start=" . ( $on_page * $per_page ) ) . '">' . $lang['Next'] . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
start
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$start
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
if ( !empty($userdata['user_popup_pm']) )
{
$template->assign_block_vars('switch_enable_pm_popup', array());
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
if ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) )
{
$template->assign_block_vars('switch_user_admin_or_mod',array() );
}
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
global $user_agent;
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
#
#-----[ IN-LINE FIND ]------------------------------------------
#
session_logged_in = $login
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, session_user_agent = '$user_agent'
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)";
#
#-----[ IN-LINE FIND ]------------------------------------------
#
session_ip,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
session_user_agent,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'$user_ip',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'$user_agent',
#
#-----[ FIND ]------------------------------------------
#
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$sql = "INSERT INTO " . LOGINS_TABLE . "
(login_id, login_userid, login_ip, login_user_agent, login_time)
VALUES (NULL, $user_id, '$user_ip', '$user_agent', $current_time)";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error inserting login', '', __LINE__, __FILE__, $sql);
}
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$user_id = $row['total'] + 1;
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$user_registered_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$user_registered_hostname = ( gethostbyaddr($user_registered_ip) ) ? gethostbyaddr($user_registered_ip) : $user_registered_ip;
$user_registered_hostname = addslashes($user_registered_hostname);
$user_registered_ip = encode_ip($user_registered_ip);
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
INSERT INTO " . USERS_TABLE . " (
#
#-----[ IN-LINE FIND ]------------------------------------------
#
INSERT INTO " . USERS_TABLE . " (
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_registered_ip, user_registered_hostname,
#
#-----[ FIND ]------------------------------------------
#
$user_id, '" . str_replace("\'", "''", $username) . "',
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$user_id, '" . str_replace("\'", "''", $username) . "',
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
'" . str_replace("\'", "''", $user_registered_ip) . "', '" . str_replace("\'", "''", $user_registered_hostname) . "',
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
$encoded_ip = ( $profiledata['user_registered_ip'] == '' ) ? '' : $profiledata['user_registered_ip'];
$decoded_ip = ( decode_ip($encoded_ip) == '0.0.0.0' ) ? $lang['Not_recorded'] : decode_ip($encoded_ip);
$hostname = ( $profiledata['user_registered_hostname'] == '' ) ? $lang['Not_recorded'] : htmlspecialchars( $profiledata['user_registered_hostname'] );
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author),
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
'L_MODERATOR_IP_INFORMATION' => $lang['Moderator_ip_information'],
'L_REGISTERED_IP_ADDRESS' => $lang['Registered_ip_address'],
'L_REGISTERED_HOSTNAME' => $lang['Registered_hostname'],
'L_OTHER_REGISTERED_IPS' => sprintf($lang['Other_registered_ips'], $decoded_ip),
'L_OTHER_IPS' => $lang['Other_posted_ips'],
'USER_EMAIL_ADDRESS' => $profiledata['user_email'],
'U_USER_IP_ADDRESS' => ( $decoded_ip != $lang['Not_recorded'] ) ? "<a href='http://whois.sc/$decoded_ip' target='_blank'>$decoded_ip</a>" : $lang['Not_recorded'],
'USER_IP_ADDRESS' => $decoded_ip,
'USER_REGISTERED_HOSTNAME' => $hostname,
// End Advanced IP Tools Pack MOD
#
#-----[ FIND ]------------------------------------------
#
$template->pparse('body');
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Advanced IP Tools Pack MOD
// Let's see if the user viewing this page is an admin or mod, if not, we can save several database queries! :P
if ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) )
{
// All users registering under this IP address section
if ( $encoded_ip != '' )
{
$sql = 'SELECT COUNT(user_id) AS total_users FROM ' . USERS_TABLE . ' WHERE user_registered_ip = "' . $encoded_ip . '" AND user_id != "' . $profiledata['user_id'] . '"';
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not determine total users registering under this IP.', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($result) )
{
message_die(GENERAL_ERROR, 'Error: could not get the total users number.', '', __LINE__, __FILE__, $sql);
}
$total_users = $row['total_users'];
if ( $total_users > 0 )
{
$u_start = ( isset($HTTP_GET_VARS['u_start']) ) ? intval($HTTP_GET_VARS['u_start']) : 0;
$sql = "SELECT user_id, username, user_regdate, user_registered_ip, user_registered_hostname FROM " . USERS_TABLE . " WHERE user_registered_ip = '" . $encoded_ip . "' AND user_id != '" . $profiledata['user_id'] . "' ORDER BY user_regdate DESC LIMIT $u_start, " . $board_config['topics_per_page'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not look up other registered IP addresses.', '', __LINE__, __FILE__, $sql);
}
$template->assign_block_vars('switch_user_admin_or_mod.switch_other_user_ips', array() );
while ( $row = $db->sql_fetchrow($result) )
{
$template->assign_block_vars('switch_user_admin_or_mod.switch_other_user_ips.OTHER_REGISTERED_IPS', array(
'USER_NAME' => $row['username'],
'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $row['user_id']),
'USER_HOSTNAME' => htmlspecialchars( $row['user_registered_hostname'] ),
'TIME' => create_date($userdata['user_dateformat'], $row['user_regdate'], $userdata['user_timezone']),
));
}
$base_url = "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $profiledata['user_id'];
$pagination = generate_pagination($base_url, $total_users, $board_config['topics_per_page'], $u_start, TRUE, 'u_start');
$template->assign_vars(array(
'USERS_PAGINATION' => $pagination,
'USERS_PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $u_start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] ) ),
));
}
else
{
$template->assign_vars(array(
'L_NO_OTHER_REGISTERED_IPS' => $lang['No_other_registered_ips'],
));
$template->assign_block_vars('switch_user_admin_or_mod.switch_no_other_registered_ips', array() );
}
}
else
{
$template->assign_vars(array(
'L_NO_OTHER_REGISTERED_IPS' => $lang['No_other_registered_ips'],
));
$template->assign_block_vars('switch_user_admin_or_mod.switch_no_other_registered_ips', array() );
}
// All IP addresses this user has posted from section
$total_ips = 0;
$sql = 'SELECT poster_ip, COUNT(*) AS postings FROM ' . POSTS_TABLE . ' WHERE poster_id = "' . $profiledata['user_id'] . '" GROUP BY poster_ip ORDER BY ' . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . ' DESC';
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not look up all IP addresses this user has posted from.', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$total_ips = $total_ips + 1;
}
if ( $total_ips > 0 )
{
$i_start = ( isset($HTTP_GET_VARS['i_start']) ) ? intval($HTTP_GET_VARS['i_start']) : 0;
$sql = 'SELECT poster_ip, COUNT(*) AS postings FROM ' . POSTS_TABLE . ' WHERE poster_id = "' . $profiledata['user_id'] . '" GROUP BY poster_ip ORDER BY ' . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC LIMIT $i_start, " . $board_config['topics_per_page'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not look up all IP addresses this user has posted from.', '', __LINE__, __FILE__, $sql);
}
$template->assign_block_vars('switch_user_admin_or_mod.switch_other_posted_ips', array() );
while ( $row = $db->sql_fetchrow($result) )
{
$poster_ip = decode_ip($row['poster_ip']);
$template->assign_block_vars('switch_user_admin_or_mod.switch_other_posted_ips.ALL_IPS_POSTED_FROM', array(
'U_POSTER_IP' => "http://whois.sc/$poster_ip",
'POSTER_IP' => $poster_ip,
'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ),
'U_POSTS_LINK' => append_sid("search.$phpEx?mode=results&search_author=" . urlencode($profiledata['username']) . "&search_ip=$poster_ip"),
));
}
$base_url = "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $profiledata['user_id'];
$pagination = generate_pagination($base_url, $total_ips, $board_config['topics_per_page'], $i_start, TRUE, 'i_start');
$template->assign_vars(array(
'IPS_PAGINATION' => $pagination,
'IPS_PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $i_start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_ips / $board_config['topics_per_page'] ) ),
));
}
else
{
$template->assign_vars(array(
'L_NO_OTHER_POSTED_IPS' => $lang['No_other_posted_ips'],
));
$template->assign_block_vars('switch_user_admin_or_mod.switch_no_other_posted_ips', array() );
}
// All logins section
// Obtain the total logins for this user
$sql = 'SELECT COUNT(login_id) AS total_logins FROM ' . LOGINS_TABLE . ' WHERE login_userid = ' . $profiledata['user_id'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not determine total logins.', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($result) )
{
message_die(GENERAL_ERROR, 'Error: could not get the logins number.', '', __LINE__, __FILE__, $sql);
}
$total_logins = $row['total_logins'];
if ( $total_logins > 0 )
{
$l_start = ( isset($HTTP_GET_VARS['l_start']) ) ? intval($HTTP_GET_VARS['l_start']) : 0;
// Now get the results in groups based on how many topics per page parameter set in the admin panel
$sql = 'SELECT * FROM ' . LOGINS_TABLE . ' WHERE login_userid = ' . $profiledata['user_id'] . " ORDER BY login_time DESC LIMIT $l_start, " . $board_config['topics_per_page'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not retrieve last login.', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$ip = decode_ip($row['login_ip']);
$template->assign_block_vars('switch_user_admin_or_mod.USER_LOGINS', array(
'U_IP' => "http://whois.sc/$ip",
'IP' => $ip,
'USER_AGENT' => htmlspecialchars( $row['login_user_agent'] ),
'LOGIN_TIME' => create_date($userdata['user_dateformat'], $row['login_time'], $userdata['user_timezone']),
));
}
$base_url = "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $profiledata['user_id'];
$pagination = generate_pagination($base_url, $total_logins, $board_config['topics_per_page'], $l_start, TRUE, 'l_start');
$template->assign_vars(array(
'LOGINS_PAGINATION' => $pagination,
'LOGINS_PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $l_start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_logins / $board_config['topics_per_page'] ) ),
));
}
else
{
$template->assign_vars(array(
'L_NO_LOGINS' => $lang['No_logins'],
));
$template->assign_block_vars('switch_user_admin_or_mod.switch_no_logins', array() );
}
$template->assign_vars(array(
'L_USERNAME' => $lang['Username'],
'L_LOGINS' => $lang['Logins'],
'L_IP' => $lang['IP'],
'L_BROWSER' => $lang['Browser'],
'L_TIME' => $lang['Time'],
));
}
// End Advanced IP Tools Pack MOD
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
//--></script><noscript>{ICQ_IMG}</noscript></td>
</tr>
</table>
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_admin_or_mod -->
<tr>
<th class="thHead" colspan="2" align="center">{L_MODERATOR_IP_INFORMATION}:</th>
</tr>
<tr>
<td class="row1" colspan="2"><span class="gen">{L_EMAIL_ADDRESS}: <a href="mailto:{USER_EMAIL_ADDRESS}">{USER_EMAIL_ADDRESS}</a></span></td>
</tr>
<tr>
<td class="row1" colspan="2"><span class="gen">{L_REGISTERED_IP_ADDRESS}: {U_USER_IP_ADDRESS}</span></td>
</tr>
<tr>
<td class="row1" colspan="2"><span class="gen">{L_REGISTERED_HOSTNAME}: {USER_REGISTERED_HOSTNAME}</span></td>
</tr>
<!-- END switch_user_admin_or_mod -->
#
#-----[ FIND ]------------------------------------------
#
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="right"><span class="nav"><br />{JUMPBOX}</span></td>
</tr>
</table>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_admin_or_mod -->
<br />
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr>
<th class="thHead" colspan="3" align="center">{L_OTHER_REGISTERED_IPS}:</th>
</tr>
<tr>
<td class="cat"><span class="gen"><b>{L_USERNAME}:</b></span></td>
<td class="cat"><span class="gen"><b>{L_REGISTERED_HOSTNAME}:</b></span></td>
<td class="cat"><span class="gen"><b>{L_TIME}:</b></span></td>
</tr>
<!-- BEGIN switch_other_user_ips -->
<!-- BEGIN OTHER_REGISTERED_IPS -->
<tr>
<td class="row1"><span class="gen"><a href="{switch_user_admin_or_mod.switch_other_user_ips.OTHER_REGISTERED_IPS.U_PROFILE}">{switch_user_admin_or_mod.switch_other_user_ips.OTHER_REGISTERED_IPS.USER_NAME}</a></span></td>
<td class="row1"><span class="gen">{switch_user_admin_or_mod.switch_other_user_ips.OTHER_REGISTERED_IPS.USER_HOSTNAME}</span></td>
<td class="row1"><span class="gen">{switch_user_admin_or_mod.switch_other_user_ips.OTHER_REGISTERED_IPS.TIME}</span></td>
</tr>
<!-- END OTHER_REGISTERED_IPS -->
<!-- END switch_other_user_ips -->
<!-- BEGIN switch_no_other_registered_ips -->
<tr>
<td class="row1" colspan="3" valign="middle" align="center"><span class="gen">{L_NO_OTHER_REGISTERED_IPS}</span></td>
</tr>
<!-- END switch_no_other_registered_ips -->
</table>
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td align="left" valign="top"><span class="nav">{USERS_PAGE_NUMBER}</span></td>
<td align="right" valign="top" nowrap="nowrap"><span class="nav">{USERS_PAGINATION}</span><br /><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
<br />
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr>
<th class="thHead" align="center">{L_OTHER_IPS}:</th>
</tr>
<!-- BEGIN switch_other_posted_ips -->
<!-- BEGIN ALL_IPS_POSTED_FROM -->
<tr>
<td class="row1"><span class="gen"><a href="{switch_user_admin_or_mod.switch_other_posted_ips.ALL_IPS_POSTED_FROM.U_POSTER_IP}" target="_blank">{switch_user_admin_or_mod.switch_other_posted_ips.ALL_IPS_POSTED_FROM.POSTER_IP}</a> [ <a href="{switch_user_admin_or_mod.switch_other_posted_ips.ALL_IPS_POSTED_FROM.U_POSTS_LINK}">{switch_user_admin_or_mod.switch_other_posted_ips.ALL_IPS_POSTED_FROM.POSTS}</a> ] </span></td>
</tr>
<!-- END ALL_IPS_POSTED_FROM -->
<!-- END switch_other_posted_ips -->
<!-- BEGIN switch_no_other_posted_ips -->
<tr>
<td class="row1" valign="middle" align="center"><span class="gen">{L_NO_OTHER_POSTED_IPS}</span></td>
</tr>
<!-- END switch_no_other_posted_ips -->
</table>
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td align="left" valign="top"><span class="nav">{IPS_PAGE_NUMBER}</span></td>
<td align="right" valign="top" nowrap="nowrap"><span class="nav">{IPS_PAGINATION}</span></td>
</tr>
</table>
<br />
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr>
<th class="thHead" colspan="3" height="25" nowrap="nowrap">{L_LOGINS}:</th>
</tr>
<tr>
<td class="cat"><span class="gen"><b>{L_IP}:</b></span></td>
<td class="cat"><span class="gen"><b>{L_BROWSER}:</b></span></td>
<td class="cat"><span class="gen"><b>{L_TIME}:</b></span></td>
</tr>
<!-- BEGIN USER_LOGINS -->
<tr>
<td class="row1"><span class="gen"><a href="{switch_user_admin_or_mod.USER_LOGINS.U_IP}" target="_blank">{switch_user_admin_or_mod.USER_LOGINS.IP}</a></span></td>
<td class="row1"><span class="gen">{switch_user_admin_or_mod.USER_LOGINS.USER_AGENT}</span></td>
<td class="row1"><span class="gen">{switch_user_admin_or_mod.USER_LOGINS.LOGIN_TIME}</span></td>
</tr>
<!-- END USER_LOGINS -->
<!-- BEGIN switch_no_logins -->
<tr>
<td class="row1" colspan="3" valign="middle" align="center"><span class="gen">{L_NO_LOGINS}</span></td>
</tr>
<!-- END switch_no_logins -->
<tr>
<td class="catBottom" colspan="3" height="28" valign="middle"> </td>
</tr>
</table>
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td align="left" valign="top"><span class="nav">{LOGINS_PAGE_NUMBER}</span></td>
<td align="right" valign="top" nowrap="nowrap"><span class="nav">{LOGINS_PAGINATION}</span><br /><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
<!-- END switch_user_admin_or_mod -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/search_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" colspan="2"><span class="gen">{L_SEARCH_AUTHOR}:</span><br /><span class="gensmall">{L_SEARCH_AUTHOR_EXPLAIN}</span></td>
<td class="row2" colspan="2" valign="middle"><span class="genmed"><input type="text" style="width: 300px" class="post" name="search_author" size="30" /></span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_admin_or_mod -->
<tr>
<td class="row1" colspan="2"><span class="gen">{L_SEARCH_IP}:</span><br /><span class="gensmall">{L_SEARCH_IP_EXPLAIN}</span></td>
<td class="row2" colspan="2" valign="middle"><span class="genmed"><input type="text" style="width: 300px" class="post" name="search_ip" size="30" /></span></td>
</tr>
<!-- END switch_user_admin_or_mod -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewonline_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td width="40%" class="{reg_user_row.ROW_CLASS}"> <span class="gen"><a href="{reg_user_row.U_FORUM_LOCATION}" class="gen">{reg_user_row.FORUM_LOCATION}</a></span> </td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_admin_or_mod -->
<tr>
<td width="100%" class="{reg_user_row.ROW_CLASS}" colspan="3"><span class="gensmall">{L_IP}: <a href="{reg_user_row.U_HOSTNAME_LOOKUP}">{reg_user_row.IP}</a> » <a href="{reg_user_row.U_WHOIS}" target="_blank">{L_WHOIS}</a> || {L_BROWSER}: {reg_user_row.USER_AGENT}</span></td>
</tr>
<!-- END switch_user_admin_or_mod -->
#
#-----[ FIND ]------------------------------------------
#
<td width="40%" class="{guest_user_row.ROW_CLASS}"> <span class="gen"><a href="{guest_user_row.U_FORUM_LOCATION}" class="gen">{guest_user_row.FORUM_LOCATION}</a></span> </td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_admin_or_mod -->
<tr>
<td width="100%" class="{guest_user_row.ROW_CLASS}" colspan="3"><span class="gensmall">{L_IP}: <a href="{guest_user_row.U_HOSTNAME_LOOKUP}">{guest_user_row.IP}</a> » <a href="{guest_user_row.U_WHOIS}" target="_blank">{L_WHOIS}</a> || {L_BROWSER}: {guest_user_row.USER_AGENT}</span></td>
</tr>
<!-- END switch_user_admin_or_mod -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM