mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
- fork/copy topic
- resync topics - possible to show only reported posts in topic_view - view reports in post details - mcp_queue (show unapproved items) git-svn-id: file:///svn/phpbb/trunk@4924 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
bdd1643a7d
commit
6a69106501
12 changed files with 988 additions and 384 deletions
|
@ -33,6 +33,21 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info)
|
|||
$post_id_list = request_var('post_id_list', 0);
|
||||
$topic_id = request_var('t', 0);
|
||||
|
||||
// Resync Topics
|
||||
if ($action == 'resync')
|
||||
{
|
||||
$topic_ids = get_array('topic_id_list', 0);
|
||||
|
||||
if (!$topic_ids)
|
||||
{
|
||||
$template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
|
||||
}
|
||||
else
|
||||
{
|
||||
mcp_resync_topics($topic_ids);
|
||||
}
|
||||
}
|
||||
|
||||
$selected_ids = '';
|
||||
if ($post_id_list)
|
||||
{
|
||||
|
@ -166,7 +181,7 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info)
|
|||
'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false,
|
||||
'U_SELECT_TOPIC' => $url . '&mode=topic_view&action=merge&to_topic_id=' . $row['topic_id'] . $selected_ids,
|
||||
'U_MCP_QUEUE' => $url . '&i=queue&mode=approve&t=' . $row['topic_id'],
|
||||
'U_MCP_REPORT' => $url . '&mode=reports&t=' . $row['topic_id'],
|
||||
'U_MCP_REPORT' => "mcp.$phpEx$SID&i=main&mode=topic_view&t={$row['topic_id']}&action=reports",
|
||||
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
|
||||
'TOPIC_FOLDER_IMG' => $folder_img,
|
||||
|
@ -184,4 +199,41 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info)
|
|||
unset($topic_rows);
|
||||
}
|
||||
|
||||
function mcp_resync_topics($topic_ids)
|
||||
{
|
||||
global $auth, $db, $template, $phpEx, $user, $SID, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
{
|
||||
$template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sync everything and perform extra checks separately
|
||||
sync('topic_reported', 'topic_id', $topic_ids, false, true);
|
||||
sync('topic_attachment', 'topic_id', $topic_ids, false, true);
|
||||
sync('topic', 'topic_id', $topic_ids, true, false);
|
||||
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
// Log this action
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']);
|
||||
}
|
||||
|
||||
$msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS'];
|
||||
$template->assign_var('MESSAGE', $msg);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
|
@ -84,6 +84,20 @@ class mcp_main extends module
|
|||
|
||||
break;
|
||||
|
||||
case 'fork':
|
||||
$user->add_lang('viewtopic');
|
||||
|
||||
$topic_ids = get_array((!$quickmod) ? 'topic_id_list' : 't', 0);
|
||||
|
||||
if (!$topic_ids)
|
||||
{
|
||||
trigger_error('NO_TOPIC_SELECTED');
|
||||
}
|
||||
|
||||
mcp_fork_topic($topic_ids);
|
||||
|
||||
break;
|
||||
|
||||
case 'delete_topic':
|
||||
$user->add_lang('viewtopic');
|
||||
|
||||
|
@ -182,358 +196,8 @@ class mcp_main extends module
|
|||
}
|
||||
}
|
||||
|
||||
// request_var, the array way
|
||||
function get_array($var, $default_value)
|
||||
{
|
||||
$ids = request_var($var, $default_value);
|
||||
|
||||
if (!is_array($ids))
|
||||
{
|
||||
if (!$ids)
|
||||
{
|
||||
return $default_value;
|
||||
}
|
||||
|
||||
$ids = array($ids);
|
||||
}
|
||||
|
||||
$ids = array_unique($ids);
|
||||
|
||||
if (sizeof($ids) == 1 && !$ids[0])
|
||||
{
|
||||
return $default_value;
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
//
|
||||
// LITTLE HELPER
|
||||
|
||||
// Build simple hidden fields from array
|
||||
function build_hidden_fields($field_ary)
|
||||
{
|
||||
$s_hidden_fields = '';
|
||||
|
||||
foreach ($field_ary as $name => $vars)
|
||||
{
|
||||
if (is_array($vars))
|
||||
{
|
||||
foreach ($vars as $key => $value)
|
||||
{
|
||||
$s_hidden_fields .= '<input type="hidden" name="' . $name . '[' . $key . ']" value="' . $value . '" />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_hidden_fields .= '<input type="hidden" name="' . $name . '" value="' . $vars . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
return $s_hidden_fields;
|
||||
}
|
||||
|
||||
// Get simple topic data
|
||||
function get_topic_data($topic_ids, $acl_list = false)
|
||||
{
|
||||
global $auth, $db;
|
||||
$rowset = array();
|
||||
|
||||
if (implode(', ', $topic_ids) == '')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = 'SELECT f.*, t.*
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON t.forum_id = f.forum_id
|
||||
WHERE t.topic_id IN (' . implode(', ', $topic_ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowset[$row['topic_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
// Get simple post data
|
||||
function get_post_data($post_ids, $acl_list = false)
|
||||
{
|
||||
global $db, $auth;
|
||||
$rowset = array();
|
||||
|
||||
$sql = 'SELECT p.*, u.*, t.*, f.*
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON f.forum_id = p.forum_id
|
||||
WHERE p.post_id IN (' . implode(', ', $post_ids) . ')
|
||||
AND u.user_id = p.poster_id
|
||||
AND t.topic_id = p.topic_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
// Moderators without the permission to approve post should at least not see them. ;)
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowset[$row['post_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
function get_forum_data($forum_id, $acl_list = 'f_list')
|
||||
{
|
||||
global $auth, $db;
|
||||
$rowset = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id ' . ((is_array($forum_id)) ? 'IN (' . implode(', ', $forum_id) . ')' : "= $forum_id");
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
$row['forum_topics'] = $row['forum_topics_real'];
|
||||
}
|
||||
|
||||
$rowset[$row['forum_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
|
||||
{
|
||||
global $db, $user, $auth, $template;
|
||||
|
||||
$sort_days = request_var('sort_days', 0);
|
||||
$min_time = ($sort_days) ? time() - ($sort_days * 86400) : 0;
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'viewforum':
|
||||
$type = 'topics';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(topic_id) AS total
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
$where_sql forum_id = $forum_id
|
||||
AND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
|
||||
AND topic_last_post_time >= $min_time";
|
||||
|
||||
if (!$auth->acl_get('m_approve', $forum_id))
|
||||
{
|
||||
$sql .= 'AND topic_approved = 1';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'viewtopic':
|
||||
$type = 'posts';
|
||||
$default_key = 't';
|
||||
$default_dir = 'a';
|
||||
$sql = 'SELECT COUNT(post_id) AS total
|
||||
FROM ' . POSTS_TABLE . "
|
||||
$where_sql topic_id = $topic_id
|
||||
AND post_time >= $min_time";
|
||||
|
||||
if (!$auth->acl_get('m_approve', $forum_id))
|
||||
{
|
||||
$sql .= 'AND post_approved = 1';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'unapproved_posts':
|
||||
$type = 'posts';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(post_id) AS total
|
||||
FROM ' . POSTS_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_approve'))) . ')
|
||||
AND post_approved = 0
|
||||
AND post_time >= ' . $min_time;
|
||||
break;
|
||||
|
||||
case 'unapproved_topics':
|
||||
$type = 'topics';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(topic_id) AS total
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_approve'))) . ')
|
||||
AND topic_approved = 0
|
||||
AND topic_time >= ' . $min_time;
|
||||
break;
|
||||
|
||||
case 'reports':
|
||||
$type = 'reports';
|
||||
$default_key = 'p';
|
||||
$default_dir = 'd';
|
||||
$limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : '';
|
||||
|
||||
if ($topic_id)
|
||||
{
|
||||
$where_sql .= ' p.topic_id = ' . $topic_id;
|
||||
}
|
||||
else if ($forum_id)
|
||||
{
|
||||
$where_sql .= ' p.forum_id = ' . $forum_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_sql .= ' p.forum_id IN (' . implode(', ', get_forum_list('m_')) . ')';
|
||||
}
|
||||
$sql = 'SELECT COUNT(r.report_id) AS total
|
||||
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p
|
||||
$where_sql
|
||||
AND p.post_id = r.post_id
|
||||
$limit_time_sql";
|
||||
break;
|
||||
|
||||
case 'viewlogs':
|
||||
$type = 'logs';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(log_id) AS total
|
||||
FROM ' . LOG_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_'))) . ')
|
||||
AND log_time >= ' . $min_time . '
|
||||
AND log_type = ' . LOG_MOD;
|
||||
break;
|
||||
}
|
||||
|
||||
$sort_key = request_var('sk', $default_key);
|
||||
$sort_dir = request_var('sd', $default_dir);
|
||||
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'topics':
|
||||
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
||||
|
||||
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_replies_real' : 't.topic_replies'), 's' => 't.topic_title', 'v' => 't.topic_views');
|
||||
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
||||
$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
|
||||
$limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : '';
|
||||
break;
|
||||
|
||||
case 'reports':
|
||||
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('p' => $user->lang['REPORT_PRIORITY'], 'r' => $user->lang['REPORTER'], 't' => $user->lang['REPORT_TIME']);
|
||||
$sort_by_sql = array('p' => 'rr.reason_priority', 'r' => 'u.username', 't' => 'r.report_time');
|
||||
break;
|
||||
|
||||
case 'logs':
|
||||
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
|
||||
|
||||
$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
|
||||
$limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : '';
|
||||
break;
|
||||
}
|
||||
|
||||
$sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||
|
||||
$s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = '';
|
||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS'=> $s_limit_days)
|
||||
);
|
||||
|
||||
if (($sort_days && $mode != 'viewlogs') || $mode == 'reports')
|
||||
{
|
||||
$result = $db->sql_query($sql);
|
||||
$total = ($row = $db->sql_fetchrow($result)) ? $row['total'] : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$total = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function check_ids(&$ids, $table, $sql_id, $acl_list = false)
|
||||
{
|
||||
global $db, $auth;
|
||||
|
||||
if (!is_array($ids) || !$ids)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// a small logical error, since global announcement are assigned to forum_id == 0
|
||||
// If the first topic id is a global announcement, we can force the forum. Though only global announcements can be
|
||||
// tricked... i really do not know how to prevent this atm.
|
||||
|
||||
// With those two queries we make sure all ids are within one forum...
|
||||
$sql = "SELECT forum_id FROM $table
|
||||
WHERE $sql_id = {$ids[0]}";
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
// Global Announcement?
|
||||
$forum_id = request_var('f', 0);
|
||||
}
|
||||
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $forum_id))
|
||||
{
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
trigger_error('Missing forum_id, has to be in url if global announcement...');
|
||||
}
|
||||
|
||||
$sql = "SELECT $sql_id FROM $table
|
||||
WHERE $sql_id IN (" . implode(', ', $ids) . ")
|
||||
AND (forum_id = $forum_id OR forum_id = 0)";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$ids[] = $row[$sql_id];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $forum_id;
|
||||
}
|
||||
|
||||
// LITTLE HELPER
|
||||
//
|
||||
|
||||
// Lock/Unlock Topic/Post
|
||||
function lock_unlock($mode, $ids)
|
||||
|
@ -917,7 +581,7 @@ function mcp_delete_topic($topic_ids)
|
|||
}
|
||||
}
|
||||
|
||||
// Delete Topics
|
||||
// Delete Posts
|
||||
function mcp_delete_post($post_ids)
|
||||
{
|
||||
global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path;
|
||||
|
@ -1026,4 +690,250 @@ function mcp_delete_post($post_ids)
|
|||
}
|
||||
}
|
||||
|
||||
// Fork Topic
|
||||
function mcp_fork_topic($topic_ids)
|
||||
{
|
||||
global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path, $template, $config;
|
||||
global $_POST, $_REQUEST;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$to_forum_id = request_var('to_forum_id', 0);
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$additional_msg = $success_msg = '';
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'topic_id_list' => $topic_ids,
|
||||
'f' => $forum_id,
|
||||
'mode' => 'fork',
|
||||
'redirect' => $redirect)
|
||||
);
|
||||
|
||||
if ($to_forum_id)
|
||||
{
|
||||
$forum_data = get_forum_data($to_forum_id);
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
{
|
||||
$additional_msg = $user->lang['NO_TOPICS_SELECTED'];
|
||||
}
|
||||
else if (!sizeof($forum_data))
|
||||
{
|
||||
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$forum_data = $forum_data[$to_forum_id];
|
||||
|
||||
if ($forum_data['forum_type'] != FORUM_POST)
|
||||
{
|
||||
$additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
|
||||
}
|
||||
else if (!$auth->acl_get('f_post', $to_forum_id))
|
||||
{
|
||||
$additional_msg = $user->lang['USER_CANNOT_POST'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$to_forum_id || $additional_msg)
|
||||
{
|
||||
unset($_POST['confirm']);
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$topic_data = get_topic_data($topic_ids);
|
||||
|
||||
$total_posts = 0;
|
||||
$new_topic_id_list = array();
|
||||
foreach ($topic_data as $topic_id => $topic_row)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'forum_id' => (int) $to_forum_id,
|
||||
'icon_id' => (int) $topic_row['icon_id'],
|
||||
'topic_attachment' => (int) $topic_row['topic_attachment'],
|
||||
'topic_approved' => 1,
|
||||
'topic_reported' => 0,
|
||||
'topic_title' => (string) $topic_row['topic_title'],
|
||||
'topic_poster' => (int) $topic_row['topic_poster'],
|
||||
'topic_time' => (int) $topic_row['topic_time'],
|
||||
'topic_replies' => (int) $topic_row['topic_replies_real'],
|
||||
'topic_replies_real' => (int) $topic_row['topic_replies_real'],
|
||||
'topic_status' => (int) $topic_row['topic_status'],
|
||||
'topic_type' => (int) $topic_row['topic_type'],
|
||||
'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'],
|
||||
'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'],
|
||||
'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'],
|
||||
'topic_last_post_time' => (int) $topic_row['topic_last_post_time'],
|
||||
'topic_last_view_time' => (int) $topic_row['topic_last_view_time'],
|
||||
'topic_bumped' => (int) $topic_row['topic_bumped'],
|
||||
'topic_bumper' => (int) $topic_row['topic_bumper'],
|
||||
'poll_title' => (string) $topic_row['poll_title'],
|
||||
'poll_start' => (int) $topic_row['poll_start'],
|
||||
'poll_length' => (int) $topic_row['poll_length']
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
$new_topic_id = $db->sql_nextid();
|
||||
$new_topic_id_list[$topic_id] = $new_topic_id;
|
||||
|
||||
markread('topic', $to_forum_id, $new_topic_id);
|
||||
|
||||
if ($topic_row['poll_start'])
|
||||
{
|
||||
$poll_rows = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . POLL_OPTIONS_TABLE . "
|
||||
WHERE topic_id = $topic_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = 'INSERT INTO ' . POLL_OPTIONS_TABLE . ' (poll_option_id, topic_id, poll_option_text, poll_option_total)
|
||||
VALUES (' . $row['poll_option_id'] . ', ' . $new_topic_id . ", '" . $db->sql_escape($row['poll_option_text']) . "', 0)";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE topic_id = $topic_id
|
||||
ORDER BY post_id ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$post_rows = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$post_rows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult();
|
||||
|
||||
if (!sizeof($post_rows))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$total_posts += sizeof($post_rows);
|
||||
foreach ($post_rows as $row)
|
||||
{
|
||||
$sql_ary = array(
|
||||
'topic_id' => (int) $new_topic_id,
|
||||
'forum_id' => (int) $to_forum_id,
|
||||
'poster_id' => (int) $row['poster_id'],
|
||||
'icon_id' => (int) $row['icon_id'],
|
||||
'poster_ip' => (string) $row['poster_ip'],
|
||||
'post_time' => (int) $row['post_time'],
|
||||
'post_approved' => 1,
|
||||
'post_reported' => 0,
|
||||
'enable_bbcode' => (int) $row['enable_bbcode'],
|
||||
'enable_html' => (int) $row['enable_html'],
|
||||
'enable_smilies' => (int) $row['enable_smilies'],
|
||||
'enable_magic_url' => (int) $row['enable_magic_url'],
|
||||
'enable_sig' => (int) $row['enable_sig'],
|
||||
'post_username' => (string) $row['post_username'],
|
||||
'post_subject' => (string) $row['post_subject'],
|
||||
'post_text' => (string) $row['post_text'],
|
||||
'post_edit_reason' => (string) $row['post_edit_reason'],
|
||||
'post_edit_user' => (int) $row['post_edit_user'],
|
||||
'post_checksum' => (string) $row['post_checksum'],
|
||||
'post_encoding' => (string) $row['post_encoding'],
|
||||
'post_attachment' => (int) $row['post_attachment'],
|
||||
'bbcode_bitfield' => (int) $row['bbcode_bitfield'],
|
||||
'bbcode_uid' => (string) $row['bbcode_uid'],
|
||||
'post_edit_time' => (int) $row['post_edit_time'],
|
||||
'post_edit_count' => (int) $row['post_edit_count'],
|
||||
'post_edit_locked' => (int) $row['post_edit_locked']
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
$new_post_id = $db->sql_nextid();
|
||||
|
||||
// Copy Attachments
|
||||
if ($row['post_attachment'])
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "
|
||||
WHERE post_msg_id = {$row['post_id']}
|
||||
AND topic_id = $topic_id
|
||||
AND in_message = 0";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($attach_row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'post_msg_id' => (int) $new_post_id,
|
||||
'topic_id' => (int) $new_topic_id,
|
||||
'in_message' => 0,
|
||||
'poster_id' => (int) $attach_row['poster_id'],
|
||||
'physical_filename' => (string) $attach_row['physical_filename'],
|
||||
'real_filename' => (string) $attach_row['real_filename'],
|
||||
'download_count' => (int) $attach_row['download_count'],
|
||||
'comment' => (string) $attach_row['comment'],
|
||||
'extension' => (string) $attach_row['extension'],
|
||||
'mimetype' => (string) $attach_row['mimetype'],
|
||||
'filesize' => (int) $attach_row['filesize'],
|
||||
'filetime' => (int) $attach_row['filetime'],
|
||||
'thumbnail' => (int) $attach_row['thumbnail']
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sync new topics, parent forums and board stats
|
||||
sync('topic', 'topic_id', $new_topic_id_list, true);
|
||||
sync('forum', 'forum_id', $to_forum_id, true);
|
||||
set_config('num_topics', $config['num_topics'] + sizeof($new_topic_id_list));
|
||||
set_config('num_posts', $config['num_posts'] + $total_posts);
|
||||
|
||||
foreach ($new_topic_id_list as $topic_id => $new_topic_id)
|
||||
{
|
||||
add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);
|
||||
}
|
||||
|
||||
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true),
|
||||
'S_CAN_LEAVE_SHADOW' => false,
|
||||
'ADDITIONAL_MSG' => $additional_msg)
|
||||
);
|
||||
|
||||
confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
|
||||
}
|
||||
|
||||
$redirect = request_var('redirect', "index.$phpEx$SID");
|
||||
|
||||
if (strpos($redirect, '?') === false)
|
||||
{
|
||||
$redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1);
|
||||
}
|
||||
|
||||
if (!$success_msg)
|
||||
{
|
||||
redirect($redirect);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_refresh(3, "viewforum.$phpEx$SID&f=$forum_id");
|
||||
$return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>');
|
||||
|
||||
if ($forum_id != $to_forum_id)
|
||||
{
|
||||
$return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&f=' . $to_forum_id . '">', '</a>');
|
||||
}
|
||||
|
||||
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -11,12 +11,6 @@
|
|||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//
|
||||
// TODO:
|
||||
// - change poster
|
||||
// - delete post
|
||||
//
|
||||
|
||||
function mcp_post_details($id, $mode, $action, $url)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
|
@ -133,7 +127,7 @@ function mcp_post_details($id, $mode, $action, $url)
|
|||
$template->assign_vars(array(
|
||||
'S_MCP_ACTION' => "$url&i=main&quickmod=1",
|
||||
'S_CHGPOSTER_ACTION' => "$url&i=$id&mode=post_details",
|
||||
'S_APPROVE_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&i=queue&mode=approve&quickmod=1&p=$post_id",
|
||||
'S_APPROVE_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&i=queue&p=$post_id",
|
||||
|
||||
'S_CAN_VIEWIP' => $auth->acl_get('m_ip', $post_info['forum_id']),
|
||||
'S_CAN_CHGPOSTER' => $auth->acl_get('m_', $post_info['forum_id']),
|
||||
|
@ -163,6 +157,39 @@ function mcp_post_details($id, $mode, $action, $url)
|
|||
'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']))
|
||||
);
|
||||
|
||||
// Get Reports
|
||||
if ($auth->acl_get('m_', $post_info['forum_id']))
|
||||
{
|
||||
$sql = 'SELECT r.*, re.*, u.user_id, u.username
|
||||
FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REASONS_TABLE . " re
|
||||
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
|
||||
{
|
||||
$template->assign_block_vars('reports', array(
|
||||
'REPORT_ID' => $row['report_id'],
|
||||
'REASON_TITLE' => $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_name'])],
|
||||
'REASON_DESC' => $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_name'])],
|
||||
'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'],
|
||||
'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['user_id']}" : '',
|
||||
'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);
|
||||
}
|
||||
|
||||
// Get IP
|
||||
if ($auth->acl_get('m_ip', $post_info['forum_id']))
|
||||
{
|
||||
|
|
|
@ -11,4 +11,177 @@
|
|||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
class mcp_queue extends module
|
||||
{
|
||||
|
||||
function mcp_queue($id, $mode, $url)
|
||||
{
|
||||
global $auth, $db, $user, $template;
|
||||
global $config, $phpbb_root_path, $phpEx, $SID;
|
||||
|
||||
$forum_id = request_var('f', 0);
|
||||
$start = request_var('start', 0);
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'unapproved_topics':
|
||||
case 'unapproved_posts':
|
||||
|
||||
$forum_info = array();
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
if (!$forum_list = implode(', ', get_forum_list('m_approve')))
|
||||
{
|
||||
trigger_error('NOT_MODERATOR');
|
||||
}
|
||||
|
||||
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id IN ($forum_list)";
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$forum_info = get_forum_data(array($forum_id), 'm_approve');
|
||||
|
||||
if (!sizeof($forum_info))
|
||||
{
|
||||
trigger_error('NOT_MODERATOR');
|
||||
}
|
||||
|
||||
$forum_info = $forum_info[$forum_id];
|
||||
}
|
||||
|
||||
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
|
||||
$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
|
||||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
||||
if ($mode == 'unapproved_posts')
|
||||
{
|
||||
$sql = 'SELECT p.post_id
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql{0} == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
|
||||
WHERE p.forum_id IN ($forum_list)
|
||||
AND p.post_approved = 0
|
||||
" . (($sort_order_sql{0} == 'u') ? 'AND u.user_id = p.poster_id' : '') . "
|
||||
AND t.topic_id = p.topic_id
|
||||
AND t.topic_first_post_id <> p.post_id
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||
|
||||
$i = 0;
|
||||
$post_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$post_ids[] = $row['post_id'];
|
||||
$row_num[$row['post_id']] = $i++;
|
||||
}
|
||||
|
||||
if (sizeof($post_ids))
|
||||
{
|
||||
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, p.post_id, p.post_username, p.poster_id, p.post_time, u.username
|
||||
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u
|
||||
WHERE p.post_id IN (" . implode(', ', $post_ids) . ")
|
||||
AND t.topic_id = p.topic_id
|
||||
AND f.forum_id = p.forum_id
|
||||
AND u.user_id = p.poster_id";
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$post_data = $rowset = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$post_data[$row['post_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($post_ids as $post_id)
|
||||
{
|
||||
$rowset[] = $post_data[$post_id];
|
||||
}
|
||||
unset($post_data, $post_ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rowset = array();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
||||
WHERE t.topic_approved = 0
|
||||
AND t.forum_id IN ($forum_list)
|
||||
AND f.forum_id = t.forum_id
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||
|
||||
$rowset = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rowset[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($rowset as $row)
|
||||
{
|
||||
if ($row['poster_id'] == ANONYMOUS)
|
||||
{
|
||||
$poster = (!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$poster = '<a href="memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['poster_id'] . '">' . $row['username'] . '</a>';
|
||||
}
|
||||
|
||||
$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'],
|
||||
// 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'] : ''),
|
||||
|
||||
'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'])
|
||||
);
|
||||
|
||||
$this->display($user->lang['MCP_QUEUE'], 'mcp_queue.html');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
}
|
||||
|
||||
function module()
|
||||
{
|
||||
$details = array(
|
||||
'name' => 'MCP - Queue',
|
||||
'description' => 'Module for management of items waiting for approval',
|
||||
'filename' => 'queue',
|
||||
'version' => '0.1.0',
|
||||
'phpbbversion' => '2.2.0'
|
||||
);
|
||||
return $details;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -45,12 +45,14 @@ function mcp_topic_view($id, $mode, $action, $url)
|
|||
if ($action == 'split_all' || $action == 'split_beyond')
|
||||
{
|
||||
split_topic($action, $topic_id, $to_forum_id, $subject);
|
||||
$action = 'split';
|
||||
}
|
||||
|
||||
// Merge Posts?
|
||||
if ($action == 'merge_posts')
|
||||
{
|
||||
merge_posts($topic_id, $to_topic_id);
|
||||
$action = 'merge';
|
||||
}
|
||||
|
||||
$topics_per_page = ($topic_info['forum_topics_per_page']) ? $topic_info['forum_topics_per_page'] : $config['topics_per_page'];
|
||||
|
@ -62,7 +64,8 @@ function mcp_topic_view($id, $mode, $action, $url)
|
|||
|
||||
// Jumpbox, sort selects and that kind of things
|
||||
make_jumpbox($url . '&mode=forum_view', $topic_info['forum_id'], false, 'm_');
|
||||
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id);
|
||||
$where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE';
|
||||
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
|
||||
|
||||
$forum_topics = ($total == -1) ? $topic_info['forum_topics'] : $total;
|
||||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
@ -74,8 +77,9 @@ function mcp_topic_view($id, $mode, $action, $url)
|
|||
$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));
|
||||
|
||||
$sql = 'SELECT u.username, u.user_colour, p.*
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
|
||||
WHERE p.topic_id = {$topic_id}
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . "
|
||||
p.topic_id = {$topic_id}
|
||||
AND p.poster_id = u.user_id
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
||||
|
@ -140,7 +144,7 @@ function mcp_topic_view($id, $mode, $action, $url)
|
|||
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
|
||||
|
||||
'U_POST_DETAILS' => "$url&p={$row['post_id']}&mode=post_details",
|
||||
'U_APPROVE' => "$url&i=queue&mode=approve&p=" . $row['post_id'])
|
||||
'U_MCP_APPROVE' => "mcp.$phpEx$SID&i=queue&mode=approve&p=" . $row['post_id'])
|
||||
);
|
||||
|
||||
unset($rowset[$i]);
|
||||
|
@ -190,13 +194,14 @@ function mcp_topic_view($id, $mode, $action, $url)
|
|||
'REPORTED_IMG' => $user->img('icon_reported', 'POST_REPORTED', false, true),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'POST_UNAPPROVED', false, true),
|
||||
|
||||
'S_MCP_ACTION' => "$url&mode=$mode&start=$start",
|
||||
'S_MCP_ACTION' => "$url&mode=$mode&action=$action&start=$start",
|
||||
'S_FORUM_SELECT' => '<select name="to_forum_id">' . (($to_forum_id) ? make_forum_select($to_forum_id) : make_forum_select($topic_info['forum_id'])) . '</select>',
|
||||
'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id']) && $action != 'merge') ? true : false,
|
||||
'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id']) && $action != 'split') ? true : false,
|
||||
'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
|
||||
'S_REPORT_VIEW' => ($action == 'reports') ? true : false,
|
||||
|
||||
'S_SHOW_TOPIC_ICONS'=> $s_topic_icons,
|
||||
'S_TOPIC_ICON' => $icon_id,
|
||||
|
@ -408,7 +413,7 @@ function merge_posts($topic_id, $to_topic_id)
|
|||
if (!$post_id_list)
|
||||
{
|
||||
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
|
||||
$this->main('merge');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge')))
|
||||
|
|
|
@ -52,6 +52,10 @@ $lang += array(
|
|||
'EMPTY_TOPICS_REMOVED_WARNING' => 'Please note that one or several topics have been removed from the database because they were or become empty',
|
||||
|
||||
'FORK' => 'Fork',
|
||||
'FORK_TOPIC' => 'Fork Topic',
|
||||
'FORK_TOPIC_CONFIRM' => 'Are you sure you want to copy this topic?',
|
||||
'FORK_TOPICS' => 'Fork selected topics',
|
||||
'FORK_TOPICS_CONFIRM' => 'Are you sure you want to copy the selected topics?',
|
||||
'FORUM_DESC' => 'Description',
|
||||
'FORUM_NAME' => 'Forum Name',
|
||||
'FORUM_NOT_EXIST' => 'The forum you selected does not exist',
|
||||
|
@ -94,10 +98,10 @@ $lang += array(
|
|||
|
||||
'MCP_ADD' => 'Add a warning',
|
||||
'MCP_MAIN' => 'Main',
|
||||
'MCP_MAIN_FORUM_VIEW' => 'View forum',
|
||||
'MCP_MAIN_FRONT' => 'Front page',
|
||||
'MCP_MAIN_POST_DETAILS' => 'Post details',
|
||||
'MCP_MAIN_TOPIC_VIEW' => 'View topic',
|
||||
'MCP_MAIN_FORUM_VIEW' => 'View Forum',
|
||||
'MCP_MAIN_FRONT' => 'Front Page',
|
||||
'MCP_MAIN_POST_DETAILS' => 'Post Details',
|
||||
'MCP_MAIN_TOPIC_VIEW' => 'View Topic',
|
||||
'MCP_MAKE_ANNOUNCEMENT' => 'Make Announcement',
|
||||
'MCP_MAKE_ANNOUNCEMENT_CONFIRM' => 'Are you sure you want to change this topic to an announcement?',
|
||||
'MCP_MAKE_ANNOUNCEMENTS' => 'Make Announcements',
|
||||
|
@ -116,9 +120,9 @@ $lang += array(
|
|||
'MCP_MAKE_NORMALS_CONFIRM' => 'Are you sure you want to revert the selected topics?',
|
||||
|
||||
'MCP_QUEUE' => 'Moderation Queue',
|
||||
'MCP_REPORTS' => 'Reports',
|
||||
'MCP_UNAPPROVED_POSTS' => 'Posts awaiting for approval (%s)',
|
||||
'MCP_UNAPPROVED_TOPICS' => 'Topics awaiting for approval (%s)',
|
||||
'MCP_QUEUE_REPORTS' => 'Reports',
|
||||
'MCP_QUEUE_UNAPPROVED_POSTS' => 'Posts awaiting for approval',
|
||||
'MCP_QUEUE_UNAPPROVED_TOPICS' => 'Topics awaiting for approval',
|
||||
'MCP_VIEW_ALL' => 'View all (%s)',
|
||||
'MCP_VIEW_LOGS' => 'View logs',
|
||||
'MCP_VIEW_RECENT' => 'View recent (%s)',
|
||||
|
|
416
phpBB/mcp.php
416
phpBB/mcp.php
|
@ -142,7 +142,8 @@ class module
|
|||
|
||||
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
|
||||
'L_TITLE' => (isset($user->lang[$module_lang])) ? $user->lang[$module_lang] : ucfirst(str_replace('_', ' ', strtolower($module_lang))),
|
||||
'S_SELECTED' => $selected,
|
||||
'S_SELECTED' => $selected,
|
||||
'ADD_ITEM' => $this->add_menu_item($row['module_filename'], $submodule_title),
|
||||
'U_TITLE' => $module_url . '&i=' . $module_id . '&mode=' . $submodule_title . $suffix)
|
||||
);
|
||||
|
||||
|
@ -222,6 +223,47 @@ class module
|
|||
page_footer();
|
||||
}
|
||||
|
||||
// Add Item to Submodule Title
|
||||
function add_menu_item($module_name, $mode)
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
if ($module_name != 'queue')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$forum_list = get_forum_list('m_approve');
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'unapproved_topics':
|
||||
|
||||
$sql = 'SELECT COUNT(*) AS total
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE forum_id IN (' . implode(', ', $forum_list) . ')
|
||||
AND topic_approved = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$total_topics = $db->sql_fetchfield('total', 0, $result);
|
||||
|
||||
return ($total_topics) ? $total_topics : $user->lang['NONE'];
|
||||
break;
|
||||
|
||||
case 'unapproved_posts':
|
||||
|
||||
$sql = 'SELECT COUNT(*) AS total
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
|
||||
WHERE p.forum_id IN (' . implode(', ', $forum_list) . ')
|
||||
AND p.post_approved = 0
|
||||
AND t.topic_id = p.topic_id
|
||||
AND t.topic_first_post_id <> p.post_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$total_posts = $db->sql_fetchfield('total', 0, $result);
|
||||
|
||||
return ($total_posts) ? $total_posts : $user->lang['NONE'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Public methods to be overwritten by modules
|
||||
function module()
|
||||
|
@ -297,11 +339,20 @@ if ($action == 'merge_select')
|
|||
$mode = 'forum_view';
|
||||
}
|
||||
|
||||
// Topic view modes
|
||||
if (in_array($mode, array('split', 'split_all', 'split_beyond', 'merge', 'merge_posts')))
|
||||
{
|
||||
$_REQUEST['action'] = $action = $mode;
|
||||
$mode = 'topic_view';
|
||||
$quickmod = 0;
|
||||
$quickmod = false;
|
||||
}
|
||||
|
||||
// Forum view modes
|
||||
if (in_array($mode, array('resync')))
|
||||
{
|
||||
$_REQUEST['action'] = $action = $mode;
|
||||
$mode = 'forum_view';
|
||||
$quickmod = false;
|
||||
}
|
||||
|
||||
if (!$quickmod)
|
||||
|
@ -314,7 +365,7 @@ if (!$quickmod)
|
|||
$mcp->create('mcp', "mcp.$phpEx$SID", $post_id, $topic_id, $forum_id, $module, $mode);
|
||||
|
||||
// Load and execute the relevant module
|
||||
$mcp->load('mcp', 'main', $mode);
|
||||
$mcp->load();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -332,17 +383,370 @@ switch ($mode)
|
|||
case 'make_normal':
|
||||
$mcp->load('mcp', 'main', $mode);
|
||||
break;
|
||||
case 'fork':
|
||||
case 'move':
|
||||
$mcp->load('mcp', 'main', $mode);
|
||||
break;
|
||||
case 'delete_topic':
|
||||
$mcp->load('mcp', 'main', $mode);
|
||||
break;
|
||||
case 'delete_post':
|
||||
case 'delete_topic':
|
||||
$mcp->load('mcp', 'main', $mode);
|
||||
break;
|
||||
default:
|
||||
trigger_error("$mode not allowed as quickmod");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// LITTLE HELPER
|
||||
|
||||
// request_var, the array way
|
||||
function get_array($var, $default_value)
|
||||
{
|
||||
$ids = request_var($var, $default_value);
|
||||
|
||||
if (!is_array($ids))
|
||||
{
|
||||
if (!$ids)
|
||||
{
|
||||
return $default_value;
|
||||
}
|
||||
|
||||
$ids = array($ids);
|
||||
}
|
||||
|
||||
$ids = array_unique($ids);
|
||||
|
||||
if (sizeof($ids) == 1 && !$ids[0])
|
||||
{
|
||||
return $default_value;
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
// Build simple hidden fields from array
|
||||
function build_hidden_fields($field_ary)
|
||||
{
|
||||
$s_hidden_fields = '';
|
||||
|
||||
foreach ($field_ary as $name => $vars)
|
||||
{
|
||||
if (is_array($vars))
|
||||
{
|
||||
foreach ($vars as $key => $value)
|
||||
{
|
||||
$s_hidden_fields .= '<input type="hidden" name="' . $name . '[' . $key . ']" value="' . $value . '" />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_hidden_fields .= '<input type="hidden" name="' . $name . '" value="' . $vars . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
return $s_hidden_fields;
|
||||
}
|
||||
|
||||
// Get simple topic data
|
||||
function get_topic_data($topic_ids, $acl_list = false)
|
||||
{
|
||||
global $auth, $db;
|
||||
$rowset = array();
|
||||
|
||||
if (implode(', ', $topic_ids) == '')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = 'SELECT f.*, t.*
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON t.forum_id = f.forum_id
|
||||
WHERE t.topic_id IN (' . implode(', ', $topic_ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowset[$row['topic_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
// Get simple post data
|
||||
function get_post_data($post_ids, $acl_list = false)
|
||||
{
|
||||
global $db, $auth;
|
||||
$rowset = array();
|
||||
|
||||
$sql = 'SELECT p.*, u.*, t.*, f.*
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON f.forum_id = p.forum_id
|
||||
WHERE p.post_id IN (' . implode(', ', $post_ids) . ')
|
||||
AND u.user_id = p.poster_id
|
||||
AND t.topic_id = p.topic_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
// Moderators without the permission to approve post should at least not see them. ;)
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowset[$row['post_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
function get_forum_data($forum_id, $acl_list = 'f_list')
|
||||
{
|
||||
global $auth, $db;
|
||||
$rowset = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id ' . ((is_array($forum_id)) ? 'IN (' . implode(', ', $forum_id) . ')' : "= $forum_id");
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
$row['forum_topics'] = $row['forum_topics_real'];
|
||||
}
|
||||
|
||||
$rowset[$row['forum_id']] = $row;
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
|
||||
{
|
||||
global $db, $user, $auth, $template;
|
||||
|
||||
$sort_days = request_var('sort_days', 0);
|
||||
$min_time = ($sort_days) ? time() - ($sort_days * 86400) : 0;
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'viewforum':
|
||||
$type = 'topics';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(topic_id) AS total
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
$where_sql forum_id = $forum_id
|
||||
AND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
|
||||
AND topic_last_post_time >= $min_time";
|
||||
|
||||
if (!$auth->acl_get('m_approve', $forum_id))
|
||||
{
|
||||
$sql .= 'AND topic_approved = 1';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'viewtopic':
|
||||
$type = 'posts';
|
||||
$default_key = 't';
|
||||
$default_dir = 'a';
|
||||
$sql = 'SELECT COUNT(post_id) AS total
|
||||
FROM ' . POSTS_TABLE . "
|
||||
$where_sql topic_id = $topic_id
|
||||
AND post_time >= $min_time";
|
||||
if (!$auth->acl_get('m_approve', $forum_id))
|
||||
{
|
||||
$sql .= 'AND post_approved = 1';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'unapproved_posts':
|
||||
$type = 'posts';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(post_id) AS total
|
||||
FROM ' . POSTS_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_approve'))) . ')
|
||||
AND post_approved = 0
|
||||
AND post_time >= ' . $min_time;
|
||||
break;
|
||||
|
||||
case 'unapproved_topics':
|
||||
$type = 'topics';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(topic_id) AS total
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_approve'))) . ')
|
||||
AND topic_approved = 0
|
||||
AND topic_time >= ' . $min_time;
|
||||
break;
|
||||
|
||||
case 'reports':
|
||||
$type = 'reports';
|
||||
$default_key = 'p';
|
||||
$default_dir = 'd';
|
||||
$limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : '';
|
||||
|
||||
if ($topic_id)
|
||||
{
|
||||
$where_sql .= ' p.topic_id = ' . $topic_id;
|
||||
}
|
||||
else if ($forum_id)
|
||||
{
|
||||
$where_sql .= ' p.forum_id = ' . $forum_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_sql .= ' p.forum_id IN (' . implode(', ', get_forum_list('m_')) . ')';
|
||||
}
|
||||
$sql = 'SELECT COUNT(r.report_id) AS total
|
||||
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p
|
||||
$where_sql
|
||||
AND p.post_id = r.post_id
|
||||
$limit_time_sql";
|
||||
break;
|
||||
|
||||
case 'viewlogs':
|
||||
$type = 'logs';
|
||||
$default_key = 't';
|
||||
$default_dir = 'd';
|
||||
$sql = 'SELECT COUNT(log_id) AS total
|
||||
FROM ' . LOG_TABLE . "
|
||||
$where_sql forum_id IN (" . (($forum_id) ? $forum_id : implode(', ', get_forum_list('m_'))) . ')
|
||||
AND log_time >= ' . $min_time . '
|
||||
AND log_type = ' . LOG_MOD;
|
||||
break;
|
||||
}
|
||||
|
||||
$sort_key = request_var('sk', $default_key);
|
||||
$sort_dir = request_var('sd', $default_dir);
|
||||
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'topics':
|
||||
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
||||
|
||||
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_replies_real' : 't.topic_replies'), 's' => 't.topic_title', 'v' => 't.topic_views');
|
||||
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
||||
$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
|
||||
$limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : '';
|
||||
break;
|
||||
|
||||
case 'reports':
|
||||
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('p' => $user->lang['REPORT_PRIORITY'], 'r' => $user->lang['REPORTER'], 't' => $user->lang['REPORT_TIME']);
|
||||
$sort_by_sql = array('p' => 'rr.reason_priority', 'r' => 'u.username', 't' => 'r.report_time');
|
||||
break;
|
||||
|
||||
case 'logs':
|
||||
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
|
||||
|
||||
$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
|
||||
$limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : '';
|
||||
break;
|
||||
}
|
||||
|
||||
$sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||
|
||||
$s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = '';
|
||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS'=> $s_limit_days)
|
||||
);
|
||||
|
||||
if (($sort_days && $mode != 'viewlogs') || $mode == 'reports' || $where_sql != 'WHERE')
|
||||
{
|
||||
$result = $db->sql_query($sql);
|
||||
$total = ($row = $db->sql_fetchrow($result)) ? $row['total'] : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$total = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function check_ids(&$ids, $table, $sql_id, $acl_list = false)
|
||||
{
|
||||
global $db, $auth;
|
||||
|
||||
if (!is_array($ids) || !$ids)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// a small logical error, since global announcement are assigned to forum_id == 0
|
||||
// If the first topic id is a global announcement, we can force the forum. Though only global announcements can be
|
||||
// tricked... i really do not know how to prevent this atm.
|
||||
|
||||
// With those two queries we make sure all ids are within one forum...
|
||||
$sql = "SELECT forum_id FROM $table
|
||||
WHERE $sql_id = {$ids[0]}";
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
// Global Announcement?
|
||||
$forum_id = request_var('f', 0);
|
||||
}
|
||||
|
||||
if ($acl_list && !$auth->acl_get($acl_list, $forum_id))
|
||||
{
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
if (!$forum_id)
|
||||
{
|
||||
trigger_error('Missing forum_id, has to be in url if global announcement...');
|
||||
}
|
||||
|
||||
$sql = "SELECT $sql_id FROM $table
|
||||
WHERE $sql_id IN (" . implode(', ', $ids) . ")
|
||||
AND (forum_id = $forum_id OR forum_id = 0)";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$ids[] = $row[$sql_id];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $forum_id;
|
||||
}
|
||||
|
||||
// LITTLE HELPER
|
||||
//
|
||||
|
||||
?>
|
|
@ -258,7 +258,7 @@ switch ($mode)
|
|||
$sql_forums = array();
|
||||
foreach ($f_postcount_ary as $forum_id => $allow)
|
||||
{
|
||||
if ($allow['f_fread'] && $allow['f_postcount'])
|
||||
if ($allow['f_postcount'])
|
||||
{
|
||||
$sql_forums[] = $forum_id;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ if ($post_id)
|
|||
}
|
||||
|
||||
// Start output of page
|
||||
page_header($user->lang['REPORT_TO_ADMIN']);
|
||||
page_header($user->lang['REPORT_POST']);
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'report_body.html')
|
||||
|
|
|
@ -47,7 +47,7 @@ function marklist(form_name, status)
|
|||
|
||||
<ul class="nav" style="margin: 0px; padding: 0px; list-style-type: none; line-height: 175%;">
|
||||
<!-- BEGIN mcp_subsection -->
|
||||
<li>» <!-- IF mcp_section.mcp_subsection.S_SELECTED --><b>{mcp_section.mcp_subsection.L_TITLE}</b><!-- ELSE --><a href="{mcp_section.mcp_subsection.U_TITLE}">{mcp_section.mcp_subsection.L_TITLE}</a><!-- ENDIF --></li>
|
||||
<li>» <!-- IF mcp_section.mcp_subsection.S_SELECTED --><b>{mcp_section.mcp_subsection.L_TITLE}<!-- IF mcp_section.mcp_subsection.ADD_ITEM --> ({mcp_section.mcp_subsection.ADD_ITEM})<!-- ENDIF --></b><!-- ELSE --><a href="{mcp_section.mcp_subsection.U_TITLE}">{mcp_section.mcp_subsection.L_TITLE}<!-- IF mcp_section.mcp_subsection.ADD_ITEM --> ({mcp_section.mcp_subsection.ADD_ITEM})<!-- ENDIF --></a><!-- ENDIF --></li>
|
||||
<!-- END mcp_subsection -->
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!-- INCLUDE mcp_header.html -->
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"><form method="post" name="mcp" action="{S_APPROVE_ACTION}"{S_FORM_ENCTYPE}>
|
||||
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"><form method="post" name="mcp" action="{S_APPROVE_ACTION}">
|
||||
<tr>
|
||||
<th colspan="2" height="28" align="center">{L_POST_DETAILS}</th>
|
||||
</tr>
|
||||
|
@ -39,6 +39,35 @@
|
|||
<!-- ENDIF -->
|
||||
</form></table>
|
||||
|
||||
<!-- IF S_SHOW_REPORTS -->
|
||||
<br /><a name="reports"></a>
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">
|
||||
<tr>
|
||||
<th colspan="2" height="28" align="center">{L_REPORTS}</th>
|
||||
</tr>
|
||||
<!-- BEGIN reports -->
|
||||
<tr>
|
||||
<td class="row1"><b class="genmed">{reports.REPORT_TIME}</b></td>
|
||||
<td class="row2"><span class="gen">{reports.REASON_TITLE} » {reports.REASON_DESC}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><b class="genmed">{L_REPORTER}: </b></td>
|
||||
<td class="row2"><span class="gen"><!-- IF reports.U_REPORTER --><a href="{reports.U_REPORTER}">{reports.REPORTER}</a><!-- ELSE -->{reports.REPORTER}<!-- ENDIF --></span></td>
|
||||
</tr>
|
||||
<!-- IF reports.REPORT_TEXT -->
|
||||
<tr>
|
||||
<td class="row1" valign="top"><b class="genmed">{L_MORE_INFO}: </b></td>
|
||||
<td class="row2"><span class="gen">{reports.REPORT_TEXT}</span></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td colspan="2" class="spacer"></td>
|
||||
</tr>
|
||||
<!-- END reports -->
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER -->
|
||||
<br /><a name="mod"></a>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<th colspan="6" height="28" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="cat" height="28" align="left" nowrap="nowrap"><!-- INCLUDE mcp_jumpbox.html --></td>
|
||||
<td colspan="2" class="cat" height="28" align="left" nowrap="nowrap"><!-- INCLUDE jumpbox.html --></td>
|
||||
<td colspan="4" class="cat" height="28" align="center"><span class="gensmall">{L_DISPLAY_LOG}:</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -40,4 +40,4 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
<!-- INCLUDE mcp_footer.html -->
|
Loading…
Add table
Reference in a new issue