CMTV
Well-known member
- Affected version
- 2.1+
Not a bug but unexpected and weird.
In
First of all, this method removes all non-alphanumerical characters:
The problem is that it removes underscores too which are commonly used when prefixing values in addons. For example a custom dialog
---
I suggest adding an underscore in pattern:
OR (AND)
Update
In
XF\Pub\Controller\Editor
class there is a actionDialog()
method which loads a dialog in popup when clicking on dialog-buttons in Froala editor:
PHP:
public function actionDialog()
{
$dialog = preg_replace('/[^a-zA-Z0-9]/', '', $this->filter('dialog', 'str')); // <--- The problem is here
$data = $this->loadDialog($dialog);
if (!$data['template'])
{
// prevents errors from being logged -- must explicitly define valid dialogs
return $this->notFound();
}
return $this->view($data['view'], $data['template'], $data['params']);
}
First of all, this method removes all non-alphanumerical characters:
PHP:
$dialog = preg_replace('/[^a-zA-Z0-9]/', '', $this->filter('dialog', 'str'));
The problem is that it removes underscores too which are commonly used when prefixing values in addons. For example a custom dialog
bar
of Foo/Baz
addon might have a name Foo_Baz_bar
and this is okay in JavaScript. But after the line above it will turn into FooBazbar
which is weird and this modified value will be used as editor_dialog
hint!---
I suggest adding an underscore in pattern:
'/[^a-zA-Z0-9_]/
.OR (AND)
Update
editor_dialog
event description saying the event hint might not be what you expect it to be (since it removes all non-alphanumeric characters)
Last edited: