Messaging Mail Template can be overwritten in the Database

This commit is contained in:
Andreas Österreicher
2018-02-21 23:53:50 +01:00
parent 45485ee02a
commit 0a8285ed03
2 changed files with 227 additions and 158 deletions
+107 -38
View File
@@ -427,31 +427,67 @@ class MessageLib
|| (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != ''))
{
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[$i]->token;
// Using a template for the html email body
$body = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
if(hasData($vorlage))
{
// Using a template for the html email body
$body = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
else
{
// Using a template for the html email body
$body = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
if (is_null($body) || $body == '')
{
$this->ci->loglib->logError('Error while parsing the mail template');
}
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT');
if(hasData($vorlage))
{
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
else
{
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[$i]->subject,
'body' => $result->retval[$i]->body
),
true
);
}
if (is_null($altBody) || $altBody == '')
{
$this->ci->loglib->logError('Error while parsing the mail template');
@@ -571,15 +607,32 @@ class MessageLib
{
// Using a template for the html email body
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
$bodyMsg = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
if(hasData($vorlage))
{
$bodyMsg = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
else
{
$bodyMsg = $this->ci->parser->parse(
'templates/mailHTML',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
if (is_null($bodyMsg) || $bodyMsg == '')
{
// $body = $result->retval[0]->body;
@@ -587,15 +640,31 @@ class MessageLib
}
// Using a template for the plain text email body
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
if(hasData($vorlage))
{
$altBody = $this->ci->parser->parse_string(
$vorlage->retval[0]->text,
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
else
{
$altBody = $this->ci->parser->parse(
'templates/mailTXT',
array(
'href' => $href,
'subject' => $result->retval[0]->subject,
'body' => $result->retval[0]->body
),
true
);
}
if (is_null($altBody) || $altBody == '')
{
$this->ci->loglib->logError('Error while parsing the plain text mail template');