diff --git a/core/util.inc.php b/core/util.inc.php index 11aa9ae0..c6450997 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -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 * diff --git a/ext/home/main.php b/ext/home/main.php index fb1269db..566c1d6e 100644 --- a/ext/home/main.php +++ b/ext/home/main.php @@ -49,7 +49,7 @@ class Home extends Extension { global $config; $base_href = get_base_href(); $sitename = $config->get_string('title'); - $contact_link = $config->get_string('contact_link'); + $contact_link = contact_link(); $counter_dir = $config->get_string('home_counter', 'default'); $total = Image::count_images(); diff --git a/ext/home/theme.php b/ext/home/theme.php index e34b8ca4..6c51c73d 100644 --- a/ext/home/theme.php +++ b/ext/home/theme.php @@ -37,7 +37,7 @@ EOD $main_links_html = empty($main_links) ? "" : "