Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sympa
sympa
Commits
441761e5
Commit
441761e5
authored
Oct 03, 2018
by
IKEDA Soji
Browse files
Sympa::Template: filter "escape_quote" is buggy. Introduced new filter "escape_cstr".
parent
f5f2f9ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/Sympa/Template.pm
View file @
441761e5
...
...
@@ -102,11 +102,18 @@ sub _escape_xml {
}
# Old name: tt2::escape_quote().
sub
_escape_quote
{
# No longer used. Use _escape_cstr().
#sub _escape_quote;
sub
_escape_cstr
{
my
$string
=
shift
;
$string
=~
s/\'/\\\'/g
;
$string
=~
s/\"/\\\"/g
;
$string
=~
s{([\t\n\r\'\"\\])}{
($1 eq "\t") ? "\\t" :
($1 eq "\n") ? "\\n" :
($1 eq "\r") ? "\\r" :
"\\$1"
}eg
;
return
$string
;
}
...
...
@@ -335,12 +342,12 @@ sub parse {
mailtourl
=>
[
\
&_mailtourl
,
1
],
obfuscate
=>
[
\
&_obfuscate
,
1
],
optdesc
=>
[
sub
{
shift
;
$self
->
_optdesc_func
(
@
_
)
},
1
],
qencode
=>
[
\
&qencode
,
0
],
escape_
xml
=>
[
\
&_escape_
xml
,
0
],
escape_
url
=>
[
\
&_escape_
ur
l
,
0
],
escape_
quote
=>
[
\
&_escape_
quote
,
0
],
decode_utf8
=>
[
\
&decode_utf8
,
0
],
encode_utf8
=>
[
\
&encode_utf8
,
0
],
qencode
=>
[
\
&qencode
,
0
],
escape_
cstr
=>
[
\
&_escape_
cstr
,
0
],
escape_
xml
=>
[
\
&_escape_
xm
l
,
0
],
escape_
url
=>
[
\
&_escape_
url
,
0
],
decode_utf8
=>
[
\
&decode_utf8
,
0
],
encode_utf8
=>
[
\
&encode_utf8
,
0
],
url_abs
=>
[
sub
{
shift
;
$self
->
_url_func
(
1
,
$data
,
@
_
)
},
1
],
url_rel
=>
[
sub
{
shift
;
$self
->
_url_func
(
0
,
$data
,
@
_
)
},
1
],
canonic_email
=>
\
&
Sympa::Tools::Text::
canonic_email
,
...
...
@@ -514,10 +521,19 @@ No longer used.
No longer used.
=item escape_cstr
Applies C-style escaping of a string (not enclosed by quotes).
This filter was added on Sympa 6.2.38.
=item escape_quote
Escape quotation marks.
B<Deprecated>.
Use escape_cstr.
=item escape_url
Escapes URL.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment