allow both http: and mailto: contact links

This commit is contained in:
Shish
2016-06-06 12:12:25 +01:00
parent dc8efcb680
commit aeeaabb22e
11 changed files with 42 additions and 17 deletions

View File

@ -591,6 +591,31 @@ function zglob($pattern) {
}
}
/**
* Gets contact link as mailto: or http:
*/
function contact_link() {
global $config;
$text = $config->get_string('contact_link');
if(
startsWith($text, "http:") ||
startsWith($text, "https:") ||
startsWith($text, "mailto:")
) {
return $text;
}
if(strpos($text, "@")) {
return "mailto:$text";
}
if(strpos($text, "/")) {
return "http://$text";
}
return $text;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* CAPTCHA abstraction *