From a8d71ee6e85146eae23dc3edc266610ec23ff0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 11 Jun 2022 13:41:37 +0200 Subject: [PATCH] GH-224 Move email address process entry creator to an util --- modules/settings/_includes.php | 1 + .../createEmailChangeProcessEntry.query.php | 40 +++++++++++++++++++ settings.php | 12 ++++-- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 modules/settings/utils/queries/createEmailChangeProcessEntry.query.php diff --git a/modules/settings/_includes.php b/modules/settings/_includes.php index e43d434e..7c83d542 100644 --- a/modules/settings/_includes.php +++ b/modules/settings/_includes.php @@ -9,6 +9,7 @@ include($includePath . './utils/errorMappers/validatePasswordChange.errorMapper.php'); include($includePath . './utils/errorMappers/validateEmailChange.errorMapper.php'); + include($includePath . './utils/queries/createEmailChangeProcessEntry.query.php'); include($includePath . './utils/queries/getUserWithEmailAddress.query.php'); include($includePath . './utils/validators/validatePasswordChange.validator.php'); diff --git a/modules/settings/utils/queries/createEmailChangeProcessEntry.query.php b/modules/settings/utils/queries/createEmailChangeProcessEntry.query.php new file mode 100644 index 00000000..f9562968 --- /dev/null +++ b/modules/settings/utils/queries/createEmailChangeProcessEntry.query.php @@ -0,0 +1,40 @@ + diff --git a/settings.php b/settings.php index f7b461ca..7df1c242 100644 --- a/settings.php +++ b/settings.php @@ -228,10 +228,14 @@ $ChangeSet['email_2'] = $normalizedInputNewEmailAddress; $ChangeSetTypes['email_2'] = 's'; - doquery( - "INSERT INTO {{table}} VALUES (NULL, {$ThisTime}, {$_User['id']}, '{$_User['email']}', '{$normalizedInputNewEmailAddress}', 0, 0, '{$changeTokenOldAddress}', '{$changeTokenNewAddress}');", - 'mailchange' - ); + Settings\Utils\Queries\createEmailChangeProcessEntry([ + 'user' => &$_User, + 'newEmailAddress' => $normalizedInputNewEmailAddress, + 'changeTokenOldAddress' => $changeTokenOldAddress, + 'changeTokenNewAddress' => $changeTokenNewAddress, + 'currentTimestamp' => $ThisTime, + ]); + $CheckMailChange = [ 'ID' => 1, 'Date' => $ThisTime, ]; $InfoMsgs[] = sprintf($_Lang['Mail_MailChange'], $_User['email']); } else {