mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge branch 'callumacrae/ticket/10510-' into develop
This commit is contained in:
commit
dc07617c19
4 changed files with 64 additions and 19 deletions
|
@ -1103,8 +1103,8 @@ function extension_allowed($forum_id, $extension, &$extensions)
|
|||
* @param string $string The text to truncate to the given length. String is specialchared.
|
||||
* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
|
||||
* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
|
||||
* @param bool $allow_reply Allow Re: in front of string
|
||||
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated.
|
||||
* @param bool $allow_reply Allow Re: in front of string
|
||||
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated.
|
||||
* @param string $append String to be appended
|
||||
*/
|
||||
function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
|
||||
|
@ -1258,6 +1258,22 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
|
|||
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an option to the quick-mod tools.
|
||||
*
|
||||
* @param string $option The language key for the value of the option.
|
||||
* @param string $lang_string The language string to use.
|
||||
*/
|
||||
function phpbb_add_quickmod_option($option, $lang_string)
|
||||
{
|
||||
global $template, $user;
|
||||
$lang_string = $user->lang($lang_string);
|
||||
$template->assign_block_vars('quickmod', array(
|
||||
'VALUE' => $option,
|
||||
'TITLE' => $lang_string,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @package phpBB3
|
||||
*/
|
||||
|
|
|
@ -254,10 +254,16 @@
|
|||
|
||||
<!-- INCLUDE jumpbox.html -->
|
||||
|
||||
<!-- IF S_TOPIC_MOD -->
|
||||
<!-- IF .quickmod -->
|
||||
<form method="post" action="{S_MOD_ACTION}">
|
||||
<fieldset class="quickmod">
|
||||
<label for="quick-mod-select">{L_QUICK_MOD}:</label> {S_TOPIC_MOD} <input type="submit" value="{L_GO}" class="button2" />
|
||||
<label for="quick-mod-select">{L_QUICK_MOD}:</label>
|
||||
<select name="action" id="quick-mod-select">
|
||||
<!-- BEGIN quickmod -->
|
||||
<option value="{quickmod.VALUE}">{quickmod.TITLE}</option>
|
||||
<!-- END quickmod -->
|
||||
</select>
|
||||
<input type="submit" value="{L_GO}" class="button2" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -347,7 +347,19 @@
|
|||
|
||||
<table width="100%" cellspacing="1">
|
||||
<tr>
|
||||
<td width="40%" valign="top" nowrap="nowrap" align="{S_CONTENT_FLOW_BEGIN}"><!-- IF S_TOPIC_MOD --><form method="post" action="{S_MOD_ACTION}"><span class="gensmall">{L_QUICK_MOD}:</span> {S_TOPIC_MOD} <input class="btnlite" type="submit" value="{L_GO}" /></form><!-- ENDIF --></td>
|
||||
<td width="40%" valign="top" nowrap="nowrap" align="{S_CONTENT_FLOW_BEGIN}">
|
||||
<!-- IF .quickmod -->
|
||||
<form method="post" action="{S_MOD_ACTION}">
|
||||
<span class="gensmall">{L_QUICK_MOD}:</span>
|
||||
<select name="action" id="quick-mod-select">
|
||||
<!-- BEGIN quickmod -->
|
||||
<option value="{quickmod.VALUE}">{quickmod.TITLE}</option>
|
||||
<!-- END quickmod -->
|
||||
</select>
|
||||
<input class="btnlite" type="submit" value="{L_GO}" />
|
||||
</form>
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><span class="gensmall"><!-- BEGIN rules -->{rules.RULE}<br /><!-- END rules --></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -517,19 +517,31 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']);
|
|||
// Quick mod tools
|
||||
$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($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)) ? (($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>' : '';
|
||||
$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : '';
|
||||
$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_POSTS'] . '</option>' : '';
|
||||
$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge_topic">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
|
||||
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : '';
|
||||
$topic_mod .= ($allow_change_type && $auth->acl_gets('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>' : '';
|
||||
$quickmod_array = array(
|
||||
// 'key' => array('LANG_KEY', $userHasPermissions),
|
||||
|
||||
'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($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))),
|
||||
'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($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))),
|
||||
'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id)),
|
||||
'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED),
|
||||
'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)),
|
||||
'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)),
|
||||
'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)),
|
||||
'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)),
|
||||
'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)),
|
||||
'make_sticky' => array('MAKE_STICKY', ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY)),
|
||||
'make_announce' => array('MAKE_ANNOUNCE', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE)),
|
||||
'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)),
|
||||
'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)),
|
||||
);
|
||||
|
||||
foreach($quickmod_array as $option => $qm_ary)
|
||||
{
|
||||
if (!empty($qm_ary[1]))
|
||||
{
|
||||
phpbb_add_quickmod_option($option, $qm_ary[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// If we've got a hightlight set pass it on to pagination.
|
||||
$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start);
|
||||
|
@ -617,7 +629,6 @@ $template->assign_vars(array(
|
|||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true,
|
||||
'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")),
|
||||
'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '',
|
||||
'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id),
|
||||
|
||||
'S_VIEWTOPIC' => true,
|
||||
|
|
Loading…
Add table
Reference in a new issue