- various corrections related to permissions in the mcp, including [Bug #1994] and [Bug #1924]

- fixed some quickmod bugs [#1994] and [Bug #1898]
- browse reports/unapproved posts by topic id
- correctly hide approval details
- added return message to mcp_ban [Bug #1851]
- adjusted some links, including [Bug #1855]
- added some missing language variables, including [Bug #1824], [Bug #1841], [Bug #1852] and [Bug #1864]
- always show all options in mcp_topic [Bug #1938]


git-svn-id: file:///svn/phpbb/trunk@5986 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2006-05-30 12:24:07 +00:00
parent 74799e168d
commit ea04b3bcbc
20 changed files with 172 additions and 67 deletions

View file

@ -199,7 +199,8 @@ function adm_page_footer($copyright_html = true)
function adm_back_link($u_action)
{
return '<br /><br /><a href="' . $u_action . '">&laquo; Back to previous page</a>';
global $user;
return '<br /><br /><a href="' . $u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
}
function build_select($option_ary, $option_default = false)

View file

@ -858,7 +858,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'U_POST_ID' => $row['post_id'],
'U_MINI_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;p=" . $row['post_id'] . '#p' . $row['post_id'],
'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;mode=post_details&amp;p=" . $row['post_id'] : '',
'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=main&amp;mode=post_details&amp;p=" . $row['post_id'] : '',
'U_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? 'javascript:addquote(' . $row['post_id'] . ", '" . addslashes($poster) . "')" : '')
);
unset($rowset[$i]);

View file

@ -20,7 +20,7 @@ class mcp_logs_info
'title' => 'MCP_LOGS',
'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_LOGS_FRONT', 'auth' => '', 'cat' => array('MCP_LOGS')),
'front' => array('title' => 'MCP_LOGS_FRONT', 'auth' => 'acl_m_ || aclf_m_', 'cat' => array('MCP_LOGS')),
'forum_logs' => array('title' => 'MCP_LOGS_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')),
'topic_logs' => array('title' => 'MCP_LOGS_TOPIC_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')),
),

View file

@ -20,7 +20,7 @@ class mcp_main_info
'title' => 'MCP_MAIN',
'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => 'acl_m_', 'cat' => array('MCP_MAIN')),
'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => '', 'cat' => array('MCP_MAIN')),
'forum_view' => array('title' => 'MCP_MAIN_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),
'topic_view' => array('title' => 'MCP_MAIN_TOPIC_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),
'post_details' => array('title' => 'MCP_MAIN_POST_DETAILS', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),

View file

@ -20,9 +20,9 @@ class mcp_queue_info
'title' => 'MCP_QUEUE',
'version' => '1.0.0',
'modes' => array(
'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'acl_m_approve || aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'acl_m_approve || aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'acl_m_approve || aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
),
);
}

View file

@ -20,9 +20,9 @@ class mcp_reports_info
'title' => 'MCP_REPORTS',
'version' => '1.0.0',
'modes' => array(
'reports' => array('title' => 'MCP_REPORTS_OPEN', 'auth' => 'acl_m_report ||aclf_m_report', 'cat' => array('MCP_REPORTS')),
'reports_closed' => array('title' => 'MCP_REPORTS_CLOSED', 'auth' => 'acl_m_report || aclf_m_report', 'cat' => array('MCP_REPORTS')),
'report_details' => array('title' => 'MCP_REPORT_DETAILS', 'auth' => 'acl_m_report || aclf_m_report', 'cat' => array('MCP_REPORTS')),
'reports' => array('title' => 'MCP_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
'reports_closed' => array('title' => 'MCP_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
'report_details' => array('title' => 'MCP_REPORT_DETAILS', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
),
);
}

View file

@ -20,10 +20,10 @@ class mcp_warn_info
'title' => 'MCP_WARN',
'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_WARN_FRONT', 'auth' => '', 'cat' => array('MCP_WARN')),
'list' => array('title' => 'MCP_WARN_LIST', 'auth' => '', 'cat' => array('MCP_WARN')),
'warn_user' => array('title' => 'MCP_WARN_USER', 'auth' => '', 'cat' => array('MCP_WARN')),
'warn_post' => array('title' => 'MCP_WARN_POST', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_WARN')),
'front' => array('title' => 'MCP_WARN_FRONT', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
'list' => array('title' => 'MCP_WARN_LIST', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
'warn_user' => array('title' => 'MCP_WARN_USER', 'auth' => 'acl_m_warn', 'cat' => array('MCP_WARN')),
'warn_post' => array('title' => 'MCP_WARN_POST', 'auth' => 'acl_m_warn,$id', 'cat' => array('MCP_WARN')),
),
);
}

View file

@ -45,7 +45,7 @@ class mcp_ban
user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
}
else if ($unbansubmit)
{
@ -53,7 +53,7 @@ class mcp_ban
user_unban($mode, $ban);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
trigger_error($user->lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
}
// Ban length options

View file

@ -210,7 +210,7 @@ function lock_unlock($action, $ids)
$l_prefix = 'POST';
}
if (!($forum_id = check_ids($ids, $table, $sql_id, 'm_lock')))
if (!($forum_id = check_ids($ids, $table, $sql_id, array('f_user_lock', 'm_lock'))))
{
return;
}
@ -266,7 +266,7 @@ function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path;
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'))))
{
return;
}

View file

@ -142,8 +142,22 @@ class mcp_queue
case 'unapproved_topics':
case 'unapproved_posts':
$topic_id = request_var('t', 0);
$forum_info = array();
if ($topic_id)
{
$topic_info = get_topic_data(array($topic_id));
if (!sizeof($topic_info))
{
trigger_error($user->lang['TOPIC_NOT_EXIST']);
}
$topic_info = $topic_info[$topic_id];
$forum_id = $topic_info['forum_id'];
}
$forum_list_approve = get_forum_list('m_approve', false, true);
if (!$forum_id)
@ -189,7 +203,7 @@ class mcp_queue
$sort_days = $total = 0;
$sort_key = $sort_dir = '';
$sort_by_sql = $sort_order_sql = array();
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_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)) : '';
@ -200,7 +214,8 @@ class mcp_queue
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' : '') . "
" . (($sort_order_sql{0} == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id
$limit_time_sql
@ -295,10 +310,14 @@ class mcp_queue
// Now display the page
$template->assign_vars(array(
'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
'S_FORUM_OPTIONS' => $forum_options,
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
'PAGINATION' => generate_pagination("{$phpbb_root_path}mcp.$phpEx$SID&amp;i=$id&amp;mode=$mode&amp;f=$forum_id", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total)
);

View file

@ -239,9 +239,9 @@ class mcp_reports
WHERE p.forum_id IN ($forum_list)
$report_state
AND r.post_id = p.post_id
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . "
" . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = p.poster_id' : '') . "
" . (($topic_id) ? "AND p.topic_id = $topic_id" : '') . "
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = p.poster_id' : '') . '
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
AND t.topic_id = p.topic_id
$limit_time_sql
ORDER BY $sort_order_sql";
@ -291,7 +291,9 @@ class mcp_reports
$template->assign_block_vars('postrow', array(
'U_VIEWFORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=" . $row['forum_id'],
'U_VIEWTOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=" . $row['forum_id'] . '&amp;t=' . $row['topic_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 wrong encoding or different charset
'U_VIEWTOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=" . $row['forum_id'] . '&amp;p=' . $row['post_id'] . '#p' . $row['post_id'],
'U_VIEW_DETAILS' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=reports&amp;start=$start&amp;mode=report_details&amp;f={$forum_id}&amp;p={$row['post_id']}",
'U_VIEW_POSTER_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u={$row['poster_id']}" : '',
'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u={$row['reporter_id']}" : '',
@ -312,12 +314,16 @@ class mcp_reports
// Now display the page
$template->assign_vars(array(
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
'PAGINATION' => generate_pagination("{$phpbb_root_path}mcp.$phpEx$SID&amp;i=$id&amp;mode=$mode&amp;f=$forum_id&amp;t=$topic_id", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOTAL' => $total,
'S_MCP_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=$id&amp;mode=$mode&amp;t=0",
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false)
'TOPIC_ID' => $topic_id,
'TOTAL' => $total)
);
$this->tpl_name = 'mcp_reports';

View file

@ -119,7 +119,7 @@ function mcp_topic_view($id, $mode, $action)
$message = str_replace("\n", '<br />', $message);
$checked = ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? 'checked="checked" ' : '';
$s_checkbox = ($row['post_id'] == $topic_info['topic_first_post_id'] && $action == 'split') ? '&nbsp;' : '<input type="checkbox" name="post_id_list[]" value="' . $row['post_id'] . '" ' . $checked . '/>';
$s_checkbox = '<input type="checkbox" name="post_id_list[]" value="' . $row['post_id'] . '" ' . $checked . '/>';
if (!$row['post_approved'])
{
@ -141,7 +141,8 @@ function mcp_topic_view($id, $mode, $action)
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
'U_POST_DETAILS' => "$url&amp;i=$id&amp;p={$row['post_id']}&amp;mode=post_details",
'U_MCP_APPROVE' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=queue&amp;mode=unapproved_posts&amp;action=approve&amp;post_id_list[]=" . $row['post_id'])
'U_MCP_APPROVE' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=queue&amp;mode=unapproved_posts&amp;action=approve&amp;post_id_list[]=" . $row['post_id'],
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=reports&amp;mode=report_details&amp;p=" . $row['post_id'])
);
unset($rowset[$i]);
@ -185,15 +186,15 @@ function mcp_topic_view($id, $mode, $action)
'SPLIT_SUBJECT' => $subject,
'POSTS_PER_PAGE' => $posts_per_page,
'MODE' => $mode,
'ACTION' => $action,
'REPORTED_IMG' => $user->img('icon_reported', 'POST_REPORTED', false, true),
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'POST_UNAPPROVED', false, true),
'S_MCP_ACTION' => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;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_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id'])) ? true : false,
'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? 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,
@ -225,7 +226,8 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
if (!sizeof($post_id_list))
{
trigger_error('NO_POST_SELECTED');
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
return;
}
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_split')))

View file

@ -90,7 +90,7 @@ $template->assign_vars(array(
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
'U_MARK_FORUMS' => "{$phpbb_root_path}index.$phpEx$SID&amp;mark=forums",
'U_MCP' => ($auth->acl_get('m_')) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=main&amp;mode=front" : '')
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? "{$phpbb_root_path}mcp.$phpEx$SID&amp;i=main&amp;mode=front" : '')
);
// Output page

View file

@ -76,6 +76,7 @@ $lang = array_merge($lang, array(
'AVATAR_WRONG_SIZE' => 'The avatar must be at least %1$d pixels wide, %2$d pixels high and at most %3$d pixels wide and %4$d pixels high. The submitted avatar is %5$d pixels wide and %6$d pixels high.',
'BACK_TO_TOP' => 'Top',
'BACK_TO_PREV' => 'Back to previous page',
'BBCODE_GUIDE' => 'BBCode Guide',
'BCC' => 'Bcc',
'BIRTHDAYS' => 'Birthdays',
@ -154,6 +155,19 @@ $lang = array_merge($lang, array(
'FORUM_RULES_LINK' => 'Please click to view the forum rules',
'FROM' => 'from',
'FTP_FSOCK_HOST' => 'FTP Host',
'FTP_FSOCK_HOST_EXPLAIN' => 'FTP Server used to connect your site',
'FTP_FSOCK_PASSWORD' => 'FTP Password',
'FTP_FSOCK_PASSWORD_EXPLAIN' => 'Password for your FTP Username',
'FTP_FSOCK_PORT' => 'FTP Port',
'FTP_FSOCK_PORT_EXPLAIN' => 'Port used to connect to your server',
'FTP_FSOCK_ROOT_PATH' => 'Path to phpBB',
'FTP_FSOCK_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board',
'FTP_FSOCK_TIMEOUT' => 'FTP Timeout',
'FTP_FSOCK_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server',
'FTP_FSOCK_USERNAME' => 'FTP Username',
'FTP_FSOCK_USERNAME_EXPLAIN' => 'Username used to connect to your server',
'FTP_HOST' => 'FTP Host',
'FTP_HOST_EXPLAIN' => 'FTP Server used to connect your site',
'FTP_PASSWORD' => 'FTP Password',
@ -236,6 +250,7 @@ $lang = array_merge($lang, array(
'LOGIN_FORUM' => 'To view or post in this forum you must enter a password.',
'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few seconds but gives you increased capabilies. The board administrator may also grant additional permissions to registered users. Before you login please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.',
'LOGIN_VIEWFORUM' => 'The board administrator requires you to be registered and logged in to view this forum.',
'LOGIN_EXPLAIN_EDIT' => 'In order to edit posts in this forum you have to be registered and logged in.',
'LOGOUT' => 'Logout',
'LOGOUT_USER' => 'Logout [ %s ]',
'LOG_ME_IN' => 'Log me on automatically each visit',
@ -452,6 +467,7 @@ $lang = array_merge($lang, array(
'TOTAL_POSTS' => 'Total posts',
'TOTAL_POSTS_OTHER' => 'Total posts <b>%d</b>',
'TOTAL_POSTS_ZERO' => 'Total posts <b>0</b>',
'TOPIC_REPORTED' => 'This topic has been reported',
'TOTAL_TOPICS_OTHER'=> 'Total topics <b>%d</b>',
'TOTAL_TOPICS_ZERO' => 'Total topics <b>0</b>',
'TOTAL_USERS_OTHER' => 'Total members <b>%d</b>',

View file

@ -200,11 +200,13 @@ $lang = array_merge($lang, array(
'NO_FEEDBACK' => 'No feedback exists for this user',
'NO_FINAL_TOPIC_SELECTED' => 'You have to select a destination topic for merging posts',
'NO_MATCHES_FOUND' => 'No matches found',
'NO_POST' => 'You have to select a post in order to warn the user for a post',
'NO_POST_REPORT' => 'This post was not reported.',
'NO_POST_SELECTED' => 'You must select at least one post to perform this action',
'NO_TOPIC_SELECTED' => 'You must select at least one topic to perform this action',
'OTHER_IPS' => 'Other IP addresses this user has posted from',
'ONLY_TOPIC' => 'Only topic "%s"',
'OTHER_USERS' => 'Users posting from this IP',
'POSTER' => 'Poster',
@ -286,7 +288,6 @@ $lang = array_merge($lang, array(
'TOPIC_LOCKED_SUCCESS' => 'The selected topic has been locked',
'TOPIC_MOVED_SUCCESS' => 'The selected topic has been moved successfully',
'TOPIC_NOT_EXIST' => 'The topic you selected does not exist',
'TOPIC_REPORTED' => 'This topic has been reported',
'TOPIC_RESYNC_SUCCESS' => 'The selected topic has been resynchronised',
'TOPIC_SPLIT_SUCCESS' => 'The selected topic has been split successfully',
'TOPIC_TIME' => 'Topic time',

View file

@ -101,9 +101,31 @@ if ($topic_id && !$forum_id)
}
// If the user doesn't have any moderator powers (globally or locally) he can't access the mcp
if (!$forum_id && !$auth->acl_get('m_') && !$auth->acl_getf_global('m_'))
if (!$auth->acl_get('m_') && !$auth->acl_getf_global('m_'))
{
trigger_error('MODULE_NOT_EXIST');
// Except he is using one of the quickmod tools for users
$user_quickmod_actions = array(
'lock' => 'f_user_lock',
'unlock' => 'f_user_lock',
'make_sticky' => 'f_sticky',
'make_announce' => 'f_announce',
'make_global' => 'f_announce',
'make_normal' => array('f_announce', 'f_sticky'));
$allow_user = false;
if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id))
{
$topic_info = get_topic_data(array($topic_id));
if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id'])
{
$allow_user = true;
}
}
if (!$allow_user)
{
trigger_error($user->lang['NOT_AUTHORIZED']);
}
}
if ($forum_id)
@ -139,6 +161,11 @@ if ($quickmod)
$module->set_active('logs', 'topic_logs');
break;
case 'split':
case 'merge':
$module->set_active('main', 'topic_view');
break;
default:
trigger_error("$action not allowed as quickmod");
}
@ -155,6 +182,11 @@ if (!$post_id)
$module->set_display('reports', 'report_details', false);
$module->set_display('main', 'post_details', false);
$module->set_display('warn', 'warn_post', false);
if (!$topic_id || $mode == 'unapproved_posts')
{
$module->set_display('queue', 'approve_details', false);
}
}
if (!$topic_id)
@ -163,11 +195,6 @@ if (!$topic_id)
$module->set_display('logs', 'topic_logs', false);
}
if (!$topic_id && !$post_id)
{
$module->set_display('queue', 'approve_details', false);
}
if (!$forum_id)
{
$module->set_display('main', 'forum_view', false);
@ -224,30 +251,47 @@ function extra_url()
function get_topic_data($topic_ids, $acl_list = false)
{
global $auth, $db;
$rowset = array();
static $rowset = array();
$topics = array();
if (implode(', ', $topic_ids) == '')
if (!sizeof($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);
$cache_topic_ids = array_intersect($topic_ids, array_keys($rowset));
$topic_ids = array_diff($topic_ids, array_keys($rowset));
while ($row = $db->sql_fetchrow($result))
if (sizeof($topic_ids))
{
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
$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))
{
continue;
}
$rowset[$row['topic_id']] = $row;
$rowset[$row['topic_id']] = $row;
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;
}
$topics[$row['topic_id']] = $row;
}
}
return $rowset;
foreach ($cache_topic_ids as $id)
{
if (!$acl_list || $auth->acl_gets($acl_list, $rowset[$id]['forum_id']))
{
$topics[$id] = $rowset[$id];
}
}
return $topics;
}
/**
@ -258,6 +302,11 @@ function get_post_data($post_ids, $acl_list = false)
global $db, $auth;
$rowset = array();
if (!sizeof($post_ids))
{
return array();
}
$sql = $db->sql_build_query('SELECT', array(
'SELECT' => 'p.*, u.*, t.*, f.*',
@ -282,7 +331,7 @@ function get_post_data($post_ids, $acl_list = false)
while ($row = $db->sql_fetchrow($result))
{
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;
}
@ -307,6 +356,11 @@ function get_forum_data($forum_id, $acl_list = 'f_list')
global $auth, $db;
$rowset = array();
if (!sizeof($forum_id))
{
return array();
}
$sql = 'SELECT *
FROM ' . FORUMS_TABLE . '
WHERE forum_id ' . ((is_array($forum_id)) ? 'IN (' . implode(', ', $forum_id) . ')' : "= $forum_id");
@ -314,7 +368,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list')
while ($row = $db->sql_fetchrow($result))
{
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id']))
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;
}
@ -331,6 +385,8 @@ function get_forum_data($forum_id, $acl_list = 'f_list')
/**
* sorting in mcp
*
* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR
*/
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')
{
@ -375,6 +431,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
$where_sql .= ($topic_id) ? ' topic_id = ' . $topic_id . ' AND' : '';
$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'))) . ')
@ -546,7 +604,7 @@ function check_ids(&$ids, $table, $sql_id, $acl_list = false)
$db->sql_freeresult($result);
}
if ($acl_list && !$auth->acl_get($acl_list, $forum_id))
if ($acl_list && !$auth->acl_gets($acl_list, $forum_id))
{
trigger_error('NOT_AUTHORIZED');
}

View file

@ -5,7 +5,7 @@
<th colspan="6" height="28" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th>
</tr>
<tr>
<td colspan="5" class="cat" height="28" align="center"><span class="gensmall">{L_DISPLAY_ITEMS}:</span> {S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select>&nbsp;<input class="btnlite" type="submit" name="sort" value="{L_GO}" /></span></td>
<td colspan="5" class="cat" height="28" align="center"><span class="gensmall">{L_DISPLAY_ITEMS}:</span> {S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select> &nbsp; <!-- IF TOPIC_ID --><input type="checkbox" name="t" value="{TOPIC_ID}" checked="checked" />&nbsp; {L_ONLY_TOPIC} &nbsp; <!-- ENDIF --><input class="btnlite" type="submit" name="sort" value="{L_GO}" /></span></td>
</tr>
<tr>
<th height="28">&nbsp;{L_TOPIC}&nbsp;</th>

View file

@ -5,7 +5,7 @@
<th colspan="5" height="28" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th>
</tr>
<tr>
<td colspan="5" class="cat" 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;<span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select>&nbsp;<input class="btnlite" type="submit" name="sort" value="{L_GO}" /></span></td>
<td colspan="5" class="cat" 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;<span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select> &nbsp; <!-- IF TOPIC_ID --><input type="checkbox" name="t" value="{TOPIC_ID}" checked="checked" />&nbsp; {L_ONLY_TOPIC} &nbsp; <!-- ENDIF --><input class="btnlite" type="submit" name="sort" value="{L_GO}" /></span></td>
</tr>
<tr>
<th height="28">&nbsp;{L_POST}&nbsp;</th>

View file

@ -124,8 +124,8 @@
<!-- IF S_CAN_APPROVE --><option value="approve">{L_APPROVE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_LOCK --><option value="lock_post">{L_LOCK_POST_POSTS} [ {L_LOCK_POST_EXPLAIN} ]</option><option value="unlock_post">{L_UNLOCK_POST_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF MODE == 'merge' --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF MODE == 'split' --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF ACTION eq 'merge' --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF ACTION eq 'split' --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
</select>&nbsp;<input class="btnmain" type="submit" name="mcp_topic_submit" value="{L_SUBMIT}"></form></td>
</tr>
</table>

View file

@ -457,6 +457,8 @@ $s_forum_rules = '';
gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']);
// Quick mod tools
$allow_change_type = ($auth->acl_get('m_') || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false;
$topic_mod = '';
$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : '';
$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . $user->lang['DELETE_TOPIC'] . '</option>' : '';
@ -464,10 +466,10 @@ $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="move">' .
$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '<option value="make_normal">' . $user->lang['MAKE_NORMAL'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_', $forum_id) && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '<option value="make_sticky">' . $user->lang['MAKE_STICKY'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_', $forum_id) && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '<option value="make_announce">' . $user->lang['MAKE_ANNOUNCE'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_', $forum_id) && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '<option value="make_global">' . $user->lang['MAKE_GLOBAL'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_gets(array('f_sticky', 'f_announce'), $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '<option value="make_normal">' . $user->lang['MAKE_NORMAL'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '<option value="make_sticky">' . $user->lang['MAKE_STICKY'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '<option value="make_announce">' . $user->lang['MAKE_ANNOUNCE'] . '</option>' : '';
$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '<option value="make_global">' . $user->lang['MAKE_GLOBAL'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="topic_logs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
// If we've got a hightlight set pass it on to pagination.