2004-07-08 23:03:03 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package mcp
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
* Handling actions in post details screen
|
|
|
|
*/
|
2006-02-05 01:40:45 +00:00
|
|
|
function mcp_post_details($id, $mode, $action)
|
2004-07-08 23:03:03 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
global $phpEx, $phpbb_root_path, $config;
|
2004-07-08 23:03:03 +00:00
|
|
|
global $template, $db, $user, $auth;
|
|
|
|
|
|
|
|
$user->add_lang('posting');
|
|
|
|
|
|
|
|
$post_id = request_var('p', 0);
|
|
|
|
$start = request_var('start', 0);
|
|
|
|
|
|
|
|
// Get post data
|
|
|
|
$post_info = get_post_data(array($post_id));
|
|
|
|
|
|
|
|
if (!sizeof($post_info))
|
|
|
|
{
|
|
|
|
trigger_error($user->lang['POST_NOT_EXIST']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$post_info = $post_info[$post_id];
|
2006-06-06 20:53:46 +00:00
|
|
|
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
|
2004-07-08 23:03:03 +00:00
|
|
|
|
|
|
|
switch ($action)
|
|
|
|
{
|
2006-04-09 21:20:24 +00:00
|
|
|
case 'whois':
|
2006-05-19 21:08:48 +00:00
|
|
|
|
2006-04-09 21:20:24 +00:00
|
|
|
$ip = request_var('ip', '');
|
|
|
|
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
|
|
|
|
|
|
$whois = user_ipwhois($ip);
|
|
|
|
|
|
|
|
$whois = preg_replace('#(\s)([\w\-\._\+]+@[\w\-\.]+)(\s)#', '\1<a href="mailto:\2">\2</a>\3', $whois);
|
2006-09-13 16:08:36 +00:00
|
|
|
$whois = preg_replace('#(\s)(http:/{2}[^\s]*)(\s)#', '\1<a href="\2">\2</a>\3', $whois);
|
2006-04-09 21:20:24 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2006-06-06 20:53:46 +00:00
|
|
|
'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id") . '">', '</a>'),
|
2006-04-09 21:20:24 +00:00
|
|
|
'WHOIS' => trim($whois))
|
|
|
|
);
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
// We're done with the whois page so return
|
|
|
|
return;
|
2006-02-05 01:40:45 +00:00
|
|
|
|
|
|
|
break;
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
case 'chgposter':
|
2006-02-05 01:40:45 +00:00
|
|
|
case 'chgposter_ip':
|
2004-07-09 12:31:33 +00:00
|
|
|
|
2006-06-14 18:59:12 +00:00
|
|
|
if ($action == 'chgposter')
|
|
|
|
{
|
- renamed the following columns:
comment -> attach_comment
new, forwarded, unread, marked, deleted -> pm_new, pm_forwarded, pm_unread, pm_marked, pm_deleted
module_name -> module_basename
value -> lang_value
- every column is now NOT NULL
- every column is now having a DEFAULT value
- hopefully mostly consistent across every db schema
- untested schemas: sqlite, oracle, firebird
git-svn-id: file:///svn/phpbb/trunk@6177 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-07-13 12:51:56 +00:00
|
|
|
$username = request_var('username', '');
|
2006-06-14 18:59:12 +00:00
|
|
|
$sql_where = "username = '" . $db->sql_escape($username) . "'";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$new_user_id = request_var('u', 0);
|
|
|
|
$sql_where = 'user_id = ' . $new_user_id;
|
|
|
|
}
|
2004-07-09 12:31:33 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM ' . USERS_TABLE . '
|
|
|
|
WHERE ' . $sql_where;
|
2006-02-05 01:40:45 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2006-05-19 21:08:48 +00:00
|
|
|
$row = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
if (!$row)
|
2004-08-22 13:16:00 +00:00
|
|
|
{
|
2006-02-05 01:40:45 +00:00
|
|
|
trigger_error($user->lang['NO_USER']);
|
2004-08-22 13:16:00 +00:00
|
|
|
}
|
|
|
|
|
2006-06-04 16:30:58 +00:00
|
|
|
if ($auth->acl_get('m_chgposter', $post_info['forum_id']))
|
2004-08-22 13:16:00 +00:00
|
|
|
{
|
2006-05-19 21:08:48 +00:00
|
|
|
change_poster($post_info, $row);
|
2004-08-22 13:16:00 +00:00
|
|
|
}
|
2006-05-19 21:08:48 +00:00
|
|
|
|
2006-02-05 01:40:45 +00:00
|
|
|
break;
|
2004-07-08 23:03:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set some vars
|
2006-09-26 19:59:41 +00:00
|
|
|
$users_ary = $usernames_ary = array();
|
2006-02-05 01:40:45 +00:00
|
|
|
$post_id = $post_info['post_id'];
|
2004-07-08 23:03:03 +00:00
|
|
|
$poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
|
|
|
|
|
|
|
|
// Process message, leave it uncensored
|
|
|
|
$message = $post_info['post_text'];
|
2006-08-28 17:20:21 +00:00
|
|
|
$message = str_replace("\n", '<br />', $message);
|
2004-07-08 23:03:03 +00:00
|
|
|
if ($post_info['bbcode_bitfield'])
|
|
|
|
{
|
2006-05-19 21:08:48 +00:00
|
|
|
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
2004-07-08 23:03:03 +00:00
|
|
|
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
|
|
|
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
|
|
|
}
|
2005-03-21 23:10:11 +00:00
|
|
|
$message = smiley_text($message);
|
2004-07-08 23:03:03 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2004-08-22 13:16:00 +00:00
|
|
|
'U_MCP_ACTION' => "$url&i=main&quickmod=1", // Use this for mode paramaters
|
|
|
|
'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2006-02-22 21:42:26 +00:00
|
|
|
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
|
2006-06-04 16:30:58 +00:00
|
|
|
'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']),
|
2004-07-08 23:03:03 +00:00
|
|
|
'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']),
|
|
|
|
'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']),
|
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false,
|
|
|
|
'S_POST_UNAPPROVED' => (!$post_info['post_approved']) ? true : false,
|
|
|
|
'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false,
|
2006-06-04 16:30:58 +00:00
|
|
|
'S_USER_NOTES' => true,
|
2004-08-22 13:16:00 +00:00
|
|
|
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2006-06-10 23:11:03 +00:00
|
|
|
'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']}") : '',
|
2006-06-06 20:53:46 +00:00
|
|
|
'U_FIND_MEMBER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_chgposter&field=username'),
|
2006-06-10 23:11:03 +00:00
|
|
|
'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
|
|
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
|
|
'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']),
|
2006-06-10 11:51:10 +00:00
|
|
|
'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '',
|
2006-07-01 15:00:50 +00:00
|
|
|
'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']),
|
2006-06-10 23:11:03 +00:00
|
|
|
'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '',
|
2006-06-29 19:57:06 +00:00
|
|
|
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']),
|
2006-06-10 23:11:03 +00:00
|
|
|
|
|
|
|
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'),
|
2006-06-06 20:53:46 +00:00
|
|
|
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'),
|
2006-08-05 15:49:28 +00:00
|
|
|
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
|
|
|
|
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
|
|
|
|
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
|
2004-07-08 23:03:03 +00:00
|
|
|
|
|
|
|
'POSTER_NAME' => $poster,
|
|
|
|
'POST_PREVIEW' => $message,
|
|
|
|
'POST_SUBJECT' => $post_info['post_subject'],
|
|
|
|
'POST_DATE' => $user->format_date($post_info['post_time']),
|
|
|
|
'POST_IP' => $post_info['poster_ip'],
|
2004-07-19 20:13:18 +00:00
|
|
|
'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']),
|
|
|
|
'POST_ID' => $post_info['post_id'])
|
2004-07-08 23:03:03 +00:00
|
|
|
);
|
|
|
|
|
2004-08-22 13:16:00 +00:00
|
|
|
// Get User Notes
|
|
|
|
$log_data = array();
|
|
|
|
$log_count = 0;
|
|
|
|
view_log('user', $log_data, $log_count, $config['posts_per_page'], 0, 0, 0, $post_info['user_id']);
|
|
|
|
|
|
|
|
if ($log_count)
|
|
|
|
{
|
|
|
|
$template->assign_var('S_USER_NOTES', true);
|
|
|
|
|
|
|
|
foreach ($log_data as $row)
|
|
|
|
{
|
|
|
|
$template->assign_block_vars('usernotes', array(
|
|
|
|
'REPORT_BY' => $row['username'],
|
|
|
|
'REPORT_AT' => $user->format_date($row['time']),
|
|
|
|
'ACTION' => $row['action'],
|
|
|
|
'ID' => $row['id'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-10 22:47:43 +00:00
|
|
|
// Get Reports
|
|
|
|
if ($auth->acl_get('m_', $post_info['forum_id']))
|
|
|
|
{
|
2006-02-05 01:40:45 +00:00
|
|
|
$sql = 'SELECT r.*, re.*, u.user_id, u.username
|
2006-06-07 19:32:23 +00:00
|
|
|
FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re
|
2004-07-10 22:47:43 +00:00
|
|
|
WHERE r.post_id = $post_id
|
|
|
|
AND r.reason_id = re.reason_id
|
|
|
|
AND u.user_id = r.user_id
|
|
|
|
ORDER BY r.report_time DESC";
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
if ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$template->assign_var('S_SHOW_REPORTS', true);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2006-03-12 23:19:55 +00:00
|
|
|
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
|
|
|
|
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
|
|
|
|
{
|
|
|
|
$row['reson_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
|
|
|
|
$row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
|
|
|
|
}
|
|
|
|
|
2004-07-10 22:47:43 +00:00
|
|
|
$template->assign_block_vars('reports', array(
|
|
|
|
'REPORT_ID' => $row['report_id'],
|
2006-03-12 23:19:55 +00:00
|
|
|
'REASON_TITLE' => $row['reason_title'],
|
|
|
|
'REASON_DESC' => $row['reason_description'],
|
2004-07-10 22:47:43 +00:00
|
|
|
'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'],
|
2006-06-06 20:53:46 +00:00
|
|
|
'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '',
|
2004-07-10 22:47:43 +00:00
|
|
|
'USER_NOTIFY' => ($row['user_notify']) ? true : false,
|
|
|
|
'REPORT_TIME' => $user->format_date($row['report_time']),
|
|
|
|
'REPORT_TEXT' => str_replace("\n", '<br />', trim($row['report_text'])))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
while ($row = $db->sql_fetchrow($result));
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
}
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2004-07-08 23:03:03 +00:00
|
|
|
// Get IP
|
2006-02-22 21:42:26 +00:00
|
|
|
if ($auth->acl_get('m_info', $post_info['forum_id']))
|
2004-07-08 23:03:03 +00:00
|
|
|
{
|
|
|
|
$rdns_ip_num = request_var('rdns', '');
|
|
|
|
|
|
|
|
if ($rdns_ip_num != 'all')
|
|
|
|
{
|
|
|
|
$template->assign_vars(array(
|
|
|
|
'U_LOOKUP_ALL' => "$url&i=main&mode=post_details&rdns=all")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get other users who've posted under this IP
|
2006-09-26 19:59:41 +00:00
|
|
|
$sql = 'SELECT poster_id, COUNT(poster_id) as postings
|
|
|
|
FROM ' . POSTS_TABLE . "
|
|
|
|
WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
|
|
|
|
GROUP BY poster_id";
|
2006-05-17 21:37:05 +00:00
|
|
|
|
|
|
|
// Firebird does not support ORDER BY on aliased columns
|
|
|
|
// MySQL does not support ORDER BY on functions
|
|
|
|
switch (SQL_LAYER)
|
|
|
|
{
|
|
|
|
case 'firebird':
|
2006-09-26 19:59:41 +00:00
|
|
|
$sql .= ' ORDER BY COUNT(poster_id) DESC';
|
2006-05-17 21:37:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-09-26 19:59:41 +00:00
|
|
|
$sql .= ' ORDER BY postings DESC';
|
2006-05-17 21:37:05 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-07-08 23:03:03 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2006-09-26 19:59:41 +00:00
|
|
|
// Fill the user select list with users who have posted under this IP
|
|
|
|
if ($row['poster_id'] != $post_info['poster_id'])
|
2004-07-08 23:03:03 +00:00
|
|
|
{
|
2006-09-26 19:59:41 +00:00
|
|
|
$users_ary[$row['poster_id']] = $row;
|
2004-07-08 23:03:03 +00:00
|
|
|
}
|
2006-09-26 19:59:41 +00:00
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2006-09-26 19:59:41 +00:00
|
|
|
if (sizeof($users_ary))
|
|
|
|
{
|
|
|
|
// Get the usernames
|
|
|
|
$sql = 'SELECT user_id, username
|
|
|
|
FROM ' . USERS_TABLE . '
|
|
|
|
WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary));
|
|
|
|
$result = $db->sql_query($sql);
|
2004-07-08 23:03:03 +00:00
|
|
|
|
2006-09-26 19:59:41 +00:00
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$users_ary[$row['user_id']]['username'] = strtolower($row['username']);
|
|
|
|
$usernames_ary[strtolower($row['username'])] = $users_ary[$row['user_id']];
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
foreach ($users_ary as $user_id => $user_row)
|
|
|
|
{
|
|
|
|
$template->assign_block_vars('userrow', array(
|
|
|
|
'USERNAME' => ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'],
|
|
|
|
'NUM_POSTS' => $user_row['postings'],
|
|
|
|
'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
|
|
|
|
|
|
|
'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id),
|
|
|
|
'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author=' . urlencode($user_row['username']) . '&sr=topics'))
|
|
|
|
);
|
|
|
|
}
|
2004-07-08 23:03:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Get other IP's this user has posted under
|
2006-05-17 21:37:05 +00:00
|
|
|
|
2006-09-26 19:59:41 +00:00
|
|
|
// A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot,
|
|
|
|
// but the extra size is only valuable if there are persons having more than a thousands posts.
|
|
|
|
// This is better left to the really really big forums.
|
|
|
|
|
2006-05-17 21:37:05 +00:00
|
|
|
// Firebird does not support ORDER BY on aliased columns
|
|
|
|
// MySQL does not support ORDER BY on functions
|
|
|
|
switch (SQL_LAYER)
|
|
|
|
{
|
|
|
|
case 'firebird':
|
2006-09-26 19:59:41 +00:00
|
|
|
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
2006-05-17 21:37:05 +00:00
|
|
|
FROM ' . POSTS_TABLE . '
|
|
|
|
WHERE poster_id = ' . $post_info['poster_id'] . '
|
|
|
|
GROUP BY poster_ip
|
2006-09-26 19:59:41 +00:00
|
|
|
ORDER BY COUNT(poster_ip) DESC';
|
2006-05-17 21:37:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-09-26 19:59:41 +00:00
|
|
|
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
2006-05-17 21:37:05 +00:00
|
|
|
FROM ' . POSTS_TABLE . '
|
|
|
|
WHERE poster_id = ' . $post_info['poster_id'] . '
|
|
|
|
GROUP BY poster_ip
|
|
|
|
ORDER BY postings DESC';
|
|
|
|
break;
|
|
|
|
}
|
2004-07-08 23:03:03 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : '';
|
|
|
|
|
|
|
|
$template->assign_block_vars('iprow', array(
|
|
|
|
'IP' => $row['poster_ip'],
|
|
|
|
'HOSTNAME' => $hostname,
|
2006-02-05 01:40:45 +00:00
|
|
|
'NUM_POSTS' => $row['postings'],
|
2004-07-08 23:03:03 +00:00
|
|
|
'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
|
|
|
|
|
|
|
'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip",
|
2006-06-06 20:53:46 +00:00
|
|
|
'U_WHOIS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}"))
|
2004-07-08 23:03:03 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
2006-02-05 01:40:45 +00:00
|
|
|
$user_select = '';
|
2006-05-19 21:08:48 +00:00
|
|
|
|
2006-09-26 19:59:41 +00:00
|
|
|
if (sizeof($usernames_ary))
|
2004-07-08 23:03:03 +00:00
|
|
|
{
|
2006-09-26 19:59:41 +00:00
|
|
|
ksort($usernames_ary);
|
|
|
|
|
|
|
|
foreach ($usernames_ary as $row)
|
|
|
|
{
|
|
|
|
$user_select .= '<option value="' . $row['poster_id'] . '">' . $row['username'] . "</option>\n";
|
|
|
|
}
|
2004-07-08 23:03:03 +00:00
|
|
|
}
|
2006-09-26 19:59:41 +00:00
|
|
|
|
2006-02-05 01:40:45 +00:00
|
|
|
$template->assign_var('S_USER_SELECT', $user_select);
|
2004-07-08 23:03:03 +00:00
|
|
|
}
|
|
|
|
|
2004-07-09 12:31:33 +00:00
|
|
|
}
|
|
|
|
|
2006-02-05 01:40:45 +00:00
|
|
|
/**
|
2006-05-19 21:08:48 +00:00
|
|
|
* Change a post's poster
|
2006-02-05 01:40:45 +00:00
|
|
|
*/
|
2006-05-19 21:08:48 +00:00
|
|
|
function change_poster(&$post_info, $userdata)
|
2006-02-05 01:40:45 +00:00
|
|
|
{
|
2006-05-28 19:15:24 +00:00
|
|
|
global $auth, $db, $config;
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
|
2006-02-05 01:40:45 +00:00
|
|
|
{
|
2006-05-19 21:08:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$post_id = $post_info['post_id'];
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
$sql = 'UPDATE ' . POSTS_TABLE . "
|
|
|
|
SET poster_id = {$userdata['user_id']}
|
|
|
|
WHERE post_id = $post_id";
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
// Resync topic/forum if needed
|
2006-06-22 15:14:03 +00:00
|
|
|
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)
|
2006-05-19 21:08:48 +00:00
|
|
|
{
|
|
|
|
sync('topic', 'topic_id', $post_info['topic_id'], false, false);
|
|
|
|
sync('forum', 'forum_id', $post_info['forum_id'], false, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Adjust post counts
|
2006-08-01 15:29:47 +00:00
|
|
|
if ($post_info['post_postcount'])
|
2006-05-19 21:08:48 +00:00
|
|
|
{
|
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET user_posts = user_posts - 1
|
|
|
|
WHERE user_id = ' . $post_info['user_id'];
|
2006-02-05 01:40:45 +00:00
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET user_posts = user_posts + 1
|
|
|
|
WHERE user_id = ' . $userdata['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
}
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
// Add posted to information for this topic for the new user
|
|
|
|
markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
|
2006-02-05 01:40:45 +00:00
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
// Remove the dotted topic option if the old user has no more posts within this topic
|
2006-05-27 16:24:21 +00:00
|
|
|
if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS)
|
2006-05-19 21:08:48 +00:00
|
|
|
{
|
2006-05-27 16:24:21 +00:00
|
|
|
$sql = 'SELECT topic_id
|
|
|
|
FROM ' . POSTS_TABLE . '
|
|
|
|
WHERE topic_id = ' . $post_info['topic_id'] . '
|
|
|
|
AND poster_id = ' . $post_info['user_id'];
|
|
|
|
$result = $db->sql_query_limit($sql, 1);
|
|
|
|
$topic_id = (int) $db->sql_fetchfield('topic_id');
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
if (!$topic_id)
|
|
|
|
{
|
|
|
|
$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
|
|
|
|
WHERE user_id = ' . $post_info['user_id'] . '
|
|
|
|
AND topic_id = ' . $post_info['topic_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
}
|
2006-05-19 21:08:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Do not change the poster_id within the attachments table, since they were still posted by the original user
|
|
|
|
|
2006-05-28 19:15:24 +00:00
|
|
|
$from_username = $post_info['username'];
|
|
|
|
$to_username = $userdata['username'];
|
|
|
|
|
2006-05-19 21:08:48 +00:00
|
|
|
// Renew post info
|
|
|
|
$post_info = get_post_data(array($post_id));
|
|
|
|
|
|
|
|
if (!sizeof($post_info))
|
|
|
|
{
|
|
|
|
trigger_error($user->lang['POST_NOT_EXIST']);
|
2006-02-05 01:40:45 +00:00
|
|
|
}
|
2006-05-19 21:08:48 +00:00
|
|
|
|
|
|
|
$post_info = $post_info[$post_id];
|
|
|
|
|
|
|
|
// Now add log entry
|
2006-05-28 19:15:24 +00:00
|
|
|
add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);
|
2006-02-05 01:40:45 +00:00
|
|
|
}
|
|
|
|
|
2004-07-09 12:31:33 +00:00
|
|
|
?>
|