diff --git a/contact.php b/contact.php index 3ce22fb35..b6ff7f898 100644 --- a/contact.php +++ b/contact.php @@ -17,12 +17,28 @@ class contact_front { function __construct() { + $range = range(00,24); + $tp = e107::getParser(); + $defs = array(); + + foreach($range as $val) + { + $inc = $tp->leadingZeros($val,2); + $legacy = 'LAN_CONTACT_'.$inc; + $defs[$legacy] = 'LANCONTACT_'.$inc; + + } + + e107::getLanguage()->bcDefs($defs); + $this->init(); } function init() { + $pref = e107::pref(); + $active = varset($pref['contact_visibility'], e_UC_PUBLIC); $contactInfo = trim(SITECONTACTINFO); $pref = e107::getPref(); @@ -34,7 +50,7 @@ class contact_front if(isset($_POST['send-contactus'])) { - $this->processFormSubmit($sql); + $this->processFormSubmit(); } $form = ''; @@ -118,51 +134,30 @@ class contact_front // Check Image-Code if(isset($_POST['rand_num']) && ($sec_img->invalidCode($_POST['rand_num'], $_POST['code_verify']))) { - $error .= LANCONTACT_15 . "\\n"; + $error .= LAN_CONTACT_15 . "\\n"; } // Check message body. if(strlen(trim($body)) < 15) { - $error .= LANCONTACT_12 . "\\n"; + $error .= LAN_CONTACT_12 . "\\n"; } // Check subject line. if(isset($_POST['subject']) && strlen(trim($subject)) < 2) { - $error .= LANCONTACT_13 . "\\n"; + $error .= LAN_CONTACT_13 . "\\n"; } if(!strpos(trim($sender), "@")) { - $error .= LANCONTACT_11 . "\\n"; + $error .= LAN_CONTACT_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('', "
" . LANCONTACT_09 . "
"); // ignore and leave them none the wiser. + $ns->tablerender('', "
" . LAN_CONTACT_09 . "
"); // ignore and leave them none the wiser. e107::getDebug()->log("Contact form post ignored"); require_once(FOOTERF); exit; @@ -257,7 +252,7 @@ class contact_front ); - $message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml) ? LANCONTACT_09 : LANCONTACT_10; + $message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml) ? LAN_CONTACT_09 : LAN_CONTACT_10; // $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10; @@ -295,7 +290,7 @@ class contact_front $contact_shortcodes->wrapper('contact/info'); $text = e107::getParser()->parseTemplate($CONTACT_INFO, true, $contact_shortcodes); - return e107::getRender()->tablerender(LANCONTACT_01, $text, "contact-info", true); + return e107::getRender()->tablerender(LAN_CONTACT_01, $text, "contact-info", true); } @@ -317,7 +312,7 @@ class contact_front if(trim($text) !== '') { - return e107::getRender()->tablerender(LANCONTACT_02, $text, "contact-form", true); + return e107::getRender()->tablerender(LAN_CONTACT_02, $text, "contact-form", true); } } @@ -327,16 +322,16 @@ class contact_front $srch = array("[", "]"); $repl = array("", ""); - $message = LANCONTACT_16; // "You must be [registered] and signed-in to use this form."; + $message = LAN_CONTACT_16; // "You must be [registered] and signed-in to use this form."; - e107::getRender()->tablerender(LANCONTACT_02, "
" . str_replace($srch, $repl, $message) . "
", "contact"); + e107::getRender()->tablerender(LAN_CONTACT_02, "
" . str_replace($srch, $repl, $message) . "
", "contact"); } } e107::lan('core','contact'); -e107::title(LANCONTACT_00); +e107::title(LAN_CONTACT_00); e107::canonical('contact'); e107::route('contact/index'); diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php index 686c1dbb4..14af85a7d 100644 --- a/e107_core/shortcodes/batch/contact_shortcodes.php +++ b/e107_core/shortcodes/batch/contact_shortcodes.php @@ -92,7 +92,7 @@ class contact_shortcodes extends e_shortcode /* example {CONTACT_NAME} */ /* example {CONTACT_NAME: class=form-control} */ - /* example {CONTACT_NAME: class=col-md-12&placeholder=".LANCONTACT_03." *} */ + /* example {CONTACT_NAME: class=col-md-12&placeholder=".LAN_CONTACT_03." *} */ function sc_contact_name($parm=null) { @@ -100,7 +100,7 @@ class contact_shortcodes extends e_shortcode $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control'; $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : ''; $value = !empty($_POST['author_name']) ? e107::getParser()->filter( $_POST['author_name']) : $userName; - return ""; + return ""; } function sc_contact_map($parm=null) @@ -174,7 +174,7 @@ class contact_shortcodes extends e_shortcode /* example {CONTACT_EMAIL} */ /* example {CONTACT_EMAIL: class=form-control} */ - /* example {CONTACT_EMAIL: class=col-md-12&placeholder=".LANCONTACT_04." *} */ + /* example {CONTACT_EMAIL: class=col-md-12&placeholder=".LAN_CONTACT_04." *} */ function sc_contact_email($parm=null) { @@ -184,21 +184,21 @@ class contact_shortcodes extends e_shortcode $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control'; $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : ''; $value = !empty($_POST['email_send'] ) ? e107::getParser()->filter($_POST['email_send'],'email') : USEREMAIL; - return ""; + return ""; } /* example {CONTACT_SUBJECT} */ /* example {CONTACT_SUBJECT: class=form-control} */ - /* example {CONTACT_SUBJECT: class=col-md-12&placeholder=".LANCONTACT_05." *} */ + /* example {CONTACT_SUBJECT: class=col-md-12&placeholder=".LAN_CONTACT_05." *} */ function sc_contact_subject($parm=null) { $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control'; $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : ''; $value = !empty($_POST['subject']) ? e107::getParser()->filter($_POST['subject']) : ''; - return ""; + return ""; } @@ -220,7 +220,7 @@ class contact_shortcodes extends e_shortcode $value = !empty($_POST['body']) ? stripslashes($_POST['body']) : ''; - return ""; + return ""; } @@ -230,7 +230,7 @@ class contact_shortcodes extends e_shortcode { $class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-primary button'; - return ""; + return ""; } function sc_contact_gdpr_check($parm=null) @@ -250,9 +250,9 @@ class contact_shortcodes extends e_shortcode } $pp = e107::getParser()->replaceConstants($pp, 'full'); $class = (!empty($parm['class'])) ? $parm['class'] : ''; - $link = sprintf('%s', $class, $pp, LANCONTACT_22); + $link = sprintf('%s', $class, $pp, LAN_CONTACT_22); - return e107::getParser()->lanVars(LANCONTACT_23, $link); + return e107::getParser()->lanVars(LAN_CONTACT_23, $link); } diff --git a/e107_core/shortcodes/single/lan.php b/e107_core/shortcodes/single/lan.php index ee701316b..5f449f52b 100644 --- a/e107_core/shortcodes/single/lan.php +++ b/e107_core/shortcodes/single/lan.php @@ -19,6 +19,6 @@ function lan_shortcode($parm = '') } elseif(ADMIN) { - return "".$parm ." is undefined"; // debug info + return "".$parm ." is undefined"; // debug info } } diff --git a/e107_core/templates/contact_template.php b/e107_core/templates/contact_template.php index 79cff576f..7e7c9c005 100644 --- a/e107_core/templates/contact_template.php +++ b/e107_core/templates/contact_template.php @@ -18,9 +18,9 @@ $CONTACT_WRAPPER['info']['CONTACT_INFO: type=message'] = "

{---}

"; $CONTACT_WRAPPER['info']['CONTACT_INFO: type=address'] = "
{GLYPH=fa-map-marker} {---}
"; $CONTACT_WRAPPER['info']['CONTACT_INFO: type=email1'] = "
{GLYPH=fa-envelope} {---}
"; $CONTACT_WRAPPER['info']['CONTACT_INFO: type=email2'] = "
{GLYPH=fa-envelope} {---}
"; -$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "
{GLYPH=fas-phone-alt} {---}
"; -$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "
{GLYPH=fas-phone-alt} {---}
"; -$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "
{GLYPH=fas-phone-alt} {---}
"; +$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "
{GLYPH=fas-phone} {---}
"; +$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "
{GLYPH=fas-phone} {---}
"; +$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "
{GLYPH=fas-phone} {---}
"; $CONTACT_WRAPPER['info']['CONTACT_INFO: type=fax'] = "
{GLYPH=fa-fax} {---}
"; $CONTACT_WRAPPER['info']['CONTACT_INFO: type=hours'] = "
{GLYPH=fa-clock} {---}
"; @@ -59,21 +59,21 @@ $CONTACT_TEMPLATE['info'] = " $CONTACT_TEMPLATE['menu'] = '
- + {CONTACT_NAME}
- + {CONTACT_EMAIL}
- + {CONTACT_BODY=rows=5&cols=30}
-
+
- +
{CONTACT_GDPR_LINK}
@@ -86,38 +86,37 @@ $CONTACT_TEMPLATE['menu'] = ' // Shortcode wrappers. $CONTACT_WRAPPER['form']['CONTACT_IMAGECODE'] = "
{---}"; $CONTACT_WRAPPER['form']['CONTACT_IMAGECODE_INPUT'] = "{---}
"; -$CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = "
{---}".LANCONTACT_07."
"; -$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "
{---}
"; +$CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = "
{---}{LAN=CONTACT_07}
"; +$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "
{---}
"; $CONTACT_TEMPLATE['form'] = " -
- + {CONTACT_PERSON} -
+
{CONTACT_NAME}
-
+
{CONTACT_EMAIL}
-
+
{CONTACT_SUBJECT}
{CONTACT_EMAIL_COPY} -
+
{CONTACT_BODY}
{CONTACT_IMAGECODE} {CONTACT_IMAGECODE_INPUT} -
+
- +
{CONTACT_GDPR_LINK}
@@ -127,7 +126,6 @@ $CONTACT_TEMPLATE['form'] = "
{CONTACT_SUBMIT_BUTTON}
- "; diff --git a/e107_languages/English/lan_contact.php b/e107_languages/English/lan_contact.php index 6ac74db5c..34180afe7 100644 --- a/e107_languages/English/lan_contact.php +++ b/e107_languages/English/lan_contact.php @@ -15,31 +15,31 @@ */ -define("LANCONTACT_00", "Contact Us"); -define("LANCONTACT_01", "Contact Details"); -define("LANCONTACT_02", "Contact Form"); -define("LANCONTACT_03", "Enter your name"); -define("LANCONTACT_04", "Enter your e-mail address"); -define("LANCONTACT_05", "Message subject"); -define("LANCONTACT_06", "Message"); -define("LANCONTACT_07", "Email a copy of this message to your own address "); -define("LANCONTACT_08", "Send"); -define("LANCONTACT_09", "Your message was sent."); -define("LANCONTACT_10", "There was a problem sending your message."); -define("LANCONTACT_11", "Please check your email address and resubmit the contact form."); -define("LANCONTACT_12", "Your message is too short."); -define("LANCONTACT_13", "Please include a subject."); +define("LAN_CONTACT_00", "Contact Us"); +define("LAN_CONTACT_01", "Contact Details"); +define("LAN_CONTACT_02", "Contact Form"); +define("LAN_CONTACT_03", "Enter your name"); +define("LAN_CONTACT_04", "Enter your e-mail address"); +define("LAN_CONTACT_05", "Message subject"); +define("LAN_CONTACT_06", "Message"); +define("LAN_CONTACT_07", "Email a copy of this message to your own address "); +define("LAN_CONTACT_08", "Send"); +define("LAN_CONTACT_09", "Your message was sent."); +define("LAN_CONTACT_10", "There was a problem sending your message."); +define("LAN_CONTACT_11", "Please check your email address and resubmit the contact form."); +define("LAN_CONTACT_12", "Your message is too short."); +define("LAN_CONTACT_13", "Please include a subject."); -define("LANCONTACT_14", "Send message to"); -define("LANCONTACT_15", "Incorrect code entered"); -define("LANCONTACT_16", "You must be [registered] and signed-in to use this form."); -define("LANCONTACT_17", "Please enter your name."); -define("LANCONTACT_18", "Please enter your e-mail address."); -define("LANCONTACT_19", "Please enter the subject for your e-mail."); -define("LANCONTACT_20", "Please enter your message for us."); -define("LANCONTACT_21", "I consent to having this website store my submitted information so they can respond to my inquiry"); // By using this form, you agree to the storage and processing of your data through this site."); -define("LANCONTACT_22", "Privacy policy"); -define("LANCONTACT_23", "You can find our privacy policy here: [x]"); -define("LANCONTACT_24", "GDPR Agreement"); +define("LAN_CONTACT_14", "Send message to"); +define("LAN_CONTACT_15", "Incorrect code entered"); +define("LAN_CONTACT_16", "You must be [registered] and signed-in to use this form."); +define("LAN_CONTACT_17", "Please enter your name."); +define("LAN_CONTACT_18", "Please enter your e-mail address."); +define("LAN_CONTACT_19", "Please enter the subject for your e-mail."); +define("LAN_CONTACT_20", "Please enter your message for us."); +define("LAN_CONTACT_21", "I consent to having this website store my submitted information so they can respond to my inquiry"); // By using this form, you agree to the storage and processing of your data through this site."); +define("LAN_CONTACT_22", "Privacy policy"); +define("LAN_CONTACT_23", "You can find our privacy policy here: [x]"); +define("LAN_CONTACT_24", "GDPR Agreement"); diff --git a/e107_plugins/contact/contact_menu.php b/e107_plugins/contact/contact_menu.php index 964e6b7a8..4c3fae385 100644 --- a/e107_plugins/contact/contact_menu.php +++ b/e107_plugins/contact/contact_menu.php @@ -15,9 +15,9 @@ $foot = ''; $template = e107::getCoreTemplate('contact','menu'); $contact_shortcodes = e107::getScBatch('contact'); -$text = $tp->parseTemplate($head. $template . $foot, true, $contact_shortcodes); +$text = e107::getParser()->parseTemplate($head. $template . $foot, true, $contact_shortcodes); -$ns->tablerender(LANCONTACT_00, $text, 'contact-menu'); +e107::getRender()->tablerender(defset('LAN_CONTACT_00', 'Contact Us'), $text, 'contact-menu');