diff --git a/contact.php b/contact.php index 66a2ef3a8..88ca897fb 100644 --- a/contact.php +++ b/contact.php @@ -10,288 +10,296 @@ * */ -require_once("class2.php"); -//define('e_HANDLER', "e107_handlers/"); -// security image may be disabled by removing the appropriate shortcodes from the template. -$active = varset($pref['contact_visibility'], e_UC_PUBLIC); -$contactInfo = trim(SITECONTACTINFO); +require_once(__DIR__."/class2.php"); -if(!check_class($active) && empty($contactInfo)) + +class contact_front { - e107::getRedirect()->go(e_HTTP."index.php"); + function __construct() + { + $this->init(); + + } + + function init() + { + $active = varset($pref['contact_visibility'], e_UC_PUBLIC); + $contactInfo = trim(SITECONTACTINFO); + + if(!check_class($active) && empty($contactInfo) && empty($pref['contact_info'])) + { + e107::redirect(); + } + + + $sec_img = e107::getSecureImg(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $pref = e107::getPref(); + + $CONTACT_FORM = $GLOBALS['CONTACT_FORM']; + + if (empty($CONTACT_FORM)) + { + /* if (file_exists(THEME."contact_template.php")) + { + require_once(THEME."contact_template.php"); + } + else*/ + { + $CONTACT_FORM = e107::getCoreTemplate('contact','form'); // require_once(e_THEME."templates/contact_template.php"); + } + } + + if(isset($_POST['send-contactus'])) + { + $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']); + $subject = $tp->toEmail($_POST['subject'], true,'RAWTEXT'); + $body = nl2br($tp->toEmail($_POST['body'], true,'RAWTEXT')); + + $email_copy = !empty($_POST['email_copy']) ? 1 : 0; + + // Check Image-Code + if (isset($_POST['rand_num']) && !$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) + { + $error .= LANCONTACT_15."\\n"; + } + + // Check message body. + if(strlen(trim($body)) < 15) + { + $error .= LANCONTACT_12."\\n"; + } + + // Check subject line. + if(isset($_POST['subject']) && strlen(trim($subject)) < 2) + { + $error .= LANCONTACT_13."\\n"; + } + + if(!strpos(trim($sender),"@")) + { + $error .= LANCONTACT_11."\\n"; + } + + + + // Check email address on remote server (if enabled). XXX Problematic! + /* + if ($pref['signup_remote_emailcheck'] && $error == '') + { + require_once(e_HANDLER."mail_validation_class.php"); + list($adminuser,$adminhost) = explode('@', SITEADMINEMAIL, 2); + $validator = new email_validation_class; + $validator->localuser= $adminuser; + $validator->localhost= $adminhost; + $validator->timeout=3; + // $validator->debug=1; + // $validator->html_debug=1; + if($validator->ValidateEmailBox($sender) != 1) + { + $error .= LANCONTACT_11."\\n"; + } + + } + */ + + // No errors - so proceed to email the admin and the user (if selected). + if($ignore === true) + { + $ns->tablerender('', "
IP: | ".e107::getIPHandler()->getIP(TRUE)." |
User: | #".USERID." ".USERNAME." |
".$k.": | ".$tp->toEmail($v, true,'RAWTEXT')." |
IP: | ".e107::getIPHandler()->getIP(TRUE)." |
User: | #".USERID." ".USERNAME." |
".$k.": | ".$tp->toEmail($v, true,'RAWTEXT')." |