Skip to content

Commit a9d351a

Browse files
committed
Fix Ctrl+Enter functionality.
1 parent af92b92 commit a9d351a

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

acp/quickreply_module.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class quickreply_module
1616

1717
public function main($id, $mode)
1818
{
19-
global $cache, $config, $db, $user, $auth, $template, $request;
20-
global $phpbb_root_path, $phpEx, $phpbb_admin_path, $phpbb_container;
19+
global $config, $user, $template, $request;
2120

2221
$this->page_title = 'ACP_QUICKREPLY';
2322
$this->tpl_name = 'acp_quickreply';
@@ -63,13 +62,22 @@ public function main($id, $mode)
6362
),
6463
);
6564

65+
/**
66+
* We need to disable this feature in phpBB 3.1.9 and higher
67+
* as it has been added to the core.
68+
*/
69+
if (version_compare($config['version'], '3.1.8', '>'))
70+
{
71+
unset($display_vars['qr_ctrlenter']);
72+
}
73+
6674
if (isset($display_vars['lang']))
6775
{
6876
$user->add_lang($display_vars['lang']);
6977
}
7078

7179
$this->new_config = $config;
72-
$cfg_array = ($request->is_set('config')) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
80+
$cfg_array = ($request->is_set('config')) ? $request->variable('config', array('' => ''), true) : $this->new_config;
7381
$error = array();
7482

7583
// We validate the complete config if wished

event/listener_helper.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,29 @@ public function assign_template_variables_for_qr($forum_id)
287287
'S_ABBC3_INSTALLED' => $this->phpbb_extension_manager->is_enabled('vse/abbc3'),
288288
));
289289
}
290+
291+
/**
292+
* Detects whether Ctrl+Enter feature is enabled in QuickReply extension.
293+
* We need to disable this feature in phpBB 3.1.9 and higher
294+
* as it has been added to the core.
295+
*
296+
* @deprecated 1.0.2 added only for backwards compatibility reasons
297+
* @return bool
298+
*/
299+
public function qr_ctrlenter_enabled()
300+
{
301+
$qr_ctrlenter = $this->config['qr_ctrlenter'];
302+
if ($qr_ctrlenter)
303+
{
304+
if (version_compare($this->config['version'], '3.1.8', '>'))
305+
{
306+
$this->config->set('qr_ctrlenter', 0);
307+
}
308+
else
309+
{
310+
return $qr_ctrlenter;
311+
}
312+
}
313+
return false;
314+
}
290315
}

0 commit comments

Comments
 (0)