add mail blocker && mail redirect

This commit is contained in:
Daniel Seifert 2017-05-30 17:10:16 +02:00
parent 6d777cd9f5
commit 440fa1a71c
3 changed files with 123 additions and 12 deletions

View File

@ -27,22 +27,25 @@ $aModule = array(
--></script>
<p style="background-color: darkred; padding: 5px;"><a href="#" style="text-decoration: underline; color: white;" onclick="showNote(); return false;"><b>Sicherheitshinweis</b></a></p>
<p style="display: none; background-color: darkred; color: white; padding: 5px;" id="secnote">Diese Shoperweiterung stellt Entwicklungshilfen zur Verf&uuml;gung, die im Livebetrieb sicherheitskritisch sein k&ouml;nnen. Es k&ouml;nnen Kunden- und Bestelldaten ausgelesen und auch Shopfunktionen manipuliert werden. Aktivieren Sie diese Erweiterung daher nur in einem Umfeld, in dem Sie Missbrauch ausschlie&szligen k&ouml;nnen. F&uuml;r entstandene Sch&auml;den lehnen wir jede Haftung ab.</p>
<ul><li>unterbindet L&ouml;schen des WKs nach Bestellabschluss</li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=thankyou&d3dev=1&d3ordernr=" target="_new">Thankyou ist ohne Bestellung aufrufbar</a></li>'.
<ul><li>unterbindet L&ouml;schen des Warenkorbs nach Bestellabschluss</li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=thankyou&d3dev=1&d3ordernr=" target="_new">Thankyou-Seite ist ohne Bestellung aufrufbar*</a></li>'.
'<li>Mail-Templates k&ouml;nnen im Browser ausgegeben werden'.
'<ul>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=owner_html&d3ordernr=" target="_new">Order Owner HTML</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=owner_plain&d3ordernr=" target="_new">Order Owner Plain</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=user_html&d3ordernr=" target="_new">Order User HTML</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=user_plain&d3ordernr=" target="_new">Order User Plain</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=owner_html&d3inquirynr=" target="_new">Inquiry Owner HTML</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=owner_plain&d3inquirynr=" target="_new">Inquiry Owner Plain</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=user_html&d3inquirynr=" target="_new">Inquiry User HTML</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=user_plain&d3inquirynr=" target="_new">Inquiry User Plain</a></li></ul>'.
'</li></ul>Jede dieser Optionen muss aus Sicherheitsgr&uuml;nden unter "Einstell." aktiviert werden. Weiterhin darf der Shop nicht im Produktivmodus betrieben werden.',
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=owner_html&d3ordernr=" target="_new">Order Owner HTML*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=owner_plain&d3ordernr=" target="_new">Order Owner Plain*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=user_html&d3ordernr=" target="_new">Order User HTML*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showOrderMailContent&type=user_plain&d3ordernr=" target="_new">Order User Plain*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=owner_html&d3inquirynr=" target="_new">Inquiry Owner HTML*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=owner_plain&d3inquirynr=" target="_new">Inquiry Owner Plain*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=user_html&d3inquirynr=" target="_new">Inquiry User HTML*</a></li>'.
'<li><a style="text-decoration: underline;" href="'.oxRegistry::getConfig()->getCurrentShopUrl(false).'index.php?cl=d3dev&fnc=showInquiryMailContent&type=user_plain&d3inquirynr=" target="_new">Inquiry User Plain*</a></li></ul>'.
'</li>'.
'<li>blockiert &uuml;bers Framework versendete Mails oder leitet diese um</li>'.
'</ul><br>Jede dieser Optionen muss aus Sicherheitsgr&uuml;nden unter "Einstell." aktiviert werden. Weiterhin darf der Shop nicht im Produktivmodus betrieben werden.<br><br>'.
'* Ordernummer an URL erg&auml;nzen, wenn bestimmte Bestellungen angezeigt werden sollen',
'en' => ''),
// 'thumbnail' => 'picture.png',
'version' => '0.1',
'version' => '1.1',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
@ -82,6 +85,18 @@ $aModule = array(
'type' => 'bool',
'value' => 'false'
),
array(
'group' => 'd3dev_mailblock',
'name' => 'blD3DevBlockMails',
'type' => 'bool',
'value' => 'false'
),
array(
'group' => 'd3dev_mailblock',
'name' => 'sD3DevRedirectMail',
'type' => 'str',
'value' => 'd3test1@shopmodule.com'
),
),
);

View File

@ -143,4 +143,92 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false));
}
protected function _sendMail()
{
if (oxRegistry::getConfig()->getActiveShop()->oxshops__oxproductive->value) {
return parent::_sendMail();
}
$this->d3clearRecipients();
$this->d3clearCC();
$this->d3clearBCC();
if (count($this->getRecipient())) {
return parent::_sendMail();
}
return true;
}
public function d3clearRecipients()
{
$aRecipients = array();
if (is_array($this->_aRecipients) && count($this->_aRecipients)) {
foreach ($this->_aRecipients as $aRecInfo) {
if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))
&& $sNewRecipient != $aRecInfo[0]
) {
$aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")";
$aRecInfo[0] = $sNewRecipient;
$aRecipients[] = $aRecInfo;
} elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) {
$aRecipients[] = $aRecInfo;
}
}
}
$this->_aRecipients = $aRecipients;
}
public function d3clearCC()
{
$aCc = array();
if (is_array($this->cc) && count($this->cc)) {
foreach ($this->cc as $aRecInfo) {
if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))
&& $sNewRecipient != $aRecInfo[0]
) {
$aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")";
$aRecInfo[0] = $sNewRecipient;
$aCc[] = $aRecInfo;
} elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) {
$aCc[] = $aRecInfo;
}
}
}
$this->cc = $aCc;
}
public function d3clearBCC()
{
$aCc = array();
if (is_array($this->bcc) && count($this->bcc)) {
foreach ($this->bcc as $aRecInfo) {
if (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))
&& $sNewRecipient != $aRecInfo[0]
) {
$aRecInfo[1] = $aRecInfo[1]." (".$aRecInfo[0].")";
$aRecInfo[0] = $sNewRecipient;
$aCc[] = $aRecInfo;
} elseif (($sNewRecipient = $this->getNewRecipient($aRecInfo[0]))) {
$aCc[] = $aRecInfo;
}
}
}
$this->bcc = $aCc;
}
public function getNewRecipient($sMailAddress)
{
if (oxRegistry::getConfig()->getConfigParam('blD3DevBlockMails')) {
return false;
} elseif (oxRegistry::getConfig()->getConfigParam('sD3DevRedirectMail')) {
return trim(oxRegistry::getConfig()->getConfigParam('sD3DevRedirectMail'));
}
return $sMailAddress;
}
}

View File

@ -46,4 +46,12 @@ $aLang = array(
'jeweiligen Mails sind im Stamm-Tab aufgelistet.<br>Für die Anzeige wird ohne Angabe der Bestellnummer die '.
'letzte vorliegende Bestellung geladen. Über den Parameter "d3ordernr=X" kann eine bestimmten Bestellung '.
'vorgegeben werden.',
'SHOP_MODULE_GROUP_d3dev_mailblock' => 'Mailversand',
'SHOP_MODULE_blD3DevBlockMails' => 'Mails an beliebige Mailadressen werden nicht '.
'versandt',
'HELP_SHOP_MODULE_blD3DevBlockMails' => 'Der Mailversand wird komplett geblockt.',
'SHOP_MODULE_sD3DevRedirectMail' => 'versendete Mails an diese Adresse umleiten',
'HELP_SHOP_MODULE_sD3DevRedirectMail' => 'Wenn leer, erfolgt keine Umleitung. Ohne '.
'zusätzliche Blockieroption werden die Mails dann an den original Empfänger gesendet.',
);