mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/15942] Add language to compatibility globals & use in confirm_box
PHPBB3-15942
This commit is contained in:
parent
a16ebf04d3
commit
0e38bebaa5
2 changed files with 16 additions and 9 deletions
|
@ -29,7 +29,7 @@ function register_compatibility_globals()
|
||||||
{
|
{
|
||||||
global $phpbb_container;
|
global $phpbb_container;
|
||||||
|
|
||||||
global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log;
|
global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $language, $phpbb_log;
|
||||||
global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
|
global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
|
||||||
|
|
||||||
// set up caching
|
// set up caching
|
||||||
|
@ -48,6 +48,9 @@ function register_compatibility_globals()
|
||||||
/* @var $user \phpbb\user */
|
/* @var $user \phpbb\user */
|
||||||
$user = $phpbb_container->get('user');
|
$user = $phpbb_container->get('user');
|
||||||
|
|
||||||
|
/* @var \phpbb\language\language $language */
|
||||||
|
$language = $phpbb_container->get('language');
|
||||||
|
|
||||||
/* @var $auth \phpbb\auth\auth */
|
/* @var $auth \phpbb\auth\auth */
|
||||||
$auth = $phpbb_container->get('auth');
|
$auth = $phpbb_container->get('auth');
|
||||||
|
|
||||||
|
|
|
@ -2139,18 +2139,20 @@ function check_form_key($form_name, $timespan = false)
|
||||||
* @param string $hidden Hidden variables
|
* @param string $hidden Hidden variables
|
||||||
* @param string $html_body Template used for confirm box
|
* @param string $html_body Template used for confirm box
|
||||||
* @param string $u_action Custom form action
|
* @param string $u_action Custom form action
|
||||||
|
*
|
||||||
|
* @return bool True if confirmation was successful, false if not
|
||||||
*/
|
*/
|
||||||
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '')
|
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '')
|
||||||
{
|
{
|
||||||
global $user, $template, $db, $request;
|
global $user, $template, $db, $request;
|
||||||
global $config, $phpbb_path_helper;
|
global $config, $language, $phpbb_path_helper;
|
||||||
|
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$confirm = ($user->lang['YES'] === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST));
|
$confirm = ($language->lang('YES') === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST));
|
||||||
|
|
||||||
if ($check && $confirm)
|
if ($check && $confirm)
|
||||||
{
|
{
|
||||||
|
@ -2189,13 +2191,13 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
{
|
{
|
||||||
$key = array_shift($title);
|
$key = array_shift($title);
|
||||||
$count = array_shift($title);
|
$count = array_shift($title);
|
||||||
$confirm_title = isset($user->lang[$key]) ? $user->lang($key, $count, $title) : $user->lang('CONFIRM');
|
$confirm_title = $language->is_set($key) ? $language->lang($key, $count, $title) : $language->lang('CONFIRM');
|
||||||
$confirm_text = isset($user->lang[$key . '_CONFIRM']) ? $user->lang($key . '_CONFIRM', $count, $title) : $key;
|
$confirm_text = $language->is_set($key . '_CONFIRM') ? $language->lang($key . '_CONFIRM', $count, $title) : $key;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$confirm_title = isset($user->lang[$title]) ? $user->lang($title) : $user->lang('CONFIRM');
|
$confirm_title = $language->is_set($title) ? $language->lang($title) : $language->lang('CONFIRM');
|
||||||
$confirm_text = isset($user->lang[$title . '_CONFIRM']) ? $user->lang($title . '_CONFIRM') : $title;
|
$confirm_text = $language->is_set($title . '_CONFIRM') ? $language->lang($title . '_CONFIRM') : $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
||||||
|
@ -2227,7 +2229,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
'MESSAGE_TITLE' => $confirm_title,
|
'MESSAGE_TITLE' => $confirm_title,
|
||||||
'MESSAGE_TEXT' => $confirm_text,
|
'MESSAGE_TEXT' => $confirm_text,
|
||||||
|
|
||||||
'YES_VALUE' => $user->lang['YES'],
|
'YES_VALUE' => $language->lang('YES'),
|
||||||
'S_CONFIRM_ACTION' => $u_action,
|
'S_CONFIRM_ACTION' => $u_action,
|
||||||
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields,
|
||||||
'S_AJAX_REQUEST' => $request->is_ajax(),
|
'S_AJAX_REQUEST' => $request->is_ajax(),
|
||||||
|
@ -2246,7 +2248,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
'MESSAGE_TITLE' => $confirm_title,
|
'MESSAGE_TITLE' => $confirm_title,
|
||||||
'MESSAGE_TEXT' => $confirm_text,
|
'MESSAGE_TEXT' => $confirm_text,
|
||||||
|
|
||||||
'YES_VALUE' => $user->lang['YES'],
|
'YES_VALUE' => $language->lang('YES'),
|
||||||
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function
|
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function
|
||||||
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields
|
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields
|
||||||
));
|
));
|
||||||
|
@ -2260,6 +2262,8 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
{
|
{
|
||||||
page_footer();
|
page_footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit; // unreachable, page_footer() above will call exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue