[feature/template-events] Handle incorrect template event identifiers

If the template event identifier is wrongly formatted phpBB will
triggern an `E_USER_NOTICE` if the `DEBUG` constant is set, otherwise
the location is ignored.

PHPBB3-9550
This commit is contained in:
Erik Frèrejean 2012-04-18 15:35:09 +02:00 committed by Oleg Pudeyev
parent db688c2574
commit 132bbede2b
2 changed files with 11 additions and 2 deletions

View file

@ -877,8 +877,16 @@ class phpbb_template_filter extends php_user_filter
{ {
if (!preg_match('/^\w+$/', $tag_args)) if (!preg_match('/^\w+$/', $tag_args))
{ {
// do something // The hook location is wrongly formatted,
var_dump($tag_args); // if the `DEBUG` constant is set then trigger a waring,
// otherwise drop the hook and continue
if (defined('DEBUG'))
{
global $user;
trigger_error($user->lang('ERR_TEMPLATE_EVENT_LOCATION', $tag_args), E_USER_NOTICE);
}
return;
} }
$location = $tag_args; $location = $tag_args;

View file

@ -186,6 +186,7 @@ $lang = array_merge($lang, array(
'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.',
'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.',
'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.',
'ERR_TEMPLATE_EVENT_LOCATION' => 'The specified template event location <em>[%s]</em> is wrongly formatted.',
'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.',
'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.', 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.',
'ERR_WATCHING' => 'An error occured while trying to subscribe.', 'ERR_WATCHING' => 'An error occured while trying to subscribe.',