Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Decode IDNA domains in any system mail (see #5932)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Aug 15, 2013
1 parent c66b39a commit 9cf8c25
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions contao/classes/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ protected function renderCommentForm(\FrontendTemplate $objTemplate, \stdClass $
$objEmail = new \Email();
$objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
$objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_subject'], \Environment::get('host'));
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_subject'], \Idna::decode(\Environment::get('host')));

// Convert the comment to plain text
$strComment = strip_tags($strComment);
Expand All @@ -388,8 +388,8 @@ protected function renderCommentForm(\FrontendTemplate $objTemplate, \stdClass $
$objEmail->text = sprintf($GLOBALS['TL_LANG']['MSC']['com_message'],
$arrSet['name'] . ' (' . $arrSet['email'] . ')',
$strComment,
\Environment::get('base') . \Environment::get('request'),
\Environment::get('base') . 'contao/main.php?do=comments&act=edit&id=' . $objComment->id);
\Idna::decode(\Environment::get('base')) . \Environment::get('request'),
\Idna::decode(\Environment::get('base')) . 'contao/main.php?do=comments&act=edit&id=' . $objComment->id);

// Do not send notifications twice
if (is_array($varNotifies))
Expand Down Expand Up @@ -546,14 +546,14 @@ public static function addCommentsSubscription(\CommentsModel $objComment)
$objNotify = new \CommentsNotifyModel();
$objNotify->setRow($arrSet)->save();

$strUrl = \Environment::get('base') . \Environment::get('request');
$strUrl = \Idna::decode(\Environment::get('base')) . \Environment::get('request');
$strConnector = (strpos($strUrl, '?') !== false) ? '&' : '?';

// Send the activation mail
$objEmail = new \Email();
$objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
$objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_optInSubject'], \Environment::get('host'));
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_optInSubject'], \Idna::decode(\Environment::get('host')));
$objEmail->text = sprintf($GLOBALS['TL_LANG']['MSC']['com_optInMessage'], $objComment->name, $strUrl, $strUrl . $strConnector . 'token=' . $objNotify->tokenConfirm, $strUrl . $strConnector . 'token=' . $objNotify->tokenRemove);
$objEmail->sendTo($objComment->email);
}
Expand Down Expand Up @@ -616,12 +616,12 @@ public static function notifyCommentsSubscribers(\CommentsModel $objComment)
}

// Prepare the URL
$strUrl = \Environment::get('base') . $objNotify->url;
$strUrl = \Idna::decode(\Environment::get('base')) . $objNotify->url;

$objEmail = new \Email();
$objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
$objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_notifySubject'], \Environment::get('host'));
$objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['com_notifySubject'], \Idna::decode(\Environment::get('host')));
$objEmail->text = sprintf($GLOBALS['TL_LANG']['MSC']['com_notifyMessage'], $objNotify->name, $strUrl, $strUrl . '?token=' . $objNotify->tokenRemove);
$objEmail->sendTo($objNotify->email);
}
Expand Down

0 comments on commit 9cf8c25

Please sign in to comment.