Skip to content
Permalink
Browse files Browse the repository at this point in the history
fixes #547, strong checks on url format
  • Loading branch information
plegall committed Nov 17, 2016
1 parent 25d2305 commit b3157cb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/functions.inc.php
Expand Up @@ -2055,6 +2055,16 @@ function mobile_theme()
*/
function url_check_format($url)
{
if (strpos($url, '"') !== false)
{
return false;
}

if (strncmp($url, 'http://', 7) !== 0 and strncmp($url, 'https://', 8) !== 0)
{
return false;
}

return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false;
}

Expand Down

0 comments on commit b3157cb

Please sign in to comment.