From a8a7d2c52f46193e2322aa0e8b9ba28b5d0f75a1 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 31 Dec 2013 16:14:56 +0100 Subject: [PATCH 1/2] [IMPROVED] Allow contactform for guests * Added admin option to disable access to contactform for guests * Propagated new option to templates Fixes #1185 --- public/include/config/admin_settings.inc.php | 7 +++++++ public/include/pages/contactform.inc.php | 3 +++ public/include/smarty_globals.inc.php | 2 ++ public/site_assets/mpos/css/layout.css | 2 +- public/templates/mpos/global/navigation.tpl | 10 ++++++++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index aab74e86..013107e5 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -287,6 +287,13 @@ $aSettings['system'][] = array( 'name' => 'disable_contactform', 'value' => $setting->getValue('disable_contactform'), 'tooltip' => 'Enable or Disable Contactform. Users will not be able to use the contact form.' ); +$aSettings['system'][] = array( + 'display' => 'Disable Contactform for Guests', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'disable_contactform_guest', 'value' => $setting->getValue('disable_contactform_guest'), + 'tooltip' => 'Enable or Disable Contactform for guests. Guests will not be able to use the contact form.' +); $aSettings['system'][] = array( 'display' => 'Disable Donors Page', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes'), diff --git a/public/include/pages/contactform.inc.php b/public/include/pages/contactform.inc.php index e4f947c4..75dc427f 100644 --- a/public/include/pages/contactform.inc.php +++ b/public/include/pages/contactform.inc.php @@ -6,6 +6,9 @@ if (!defined('SECURITY')) die('Hacking attempt'); if ($setting->getValue('disable_contactform')) { $_SESSION['POPUP'][] = array('CONTENT' => 'Contactform is currently disabled. Please try again later.', 'TYPE' => 'errormsg'); $smarty->assign("CONTENT", "disabled.tpl"); +} else if ($setting->getValue('disable_contactform_guest') && !$user->isAuthenticated(false)) { + $_SESSION['POPUP'][] = array('CONTENT' => 'Contactform is disabled for guests.', 'TYPE' => 'errormsg'); + $smarty->assign("CONTENT", "disabled.tpl"); } else { if ($setting->getValue('recaptcha_enabled')) { require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index c1f85023..b7a3829e 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -69,6 +69,8 @@ $aGlobal = array( 'disable_payouts' => $setting->getValue('disable_payouts'), 'disable_manual_payouts' => $setting->getValue('disable_manual_payouts'), 'disable_auto_payouts' => $setting->getValue('disable_auto_payouts'), + 'disable_contactform' => $setting->getValue('disable_contactform'), + 'disable_contactform_guest' => $setting->getValue('disable_contactform_guest'), 'algorithm' => $config['algorithm'], 'target_bits' => $config['target_bits'], 'accounts' => $config['accounts'], diff --git a/public/site_assets/mpos/css/layout.css b/public/site_assets/mpos/css/layout.css index e7b06b9d..9f5785a7 100644 --- a/public/site_assets/mpos/css/layout.css +++ b/public/site_assets/mpos/css/layout.css @@ -662,7 +662,7 @@ margin: 0 10px; fieldset label { display: block; float: left; -width: 200px; +width: 250px; height: 25px; line-height: 25px; text-shadow: 0 1px 0 #fff; diff --git a/public/templates/mpos/global/navigation.tpl b/public/templates/mpos/global/navigation.tpl index c6abcc58..b658fe19 100644 --- a/public/templates/mpos/global/navigation.tpl +++ b/public/templates/mpos/global/navigation.tpl @@ -72,14 +72,20 @@

Other