Merge pull request #551 from shish/contact-link

Have contact_link support http: and mailto:
This commit is contained in:
Shish 2016-06-06 12:37:27 +01:00
commit 43eed32958
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 *

View file

@ -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();

View file

@ -37,7 +37,7 @@ EOD
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";
$message_html = empty($main_text) ? "" : "<div class='space' id='message'>$main_text</div>";
$counter_html = empty($counter_text) ? "" : "<div class='space' id='counter'>$counter_text</div>";
$contact_link = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a> &ndash;";
$contact_link = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a> &ndash;";
$search_html = "
<div class='space' id='search'>
<form action='".make_link("post/list")."' method='GET'>

View file

@ -222,7 +222,7 @@ class IPBan extends Extension {
print "IP <b>$ip</b> has been banned until <b>$date</b> by <b>{$admin->name}</b> because of <b>$reason</b>\n";
print "<p>If you couldn't possibly be guilty of what you're banned for, the person we banned probably had a dynamic IP address and so do you. See <a href='http://whatismyipaddress.com/dynamic-static'>http://whatismyipaddress.com/dynamic-static</a> for more information.\n";
$contact_link = $config->get_string("contact_link");
$contact_link = contact_link();
if(!empty($contact_link)) {
print "<p><a href='$contact_link'>Contact the staff (be sure to include this message)</a>";
}

View file

@ -49,7 +49,7 @@ class Layout {
$theme_name = $config->get_string('theme');
//$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
@ -88,7 +88,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
if(empty($this->subheading)) {
$subheading = "";

View file

@ -49,7 +49,7 @@ class Layout {
//$theme_name = $config->get_string('theme');
//$base_href = $config->get_string('base_href');
//$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
@ -88,7 +88,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
if(empty($this->subheading)) {
$subheading = "";

View file

@ -13,7 +13,7 @@ class Layout {
//$theme_name = $config->get_string('theme', 'default');
//$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
ksort($page->html_headers);
@ -44,7 +44,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
$wrapper = "";
if(strlen($page->heading) > 100) {

View file

@ -6,7 +6,7 @@ class Layout {
$theme_name = $config->get_string('theme', 'default');
$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
ksort($page->html_headers);
@ -37,7 +37,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
if(empty($page->subheading)) {
$subheading = "";

View file

@ -20,7 +20,7 @@ class Layout {
$theme_name = $config->get_string('theme', 'lite');
$site_name = $config->get_string('title');
$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
ksort($page->html_headers);
@ -152,7 +152,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:{$contact_link}'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='{$contact_link}'>Contact</a>";
//$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
/*$wrapper = "";

View file

@ -13,7 +13,7 @@ class Layout {
$site_name = $config->get_string('title');
$data_href = get_base_href();
$main_page = $config->get_string('main_page');
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$site_link = make_link();
$header_html = "";
@ -86,7 +86,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
/*$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = "";

View file

@ -15,7 +15,7 @@ class Layout {
$site_name = $config->get_string('title');
$data_href = get_base_href();
$main_page = $config->get_string('main_page');
$contact_link = $config->get_string('contact_link');
$contact_link = contact_link();
$header_html = "";
ksort($page->html_headers);
@ -50,7 +50,7 @@ class Layout {
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
/*$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
$wrapper = "";