mirror of
https://github.com/friendica/friendica
synced 2025-04-24 12:30:10 +00:00
Only use and accept valid http links as links to an external resource
This commit is contained in:
parent
e9a6c4a7e3
commit
029daef997
3 changed files with 27 additions and 5 deletions
|
@ -560,4 +560,15 @@ class Network
|
|||
{
|
||||
return (strpos(Strings::normaliseLink($url), Strings::normaliseLink(DI::baseUrl())) !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given URL is a valid HTTP/HTTPS URL
|
||||
*
|
||||
* @param string $url
|
||||
* @return bool
|
||||
*/
|
||||
public static function isValidHttpUrl(string $url)
|
||||
{
|
||||
return in_array(parse_url($url, PHP_URL_SCHEME), ['http', 'https']) && parse_url($url, PHP_URL_HOST);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue