10 Commits

Author SHA1 Message Date
f46ac0e6da add user authentification 2017-11-21 16:35:36 +01:00
a136926975 readme updated 2017-11-21 16:30:05 +01:00
bc6352d893 set encoding header 2017-11-17 12:38:46 +01:00
1b60e58e85 readme completed 2017-05-31 09:55:54 +02:00
1d182f9f31 readme added 2017-05-31 09:51:37 +02:00
34c9c2f1ed changelog completed 2017-05-31 09:22:52 +02:00
440fa1a71c add mail blocker && mail redirect 2017-05-30 17:10:16 +02:00
6d777cd9f5 ... 2017-05-30 16:17:39 +02:00
47476ca025 Merge branch 'rel_1.x' of https://github.com/d3datadevelopment/TPL-development-helper into rel_1.x
# Conflicts:
#	copy_this/modules/d3/d3dev/IntelliSenseHelper.php
#	copy_this/modules/d3/d3dev/controllers/d3dev.php
#	copy_this/modules/d3/d3dev/metadata.php
#	copy_this/modules/d3/d3dev/modules/controllers/d3_dev_thankyou.php
#	copy_this/modules/d3/d3dev/modules/models/d3_dev_oxemail.php
2017-05-30 16:15:30 +02:00
f1369d0b4d ... 2017-05-30 16:00:47 +02:00
11 changed files with 283 additions and 13 deletions

35
README.md Normal file
View File

@ -0,0 +1,35 @@
# TPL Development Helper
### Entwicklungswerkzeug zur Kontrolle schwer zug<75>nglicher Shopinhalte
Diese Tool soll bei t<>glichen Entwicklungsaufgaben im OXID eShop helfen, die (systembedingt) vom Shopsystem erschwert werden.
* Mailversand (<28>bers Shopframework) <20>bers Shopframework wird blockiert __oder__
* Mails (<28>bers Shopframework) werden an alternative Mailadresse umgeleitet
(Das Tool setzt direkt an der oxemail::_sendMail()-Methode an und kann damit __jeden__ Mailversand kontrollieren, der <20>bers Framework l<>uft. Man muss nicht X verschiedene Module <20>berwachen und hat auch Kontrolle <20>ber Mailerweiterungen, die keinen Stage-Einsatz vorsehen.)
* unterbindet das L<>schen des Warenkorbs nach Bestellabschluss
* Thankyou-Seite ist auch ohne Bestellabschluss aufrufbar (unter Angabe der Bestellnummer auch f<>r eine bestimmte Bestellung)
* Bestellbest<73>tigungsmails und sind im Browser darstellbar (unter Angabe der Bestellnummer auch f<>r eine bestimmte Bestellung)
__Da hiermit gezielt Mails der Shopbestellungen angezeigt werden k<>nnen, ist das Modul mit <20>u<EFBFBD>erster Vorsicht zu verwenden. Die H<>rden f<>r die Anzeige der Mails sind daher absichtlich sehr hoch gesetzt. Vor der Verwendung sind Einstellungen zu <20>ndern. Denken Sie unbedingt daran, diese Einstellungen im Anschluss wieder zur<75>ckzusetzen. Sonst sind Kunden- und Bestelldaten frei abrufbar. Wir <20>bernehmen f<>r daraus resultierenden Sch<63>den keine Haftung.__
Um unser Tool verwenden zu k<>nnen, folgen Sie bitte diesen Schritten:
1. Produktivmodus entfernen
![Adminbereich -> Stammdaten -> Grundeinstellungen -> Haken bei Produktivmodus entfernen](step1.jpg "Produktivmodus entfernen")
2. Modul aktivieren
![Adminbereich -> Erweiterungen -> Module -> TPL Development Tool -> Aktivieren](step2.jpg "Modul aktivieren")
3. In den Einstellungen die gew<65>nschten Funktionen freischalten
![Adminbereich -> Erweiterungen -> Module -> TPL Development Tool -> Einstell.](step3.jpg "gew<65>nschte Funktionen freischalten")
4. <20>ber die Links im Tab <20>Stamm<6D> k<>nnen Sie die betreffenden Seiten aufrufen. Vor der Darstellung wird ein Benutzername und Passwort abgefragt. Hierf<72>r verwenden Sie die Anmeldedaten des Abminbereichs Ihres Shops.
5. An den E-Mail- und Thankyou-Links gibt es einen leeren Parameter, den Sie bei Bedarf mit einer Bestellnummer f<>llen k<>nnen. Dann wird statt der letzten Bestellung ganz gezielt eine andere Bestellung zur Darstellung verwendet.
6. Beachten Sie unbedingt, dass Sie nach der Verwendung unbedingt das Modul wieder deaktivieren und den Produktivmodus wieder anschalten.
Ber<EFBFBD>cksichtigen Sie bei der Darstellung der E-Mails bitte, dass die Mailprogramme diese m<>glicherweise anders darstellen, als der Browser dies tut. Daher kann die Darstellung im Browser nur ein Anhaltspunkt sein.

View File

@ -16,8 +16,62 @@
class d3dev extends oxUBase
{
public function init()
{
$this->_authenticate();
parent::init();
}
protected function _authenticate ()
{
$oConfig = oxRegistry::getConfig();
try {
$sUser = $oConfig->getRequestParameter( 'usr' );
$sPassword = $oConfig->getRequestParameter( 'pwd' );
if ( !$sUser || !$sPassword ) {
$sUser = $_SERVER[ 'PHP_AUTH_USER' ];
$sPassword = $_SERVER[ 'PHP_AUTH_PW' ];
}
if ( !$sUser || !$sPassword ) {
$sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ];
if ( $sHttpAuthorization ) {
$sUser = null;
$sPassword = null;
$aHttpAuthorization = explode( ' ', $sHttpAuthorization );
if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) {
$sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] );
$aBasicAuthorization = explode( ':', $sBasicAuthorization );
if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) {
$sUser = $aBasicAuthorization[ 0 ];
$sPassword = $aBasicAuthorization[ 1 ];
}
}
}
}
/** @var oxUser $oUser */
$oUser = oxNew( 'oxuser' );
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
$oEx = oxNew( 'oxuserexception' );
$oEx->setMessage( 'EXCEPTION_USER_NOVALIDLOGIN' );
throw $oEx;
}
}
catch ( Exception $oEx ) {
$oShop = $oConfig->getActiveShop();
header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
exit( 1 );
}
}
public function showOrderMailContent()
{
header('Content-type: text/html; charset='.oxRegistry::getLang()->translateString('charset'));
if (oxRegistry::getConfig()->getActiveShop()->oxshops__oxproductive->value
|| false == oxRegistry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser')
) {

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.2.0.0',
'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

@ -31,12 +31,58 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
&& false == (bool) oxRegistry::getConfig()->getActiveShop()->oxshops__oxproductive->value
&& oxRegistry::getConfig()->getConfigParam('blD3DevShowThankyou')
) {
$this->_d3authenticate();
$oOrder = $this->d3GetLastOrder();
$oBasket = $oOrder->d3DevGetOrderBasket();
$this->_oBasket = $oBasket;
}
}
protected function _d3authenticate ()
{
$oConfig = oxRegistry::getConfig();
try {
$sUser = $oConfig->getRequestParameter( 'usr' );
$sPassword = $oConfig->getRequestParameter( 'pwd' );
if ( !$sUser || !$sPassword ) {
$sUser = $_SERVER[ 'PHP_AUTH_USER' ];
$sPassword = $_SERVER[ 'PHP_AUTH_PW' ];
}
if ( !$sUser || !$sPassword ) {
$sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ];
if ( $sHttpAuthorization ) {
$sUser = null;
$sPassword = null;
$aHttpAuthorization = explode( ' ', $sHttpAuthorization );
if ( is_array( $aHttpAuthorization ) && count( $aHttpAuthorization ) >= 2 && strtolower( $aHttpAuthorization[ 0 ] ) == 'basic' ) {
$sBasicAuthorization = base64_decode( $aHttpAuthorization[ 1 ] );
$aBasicAuthorization = explode( ':', $sBasicAuthorization );
if ( is_array( $aBasicAuthorization ) && count( $aBasicAuthorization ) >= 2 ) {
$sUser = $aBasicAuthorization[ 0 ];
$sPassword = $aBasicAuthorization[ 1 ];
}
}
}
}
/** @var oxUser $oUser */
$oUser = oxNew( 'oxuser' );
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
$oEx = oxNew( 'oxuserexception' );
$oEx->setMessage( 'EXCEPTION_USER_NOVALIDLOGIN' );
throw $oEx;
}
}
catch ( Exception $oEx ) {
$oShop = $oConfig->getActiveShop();
header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
exit( 1 );
}
}
/**
* @return d3_dev_oxorder
*/

View File

@ -20,4 +20,16 @@ class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
{
$this->_oArticle = null;
}
public function getTitle()
{
$oArticle = $this->getArticle();
$this->_sTitle = $oArticle->oxarticles__oxtitle->value;
if ($oArticle->oxarticles__oxvarselect->value) {
$this->_sTitle = $this->_sTitle . ', ' . $this->getVarSelect();
}
return $this->_sTitle;
}
}

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. <20>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<75>tzliche Blockieroption werden die Mails dann an den original Empf<70>nger gesendet.',
);

View File

@ -1,4 +1,16 @@
Hinweise zur Benutzung und Konfiguration sind in der Metadata-Modulbeschreibung enthalten.
Diese k<>nnen nach Installation im Backend des OXID-Shops unter "Erweiterungen -> Module" eingesehen werden.
=> 1.2.0.0
- Dokuemntation erg<72>nzt
- Mail-Anzeige fordert zus<75>tzlich Authentfikation mit einem Shopadmin-Konto
- Seitenencoding definiert
=> 1.1.0.0
- Mailversand <20>bers Shopframework wird blockiert oder
- Mails werden an alternative Mailadresse umgeleitet
=> 1.0.0.0
- unterbindet das L<>schen des Warenkorbs nach Bestellabschluss
- Thankyou ist ohne Bestellabschluss aufrufbar (unter Angabe der Bestellnummer auch f<>r eine bestimmte Bestellung)
- Bestellbest<73>tigungsmails sind im Browser darstellbar (unter Angabe der Bestellnummer auch f<>r eine bestimmte Bestellung)
- Bestellbest<73>tigungsmails und (sofern D3-Modul installiert) Anfragebest<73>tigungsmails sind im Browser darstellbar (unter Angabe der Bestellnummer auch f<>r eine bestimmte Bestellung)

BIN
step1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

BIN
step2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
step3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB