mirror of
https://github.com/friendica/friendica
synced 2025-04-25 13:10:11 +00:00
Configurable list of domains to ignore redirects
This commit is contained in:
parent
26831371f7
commit
55e169db49
4 changed files with 52 additions and 2 deletions
|
@ -177,6 +177,35 @@ class Network
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided url is on the list of domains where redirects are blocked.
|
||||
* Returns true if it is or malformed URL, false if not.
|
||||
*
|
||||
* @param string $url The url to check the domain from
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isRedirectBlocked(string $url)
|
||||
{
|
||||
$host = @parse_url($url, PHP_URL_HOST);
|
||||
if (!$host) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$no_redirect_list = DI::config()->get('system', 'no_redirect_list', []);
|
||||
if (!$no_redirect_list) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($no_redirect_list as $no_redirect) {
|
||||
if (fnmatch(strtolower($no_redirect), strtolower($host))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if email address is allowed to register here.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue