diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-01-31 12:59:40 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-01-31 12:59:40 +0100 |
commit | a893dfa46bc66b23c9dccea9320e1957575c48d6 (patch) | |
tree | 6288a8c7935c6df051d2c0130f7c29b148c51ca6 | |
parent | bacb38b1615b6d65f4d5494ff243783a46365a4e (diff) | |
parent | 9f4c2effe9a9b8a497a3f00dc8a6d71e745c7ea9 (diff) | |
download | forums-a893dfa46bc66b23c9dccea9320e1957575c48d6.tar forums-a893dfa46bc66b23c9dccea9320e1957575c48d6.tar.gz forums-a893dfa46bc66b23c9dccea9320e1957575c48d6.tar.bz2 forums-a893dfa46bc66b23c9dccea9320e1957575c48d6.tar.xz forums-a893dfa46bc66b23c9dccea9320e1957575c48d6.zip |
Merge pull request #3352 from VSEphpbb/ticket/10388
Ticket/10388 Use Twig's JS escape filter instead of addslashes on LA_ keys
-rw-r--r-- | phpBB/phpbb/template/twig/extension.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 6 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/captcha_recaptcha.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_body.html | 2 | ||||
-rw-r--r-- | tests/template/template_test.php | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 3a983491b9..14d1258c09 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -71,6 +71,7 @@ class extension extends \Twig_Extension { return array( new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes new \Twig_SimpleFilter('addslashes', 'addslashes'), ); } @@ -177,7 +178,7 @@ class extension extends \Twig_Extension return $context_vars['L_' . $key]; } - // LA_ is transformed into lang(\'$1\')|addslashes, so we should not + // LA_ is transformed into lang(\'$1\')|escape('js'), so we should not // need to check for it return call_user_func_array(array($this->user, 'lang'), $args); diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index a7848738bb..f1542109a4 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -117,9 +117,9 @@ class lexer extends \Twig_Lexer // Appends any filters after lang() $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code); - // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} - // Appends any filters after lang(), but before addslashes - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code); + // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }} + // Appends any filters after lang(), but before escape('js') + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|escape(\'js\') }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} // Appends any filters diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index fee0f7423e..d3c0ea95d6 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -29,7 +29,7 @@ </div> </noscript> - <a href="http://www.google.com/intl/{LA_RECAPTCHA_LANG}/policies/" target="_blank" class="recaptcha-responsive" style="display: none"><img alt="" width="71" height="36" src="{RECAPTCHA_SERVER}/img/clean/logo.png"></a> + <a href="http://www.google.com/intl/{L_RECAPTCHA_LANG}/policies/" target="_blank" class="recaptcha-responsive" style="display: none"><img alt="" width="71" height="36" src="{RECAPTCHA_SERVER}/img/clean/logo.png"></a> </dd> </dl> <!-- ELSE --> diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 512df7b0a7..841f542bbc 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -25,7 +25,7 @@ <div class="action-bar top"> <div class="member-search panel"> - <!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}" id="member_search" data-alt-text="{LA_HIDE_MEMBER_SEARCH}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}" id="member_search" data-alt-text="{LA_FIND_USERNAME}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF --> + <!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}" id="member_search" data-alt-text="{L_HIDE_MEMBER_SEARCH}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}" id="member_search" data-alt-text="{L_FIND_USERNAME}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF --> <strong> <!-- BEGIN first_char --> <a href="{first_char.U_SORT}">{first_char.DESC}</a> diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0bbfe3848d..bb6b7300cb 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -286,7 +286,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array(), array(), - "Value'\n1 O'Clock\nValue\'\n1 O\'Clock", + "Value'\n1 O'Clock\nValue\\x27\n1\\x20O\\x27Clock", array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock"), ), array( |