-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-224 Move email content creator to an util
- Loading branch information
Showing
4 changed files
with
94 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
69 changes: 69 additions & 0 deletions
69
modules/settings/utils/content/prepareChangeProcessEmails.content.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace UniEngine\Engine\Modules\Settings\Utils\Content; | ||
|
||
/** | ||
* @param array $params | ||
* @param arrayRef $params['user'] | ||
* @param string $params['newEmailAddress'] | ||
* @param string $params['changeTokenOldAddress'] | ||
* @param string $params['changeTokenNewAddress'] | ||
* @param number $params['currentTimestamp'] | ||
*/ | ||
function prepareChangeProcessEmails($params) { | ||
global $_Lang, $_GameConfig; | ||
|
||
$user = &$params['user']; | ||
$newEmailAddress = $params['newEmailAddress']; | ||
$changeTokenOldAddress = $params['changeTokenOldAddress']; | ||
$changeTokenNewAddress = $params['changeTokenNewAddress']; | ||
$currentTimestamp = $params['currentTimestamp']; | ||
|
||
$mailContentCommonProps = [ | ||
'EP_GameName' => $_GameConfig['game_name'], | ||
'EP_User' => $user['username'], | ||
'EP_GameLink' => GAMEURL_STRICT, | ||
'EP_OldMail' => $user['email'], | ||
'EP_NewMail' => $newEmailAddress, | ||
'EP_Date' => date('d.m.Y - H:i:s', $currentTimestamp), | ||
'EP_IP' => $user['user_lastip'], | ||
'EP_ContactLink' => GAMEURL_STRICT . '/contact.php', | ||
]; | ||
|
||
$mailContentOldAddressProps = [ | ||
'EP_Link' => GAMEURL . "email_change.php?hash=old&key={$changeTokenOldAddress}", | ||
'EP_Text' => $_Lang['Email_MailOld'], | ||
'EP_Text2' => $_Lang['Email_WarnOld'] | ||
]; | ||
$mailContentNewAddressProps = [ | ||
'EP_Link' => GAMEURL . "email_change.php?hash=new&key={$changeTokenNewAddress}", | ||
'EP_Text' => $_Lang['Email_MailNew'], | ||
'EP_Text2' => $_Lang['Email_WarnNew'] | ||
]; | ||
|
||
$mailTitle = parsetemplate( | ||
$_Lang['Email_Title'], | ||
[ | ||
'gameName' => $_GameConfig['game_name'] | ||
] | ||
); | ||
|
||
return [ | ||
'oldAddress' => [ | ||
'title' => $mailTitle, | ||
'content' => parsetemplate( | ||
$_Lang['Email_Body'], | ||
array_merge($mailContentCommonProps, $mailContentOldAddressProps) | ||
), | ||
], | ||
'newAddress' => [ | ||
'title' => $mailTitle, | ||
'content' => parsetemplate( | ||
$_Lang['Email_Body'], | ||
array_merge($mailContentCommonProps, $mailContentNewAddressProps) | ||
), | ||
], | ||
]; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters