Merge remote-tracking branch 'upstream/develop' into follow-tags

This commit is contained in:
Michael 2018-01-08 07:04:15 +00:00
commit a5536086dd
3 changed files with 25 additions and 20 deletions

View file

@ -609,11 +609,15 @@ function blocked_url($url)
function allowed_email($email)
{
$domain = strtolower(substr($email, strpos($email, '@') + 1));
if (! $domain) {
if (!$domain) {
return false;
}
$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;
}

View file

@ -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,

View file

@ -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)