diff --git a/contact.php b/contact.php index ce5f4ef2f..647e31af9 100644 --- a/contact.php +++ b/contact.php @@ -53,7 +53,33 @@ if (!vartrue($CONTACT_FORM)) if(isset($_POST['send-contactus'])) { - $error = ""; + $error = ""; + $ignore = false; + + + // Contact Form Filter ----- + + $contact_filter = e107::pref('core','contact_filter',''); + + if(!empty($contact_filter)) + { + $tmp = explode("\n", $contact_filter); + + if(!empty($tmp)) + { + foreach($tmp as $filterItem) + { + if(strpos($_POST['body'], $filterItem)!==false) + { + $ignore = true; + break; + } + + } + } + } + + // --------- $sender_name = $tp->toEmail($_POST['author_name'], true,'RAWTEXT'); $sender = check_email($_POST['email_send']); @@ -108,7 +134,14 @@ if(isset($_POST['send-contactus'])) */ // No errors - so proceed to email the admin and the user (if selected). - if(empty($error)) + if($ignore === true) + { + $ns->tablerender('', "
".LANCONTACT_09."
"); // ignore and leave them none the wiser. + e107::getDebug()->log("Contact form post ignored"); + require_once(FOOTERF); + exit; + } + elseif(empty($error)) { $body .= "

@@ -198,22 +231,23 @@ if(isset($_POST['send-contactus'])) ); - $message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml, false) ? LANCONTACT_09 : LANCONTACT_10; - // $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10; + $message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml, false) ? LANCONTACT_09 : LANCONTACT_10; - if(isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $email_copy == 1) - { + // $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10; + + if(isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $email_copy == 1) + { require_once(e_HANDLER."mail.php"); sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name); - } + } $ns->tablerender('', "
".$message."
"); require_once(FOOTERF); exit; } - else + else { message_handler("P_ALERT", $error); } diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 289bc50bc..122b5a20c 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -501,6 +501,17 @@ $text .= "
Contact form will only be visible to this userclass group.
+
+ + + + + + + +
+ ".$frm->textarea('contact_filter', $pref['contact_filter'], 5, 59, array('size'=>'xxlarge'))." +
".PRFLAN_271."
+
"; @@ -517,6 +528,7 @@ $text .= "
".pref_submit('email')." diff --git a/e107_core/xml/default_install.xml b/e107_core/xml/default_install.xml index a30ee4313..cd1f717f1 100644 --- a/e107_core/xml/default_install.xml +++ b/e107_core/xml/default_install.xml @@ -32,6 +32,7 @@ 0 0 0 + e107cookie 'e-administrator', diff --git a/e107_languages/English/admin/lan_prefs.php b/e107_languages/English/admin/lan_prefs.php index 59cb19b13..97a06866a 100644 --- a/e107_languages/English/admin/lan_prefs.php +++ b/e107_languages/English/admin/lan_prefs.php @@ -287,4 +287,5 @@ define("PRFLAN_267", "Emailing method"); define("PRFLAN_268", "Frontend Inline-Editing"); define("PRFLAN_269", "Admins with this userclass (and the appropriate admin permissions) will be able to edit html directly via the frontend area."); - +define("PRFLAN_270", "Contact Form Filtering"); +define("PRFLAN_271", "Ignore form submissions containing these words or phrases. One per line.");