Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -55,45 +55,40 @@ class _Email extends Text
|
||||
if ( $this->options['accountEmail'] )
|
||||
{
|
||||
/* Check if it exists */
|
||||
foreach ( \IPS\Login::handlers( TRUE ) as $k => $handler )
|
||||
if ( $error = \IPS\Login::emailIsInUse( $this->value, ( $this->options['accountEmail'] instanceof \IPS\Member ) ? $this->options['accountEmail'] : NULL, \IPS\Member::loggedIn()->isAdmin() ) )
|
||||
{
|
||||
if ( $handler->emailIsInUse( $this->value, ( $this->options['accountEmail'] instanceof \IPS\Member ) ? $this->options['accountEmail'] : NULL ) === TRUE )
|
||||
{
|
||||
if ( \IPS\Member::loggedIn()->isAdmin() )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack('member_email_exists_admin', FALSE, array( 'sprintf' => array( $k ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \DomainException( 'member_email_exists' );
|
||||
}
|
||||
}
|
||||
throw new \DomainException( $error );
|
||||
}
|
||||
|
||||
/* Check it's not banned */
|
||||
foreach ( \IPS\Db::i()->select( 'ban_content', 'core_banfilters', array( "ban_type=?", 'email' ) ) as $bannedEmail )
|
||||
{
|
||||
if ( preg_match( '/^' . str_replace( '\*', '.*', preg_quote( $bannedEmail, '/' ) ) . '$/i', $this->value ) )
|
||||
{
|
||||
throw new \DomainException( 'form_email_banned' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Check it's an allowed domain */
|
||||
if ( !\IPS\Member::loggedIn()->isAdmin() and \IPS\Settings::i()->allowed_reg_email !== '' AND $allowedEmailDomains = explode( ',', \IPS\Settings::i()->allowed_reg_email ) )
|
||||
|
||||
/* Check Banned and Allowed Emails only if the data are not coming from an administrator */
|
||||
if ( !\IPS\Member::loggedIn()->isAdmin() )
|
||||
{
|
||||
$matched = FALSE;
|
||||
foreach ( $allowedEmailDomains AS $domain )
|
||||
/* Check it's not a banned address */
|
||||
foreach ( \IPS\Db::i()->select( 'ban_content', 'core_banfilters', array( "ban_type=?", 'email' ) ) as $bannedEmail )
|
||||
{
|
||||
if( \mb_stripos( $this->value, "@" . $domain ) !== FALSE )
|
||||
if ( preg_match( '/^' . str_replace( '\*', '.*', preg_quote( $bannedEmail, '/' ) ) . '$/i', $this->value ) )
|
||||
{
|
||||
$matched = TRUE;
|
||||
throw new \DomainException( 'form_email_banned' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $allowedEmailDomains ) AND !$matched )
|
||||
/* Check it's an allowed domain */
|
||||
if ( \IPS\Settings::i()->allowed_reg_email !== '' AND $allowedEmailDomains = explode( ',', \IPS\Settings::i()->allowed_reg_email ) )
|
||||
{
|
||||
throw new \DomainException( 'form_email_banned' );
|
||||
$matched = FALSE;
|
||||
foreach ( $allowedEmailDomains AS $domain )
|
||||
{
|
||||
if( \mb_stripos( $this->value, "@" . $domain ) !== FALSE )
|
||||
{
|
||||
$matched = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $allowedEmailDomains ) AND !$matched )
|
||||
{
|
||||
throw new \DomainException( 'form_email_banned' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user