Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -128,10 +128,71 @@ class _Request
*/
public function setMember( \IPS\Member $member )
{
$this->data['domain'] = mb_substr( $member->email, mb_strrpos( $member->email, '@' ) + 1 );
$this->data['emailMD5'] = md5( $member->email );
$this->_setEmailProperties( $member->email );
$this->data['usernameMD5'] = md5( $member->name );
}
/**
* @brief MaxMind common typo domains list
* @see https://github.com/maxmind/minfraud-api-php/blob/b08158b6c096bde8560b1b7fb8bb548c79f8d57b/src/MinFraud/Util.php#L18
*/
protected static $typoDomains = [
// gmail.com
'35gmai.com' => 'gmail.com',
'636gmail.com' => 'gmail.com',
'gamil.com' => 'gmail.com',
'gmail.comu' => 'gmail.com',
'gmial.com' => 'gmail.com',
'gmil.com' => 'gmail.com',
'yahoogmail.com' => 'gmail.com',
// outlook.com
'putlook.com' => 'outlook.com',
];
/**
* Set the email properties after applying MaxMind's recommended normalization
*
* @see https://dev.maxmind.com/normalizing-email-addresses-for-minfraud/
* @param string $email The member's email address
* @return void
*/
protected function _setEmailProperties( $email )
{
$email = trim( \strtolower( $email ) );
$local = \substr( $email, 0, \strrpos( $email, '@' ) );
$domain = \substr( $email, \strrpos( $email, '@' ) + 1 );
/* Trim the domain and remove trailing dots */
$domain = rtrim( trim( $domain ), '.' );
/* Convert IDNs to ASCII */
if ( !\function_exists('idn_to_ascii') )
{
\IPS\IPS::$PSR0Namespaces['TrueBV'] = \IPS\ROOT_PATH . "/system/3rd_party/php-punycode";
require_once \IPS\ROOT_PATH . "/system/3rd_party/php-punycode/polyfill.php";
}
$asciiDomain = idn_to_ascii( $domain, \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46 );
if( $asciiDomain !== FALSE )
{
$domain = $asciiDomain;
}
/* Then address common typos */
$domain = isset( static::$typoDomains[ $domain ] ) ? static::$typoDomains[ $domain ] : $domain;
/* Now remove email aliases from the local part */
$divider = ( $domain === 'yahoo.com' ) ? '-' : '+';
if( $alias = \strpos( $local, $divider ) )
{
$local = \substr( $local, 0, $alias );
}
$this->data['domain'] = $domain;
$this->data['emailMD5'] = md5( $local . '@' . $domain );
}
/**
* Set Phone Number