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

Issue #4372 - Enhancement: Contact page info. Requires database update.

This commit is contained in:
Cameron
2021-02-15 10:58:49 -08:00
parent 523fae8582
commit c94b1867a3
7 changed files with 450 additions and 300 deletions

View File

@@ -10,288 +10,296 @@
* *
*/ */
require_once("class2.php"); require_once(__DIR__."/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);
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('', "<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 />
<table class='table'>
<tr>
<td>IP:</td><td>".e107::getIPHandler()->getIP(TRUE)."</td></tr>";
if (USER)
{
$body .= "<tr><td>User:</td><td>#".USERID." ".USERNAME."</td></tr>";
}
if(empty($_POST['contact_person']) && !empty($pref['sitecontacts'])) // only 1 person, so contact_person not posted.
{
if($pref['sitecontacts'] == e_UC_MAINADMIN)
{
$query = "user_perms = '0' OR user_perms = '0.' ";
}
elseif($pref['sitecontacts'] == e_UC_ADMIN)
{
$query = "user_admin = 1 ";
}
else
{
$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
}
}
else
{
$query = "user_id = ".intval($_POST['contact_person']);
}
if($sql->gen("SELECT user_name,user_email FROM `#user` WHERE ".$query." LIMIT 1"))
{
$row = $sql->fetch();
$send_to = $row['user_email'];
$send_to_name = $row['user_name'];
}
else
{
$send_to = SITEADMINEMAIL;
$send_to_name = ADMIN;
}
// ----------------------
$CONTACT_EMAIL = e107::getCoreTemplate('contact','email');
unset($_POST['contact_person'], $_POST['author_name'], $_POST['email_send'] , $_POST['subject'], $_POST['body'], $_POST['rand_num'], $_POST['code_verify'], $_POST['send-contactus']);
if(!empty($_POST)) // support for custom fields in contact template.
{
foreach($_POST as $k=>$v)
{
$body .= "<tr><td>".$k.":</td><td>".$tp->toEmail($v, true,'RAWTEXT')."</td></tr>";
}
}
$body .= "</table>";
if(!empty($CONTACT_EMAIL['subject']))
{
$vars = array('CONTACT_SUBJECT'=>$subject,'CONTACT_PERSON'=>$send_to_name);
if(!empty($_POST)) // support for custom fields in contact template.
{
foreach($_POST as $k=>$v)
{
$scKey = strtoupper($k);
$vars[$scKey] =$tp->toEmail($v, true,'RAWTEXT');
}
}
$subject = $tp->simpleParse($CONTACT_EMAIL['subject'],$vars);
}
// -----------------------
// Send as default sender to avoid spam issues. Use 'replyto' instead.
$eml = array(
'subject' => $subject,
'sender_name' => $sender_name,
'body' => $body,
'replyto' => $sender,
'replytonames' => $sender_name,
'template' => 'default'
);
$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;
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('', "<div class='alert alert-success'>".$message."</div>");
require_once(FOOTERF);
exit;
}
else
{
message_handler("P_ALERT", $error);
}
}
if(deftrue('SITECONTACTINFO') || !empty($pref['contact_info']))
{
if(!isset($CONTACT_INFO))
{
$CONTACT_INFO = e107::getCoreTemplate('contact','info');
}
$contact_shortcodes = e107::getScBatch('contact');
$contact_shortcodes->wrapper('contact/info');
$text = $tp->parseTemplate($CONTACT_INFO, true, $contact_shortcodes);
$ns->tablerender(LANCONTACT_01, $text,"contact-info");
}
if(check_class($active) && isset($pref['sitecontacts']) && $pref['sitecontacts'] != e_UC_NOBODY)
{
// Wrapper support
$contact_shortcodes->wrapper('contact/form');
$text = $tp->parseTemplate($CONTACT_FORM, true, $contact_shortcodes);
if(trim($text) != "")
{
$ns->tablerender(LANCONTACT_02, $text, "contact-form");
}
}
elseif($active == e_UC_MEMBER && ($pref['sitecontacts'] != e_UC_NOBODY))
{
$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.";
$ns->tablerender(LANCONTACT_02, "<div class='alert alert-info'>".str_replace($srch, $repl, $message)."</div>", "contact");
}
}
} }
require_once(e_HANDLER."secure_img_handler.php");
$sec_img = new secure_image;
e107::lan('core','contact'); e107::lan('core','contact');
if(!defined('PAGE_NAME')) e107::title(LANCONTACT_00);
{
define('PAGE_NAME', LANCONTACT_00); // FIX ME
}
e107::canonical('contact'); e107::canonical('contact');
require_once(HEADERF); require_once(HEADERF);
$tp = e107::getParser(); new contact_front;
$ns = e107::getRender();
if (!vartrue($CONTACT_FORM))
{
if (file_exists(THEME."contact_template.php"))
{
require_once(THEME."contact_template.php");
}
else
{
// Redirect Page if no contact-form or contact-info is available.
if(($pref['sitecontacts']== e_UC_NOBODY) && trim(SITECONTACTINFO) == "")
{
e107::getRedirect()->redirect(e_BASE."index.php");
exit;
}
$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('', "<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 />
<table class='table'>
<tr>
<td>IP:</td><td>".e107::getIPHandler()->getIP(TRUE)."</td></tr>";
if (USER)
{
$body .= "<tr><td>User:</td><td>#".USERID." ".USERNAME."</td></tr>";
}
if(empty($_POST['contact_person']) && !empty($pref['sitecontacts'])) // only 1 person, so contact_person not posted.
{
if($pref['sitecontacts'] == e_UC_MAINADMIN)
{
$query = "user_perms = '0' OR user_perms = '0.' ";
}
elseif($pref['sitecontacts'] == e_UC_ADMIN)
{
$query = "user_admin = 1 ";
}
else
{
$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
}
}
else
{
$query = "user_id = ".intval($_POST['contact_person']);
}
if($sql->gen("SELECT user_name,user_email FROM `#user` WHERE ".$query." LIMIT 1"))
{
$row = $sql->fetch();
$send_to = $row['user_email'];
$send_to_name = $row['user_name'];
}
else
{
$send_to = SITEADMINEMAIL;
$send_to_name = ADMIN;
}
// ----------------------
$CONTACT_EMAIL = e107::getCoreTemplate('contact','email');
unset($_POST['contact_person'], $_POST['author_name'], $_POST['email_send'] , $_POST['subject'], $_POST['body'], $_POST['rand_num'], $_POST['code_verify'], $_POST['send-contactus']);
if(!empty($_POST)) // support for custom fields in contact template.
{
foreach($_POST as $k=>$v)
{
$body .= "<tr><td>".$k.":</td><td>".$tp->toEmail($v, true,'RAWTEXT')."</td></tr>";
}
}
$body .= "</table>";
if(!empty($CONTACT_EMAIL['subject']))
{
$vars = array('CONTACT_SUBJECT'=>$subject,'CONTACT_PERSON'=>$send_to_name);
if(!empty($_POST)) // support for custom fields in contact template.
{
foreach($_POST as $k=>$v)
{
$scKey = strtoupper($k);
$vars[$scKey] =$tp->toEmail($v, true,'RAWTEXT');
}
}
$subject = $tp->simpleParse($CONTACT_EMAIL['subject'],$vars);
}
// -----------------------
// Send as default sender to avoid spam issues. Use 'replyto' instead.
$eml = array(
'subject' => $subject,
'sender_name' => $sender_name,
'body' => $body,
'replyto' => $sender,
'replytonames' => $sender_name,
'template' => 'default'
);
$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;
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('', "<div class='alert alert-success'>".$message."</div>");
require_once(FOOTERF);
exit;
}
else
{
message_handler("P_ALERT", $error);
}
}
if(SITECONTACTINFO)
{
if(!isset($CONTACT_INFO))
{
$CONTACT_INFO = e107::getCoreTemplate('contact','info');
}
$text = $tp->parseTemplate($CONTACT_INFO, true, vartrue($contact_shortcodes));
$ns->tablerender(LANCONTACT_01, $text,"contact-info");
}
if(check_class($active) && isset($pref['sitecontacts']) && $pref['sitecontacts'] != e_UC_NOBODY)
{
$contact_shortcodes = e107::getScBatch('contact');
// Wrapper support
$contact_shortcodes->wrapper('contact/form');
$text = $tp->parseTemplate($CONTACT_FORM, true, $contact_shortcodes);
if(trim($text) != "")
{
$ns->tablerender(LANCONTACT_02, $text, "contact-form");
}
}
elseif($active == e_UC_MEMBER && ($pref['sitecontacts'] != e_UC_NOBODY))
{
$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.";
$ns->tablerender(LANCONTACT_02, "<div class='alert alert-info'>".str_replace($srch, $repl, $message)."</div>", "contact");
}
require_once(FOOTERF); require_once(FOOTERF);

View File

@@ -38,9 +38,8 @@ e107::coreLan('mailout', true);
require_once (e_ADMIN."auth.php"); require_once (e_ADMIN."auth.php");
$e_userclass = e107::getUserClass(); $e_userclass = e107::getUserClass();
require_once (e_HANDLER."user_extended_class.php");
require_once(e_HANDLER.'mailout_admin_class.php'); // Admin tasks handler require_once(e_HANDLER.'mailout_admin_class.php'); // Admin tasks handler
$ue = new e107_user_extended(); $ue = e107::getUserExt();
$core_pref = e107::getConfig(); $core_pref = e107::getConfig();
if(!$core_pref->get('timezone')) if(!$core_pref->get('timezone'))
@@ -321,7 +320,7 @@ $text = "
<form method='post' action='".e_SELF."' autocomplete='off'> <form method='post' action='".e_SELF."' autocomplete='off'>
<input type='hidden' name='e-token' value='".defset('e_TOKEN')."' /> <input type='hidden' name='e-token' value='".defset('e_TOKEN')."' />
<fieldset id='core-prefs-main'> <fieldset id='core-prefs-main'>
<legend>".PRFLAN_1."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_1."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -423,7 +422,7 @@ $text .= "
// Email and Contact Information -------------- // Email and Contact Information --------------
$text .= "<fieldset class='e-hideme' id='core-prefs-email'> $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
<legend>".PRFLAN_13."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_13."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -492,8 +491,53 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
<tr> <tr>
<td><label for='sitecontactinfo'>".PRFLAN_162."</label>".$frm->help(PRFLAN_163)."</td> <td><label for='sitecontactinfo'>".PRFLAN_162."</label>".$frm->help(PRFLAN_163)."</td>
<td> <td>";
".$frm->textarea('sitecontactinfo', $pref['sitecontactinfo'], 6, 59, array('size'=>'xxlarge'))."
if(!empty($pref['sitecontactinfo']))
{
$text .= $frm->textarea('sitecontactinfo', $pref['sitecontactinfo'], 6, 59, array('size'=>'xxlarge'));
}
else
{
$text .= "<table class='table table-bordered table-striped' style='margin:0; max-width:690px'>
<colgroup>
<col style='width:150px' />
<col />
</colgroup>
<tr>";
$text .= "<td>Company</td>
<td>".$frm->text('contact_info[company]', varset($pref['contact_info']['company']), 200, ['size'=>'block-level', 'placeholder'=>'My Company'])."</td>
</tr>";
$text .= "<td>Address</td>
<td>".$frm->textarea('contact_info[address]', varset($pref['contact_info']['address']), 2, 80, ['size'=>'block-level', 'placeholder'=>'123 address st. city, state, zip/postal, country'])."</td>
</tr>";
$contactFields = [
'phone1' => ['label'=>'Phone', 'placeholder'=>'+1-555-555-5555'],
'phone2' => ['label'=>'Phone', 'placeholder'=>'+1-444-444-4444'],
'phone3' => ['label'=>'Phone', 'placeholder'=>'+1-333-333-3333'],
'fax' => ['label'=>'Fax', 'placeholder'=>'+1-555-555-5555'],
'email1' => ['label'=>LAN_EMAIL, 'placeholder'=>'info@mycompany.com'],
'email2' => ['label'=>LAN_EMAIL, 'placeholder'=>'sales@mycompany.com']
];
foreach($contactFields as $type => $var)
{
$text .= "<td>".$var['label']."</td>
<td>".$frm->text('contact_info['.$type.']', varset($pref['contact_info'][$type]), 200, ['size'=>'block-level', 'placeholder'=>varset($var['placeholder'])])."</td>
</tr>
";
}
$text .= "</table>";
}
$text .= "
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -544,7 +588,7 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
// GDPR Settings ----------------------------- // GDPR Settings -----------------------------
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-gdpr'> <fieldset class='e-hideme' id='core-prefs-gdpr'>
<legend>".PRFLAN_277."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_277."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -580,7 +624,7 @@ $text .= "
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-display'> <fieldset class='e-hideme' id='core-prefs-display'>
<legend>".PRFLAN_13."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_13."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -630,7 +674,7 @@ $text .= "
*/ */
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-admindisp'> <fieldset class='e-hideme' id='core-prefs-admindisp'>
<legend>".PRFLAN_77."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_77."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -703,7 +747,7 @@ $date4 = $tp->toDate(time(),"input");
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-date'> <fieldset class='e-hideme' id='core-prefs-date'>
<legend>".PRFLAN_21."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_21."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -817,7 +861,7 @@ $elements = array(1=> PRFLAN_259, 2=> PRFLAN_260, 0=>LAN_DISABLED);
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-registration'> <fieldset class='e-hideme' id='core-prefs-registration'>
<legend>".PRFLAN_28."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_28."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -962,7 +1006,7 @@ $prefOptionPassword = (isset($pref['signup_option_password'])) ? $pref['signup_o
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-signup'> <fieldset class='e-hideme' id='core-prefs-signup'>
<legend>".PRFLAN_19."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_19."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1166,7 +1210,7 @@ if ($savePrefs) $core_pref->setPref($pref)->save(false, true);
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-textpost'> <fieldset class='e-hideme' id='core-prefs-textpost'>
<legend>".PRFLAN_101."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_286."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1332,7 +1376,7 @@ $hasGD = extension_loaded("gd");
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-security'> <fieldset class='e-hideme' id='core-prefs-security'>
<legend>".PRFLAN_47."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_47."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1575,7 +1619,7 @@ $text .= "
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-comments'> <fieldset class='e-hideme' id='core-prefs-comments'>
<legend>".PRFLAN_87."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_87."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1646,7 +1690,7 @@ $text .= "
</tbody> </tbody>
</table> </table>
<legend>".PRFLAN_209."</legend> <h4 class='caption'>".PRFLAN_209."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1679,7 +1723,7 @@ $text .= "
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-uploads'> <fieldset class='e-hideme' id='core-prefs-uploads'>
<legend>".PRFLAN_238."</legend>"; <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_238."</h4>";
$upload_max_filesize = ini_get('upload_max_filesize'); $upload_max_filesize = ini_get('upload_max_filesize');
@@ -1764,7 +1808,8 @@ $text .= "
</fieldset>"; </fieldset>";
$text .= "<fieldset class='e-hideme' id='core-prefs-javascript'>"; $text .= "<fieldset class='e-hideme' id='core-prefs-javascript'>
<h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_257 . "</h4>";
if(E107_DEBUG_LEVEL > 0) if(E107_DEBUG_LEVEL > 0)
{ {
@@ -1772,7 +1817,7 @@ if(E107_DEBUG_LEVEL > 0)
// Javascript Control // Javascript Control
$text .= " $text .= "
<legend>" . PRFLAN_242 . "</legend> <h4>".PRFLAN_242 . "</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1972,7 +2017,7 @@ $text .= "</fieldset>";
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-advanced'> <fieldset class='e-hideme' id='core-prefs-advanced'>
<legend>".PRFLAN_149."</legend> <h4 class='caption'>".PRFLAN_53.SEP.PRFLAN_149."</h4>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -2043,8 +2088,8 @@ $text .= "
</form> </form>
</div> </div>
"; ";
//PRFLAN_53
$ns->tablerender(PRFLAN_53, $mes->render().$text); $ns->tablerender(null, $mes->render().$text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
@@ -2107,7 +2152,7 @@ function prefs_adminmenu()
$var['core-prefs-admindisp']['text'] = PRFLAN_77; $var['core-prefs-admindisp']['text'] = PRFLAN_77;
$var['core-prefs-admindisp']['image_src'] = 'fa-dashboard.glyph'; $var['core-prefs-admindisp']['image_src'] = 'fa-dashboard.glyph';
$var['core-prefs-textpost']['text'] = PRFLAN_101; $var['core-prefs-textpost']['text'] = PRFLAN_286;
$var['core-prefs-textpost']['image_src'] = 'fa-filter.glyph'; $var['core-prefs-textpost']['image_src'] = 'fa-filter.glyph';
$var['core-prefs-security']['text'] = PRFLAN_47; $var['core-prefs-security']['text'] = PRFLAN_47;

View File

@@ -103,6 +103,71 @@ class contact_shortcodes extends e_shortcode
return "<input type='text' id='contactName' title='".LANCONTACT_17."' name='author_name' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />"; return "<input type='text' id='contactName' title='".LANCONTACT_17."' name='author_name' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
} }
function sc_contact_map($parm=null)
{
$pref = e107::getPref('contact_info');
if(empty($pref['address']))
{
return null;
}
$address = trim($pref['address']);
$zoom = varset($parm['zoom'], 'street');
$zoomOpts = [
'street' => 17,
'district' => 14,
'city' => 12,
];
$zoom = (int) varset($zoomOpts[$zoom],$zoom);
// &z='.$zoom.'
return '<iframe class="sc-contact-map" src="https://maps.google.com/maps?q='.$address.'&output=embed&z='.$zoom.'"></iframe>';
}
function sc_contact_info($parm=null)
{
$ipref = e107::getPref('contact_info');
$type = varset($parm['type']);
if(empty($type) || empty($ipref[$type]))
{
return null;
}
$tp = e107::getParser();
$ret = '';
switch($type)
{
case "company":
$ret = $tp->toHTML($ipref[$type], true, 'TITLE');
break;
case 'email1':
case 'email2':
case 'phone1':
case 'phone2':
case 'phone3':
case 'fax':
$ret = $tp->obfuscate($ipref[$type]);
break;
default:
$ret = $tp->toHTML($ipref[$type], true, 'BODY');
// code to be executed if n is different from all labels;
}
return $ret;
}
/* example {CONTACT_EMAIL} */ /* example {CONTACT_EMAIL} */

View File

@@ -12,11 +12,40 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
$CONTACT_WRAPPER['info']['CONTACT_INFO'] = "<div>{---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=company'] = "<h4>{---}</h4>";
$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=fax'] = "<div>{GLYPH=fa-fax} {---}</div>";
$CONTACT_TEMPLATE['info'] = " $CONTACT_TEMPLATE['info'] = "
<div id='contactInfo' > <div id='contactInfo' >
<address>{SITECONTACTINFO}</address>
<!-- Backward Compat. Contact Info -->
{SITECONTACTINFO}
<!-- New Contact Info -->
{CONTACT_INFO: type=company}
<div class='row'>
<div class ='col-md-6 col-lg-4 h=100'>
{CONTACT_INFO: type=address}
<div class='form-group'>
{CONTACT_INFO: type=phone1}
{CONTACT_INFO: type=phone2}
{CONTACT_INFO: type=phone3}
{CONTACT_INFO: type=fax}
</div>
{CONTACT_INFO: type=email1}
{CONTACT_INFO: type=email2}
</div>
<div class ='col-md-6 col-lg-8 h=100'>
{CONTACT_MAP: zoom=city}
</div>
</div>
</div> </div>
"; ";

View File

@@ -33,6 +33,8 @@
<core name="comments_moderate">247</core> <core name="comments_moderate">247</core>
<core name="comments_sort">desc</core> <core name="comments_sort">desc</core>
<core name="compress_output">0</core> <core name="compress_output">0</core>
<core name="contact_info"><![CDATA[array (
)]]></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="contact_filter"></core>

View File

@@ -61,7 +61,7 @@ define("PRFLAN_59", "ticking will restrict all areas apart from the front page a
define("PRFLAN_60", "Use SSL only"); define("PRFLAN_60", "Use SSL only");
define("PRFLAN_61", "Redirect all traffic through SSL (https)"); define("PRFLAN_61", "Redirect all traffic through SSL (https)");
define("PRFLAN_76", "Display CAPTCHA on signup page."); define("PRFLAN_76", "Display CAPTCHA on signup page.");
define("PRFLAN_77", "Admin Display Options "); define("PRFLAN_77", "Admin Display");
define("PRFLAN_78", "Leave blank to disable"); define("PRFLAN_78", "Leave blank to disable");
// define("PRFLAN_80", "Click here to view"); // define("PRFLAN_80", "Click here to view");
define("PRFLAN_81", "Display CAPTCHA on login page."); define("PRFLAN_81", "Display CAPTCHA on login page.");
@@ -99,7 +99,7 @@ define("PRFLAN_95", "Display plugins info:");
define("PRFLAN_96", "Will display info on all admin pages for each plugin supporting this type of feature"); define("PRFLAN_96", "Will display info on all admin pages for each plugin supporting this type of feature");
define("PRFLAN_97", "Unique 'Plugins info' menu:"); define("PRFLAN_97", "Unique 'Plugins info' menu:");
define("PRFLAN_98", "If disabled, each plugin will display its own info in an individual menu. If enabled all info will be displayed in one menu."); define("PRFLAN_98", "If disabled, each plugin will display its own info in an individual menu. If enabled all info will be displayed in one menu.");
define("PRFLAN_101", "Text Rendering"); // define("PRFLAN_101", "Text Rendering");
define("PRFLAN_102", "Replace clickable URLs"); define("PRFLAN_102", "Replace clickable URLs");
define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs or Email addresses are displayed as a hyperlink using text from the textboxes below. This keeps very long URLs/Emails from breaking layout."); define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs or Email addresses are displayed as a hyperlink using text from the textboxes below. This keeps very long URLs/Emails from breaking layout.");
define("PRFLAN_104", "URL replacement text"); define("PRFLAN_104", "URL replacement text");
@@ -307,4 +307,4 @@ define("PRFLAN_282", "Session Save Method");
define("PRFLAN_283", "Display navigation-bar labels"); define("PRFLAN_283", "Display navigation-bar labels");
define("PRFLAN_284", "Collapse navigation side-bar by default"); define("PRFLAN_284", "Collapse navigation side-bar by default");
define("PRFLAN_285", "Display field help tips"); define("PRFLAN_285", "Display field help tips");
define("PRFLAN_286", "Content Filters");

View File

@@ -382,6 +382,7 @@ cursor: pointer;
#uiAlert .alert { z-index:10000; box-shadow:1px 4px 5px rgba(0,0,0,0.4) } #uiAlert .alert { z-index:10000; box-shadow:1px 4px 5px rgba(0,0,0,0.4) }
#uiAlert.notifications { top: 48%; left: 0; width: 100%; } #uiAlert.notifications { top: 48%; left: 0; width: 100%; }
#contactInfo iframe.sc-contact-map { width:100%; min-height:195px }
#login-template { max-width: 330px; margin-right: auto; margin-left: auto; } #login-template { max-width: 330px; margin-right: auto; margin-left: auto; }