diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2022-03-20 14:35:25 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2022-03-20 15:34:24 +0100 |
commit | b02f6a1dae3e3fae4af4b24e65256cdf653b2515 (patch) | |
tree | 61a6ae0c29b681b699374a38806ce0c3c7331dd3 /include | |
parent | d35609f33a3679043b8fa4dc3ad2570b425c06f5 (diff) | |
download | volse-hubzilla-b02f6a1dae3e3fae4af4b24e65256cdf653b2515.tar.gz volse-hubzilla-b02f6a1dae3e3fae4af4b24e65256cdf653b2515.tar.bz2 volse-hubzilla-b02f6a1dae3e3fae4af4b24e65256cdf653b2515.zip |
Add function is_local_url() to check if url is local.
Diffstat (limited to 'include')
-rw-r--r-- | include/network.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php index fa408e602..a236a6f8e 100644 --- a/include/network.php +++ b/include/network.php @@ -559,6 +559,14 @@ function z_dns_check($h,$check_mx = 0) { return((@dns_get_record($h,$opts) || filter_var($h, FILTER_VALIDATE_IP)) ? true : false); } +function is_local_url($url) { + if (str_starts_with($url, z_root()) || str_starts_with($url, '/')) { + return true; + } + + return false; +} + /** * @brief Validates a given URL. * |