mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
- fixed permissions for mcp (global permission settings are false if user is only able to moderate one to x forums)
- determine permission settings for submodules - further approve/disapprove work (approve_details added) git-svn-id: file:///svn/phpbb/trunk@4925 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -928,4 +928,89 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||
}
|
||||
}
|
||||
|
||||
// Topic Review
|
||||
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
|
||||
{
|
||||
global $user, $auth, $db, $template, $bbcode, $template;
|
||||
global $config, $phpbb_root_path, $phpEx, $SID;
|
||||
|
||||
// Go ahead and pull all data for this topic
|
||||
$sql = 'SELECT u.username, u.user_id, u.user_karma, p.post_id, p.post_username, p.post_subject, p.post_text, p.enable_smilies, p.bbcode_uid, p.bbcode_bitfield, p.post_time
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
|
||||
WHERE p.topic_id = $topic_id
|
||||
AND p.poster_id = u.user_id
|
||||
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . '
|
||||
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
|
||||
ORDER BY p.post_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
|
||||
|
||||
if (!$row = $db->sql_fetchrow($result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$bbcode_bitfield = 0;
|
||||
do
|
||||
{
|
||||
$rowset[] = $row;
|
||||
$bbcode_bitfield |= $row['bbcode_bitfield'];
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Instantiate BBCode class
|
||||
if (!isset($bbcode) && $bbcode_bitfield)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||
$bbcode = new bbcode($bbcode_bitfield);
|
||||
}
|
||||
|
||||
foreach ($rowset as $i => $row)
|
||||
{
|
||||
$poster_id = $row['user_id'];
|
||||
$poster = $row['username'];
|
||||
|
||||
// Handle anon users posting with usernames
|
||||
if ($poster_id == ANONYMOUS && $row['post_username'])
|
||||
{
|
||||
$poster = $row['post_username'];
|
||||
$poster_rank = $user->lang['GUEST'];
|
||||
}
|
||||
|
||||
$post_subject = $row['post_subject'];
|
||||
$message = $row['post_text'];
|
||||
|
||||
if ($row['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
$message = smilie_text($message, !$row['enable_smilies']);
|
||||
|
||||
$post_subject = censor_text($post_subject);
|
||||
$message = censor_text($message);
|
||||
|
||||
$template->assign_block_vars($mode . '_row', array(
|
||||
'POSTER_NAME' => $poster,
|
||||
'POST_SUBJECT' => $post_subject,
|
||||
'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']),
|
||||
'POST_DATE' => $user->format_date($row['post_time']),
|
||||
'MESSAGE' => str_replace("\n", '<br />', $message),
|
||||
|
||||
'U_POST_ID' => $row['post_id'],
|
||||
'U_MINI_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&p=" . $row['post_id'] . '#' . $row['post_id'],
|
||||
'U_MCP_DETAILS' => ($auth->acl_get('m_', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'] : '',
|
||||
'U_QUOTE' => ($show_quote_button && $auth->acl_get('f_quote', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : '')
|
||||
);
|
||||
unset($rowset[$i]);
|
||||
}
|
||||
|
||||
if ($mode == 'topic_review')
|
||||
{
|
||||
$template->assign_var('QUOTE_IMG', $user->img('btn_quote', $user->lang['REPLY_WITH_QUOTE']));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
@@ -24,14 +24,91 @@ class mcp_queue extends module
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'approve':
|
||||
case 'disapprove':
|
||||
|
||||
break;
|
||||
|
||||
case 'approve_details':
|
||||
|
||||
$user->add_lang('posting');
|
||||
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
|
||||
$post_id = request_var('p', 0);
|
||||
$post_info = get_post_data(array($post_id), 'm_approve');
|
||||
|
||||
if (!sizeof($post_info))
|
||||
{
|
||||
trigger_error('NO_POST_SELECTED');
|
||||
}
|
||||
|
||||
$post_info = $post_info[$post_id];
|
||||
|
||||
if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_TOPIC_REVIEW' => true,
|
||||
'TOPIC_TITLE' => $post_info['topic_title'])
|
||||
);
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
$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'];
|
||||
if ($post_info['bbcode_bitfield'])
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
||||
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
||||
}
|
||||
$message = smilie_text($message);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_APPROVE_ACTION' => "mcp.$phpEx$SID&i=queue&p=$post_id&f=$forum_id",
|
||||
|
||||
'S_CAN_VIEWIP' => $auth->acl_get('m_ip', $post_info['forum_id']),
|
||||
'S_POST_REPORTED' => $post_info['post_reported'],
|
||||
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
|
||||
'S_POST_LOCKED' => $post_info['post_edit_locked'],
|
||||
// 'S_USER_NOTES' => ($post_info['user_notes']) ? true : false,
|
||||
'S_USER_WARNINGS' => ($post_info['user_warnings']) ? true : false,
|
||||
|
||||
'U_VIEW_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'],
|
||||
'U_MCP_USERNOTES' => "mcp.$phpEx$SID&i=notes&mode=user_notes&u=" . $post_info['user_id'],
|
||||
'U_MCP_WARNINGS' => "mcp.$phpEx$SID&i=warnings&mode=view_user&u=" . $post_info['user_id'],
|
||||
|
||||
'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']),
|
||||
|
||||
'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'],
|
||||
'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']))
|
||||
);
|
||||
|
||||
$this->display($user->lang['MCP_QUEUE'], 'mcp_approve.html');
|
||||
|
||||
break;
|
||||
|
||||
case 'unapproved_topics':
|
||||
case 'unapproved_posts':
|
||||
|
||||
$forum_info = array();
|
||||
|
||||
$forum_list_approve = get_forum_list('m_approve', false, true);
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
if (!$forum_list = implode(', ', get_forum_list('m_approve')))
|
||||
$forum_list = array();
|
||||
foreach ($forum_list_approve as $row)
|
||||
{
|
||||
$forum_list[] = $row['forum_id'];
|
||||
}
|
||||
|
||||
if (!$forum_list = implode(', ', $forum_list))
|
||||
{
|
||||
trigger_error('NOT_MODERATOR');
|
||||
}
|
||||
@@ -42,6 +119,7 @@ class mcp_queue extends module
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -53,6 +131,13 @@ class mcp_queue extends module
|
||||
}
|
||||
|
||||
$forum_info = $forum_info[$forum_id];
|
||||
$forum_list = $forum_id;
|
||||
}
|
||||
|
||||
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
||||
foreach ($forum_list_approve as $row)
|
||||
{
|
||||
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
|
||||
}
|
||||
|
||||
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
|
||||
@@ -133,29 +218,32 @@ class mcp_queue extends module
|
||||
}
|
||||
else
|
||||
{
|
||||
$poster = '<a href="memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['poster_id'] . '">' . $row['username'] . '</a>';
|
||||
$poster = $row['username'];
|
||||
}
|
||||
|
||||
$s_checkbox = ($mode == 'unapproved_posts') ? '<input type="checkbox" name="post_id_list[]" value="' . $row['post_id'] . '" />' : '<input type="checkbox" name="topic_id_list[]" value="' . $row['topic_id'] . '" />';
|
||||
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'U_VIEWFORUM' => "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
||||
'U_VIEWFORUM' => "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
||||
// Q: Why accessing the topic by a post_id instead of its topic_id?
|
||||
// A: To prevent the post from being hidden because of low karma or wrong encoding
|
||||
'U_VIEWTOPIC' => "viewtopic.$phpEx$SID&f=" . $row['forum_id'] . '&p=' . $row['post_id'] . (($mode == 'unapproved_posts') ? '#' . $row['post_id'] : ''),
|
||||
'U_VIEWTOPIC' => "viewtopic.$phpEx$SID&f=" . $row['forum_id'] . '&p=' . $row['post_id'] . (($mode == 'unapproved_posts') ? '#' . $row['post_id'] : ''),
|
||||
'U_VIEW_DETAILS'=> "mcp.$phpEx$SID&i=queue&start=$start&mode=approve_details&f={$forum_id}&p={$row['post_id']}",
|
||||
'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['poster_id']}" : '',
|
||||
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
'TOPIC_TITLE' => $row['topic_title'],
|
||||
'POSTER' => $poster,
|
||||
'POST_TIME' => $user->format_date($row['post_time']),
|
||||
'S_CHECKBOX' => $s_checkbox)
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
'TOPIC_TITLE' => $row['topic_title'],
|
||||
'POSTER' => $poster,
|
||||
'POST_TIME' => $user->format_date($row['post_time']),
|
||||
'S_CHECKBOX' => $s_checkbox)
|
||||
);
|
||||
}
|
||||
unset($rowset);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'])
|
||||
'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
|
||||
'S_FORUM_OPTIONS' => $forum_options)
|
||||
);
|
||||
|
||||
$this->display($user->lang['MCP_QUEUE'], 'mcp_queue.html');
|
||||
|
@@ -420,7 +420,7 @@ class ucp_main extends module
|
||||
$topic_id = $row['topic_id'];
|
||||
|
||||
// Goto message generation
|
||||
$replies = ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
|
||||
$topic_type = '';
|
||||
switch ($row['topic_type'])
|
||||
@@ -637,7 +637,7 @@ class ucp_main extends module
|
||||
$forum_id = $row['forum_id'];
|
||||
$topic_id = $row['b_topic_id'];
|
||||
|
||||
$replies = ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
|
||||
$topic_type = '';
|
||||
switch ($row['topic_type'])
|
||||
|
@@ -171,7 +171,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||
|
||||
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'],
|
||||
'U_REPORT' => ($config['auth_report_pm'] && $auth->acl_get('u_pm_report')) ? "{$phpbb_root_path}report.$phpEx$SID&pm=" . $message_row['msg_id'] : '',
|
||||
'U_IP' => ($auth->acl_get('m_') && $message_row['message_reported']) ? "{$phpbb_root_path}mcp.$phpEx?sid=" . $user->session_id . "&mode=pm_details&p=" . $message_row['msg_id'] . '#ip' : '',
|
||||
'U_IP' => ($auth->acl_get('m_ip') && $message_row['message_reported']) ? "{$phpbb_root_path}mcp.$phpEx?sid=" . $user->session_id . "&mode=pm_details&p=" . $message_row['msg_id'] . '#ip' : '',
|
||||
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '',
|
||||
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $author_id,
|
||||
'U_EMAIL' => $user_info['email'],
|
||||
|
Reference in New Issue
Block a user