Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
407c3cb7
Commit
407c3cb7
authored
Jun 27, 2018
by
Carsten Rose
Browse files
F6314: HTML Mails enabled by specifying flag 'mode=html'.
parent
89b2995a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
extension/Documentation/Manual.rst
View file @
407c3cb7
This diff is collapsed.
Click to expand it.
extension/qfq/qfq/Constants.php
View file @
407c3cb7
...
...
@@ -1224,6 +1224,9 @@ const SENDMAIL_TOKEN_ATTACHMENT_FILE = 'F';
const
SENDMAIL_TOKEN_ATTACHMENT_FILE_DEPRECATED
=
'a'
;
// since 5.12.17
const
SENDMAIL_TOKEN_SUBJECT_HTML_ENTITY
=
'e'
;
const
SENDMAIL_TOKEN_BODY_HTML_ENTITY
=
'E'
;
const
SENDMAIL_TOKEN_BODY_MODE
=
'M'
;
const
SENDMAIL_TOKEN_BODY_MODE_LONG
=
'mode'
;
const
SENDMAIL_TOKEN_BODY_MODE_HTML
=
'html'
;
const
SENDMAIL_TOKEN_CONCAT
=
'C'
;
const
SENDMAIL_TOKEN_DOWNLOAD_FILENAME
=
'd'
;
...
...
extension/qfq/qfq/database/Database.php
View file @
407c3cb7
...
...
@@ -296,6 +296,12 @@ class Database {
// Look for QFQ variables which haven't been replaced
$matches
=
array
();
preg_match_all
(
"/
{
{[^}}]*}
}
/"
,
$sql
,
$matches
);
// '.line.count' might be replaced later and should not shown.
foreach
(
$matches
[
0
]
as
$key
=>
$value
)
{
if
(
false
!==
stripos
(
$value
,
'.line.count'
))
{
unset
(
$matches
[
0
][
$key
]);
}
}
if
(
count
(
$matches
[
0
])
>
0
)
{
$msg
.
=
"HINT: The following variables couldn't be replaced: "
.
implode
(
', '
,
$matches
[
0
])
.
"
\n
"
;
}
...
...
@@ -303,7 +309,7 @@ class Database {
// Look for missing '()' after FROM in case LEFT JOIN is used.
if
(
stripos
(
$errorMsg
,
'Unknown column'
)
!==
false
&&
stripos
(
$pos
=
$sql
,
' LEFT JOIN '
)
!==
false
&&
isset
(
$sql
[
$pos
-
1
])
&&
$sql
[
$pos
-
1
]
!=
')'
)
{
isset
(
$sql
[
$pos
-
1
])
&&
$sql
[
$pos
-
1
]
!=
')'
)
{
$msg
.
=
"HINT: Maybe the tables after 'FROM' should be enclosed by '()'
\n
"
;
}
...
...
extension/qfq/qfq/report/SendMail.php
View file @
407c3cb7
...
...
@@ -12,6 +12,7 @@ require_once(__DIR__ . '/../helper/Sanitize.php');
require_once
(
__DIR__
.
'/../helper/HelperFile.php'
);
require_once
(
__DIR__
.
'/../helper/Support.php'
);
const
SENDMAIL_HTML_TOKEN
=
'<html>'
;
/**
* Class SendMail
...
...
@@ -33,6 +34,7 @@ class SendMail {
*
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public
function
__construct
()
{
...
...
@@ -55,19 +57,25 @@ class SendMail {
return
;
}
if
(
count
(
$mailConfig
)
<
4
||
$mailConfig
[
SENDMAIL_TOKEN_SENDER
]
===
''
||
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT
]
===
''
||
$mailConfig
[
SENDMAIL_TOKEN_BODY
]
===
''
)
{
throw
new
UserFormException
(
"Error sendmail missing one of:
receiver,
sender, subject or body"
,
ERROR_SENDMAIL_MISSING_VALUE
);
if
(
$mailConfig
[
SENDMAIL_TOKEN_SENDER
]
===
''
||
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT
]
===
''
||
$mailConfig
[
SENDMAIL_TOKEN_BODY
]
===
''
)
{
throw
new
UserFormException
(
"Error sendmail missing one of: sender, subject or body"
,
ERROR_SENDMAIL_MISSING_VALUE
);
}
$redirectAllMail
=
$this
->
store
->
getVar
(
SYSTEM_REDIRECT_ALL_MAIL_TO
,
STORE_SYSTEM
);
if
(
!
empty
(
$redirectAllMail
))
{
$addBody
=
"All QFQ outgoing mails are catched and redirected to you."
.
PHP_EOL
.
"Original receiver:"
.
PHP_EOL
;
$addBody
=
"All QFQ outgoing mails are catched and redirected to you."
.
PHP_EOL
.
"Original receiver are ..."
.
PHP_EOL
;
$addBody
.
=
'TO: '
.
$mailConfig
[
SENDMAIL_TOKEN_RECEIVER
]
.
PHP_EOL
;
$addBody
.
=
'CC: '
.
$mailConfig
[
SENDMAIL_TOKEN_RECEIVER_CC
]
.
PHP_EOL
;
$addBody
.
=
'BCC: '
.
$mailConfig
[
SENDMAIL_TOKEN_RECEIVER_BCC
]
.
PHP_EOL
;
$addBody
.
=
PHP_EOL
.
"=========================================="
.
PHP_EOL
.
PHP_EOL
;
// Check if the given body is a HTML body.
if
(
isset
(
$mailConfig
[
SENDMAIL_TOKEN_BODY_MODE
])
&&
$mailConfig
[
SENDMAIL_TOKEN_BODY_MODE
]
===
SENDMAIL_TOKEN_BODY_MODE_HTML
)
{
$addBody
=
str_replace
(
PHP_EOL
,
'<br>'
,
$addBody
);
}
$mailConfig
[
SENDMAIL_TOKEN_BODY
]
=
$addBody
.
$mailConfig
[
SENDMAIL_TOKEN_BODY
];
$mailConfig
[
SENDMAIL_TOKEN_RECEIVER
]
=
$redirectAllMail
;
...
...
@@ -91,10 +99,12 @@ class SendMail {
$mailConfig
[
SENDMAIL_TOKEN_FLAG_AUTO_SUBMIT
]
=
'on'
;
}
// Subject
if
(
empty
(
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT_HTML_ENTITY
])
||
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT_HTML_ENTITY
]
!==
MODE_ENCODE
)
{
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT_HTML_ENTITY
]
=
MODE_DECODE
;
}
// Body
if
(
empty
(
$mailConfig
[
SENDMAIL_TOKEN_BODY_HTML_ENTITY
])
||
$mailConfig
[
SENDMAIL_TOKEN_BODY_HTML_ENTITY
]
!==
MODE_ENCODE
)
{
$mailConfig
[
SENDMAIL_TOKEN_BODY_HTML_ENTITY
]
=
MODE_DECODE
;
}
...
...
@@ -121,11 +131,15 @@ class SendMail {
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT
]
=
Support
::
htmlEntityEncodeDecode
(
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT_HTML_ENTITY
],
$mailConfig
[
SENDMAIL_TOKEN_SUBJECT
]);
$mailConfig
[
SENDMAIL_TOKEN_BODY
]
=
Support
::
htmlEntityEncodeDecode
(
$mailConfig
[
SENDMAIL_TOKEN_BODY_HTML_ENTITY
],
$mailConfig
[
SENDMAIL_TOKEN_BODY
]);
if
(
isset
(
$mailConfig
[
SENDMAIL_TOKEN_BODY_MODE
])
&&
$mailConfig
[
SENDMAIL_TOKEN_BODY_MODE
]
===
SENDMAIL_TOKEN_BODY_MODE_HTML
)
{
$mailConfig
[
SENDMAIL_TOKEN_BODY
]
=
Support
::
wrapTag
(
SENDMAIL_HTML_TOKEN
,
$mailConfig
[
SENDMAIL_TOKEN_BODY
]);
}
foreach
(
$mailConfig
as
$key
=>
$value
)
{
if
(
is_array
(
$value
))
{
continue
;
}
if
(
$key
!=
SENDMAIL_TOKEN_SUBJECT
)
{
// do not escape double ticks in subject - this breaks the UTF8 encoding later
if
(
$key
!=
SENDMAIL_TOKEN_SUBJECT
)
{
// do not escape double ticks in subject - this breaks the UTF8 encoding later
$mailConfig
[
$key
]
=
Support
::
escapeDoubleTick
(
$value
);
}
}
...
...
@@ -387,11 +401,12 @@ class SendMail {
SENDMAIL_TOKEN_X_ID3_LONG
=>
SENDMAIL_TOKEN_X_ID3
,
SENDMAIL_TOKEN_HEADER_LONG
=>
SENDMAIL_TOKEN_HEADER
,
SENDMAIL_TOKEN_SRC_LONG
=>
SENDMAIL_TOKEN_SRC
,
SENDMAIL_TOKEN_BODY_MODE_LONG
=>
SENDMAIL_TOKEN_BODY_MODE
,
];
$param
=
explode
(
PARAM_DELIMITER
,
$data
);
// Iterate over all parameter: use token as key. Collect corresponding attachments arguments in separate array elements
// Iterate over all parameter: use token as key. Collect corresponding attachments arguments in separate array elements
.
foreach
(
$param
AS
$line
)
{
if
(
empty
(
$line
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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