More "reporting" stuff, note the very lame warning in viewtopic when a post has been reported.

git-svn-id: file:///svn/phpbb/trunk@3604 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2003-03-06 02:03:37 +00:00
parent 553087d0aa
commit 9e9d126a6a
7 changed files with 399 additions and 117 deletions

View file

@ -29,7 +29,7 @@
// equally where a string contains only two placeholders which are used to wrap text // equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array( $lang = array(
'ENCODING' => 'iso-8859-15', 'ENCODING' => 'iso-8859-15',
'DIRECTION' => 'ltr', 'DIRECTION' => 'ltr',
'LEFT' => 'left', 'LEFT' => 'left',
@ -70,8 +70,6 @@ $lang = array_merge($lang, array(
'GO' => 'Go', 'GO' => 'Go',
'JUMP_TO' => 'Jump to', 'JUMP_TO' => 'Jump to',
'SEARCH_FOR' => 'Search for',
'SUBMIT' => 'Submit', 'SUBMIT' => 'Submit',
'RESET' => 'Reset', 'RESET' => 'Reset',
'CANCEL' => 'Cancel', 'CANCEL' => 'Cancel',
@ -83,6 +81,7 @@ $lang = array_merge($lang, array(
'NO' => 'No', 'NO' => 'No',
'ENABLED' => 'Enabled', 'ENABLED' => 'Enabled',
'DISABLED' => 'Disabled', 'DISABLED' => 'Disabled',
'SELECT' => 'Select',
'ERROR' => 'Error', 'ERROR' => 'Error',
'NEXT' => 'Next', 'NEXT' => 'Next',
'PREVIOUS' => 'Previous', 'PREVIOUS' => 'Previous',
@ -281,6 +280,8 @@ $lang = array_merge($lang, array(
'VIEW_IP' => 'IP', 'VIEW_IP' => 'IP',
'DELETE_POST' => 'Delete', 'DELETE_POST' => 'Delete',
'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered', 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
'REPORT_TO_ADMIN' => 'Report this post',
'POST_BEEN_REPORTED' => 'This post has been reported',
'wrote' => 'wrote', 'wrote' => 'wrote',
'Quote' => 'Quote', 'Quote' => 'Quote',
'Code' => 'Code', 'Code' => 'Code',
@ -784,43 +785,6 @@ $lang = array_merge($lang, array(
'Viewing_priv_msgs' => 'Viewing Private Messages', 'Viewing_priv_msgs' => 'Viewing Private Messages',
'Viewing_FAQ' => 'Viewing FAQ', 'Viewing_FAQ' => 'Viewing FAQ',
'MOD_CP' => 'Moderator Control Panel',
'MOD_CP_EXPLAIN' => 'Using the form below you can perform mass moderation operations on this forum. You can lock, unlock, move or delete any number of topics.',
'SELECT' => 'Select',
'MOVE' => 'Move',
'LOCK' => 'Lock',
'UNLOCK' => 'Unlock',
'Topics_Removed' => 'The selected topics have been successfully removed from the database.',
'Topics_Locked' => 'The selected topics have been locked',
'Topics_Moved' => 'The selected topics have been moved',
'Topics_Unlocked' => 'The selected topics have been unlocked',
'No_Topics_Moved' => 'No topics were moved',
'Confirm_delete_topic' => 'Are you sure you want to remove the selected topic/s?',
'Confirm_lock_topic' => 'Are you sure you want to lock the selected topic/s?',
'Confirm_unlock_topic' => 'Are you sure you want to unlock the selected topic/s?',
'Confirm_move_topic' => 'Are you sure you want to move the selected topic/s?',
'Move_to_forum' => 'Move to forum',
'Leave_shadow_topic' => 'Leave shadow topic in old forum.',
'Split_Topic' => 'Split Topic Control Panel',
'Split_Topic_explain' => 'Using the form below you can split a topic in two, either by selecting the posts individually or by splitting at a selected post',
'Split_title' => 'New topic title',
'Split_forum' => 'Forum for new topic',
'Split_posts' => 'Split selected posts',
'Split_after' => 'Split from selected post',
'Topic_split' => 'The selected topic has been split successfully',
'Too_many_error' => 'You have selected too many posts. You can only select one post to split a topic after!',
'None_selected' => 'You have no selected any topics to preform this operation on. Please go back and select at least one.',
'New_forum' => 'New forum',
'This_posts_IP' => 'IP for this post',
'Other_IP_this_user' => 'Other IP\'s this user has posted from',
'Users_this_IP' => 'Users posting from this IP',
'IP_info' => 'IP Information',
'Lookup_IP' => 'Look up IP',
'logm_lock' => 'Locked following topic/s => %s',
'All_times' => 'All times are %s %s', 'All_times' => 'All times are %s %s',
'-13' => 'GMT - 13 Hours', '-13' => 'GMT - 13 Hours',
'-12' => 'GMT - 12 Hours', '-12' => 'GMT - 12 Hours',
@ -943,5 +907,5 @@ $lang = array_merge($lang, array(
'Critical_Error' => 'Critical Error', 'Critical_Error' => 'Critical Error',
'An_error_occured' => 'An Error Occurred', 'An_error_occured' => 'An Error Occurred',
'A_critical_error' => 'A Critical Error Occurred' 'A_critical_error' => 'A Critical Error Occurred'
)); );
?> ?>

View file

@ -57,6 +57,16 @@ $user->setup();
$auth->acl($user->data); $auth->acl($user->data);
// End session management // End session management
/**
$sql = 'SELECT auth_option_id, auth_value FROM phpbb_auth_options';
$result = $db->sql_query($sql);
while ($row=$db->sql_fetchrow($result))
{
echo "$row[auth_option_id] $row[auth_value] => " . $auth->acl_get($row['auth_value'], 2) . "<br/>";
}
/**/
// temp temp temp // temp temp temp
very_temporary_lang_strings(); very_temporary_lang_strings();
// temp temp temp // temp temp temp
@ -69,17 +79,18 @@ $topic_id = (!empty($_REQUEST['t'])) ? intval($_REQUEST['t']) : '';
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : ''; $post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : '';
$start = (!empty($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0; $start = (!empty($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0;
// //
// Check if user did or did not confirm // Check if user did or did not confirm
// If they did not, forward them to the last page they were on // If they did not, forward them to the last page they were on
// //
if (isset($_POST['cancel'])) if (isset($_POST['cancel']))
{ {
if ($topic_id) if ($topic_id > 0)
{ {
$redirect = "viewtopic.$phpEx$SID&t=$topic_id&amp;start=$start"; $redirect = "viewtopic.$phpEx$SID&t=$topic_id&amp;start=$start";
} }
elseif ($forum_id) elseif ($forum_id > 0)
{ {
$redirect = "viewforum.$phpEx$SID&f=$forum_id&amp;start=$start"; $redirect = "viewforum.$phpEx$SID&f=$forum_id&amp;start=$start";
} }
@ -116,6 +127,22 @@ foreach ($post_modes as $post_mode)
} }
} }
// Cleanse inputted values
foreach ($_POST['topic_id_list'] as $t_id)
{
if ($t_id = intval($t_id))
{
$topic_id_list[] = $t_id;
}
}
foreach ($_POST['post_id_list'] as $p_id)
{
if ($p_id = intval($p_id))
{
$post_id_list[] = $p_id;
}
}
// Build short_id_list and $return string // Build short_id_list and $return string
$selected_post_ids = array(); $selected_post_ids = array();
if (!empty($_GET['post_id_list'])) if (!empty($_GET['post_id_list']))
@ -128,7 +155,7 @@ if (!empty($_GET['post_id_list']))
$post_id_list[] = base_convert($short, 36, 10); $post_id_list[] = base_convert($short, 36, 10);
} }
} }
$url_extra = (!empty($selected_post_ids)) ? '&amp;post_id_list=' . short_id_list($selected_post_ids) : ''; $url_extra = (!empty($post_id_list)) ? '&amp;post_id_list=' . short_id_list($post_id_list ) : '';
$return_mcp = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '">', '</a>'); $return_mcp = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '">', '</a>');
// Build up return links and acl list // Build up return links and acl list
@ -208,26 +235,9 @@ if ($to_forum_id > 0)
} }
} }
// Cleanse inputted values then get permissions // Reset id lists then rebuild them from verified data
foreach ($_POST['topic_id_list'] as $t_id)
{
if ($t_id = intval($t_id))
{
$topic_id_list[] = $t_id;
}
}
foreach ($_POST['post_id_list'] as $p_id)
{
if ($p_id = intval($p_id))
{
$post_id_list[] = $p_id;
}
}
$topic_id_sql = implode(', ', array_unique($topic_id_list)); $topic_id_sql = implode(', ', array_unique($topic_id_list));
$post_id_sql = implode(', ', array_unique($post_id_list)); $post_id_sql = implode(', ', array_unique($post_id_list));
// Reset id lists then rebuild them
$forum_id_list = $topic_id_list = $post_id_list = array(); $forum_id_list = $topic_id_list = $post_id_list = array();
$not_moderator = FALSE; $not_moderator = FALSE;
@ -334,7 +344,7 @@ else
{ {
// There's no forums list available so the user either submitted an empty or invalid list of posts/topics or isn't a moderator // There's no forums list available so the user either submitted an empty or invalid list of posts/topics or isn't a moderator
if ($not_moderator) if ($not_moderator || !$auth->acl_gets('m_', 'a_'))
{ {
trigger_error('Line : ' . __LINE__ . '<br/><br/>' . 'Not_Moderator'); trigger_error('Line : ' . __LINE__ . '<br/><br/>' . 'Not_Moderator');
} }
@ -344,7 +354,7 @@ else
if (!in_array($mode, $forumless_modes)) if (!in_array($mode, $forumless_modes))
{ {
// The user has submitted invalid post_ids or topic_ids // The user has submitted invalid post_ids or topic_ids
trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['Topic_post_not_exist'] . $return_mcp); trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['TOPIC_NOT_EXIST'] . $return_mcp);
} }
} }
} }
@ -365,8 +375,8 @@ else
$mcp_url = "mcp.$phpEx$SID"; $mcp_url = "mcp.$phpEx$SID";
$tabs = array( $tabs = array(
'front' => $mcp_url, 'front' => $mcp_url,
'mod_queue' => $mcp_url . '&amp;mode=mod_queue', 'mod_queue' => $mcp_url . '&amp;f=' . $forum_id . '&amp;mode=mod_queue',
'post_reports' => $mcp_url . '&amp;mode=post_reports' 'post_reports' => $mcp_url . '&amp;f=' . $forum_id . '&amp;mode=post_reports'
); );
$mcp_url .= ($forum_id) ? '&amp;f=' . $forum_id : ''; $mcp_url .= ($forum_id) ? '&amp;f=' . $forum_id : '';
@ -377,7 +387,7 @@ $return_mcp = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="' .
if ($forum_id) if ($forum_id)
{ {
$tabs['forum_view'] = $mcp_url . '&amp;mode=forum_view' . $url_extra; $tabs['forum_view'] = $mcp_url . '&amp;mode=forum_view';
} }
if ($topic_id) if ($topic_id)
{ {
@ -385,7 +395,7 @@ if ($topic_id)
} }
if ($post_id) if ($post_id)
{ {
$tabs['post_details'] = $mcp_url . '&amp;mode=post_details' . $url_extra; $tabs['post_details'] = $mcp_url . '&amp;mode=post_details';
} }
if (!$forum_info['forum_postable']) if (!$forum_info['forum_postable'])
{ {
@ -421,9 +431,16 @@ if (!$mode)
switch ($mode) switch ($mode)
{ {
case 'select_topic':
if ($url_extra)
{
$tabs['merge'] = $mcp_url . '&amp;mode=merge' . $url_extra;
}
break;
case 'merge': case 'merge':
case 'split': case 'split':
$tabs[$mode] = $mcp_url . '&amp=' . $mode; $tabs[$mode] = $mcp_url . '&amp;=' . $mode . $url_extra;
break; break;
} }
// Get the current tab from the mode // Get the current tab from the mode
@ -537,7 +554,7 @@ switch ($mode)
'L_YES' => $user->lang['YES'], 'L_YES' => $user->lang['YES'],
'L_NO' => $user->lang['NO'], 'L_NO' => $user->lang['NO'],
'S_CONFIRM_ACTION' => $mcp_url . '&amp;mode=delete_posts', 'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&amp;mode=delete_posts",
'S_HIDDEN_FIELDS' => $hidden_fields 'S_HIDDEN_FIELDS' => $hidden_fields
)); ));
break; break;
@ -587,16 +604,11 @@ switch ($mode)
'L_YES' => $user->lang['YES'], 'L_YES' => $user->lang['YES'],
'L_NO' => $user->lang['NO'], 'L_NO' => $user->lang['NO'],
'S_CONFIRM_ACTION' => $mcp_url . '&amp;mode=delete' . (($quickmod) ? '&amp;quickmod=1' : ''), 'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&amp;mode=delete" . (($quickmod) ? '&amp;quickmod=1' : ''),
'S_HIDDEN_FIELDS' => $hidden_fields 'S_HIDDEN_FIELDS' => $hidden_fields
)); ));
break; break;
case 'select_topic':
$post_id_str = short_id_list($post_id_list);
redirect(str_replace('&amp;', '&', $mcp_url) . '&mode=forum_view&post_id_list=' . $post_id_str);
break;
case 'merge': case 'merge':
case 'split': case 'split':
case 'delete': case 'delete':
@ -605,13 +617,14 @@ switch ($mode)
$posts_per_page = (isset($_REQUEST['posts_per_page'])) ? intval($_REQUEST['posts_per_page']) : $config['posts_per_page']; $posts_per_page = (isset($_REQUEST['posts_per_page'])) ? intval($_REQUEST['posts_per_page']) : $config['posts_per_page'];
/*
// Temp fix for merge: display all posts after the topic has been selected to avoid any confusion // Temp fix for merge: display all posts after the topic has been selected to avoid any confusion
if ($to_topic_id) if ($to_topic_id)
{ {
$sort_days = 0; $sort_days = 0;
$posts_per_page = 0; $posts_per_page = 0;
} }
*/
// Following section altered for consistency with viewforum, viewtopic, etc. // Following section altered for consistency with viewforum, viewtopic, etc.
// Post ordering options // Post ordering options
@ -688,13 +701,11 @@ switch ($mode)
'POST_ID' => $row['post_id'], 'POST_ID' => $row['post_id'],
'S_CHECKBOX' => $s_checkbox, 'S_CHECKBOX' => $s_checkbox,
'ROW_CLASS' => ($i % 2) ? 'row2' : 'row1', 'S_ROW_COUNT' => $i++,
'S_DISPLAY_MODES' => ($i % 10 == 0) ? TRUE : FALSE, 'S_DISPLAY_MODES' => ($i % 10 == 0) ? TRUE : FALSE,
'U_POST_DETAILS' => $mcp_url . '&amp;p=' . $row['post_id'] . '&amp;mode=post_details' 'U_POST_DETAILS' => $mcp_url . '&amp;p=' . $row['post_id'] . '&amp;mode=post_details'
)); ));
++$i;
} }
if ($mode == 'topic_view' || $mode == 'split') if ($mode == 'topic_view' || $mode == 'split')
@ -733,8 +744,8 @@ switch ($mode)
'POSTS_PER_PAGE' => $posts_per_page, 'POSTS_PER_PAGE' => $posts_per_page,
'S_FORM_ACTION' => $mcp_url . '&amp;mode=' . $mode, 'S_FORM_ACTION' => "mcp.$phpEx$SID&amp;mode=$mode&amp;t=$topic_id&amp;start=$start",
'S_FORUM_SELECT' => '<select name="to_forum_id">' . make_forum_select() . '</select>', 'S_FORUM_SELECT' => '<select name="to_forum_id">' . make_forum_select($to_forum_id) . '</select>',
'S_CAN_SPLIT' => ($auth->acl_gets('m_split', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'split')) ? TRUE : FALSE, 'S_CAN_SPLIT' => ($auth->acl_gets('m_split', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'split')) ? TRUE : FALSE,
'S_CAN_MERGE' => ($auth->acl_gets('m_merge', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'merge')) ? TRUE : FALSE, 'S_CAN_MERGE' => ($auth->acl_gets('m_merge', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'merge')) ? TRUE : FALSE,
'S_CAN_DELETE' => ($auth->acl_gets('m_delete', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'delete')) ? TRUE : FALSE, 'S_CAN_DELETE' => ($auth->acl_gets('m_delete', 'a_', $forum_id) &&($mode == 'topic_view' || $mode == 'delete')) ? TRUE : FALSE,
@ -743,7 +754,7 @@ switch ($mode)
'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS'=> $s_limit_days, 'S_SELECT_SORT_DAYS'=> $s_limit_days,
'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("$mcp_url&amp;mode=$mode&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total_posts, $posts_per_page, $start) 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("mcp.$phpEx$SID&amp;t=$topic_id&amp;mode=$mode&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total_posts, $posts_per_page, $start)
)); ));
break; break;
@ -753,7 +764,7 @@ switch ($mode)
$template->assign_vars(array( $template->assign_vars(array(
'FORUM_NAME' => $forum_info['forum_name'], 'FORUM_NAME' => $forum_info['forum_name'],
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id", 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id",
'S_FORM_ACTION' => $mcp_url 'S_FORM_ACTION' => "mcp.$phpEx$SID"
)); ));
$sql = 'SELECT u.username, p.* $sql = 'SELECT u.username, p.*
@ -899,23 +910,60 @@ switch ($mode)
if (!$subject) if (!$subject)
{ {
trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['Empty_subject'] . $return_split); trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['EMPTY_SUBJECT'] . $return_split);
} }
if (!$to_forum_id) if ($to_forum_id <= 0)
{ {
trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['SELECT_DESTINATION_FORUM'] . $return_split); trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['SELECT_DESTINATION_FORUM'] . $return_split);
} }
if ($mode == 'split_beyond') if ($mode == 'split_beyond')
{ {
// TODO: this method only works when posts are displayed in chronological order $sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
$sort_days = (!empty($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : 0;
$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : 't';
$sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : 'a';
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
$s_limit_days = $s_sort_key = $s_sort_dir = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir);
if ($sort_days)
{
$min_post_time = time() - ($sort_days * 86400);
$sql = 'SELECT COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
AND post_time >= $min_post_time";
$result = $db->sql_query($sql);
$total_posts = ($row = $db->sql_fetchrow($result)) ? $row['num_posts'] : 0;
$limit_posts_time = "AND p.post_time >= $min_post_time ";
}
else
{
$limit_posts_time = '';
$total_posts = $topic_info['topic_replies'] + 1;
}
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
$limit_posts_time
ORDER BY $sort_order
LIMIT $start, -1";
$result = $db->sql_query($sql);
/*
$sql = 'SELECT post_id $sql = 'SELECT post_id
FROM ' . POSTS_TABLE . " FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND post_id >= $post_id"; AND post_id >= $post_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
*/
$post_id_list = array(); $post_id_list = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
@ -928,6 +976,7 @@ switch ($mode)
trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['None_selected'] . $return_split); trigger_error('Line : ' . __LINE__ . '<br/><br/>' . $user->lang['None_selected'] . $return_split);
} }
/*
$icon_id = (!empty($_POST['icon'])) ? intval($_POST['icon']) : 0; $icon_id = (!empty($_POST['icon'])) ? intval($_POST['icon']) : 0;
$sql = 'INSERT INTO ' . TOPICS_TABLE . " (forum_id, topic_title, icon_id, topic_approved) $sql = 'INSERT INTO ' . TOPICS_TABLE . " (forum_id, topic_title, icon_id, topic_approved)
VALUES ($to_forum_id, '" . $db->sql_escape($subject) . "', $icon_id, 1)"; VALUES ($to_forum_id, '" . $db->sql_escape($subject) . "', $icon_id, 1)";
@ -935,6 +984,7 @@ switch ($mode)
$to_topic_id = $db->sql_nextid(); $to_topic_id = $db->sql_nextid();
move_posts($post_id_list, $to_topic_id); move_posts($post_id_list, $to_topic_id);
*/
$return_url = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '">', '</a>'); $return_url = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '">', '</a>');
$return_url .= '<br /><br />' . sprintf($user->lang['CLICK_GO_NEW_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $to_topic_id . '">', '</a>'); $return_url .= '<br /><br />' . sprintf($user->lang['CLICK_GO_NEW_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $to_topic_id . '">', '</a>');
@ -1032,21 +1082,27 @@ switch ($mode)
$db->sql_freeresult($result); $db->sql_freeresult($result);
break; break;
case 'select_topic':
/* $post_id_str = short_id_list($post_id_list);
redirect(str_replace('&amp;', '&', $mcp_url) . '&mode=forum_view&post_id_list=' . $post_id_str);
break;
*/
case 'forum_view': case 'forum_view':
mcp_header('mcp_forum.html', TRUE); mcp_header('mcp_forum.html', TRUE);
$template->assign_vars(array( $template->assign_vars(array(
'FORUM_NAME' => $forum_info['forum_name'], 'FORUM_NAME' => $forum_info['forum_name'],
'S_CAN_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_CAN_DELETE' => $auth->acl_gets('a_', 'm_delete', $forum_id),
'S_CAN_MOVE' => $auth->acl_get('m_move', $forum_id), 'S_CAN_MOVE' => $auth->acl_gets('a_', 'm_move', $forum_id),
'S_CAN_LOCK' => $auth->acl_get('m_lock', $forum_id), 'S_CAN_LOCK' => $auth->acl_gets('a_', 'm_lock', $forum_id),
'S_CAN_UNLOCK' => $auth->acl_get('m_unlock', $forum_id), 'S_CAN_RESYNC' => $auth->acl_gets('a_', 'm_', $forum_id),
'S_CAN_RESYNC' => $auth->acl_gets('m_', 'a_', $forum_id),
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id", 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id",
'S_HIDDEN_FIELDS' => '<input type="hidden" name="f" value="' . $forum_id . '">', 'S_HIDDEN_FIELDS' => '<input type="hidden" name="f" value="' . $forum_id . '">',
'S_MCP_ACTION' => $mcp_url 'S_MCP_ACTION' => "mcp.$phpEx$SID"
)); ));
// Define censored word matches // Define censored word matches
@ -1116,17 +1172,17 @@ switch ($mode)
} }
$template->assign_block_vars('topicrow', array( $template->assign_block_vars('topicrow', array(
'U_VIEW_TOPIC' => $mcp_url . '&amp;t=' . $row['topic_id'] . '&amp;mode=topic_view', 'U_VIEW_TOPIC' => $mcp_url . '&amp;t=' . $row['topic_id'] . '&amp;mode=topic_view',
'S_SELECT_TOPIC' => ($topic_id && isset($_GET['post_id_list']) && $row['topic_id'] != $topic_id) ? TRUE : FALSE, 'S_SELECT_TOPIC' => ($mode == 'select_topic' && $row['topic_id'] != $topic_id) ? TRUE : FALSE,
'U_SELECT_TOPIC' => $mcp_url . '&amp;mode=merge&amp;to_topic_id=' . $row['topic_id'] . $url_extra, 'U_SELECT_TOPIC' => $mcp_url . '&amp;mode=merge&amp;to_topic_id=' . $row['topic_id'] . $url_extra,
'TOPIC_FOLDER_IMG' => $folder_img, 'TOPIC_FOLDER_IMG' => $folder_img,
'TOPIC_TYPE' => $topic_type, 'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE' => $topic_title,
'REPLIES' => $row['topic_replies'], 'REPLIES' => $row['topic_replies'],
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
'TOPIC_ID' => $row['topic_id'] 'TOPIC_ID' => $row['topic_id']
)); ));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -1736,12 +1792,12 @@ function short_id_list($id_list)
foreach ($id_list as $id) foreach ($id_list as $id)
{ {
$short = base_convert($id, 10, 36); $short = (string) base_convert($id, 10, 36);
$max_len = max(strlen($short), $max_len); $max_len = max(strlen($short), $max_len);
$short_id_list[] = $short; $short_id_list[] = $short;
} }
$id_str = $max_len; $id_str = (string) $max_len;
foreach ($short_id_list as $short) foreach ($short_id_list as $short)
{ {
$id_str .= str_pad($short, $max_len, '0', STR_PAD_LEFT); $id_str .= str_pad($short, $max_len, '0', STR_PAD_LEFT);
@ -1763,7 +1819,7 @@ function very_temporary_lang_strings()
'FORUM_NOT_POSTABLE' => 'This forum is not postable', 'FORUM_NOT_POSTABLE' => 'This forum is not postable',
'SELECTED_TOPICS' => 'You selected the following topic(s)', 'SELECTED_TOPICS' => 'You selected the following topic(s)',
'FORUM_NOT_EXIST' => 'The forum you selected does not exist', 'FORUM_NOT_EXIST' => 'The forum you selected does not exist',
'Topic_not_exist' => 'The topic you selected does not exist', 'TOPIC_NOT_EXIST' => 'The topic you selected does not exist',
'Posts_merged' => 'The selected posts have been merged', 'Posts_merged' => 'The selected posts have been merged',
'SELECT_TOPIC' => 'Select topic', 'SELECT_TOPIC' => 'Select topic',
'Topic_number_is' => 'Topic #%d is %s', 'Topic_number_is' => 'Topic #%d is %s',
@ -1797,6 +1853,9 @@ function very_temporary_lang_strings()
'SPLIT_AFTER' => 'Split from selected post', 'SPLIT_AFTER' => 'Split from selected post',
'DELETE_POSTS' => 'Delete posts', 'DELETE_POSTS' => 'Delete posts',
'MOVE' => 'Move',
'LOCK' => 'Lock',
'UNLOCK' => 'Unlock',
'NOT_ALLOWED' => 'You are not allowed to perform this action.' 'NOT_ALLOWED' => 'You are not allowed to perform this action.'
); );
@ -1814,5 +1873,34 @@ function very_temporary_lang_strings()
'merge' => 'Merge topic', 'merge' => 'Merge topic',
'split' => 'Split topic' 'split' => 'Split topic'
); );
$user->lang['report_reasons'] = array(
'warez' => 'The post contains links to illegal or pirated software',
'sex' => 'The post contains nudity or something similar',
'off_topic' => 'Typically any of Pit\'t or TC\'s posts ^ ^'
);
} }
?> ?>

162
phpBB/report.php Normal file
View file

@ -0,0 +1,162 @@
<?php
/***************************************************************************
* report.php
* -------------------
* begin : July 4, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* 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.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$user->start();
$user->setup();
$auth->acl($user->data);
// End session management
// temp temp temp
very_temporary_lang_strings();
// temp temp temp
// var definitions
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
$reason_id = (!empty($_REQUEST['reason_id'])) ? intval($_REQUEST['reason_id']) : 0;
$description = (!empty($_REQUEST['description'])) ? stripslashes($_REQUEST['description']) : '';
// Start output of page
$page_title = $user->lang['REPORT_TO_ADMIN'];
include($phpbb_root_path . 'includes/page_header.' . $phpEx);
$sql = 'SELECT f.*, t.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE p.post_id = $post_id
AND p.topic_id = t.topic_id
AND p.forum_id = f.forum_id";
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
{
trigger_error('POST_NOT_EXIST');
}
$forum_id = $row['forum_id'];
$topic_id = $row['topic_id'];
// Checking permissions
if (!$auth->acl_gets('f_list', 'm_', 'a_', $forum_id))
{
trigger_error('POST_NOT_EXIST');
}
if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
{
trigger_error('USER_CANNOT_READ');
}
// Has the report been cancelled?
if (isset($_POST['cancel']))
{
redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
}
// Has the report been confirmed?
if (!empty($_POST['reason_id']))
{
$sql_ary = array(
'reason_id' => (int) $reason_id,
'post_id' => (int) $post_id,
'user_id' => (int) $user->user_id,
'report_time' => (int) time(),
'report_text' => (string) $description
);
$sql = 'INSERT INTO ' . REPORTS_TABLE . " (reason_id, post_id, user_id, report_time, report_text)
VALUES ($reason_id, $post_id, " . $user->data['user_id'] . ', ' . time() . ", '" . $db->sql_escape($description) . "')";
$db->sql_query($sql);
if (!$row['post_reported'])
{
$db->sql_query('UPDATE ' . POSTS_TABLE . ' SET post_reported = 1 WHERE post_id = ' . $post_id);
}
if (!$row['topic_reported'])
{
$db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 1 WHERE topic_id = ' . $topic_id);
}
trigger_error($user->lang['POST_REPORTED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;p=$post_id#$post_id\">", '</a>'));
}
// Generate the form
generate_forum_nav($row);
$result = $db->sql_query('SELECT * FROM ' . REASONS_TABLE . ' ORDER BY reason_priority ASC');
while ($row = $db->sql_fetchrow($result))
{
$reason_name = str_replace('_', ' ', $row['reason_name']);
$reason_name = ucwords($reason_name);
if (!empty($user->lang['reports_reasons'][$row['reason_name']]))
{
$reason_description = $user->lang['reports_reasons'][$row['reason_name']];
}
else
{
$reason_description = $row['reason_description'];
}
$template->assign_block_vars('reason', array(
'ID' => $row['reason_id'],
'NAME' => htmlspecialchars($reason_name),
'DESCRIPTION' => htmlspecialchars($reason_description)
));
}
$template->set_filenames(array(
'body' => 'report.html'
));
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
function very_temporary_lang_strings()
{
global $user;
$user->lang['reports_reasons'] = array(
'warez' => 'The post contains links to illegal or pirated software'
);
$lang = array(
'REASON' => 'Reason',
'ADDITIONAL_INFOS' => 'Additional infos',
'CAN_BE_LEFT_BLANK' => '(can be left blank)',
'POST_NOT_EXIST' => 'The post you requested does not exist',
'REPORT_TO_ADMIN_EXPLAIN' => 'Using this forum you can report the selected post to admins.',
'REPORT_NOTIFY' => 'Notify me when this report is reviewed',
'POST_REPORTED' => 'This post has been successfully reported'
);
$user->lang = array_merge($user->lang, $lang);
}
?>

View file

@ -36,8 +36,6 @@
<!-- IF S_CAN_LOCK --> <!-- IF S_CAN_LOCK -->
<input type="submit" name="lock" class="liteoption" value="{L_LOCK}" /> <input type="submit" name="lock" class="liteoption" value="{L_LOCK}" />
&nbsp; &nbsp;
<!-- ENDIF -->
<!-- IF S_CAN_UNLOCK -->
<input type="submit" name="unlock" class="liteoption" value="{L_UNLOCK}" /> <input type="submit" name="unlock" class="liteoption" value="{L_UNLOCK}" />
&nbsp; &nbsp;
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -46,6 +46,9 @@
<td class="row1" nowrap="nowrap"><span class="gen">{L_POSTS_PER_PAGE}</span><br /><span class="gensmall">{L_POSTS_PER_PAGE_EXPLAIN}</span</td> <td class="row1" nowrap="nowrap"><span class="gen">{L_POSTS_PER_PAGE}</span><br /><span class="gensmall">{L_POSTS_PER_PAGE_EXPLAIN}</span</td>
<td class="row2" colspan="2"><input class="post" type="text" name="posts_per_page" size="6" value="{POSTS_PER_PAGE}"></td> <td class="row2" colspan="2"><input class="post" type="text" name="posts_per_page" size="6" value="{POSTS_PER_PAGE}"></td>
</tr> </tr>
<tr>
<td class="cat" colspan="3" height="28" align="center"><span class="gensmall">{L_DISPLAY_POSTS}:</span> {S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input class="liteoption" type="submit" name="sort" value="{L_GO}" /></span></td>
</tr>
<tr> <tr>
<th nowrap="nowrap">{L_AUTHOR}</th> <th nowrap="nowrap">{L_AUTHOR}</th>
<th nowrap="nowrap">{L_MESSAGE}</th> <th nowrap="nowrap">{L_MESSAGE}</th>
@ -61,9 +64,13 @@
</td> </td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr> <!-- IF postrow.S_ROW_COUNT is even -->
<td class="{postrow.ROW_CLASS}" align="left" valign="top"><span class="name"><a name="{postrow.U_POST_ID}"></a>{postrow.POSTER_NAME}</span><br /><br /><br /><span class="gensmall"><a href="{postrow.U_POST_DETAILS}">{L_POST_DETAILS}</a></span></td> <tr class="row1">
<td width="100%" valign="top" class="{postrow.ROW_CLASS}"><table width="100%" cellspacing="0" cellpadding="2" border="0"> <!-- ELSE -->
<tr class="row2">
<!-- ENDIF -->
<td align="left" valign="top"><span class="name"><a name="{postrow.U_POST_ID}"></a>{postrow.POSTER_NAME}</span><br /><br /><br /><span class="gensmall"><a href="{postrow.U_POST_DETAILS}">{L_POST_DETAILS}</a></span></td>
<td width="100%" valign="top"><table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr> <tr>
<td valign="middle"><img src="imagesets/subSilver/icon_minipost.gif" alt="{L_POST}"><span class="postdetails">{L_POSTED}: <td valign="middle"><img src="imagesets/subSilver/icon_minipost.gif" alt="{L_POST}"><span class="postdetails">{L_POSTED}:
{postrow.POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td> {postrow.POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
@ -72,7 +79,7 @@
<td class="postbody" valign="top"><hr size="1" />{postrow.MESSAGE}</td> <td class="postbody" valign="top"><hr size="1" />{postrow.MESSAGE}</td>
</tr> </tr>
</table></td> </table></td>
<td class="{postrow.ROW_CLASS}" width="5%" align="center">{postrow.S_CHECKBOX}</td> <td width="5%" align="center">{postrow.S_CHECKBOX}</td>
</tr> </tr>
<tr> <tr>
<td class="row3" colspan="3" height="1"><img src="images/spacer.gif" width="1" height="1" alt="" /></td> <td class="row3" colspan="3" height="1"><img src="images/spacer.gif" width="1" height="1" alt="" /></td>
@ -84,8 +91,9 @@
</table></form> </table></form>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <tr>
<td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td> <td class="nav" align="left" valign="middle">{PAGE_NUMBER}</td>
<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
</tr> </tr>
</table> </table>

View file

@ -0,0 +1,54 @@
<!-- INCLUDE overall_header.html -->
<form action="{S_POST_ACTION}" method="post">
{ERROR_BOX}
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td class="nav" width="100%" align="left" valign="middle">&nbsp; &nbsp;<a href="{U_INDEX}">{L_INDEX}</a><!-- BEGIN navlinks --> -> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
<tr>
<th colspan="2" height="25">&nbsp;{L_REPORT_TO_ADMIN}&nbsp;</th>
</tr>
<tr>
<td class="row2" colspan="2" align="center"><span class="gen">&nbsp;{L_REPORT_TO_ADMIN_EXPLAIN}&nbsp;</span></td>
</tr>
<tr>
<td class="row1" width="22%"><span class="gen"><b>{L_REASON}</b></span></td>
<td class="row2" width="78%"><select name="reason_id"><!-- BEGIN reason --><option value="{reason.ID}">{reason.DESCRIPTION}</option><!-- END reason --></select></td>
</tr>
<tr>
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span></td>
<td class="row2"><table cellspacing="0" cellpadding="1" border="0">
<tr>
<td><input type="checkbox" name="notify" /></td>
<td><span class="gen">{L_REPORT_NOTIFY}</span></td>
</tr>
</table></td>
</tr>
<tr>
<td class="row1" valign="top"><span class="gen"><b>{L_ADDITIONAL_INFOS}</b></span><br /><span class="gensmall">{L_CAN_BE_LEFT_BLANK}</span></td>
<td class="row2"><span class="gen"><textarea name="description" rows="25" cols="40" wrap="virtual" style="width:500px" class="post">{MESSAGE}</textarea></span></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center" height="28"><input type="submit" name="submit" class="mainoption" value="{L_REPORT_TO_ADMIN}" />&nbsp;<input type="submit" name="cancel" class="liteoption" value="{L_CANCEL}"></td>
</tr>
</table>
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table></form>
<table width="100%" cellspacing="2" border="0" align="center">
<tr>
<td valign="top" align="right">{JUMPBOX}</td>
</tr>
</table>
<!-- INCLUDE overall_footer.html -->

View file

@ -105,8 +105,16 @@
<tr> <tr>
<td colspan="2"><hr /></td> <td colspan="2"><hr /></td>
</tr> </tr>
<!-- IF postrow.S_POST_REPORTED -->
<tr> <tr>
<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td> <td colspan="2" class="gen"><a href="{postrow.U_MCP_REPORT}">{L_POST_BEEN_REPORTED}</a></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<!-- ENDIF -->
<tr>
<td><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@ -126,7 +134,7 @@
document.write('</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>'); document.write('</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td> //--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
<td width="100%" align="right" nowrap="nowrap"><!-- span class="gensmall">{postrow.RATING}</span -->&nbsp;</td> <td width="100%" align="right" nowrap="nowrap"><!-- span class="gensmall">{postrow.RATING}</span --><span class="gensmall">[ <a href="{postrow.U_REPORT}">{L_REPORT_TO_ADMIN}</a> ]</span>&nbsp;</td>
</tr> </tr>
</table></td> </table></td>
<!-- ENDIF --> <!-- ENDIF -->