1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Contact LANs updated to v2 specifications. BC fix included.

This commit is contained in:
Cameron
2021-03-29 17:50:51 -07:00
parent dbefbe4630
commit 0876e0d43b
6 changed files with 83 additions and 90 deletions

View File

@@ -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('', "<div class='alert alert-success'>" . LANCONTACT_09 . "</div>"); // ignore and leave them none the wiser.
$ns->tablerender('', "<div class='alert alert-success'>" . LAN_CONTACT_09 . "</div>"); // 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("<a class='alert-link' href='" . e_SIGNUP . "'>", "</a>");
$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, "<div class='alert alert-info'>" . str_replace($srch, $repl, $message) . "</div>", "contact");
e107::getRender()->tablerender(LAN_CONTACT_02, "<div class='alert alert-info'>" . str_replace($srch, $repl, $message) . "</div>", "contact");
}
}
e107::lan('core','contact');
e107::title(LANCONTACT_00);
e107::title(LAN_CONTACT_00);
e107::canonical('contact');
e107::route('contact/index');

View File

@@ -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 "<input type='text' id='contactName' title='".LANCONTACT_17."' aria-label='".LANCONTACT_17."' aria-labelledby='contactName' name='author_name' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
return "<input type='text' id='contactName' title='".LAN_CONTACT_17."' aria-label='".LAN_CONTACT_17."' aria-labelledby='contactName' name='author_name' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
}
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 "<input type='email' ".$disabled." id='contactEmail' title='".LANCONTACT_18."' aria-label='".LANCONTACT_18."' aria-labelledby='contactEmail' name='email_send' required='required' size='30' ".$placeholder." class='".$class."' value='".$value."' />";
return "<input type='email' ".$disabled." id='contactEmail' title='".LAN_CONTACT_18."' aria-label='".LAN_CONTACT_18."' aria-labelledby='contactEmail' name='email_send' required='required' size='30' ".$placeholder." class='".$class."' value='".$value."' />";
}
/* 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 "<input type='text' id='contactSubject' title='".LANCONTACT_19."' aria-label='".LANCONTACT_19."' aria-labelledby='contactSubject' name='subject' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
return "<input type='text' id='contactSubject' title='".LAN_CONTACT_19."' aria-label='".LAN_CONTACT_19."' aria-labelledby='contactSubject' name='subject' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
}
@@ -220,7 +220,7 @@ class contact_shortcodes extends e_shortcode
$value = !empty($_POST['body']) ? stripslashes($_POST['body']) : '';
return "<textarea cols='{$cols}' id='contactBody' rows='{$rows}' title='".LANCONTACT_20."' aria-label='".LANCONTACT_20."' aria-labelledby='contactBody' name='body' ".$placeholder." required='required' class='".$class."'>".$value."</textarea>";
return "<textarea cols='{$cols}' id='contactBody' rows='{$rows}' title='".LAN_CONTACT_20."' aria-label='".LAN_CONTACT_20."' aria-labelledby='contactBody' name='body' ".$placeholder." required='required' class='".$class."'>".$value."</textarea>";
}
@@ -230,7 +230,7 @@ class contact_shortcodes extends e_shortcode
{
$class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-primary button';
return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='".$class."' />";
return "<input type='submit' name='send-contactus' value=\"".LAN_CONTACT_08."\" class='".$class."' />";
}
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('<span class="%s"><a href="%s" target="_blank">%s</a></span>', $class, $pp, LANCONTACT_22);
$link = sprintf('<span class="%s"><a href="%s" target="_blank">%s</a></span>', $class, $pp, LAN_CONTACT_22);
return e107::getParser()->lanVars(LANCONTACT_23, $link);
return e107::getParser()->lanVars(LAN_CONTACT_23, $link);
}

View File

@@ -19,6 +19,6 @@ function lan_shortcode($parm = '')
}
elseif(ADMIN)
{
return "<span class='alert alert-danger'><strong>".$parm ."</strong> is undefined</span>"; // debug info
return "<span class='alert alert-danger' style='padding:0'><strong>".$parm ."</strong> is undefined</span>"; // debug info
}
}

View File

@@ -18,9 +18,9 @@ $CONTACT_WRAPPER['info']['CONTACT_INFO: type=message'] = "<p>{---}</p>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=address'] = "<address>{GLYPH=fa-map-marker} {---}</address>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email1'] = "<div>{GLYPH=fa-envelope} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email2'] = "<div>{GLYPH=fa-envelope} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "<div>{GLYPH=fas-phone} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "<div>{GLYPH=fas-phone} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "<div>{GLYPH=fas-phone} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=fax'] = "<div>{GLYPH=fa-fax} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=hours'] = "<div>{GLYPH=fa-clock} {---}</div>";
@@ -59,21 +59,21 @@ $CONTACT_TEMPLATE['info'] = "
$CONTACT_TEMPLATE['menu'] = '
<div class="contactMenuForm">
<div class="control-group form-group mb-3">
<label for="contactName">'.LANCONTACT_03.'</label>
<label for="contactName">{LAN=CONTACT_03}</label>
{CONTACT_NAME}
</div>
<div class="control-group form-group mb-3">
<label class="control-label" for="contactEmail">'.LANCONTACT_04.'</label>
<label class="control-label" for="contactEmail">{LAN=CONTACT_04}</label>
{CONTACT_EMAIL}
</div>
<div class="control-group form-group mb-3">
<label for="contactBody" >'.LANCONTACT_06.'</label>
<label for="contactBody" >{LAN=CONTACT_06}</label>
{CONTACT_BODY=rows=5&cols=30}
</div>
<div class="form-group mb-3"><label for="gdpr">'.LANCONTACT_24.'</label>
<div class="form-group mb-3"><label for="gdpr">{LAN=CONTACT_24}</label>
<div class="checkbox form-check">
<label>{CONTACT_GDPR_CHECK} '.LANCONTACT_21.'</label>
<label>{CONTACT_GDPR_CHECK} {LAN=CONTACT_21}</label>
<div class="help-block">{CONTACT_GDPR_LINK}</div>
</div>
</div>
@@ -86,38 +86,37 @@ $CONTACT_TEMPLATE['menu'] = '
// Shortcode wrappers.
$CONTACT_WRAPPER['form']['CONTACT_IMAGECODE'] = "<div class='control-group form-group'><label for='code-verify'>{CONTACT_IMAGECODE_LABEL}</label> {---}";
$CONTACT_WRAPPER['form']['CONTACT_IMAGECODE_INPUT'] = "{---}</div>";
$CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = "<div class='control-group form-group'>{---}".LANCONTACT_07."</div>";
$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "<div class='control-group form-group'><label for='contactPerson'>".LANCONTACT_14."</label>{---}</div>";
$CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = "<div class='control-group form-group'>{---}{LAN=CONTACT_07}</div>";
$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "<div class='control-group form-group'><label for='contactPerson'>{LAN=CONTACT_14}</label>{---}</div>";
$CONTACT_TEMPLATE['form'] = "
<form action='".e_SELF."' method='post' id='contactForm' >
<form action='".e_SELF."' method='post' id='contactForm' class='mt-5' >
{CONTACT_PERSON}
<div class='control-group form-group'><label for='contactName'>".LANCONTACT_03."</label>
<div class='control-group form-group'><label for='contactName'>{LAN=CONTACT_03}</label>
{CONTACT_NAME}
</div>
<div class='control-group form-group'><label for='contactEmail'>".LANCONTACT_04."</label>
<div class='control-group form-group'><label for='contactEmail'>{LAN=CONTACT_04}</label>
{CONTACT_EMAIL}
</div>
<div class='control-group form-group'><label for='contactSubject'>".LANCONTACT_05."</label>
<div class='control-group form-group'><label for='contactSubject'>{LAN=CONTACT_05}</label>
{CONTACT_SUBJECT}
</div>
{CONTACT_EMAIL_COPY}
<div class='control-group form-group'><label for='contactBody'>".LANCONTACT_06."</label>
<div class='control-group form-group'><label for='contactBody'>{LAN=CONTACT_06}</label>
{CONTACT_BODY}
</div>
{CONTACT_IMAGECODE}
{CONTACT_IMAGECODE_INPUT}
<div class='form-group'><label for='gdpr'>".LANCONTACT_24."</label>
<div class='form-group'><label for='gdpr'>{LAN=CONTACT_24}</label>
<div class='checkbox'>
<label>{CONTACT_GDPR_CHECK} ".LANCONTACT_21."</label>
<label>{CONTACT_GDPR_CHECK} {LAN=CONTACT_21}</label>
<div class='help-block'>{CONTACT_GDPR_LINK}</div>
</div>
</div>
@@ -127,7 +126,6 @@ $CONTACT_TEMPLATE['form'] = "
<div class='form-group'>
{CONTACT_SUBMIT_BUTTON}
</div>
</form>";

View File

@@ -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");

View File

@@ -15,9 +15,9 @@ $foot = '</form>';
$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');