Merge pull request #4185 from MrPetovan/bug/4184-fix-allowed-email-domains
Fix allowed_email()
This commit is contained in:
commit
c337bdc280
3 changed files with 25 additions and 20 deletions
|
@ -614,6 +614,10 @@ function allowed_email($email)
|
|||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_email', '');
|
||||
if (!x($str_allowed)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$allowed = explode(',', $str_allowed);
|
||||
|
||||
return allowed_domain($domain, $allowed);
|
||||
|
@ -622,19 +626,15 @@ function allowed_email($email)
|
|||
/**
|
||||
* Checks for the existence of a domain in a domain list
|
||||
*
|
||||
* If strict is not set, an empty domain list counts as found
|
||||
*
|
||||
* @brief Checks for the existence of a domain in a domain list
|
||||
* @param string $domain
|
||||
* @param array $domain_list
|
||||
* @param bool $strict
|
||||
* @return boolean
|
||||
*/
|
||||
function allowed_domain($domain, array $domain_list, $strict = false)
|
||||
function allowed_domain($domain, array $domain_list)
|
||||
{
|
||||
$found = false;
|
||||
|
||||
if (count($domain_list)) {
|
||||
foreach ($domain_list as $item) {
|
||||
$pat = strtolower(trim($item));
|
||||
if (fnmatch($pat, $domain) || ($pat == $domain)) {
|
||||
|
@ -642,9 +642,7 @@ function allowed_domain($domain, array $domain_list, $strict = false)
|
|||
break;
|
||||
}
|
||||
}
|
||||
} elseif(!$strict) {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,15 +237,15 @@ function register_content(App $a)
|
|||
|
||||
$license = '';
|
||||
|
||||
$o = get_markup_template("register.tpl");
|
||||
$tpl = get_markup_template("register.tpl");
|
||||
|
||||
$arr = array('template' => $o);
|
||||
$arr = array('template' => $tpl);
|
||||
|
||||
call_hooks('register_form', $arr);
|
||||
|
||||
$o = $arr['template'];
|
||||
$tpl = $arr['template'];
|
||||
|
||||
$o = replace_macros($o, [
|
||||
$o = replace_macros($tpl, [
|
||||
'$oidhtml' => $oidhtml,
|
||||
'$invitations' => Config::get('system', 'invitation_only'),
|
||||
'$permonly' => $a->config['register_policy'] == REGISTER_APPROVE,
|
||||
|
|
|
@ -299,11 +299,18 @@ class OEmbed
|
|||
}
|
||||
|
||||
$domain = parse_url($url, PHP_URL_HOST);
|
||||
if (!x($domain)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_oembed', '');
|
||||
if (!x($str_allowed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$allowed = explode(',', $str_allowed);
|
||||
|
||||
return allowed_domain($domain, $allowed, true);
|
||||
return allowed_domain($domain, $allowed);
|
||||
}
|
||||
|
||||
public static function getHTML($url, $title = null)
|
||||
|
|
Loading…
Reference in a new issue