mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/15942] Allow array in confirm_box title
PHPBB3-15942
This commit is contained in:
parent
5e302c7e15
commit
3f4b7059cb
2 changed files with 24 additions and 10 deletions
|
@ -2130,7 +2130,7 @@ function check_form_key($form_name, $timespan = false)
|
||||||
/**
|
/**
|
||||||
* Build Confirm box
|
* Build Confirm box
|
||||||
* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
|
* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
|
||||||
* @param string $title Title/Message used for confirm box.
|
* @param string|array $title Title/Message used for confirm box.
|
||||||
* message text is _CONFIRM appended to title.
|
* message text is _CONFIRM appended to title.
|
||||||
* If title cannot be found in user->lang a default one is displayed
|
* If title cannot be found in user->lang a default one is displayed
|
||||||
* If title_CONFIRM cannot be found in user->lang the text given is used.
|
* If title_CONFIRM cannot be found in user->lang the text given is used.
|
||||||
|
@ -2182,13 +2182,27 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
// generate activation key
|
// generate activation key
|
||||||
$confirm_key = gen_rand_string(10);
|
$confirm_key = gen_rand_string(10);
|
||||||
|
|
||||||
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
// generate language strings
|
||||||
|
if (is_array($title))
|
||||||
{
|
{
|
||||||
adm_page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]);
|
$key = array_shift($title);
|
||||||
|
$count = array_shift($title);
|
||||||
|
$confirm_title = isset($user->lang[$key]) ? $user->lang($key, $count, $title) : $user->lang('CONFIRM');
|
||||||
|
$confirm_text = isset($user->lang[$key . '_CONFIRM']) ? $user->lang($key . '_CONFIRM', $count, $title) : $key;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]);
|
$confirm_title = isset($user->lang[$title]) ? $user->lang($title) : $user->lang('CONFIRM');
|
||||||
|
$confirm_text = isset($user->lang[$title . '_CONFIRM']) ? $user->lang($title . '_CONFIRM') : $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
||||||
|
{
|
||||||
|
adm_page_header($confirm_title);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page_header($confirm_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
|
@ -2208,8 +2222,8 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
$u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key;
|
$u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key;
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang($title, 1),
|
'MESSAGE_TITLE' => $confirm_title,
|
||||||
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
|
'MESSAGE_TEXT' => $confirm_text,
|
||||||
|
|
||||||
'YES_VALUE' => $user->lang['YES'],
|
'YES_VALUE' => $user->lang['YES'],
|
||||||
'S_CONFIRM_ACTION' => $u_action,
|
'S_CONFIRM_ACTION' => $u_action,
|
||||||
|
@ -2227,8 +2241,8 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
$json_response = new \phpbb\json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_BODY' => $template->assign_display('body'),
|
'MESSAGE_BODY' => $template->assign_display('body'),
|
||||||
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
|
'MESSAGE_TITLE' => $confirm_title,
|
||||||
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
|
'MESSAGE_TEXT' => $confirm_text,
|
||||||
|
|
||||||
'YES_VALUE' => $user->lang['YES'],
|
'YES_VALUE' => $user->lang['YES'],
|
||||||
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function
|
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function
|
||||||
|
|
|
@ -933,7 +933,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
$l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
|
$l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
|
||||||
if ($only_softdeleted)
|
if ($only_softdeleted)
|
||||||
{
|
{
|
||||||
$l_confirm .= '_PERMANENTLY';
|
$l_confirm = array($l_confirm . '_PERMANENTLY', count($topic_ids));
|
||||||
$s_hidden_fields['delete_permanent'] = '1';
|
$s_hidden_fields['delete_permanent'] = '1';
|
||||||
}
|
}
|
||||||
else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))
|
else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))
|
||||||
|
@ -1187,7 +1187,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||||
$l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
|
$l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
|
||||||
if ($only_softdeleted)
|
if ($only_softdeleted)
|
||||||
{
|
{
|
||||||
$l_confirm .= '_PERMANENTLY';
|
$l_confirm = array($l_confirm . '_PERMANENTLY', (int) count($post_ids));
|
||||||
$s_hidden_fields['delete_permanent'] = '1';
|
$s_hidden_fields['delete_permanent'] = '1';
|
||||||
}
|
}
|
||||||
else if (!$auth->acl_get('m_softdelete', $forum_id))
|
else if (!$auth->acl_get('m_softdelete', $forum_id))
|
||||||
|
|
Loading…
Add table
Reference in a new issue