function _forward_strip_dangerous_protocols in Forward 6
1 call to _forward_strip_dangerous_protocols()
- _forward_url_is_external in ./forward.module
- Email Tracker
File
- ./forward.module, line 453
Code
function _forward_strip_dangerous_protocols($uri) {
static $allowed_protocols;
if (!isset($allowed_protocols)) {
$allowed_protocols = array_flip(variable_get('filter_allowed_protocols', array(
'ftp',
'http',
'https',
'irc',
'mailto',
'news',
'nntp',
'rtsp',
'sftp',
'ssh',
'tel',
'telnet',
'webcal',
)));
}
do {
$before = $uri;
$colonpos = strpos($uri, ':');
if ($colonpos > 0) {
$protocol = substr($uri, 0, $colonpos);
if (preg_match('![/?#]!', $protocol)) {
break;
}
if (!isset($allowed_protocols[strtolower($protocol)])) {
$uri = substr($uri, $colonpos + 1);
}
}
} while ($before != $uri);
return $uri;
}