mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Contact Form: Simple keyword and phrase filtering option added.
This commit is contained in:
50
contact.php
50
contact.php
@@ -53,7 +53,33 @@ if (!vartrue($CONTACT_FORM))
|
|||||||
if(isset($_POST['send-contactus']))
|
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_name = $tp->toEmail($_POST['author_name'], true,'RAWTEXT');
|
||||||
$sender = check_email($_POST['email_send']);
|
$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).
|
// No errors - so proceed to email the admin and the user (if selected).
|
||||||
if(empty($error))
|
if($ignore === true)
|
||||||
|
{
|
||||||
|
$ns->tablerender('', "<div class='alert alert-success'>".LANCONTACT_09."</div>"); // ignore and leave them none the wiser.
|
||||||
|
e107::getDebug()->log("Contact form post ignored");
|
||||||
|
require_once(FOOTERF);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
elseif(empty($error))
|
||||||
{
|
{
|
||||||
$body .= "<br /><br />
|
$body .= "<br /><br />
|
||||||
<table class='table'>
|
<table class='table'>
|
||||||
@@ -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");
|
require_once(e_HANDLER."mail.php");
|
||||||
sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name);
|
sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ns->tablerender('', "<div class='alert alert-success'>".$message."</div>");
|
$ns->tablerender('', "<div class='alert alert-success'>".$message."</div>");
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_handler("P_ALERT", $error);
|
message_handler("P_ALERT", $error);
|
||||||
}
|
}
|
||||||
|
@@ -501,6 +501,17 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
|
|||||||
<div class='smalltext field-help'>Contact form will only be visible to this userclass group.</div>
|
<div class='smalltext field-help'>Contact form will only be visible to this userclass group.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for='contact-filter'>".PRFLAN_270."</label></td>
|
||||||
|
<td>
|
||||||
|
".$frm->textarea('contact_filter', $pref['contact_filter'], 5, 59, array('size'=>'xxlarge'))."
|
||||||
|
<div class='smalltext field-help'>".PRFLAN_271."</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for='contact-emailcopy'>".PRFLAN_164."</label></td>
|
<td><label for='contact-emailcopy'>".PRFLAN_164."</label></td>
|
||||||
<td>";
|
<td>";
|
||||||
@@ -517,6 +528,7 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
".pref_submit('email')."
|
".pref_submit('email')."
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
<core name="compress_output">0</core>
|
<core name="compress_output">0</core>
|
||||||
<core name="contact_emailcopy">0</core>
|
<core name="contact_emailcopy">0</core>
|
||||||
<core name="contact_visibility">0</core>
|
<core name="contact_visibility">0</core>
|
||||||
|
<core name="contact_filter"></core>
|
||||||
<core name="cookie_name">e107cookie</core>
|
<core name="cookie_name">e107cookie</core>
|
||||||
<core name="core-infopanel-default"><![CDATA[array (
|
<core name="core-infopanel-default"><![CDATA[array (
|
||||||
0 => 'e-administrator',
|
0 => 'e-administrator',
|
||||||
|
@@ -287,4 +287,5 @@ define("PRFLAN_267", "Emailing method");
|
|||||||
|
|
||||||
define("PRFLAN_268", "Frontend Inline-Editing");
|
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_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.");
|
||||||
|
Reference in New Issue
Block a user