2015-12-16 17:44:47 +01:00
|
|
|
|
<?php
|
2018-01-25 10:53:09 +01:00
|
|
|
|
|
|
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
|
use OxidEsales\Eshop\Core\Request;
|
|
|
|
|
|
|
|
|
|
/**
|
2015-12-16 17:44:47 +01:00
|
|
|
|
* This Software is the property of Data Development and is protected
|
|
|
|
|
* by copyright law - it is NOT Freeware.
|
|
|
|
|
*
|
|
|
|
|
* Any unauthorized use of this software without a valid license
|
|
|
|
|
* is a violation of the license agreement and will be prosecuted by
|
|
|
|
|
* civil and criminal law.
|
|
|
|
|
*
|
|
|
|
|
* http://www.shopmodule.com
|
|
|
|
|
*
|
|
|
|
|
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
|
|
|
|
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
|
|
|
|
* @link http://www.oxidmodule.com
|
|
|
|
|
*/
|
|
|
|
|
|
2018-01-25 10:53:09 +01:00
|
|
|
|
class d3dev extends \OxidEsales\EshopProfessional\Application\Controller\FrontendController
|
2015-12-16 17:44:47 +01:00
|
|
|
|
{
|
2017-11-21 16:35:36 +01:00
|
|
|
|
public function init()
|
|
|
|
|
{
|
|
|
|
|
$this->_authenticate();
|
|
|
|
|
|
|
|
|
|
parent::init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function _authenticate ()
|
|
|
|
|
{
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$request = oxNew(Request::class);
|
2017-11-21 16:35:36 +01:00
|
|
|
|
try {
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$sUser = $request->getRequestParameter( 'usr' );
|
|
|
|
|
$sPassword = $request->getRequestParameter( 'pwd' );
|
2017-11-21 16:35:36 +01:00
|
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oUser = oxNew( \OxidEsales\Eshop\Application\Model\User::class );
|
2017-11-21 16:35:36 +01:00
|
|
|
|
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
|
2018-01-25 10:53:09 +01:00
|
|
|
|
/** @var \OxidEsales\Eshop\Core\Exception\UserException $oEx */
|
|
|
|
|
$oEx = oxNew( \OxidEsales\Eshop\Core\Exception\UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
|
|
|
|
|
|
2017-11-21 16:35:36 +01:00
|
|
|
|
throw $oEx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch ( Exception $oEx ) {
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oShop = Registry::getConfig()->getActiveShop();
|
2017-11-21 16:35:36 +01:00
|
|
|
|
header( 'WWW-Authenticate: Basic realm="' . $oShop->oxshops__oxname->value . '"' );
|
|
|
|
|
header( 'HTTP/1.0 401 Unauthorized' );
|
|
|
|
|
exit( 1 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-16 17:44:47 +01:00
|
|
|
|
public function showOrderMailContent()
|
|
|
|
|
{
|
2018-01-25 10:53:09 +01:00
|
|
|
|
header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset'));
|
|
|
|
|
|
|
|
|
|
if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value
|
|
|
|
|
|| false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser')
|
2015-12-16 17:44:47 +01:00
|
|
|
|
) {
|
2018-01-25 10:53:09 +01:00
|
|
|
|
Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start');
|
2015-12-16 17:44:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$sTpl = oxNew(Request::class)->getRequestParameter('type');
|
2015-12-16 17:44:47 +01:00
|
|
|
|
|
|
|
|
|
/** @var d3_dev_thankyou $oThankyou */
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class);
|
2015-12-16 17:44:47 +01:00
|
|
|
|
$oOrder = $oThankyou->d3GetLastOrder();
|
|
|
|
|
|
|
|
|
|
/** @var d3_dev_oxemail $oEmail */
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
|
2015-12-16 17:44:47 +01:00
|
|
|
|
echo $oEmail->d3GetOrderMailContent($oOrder, $sTpl);
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function showInquiryMailContent()
|
|
|
|
|
{
|
2018-01-25 10:53:09 +01:00
|
|
|
|
if (Registry::getConfig()->getActiveShop()->oxshops__oxproductive->value
|
|
|
|
|
|| false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser')
|
2015-12-16 17:44:47 +01:00
|
|
|
|
) {
|
2018-01-25 10:53:09 +01:00
|
|
|
|
Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start');
|
2015-12-16 17:44:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$sTpl = oxNew(Request::class)->getRequestParameter('type');
|
2015-12-16 17:44:47 +01:00
|
|
|
|
|
|
|
|
|
/** @var d3_dev_thankyou $oThankyou */
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oThankyou = oxNew(\OxidEsales\Eshop\Application\Controller\ThankYouController::class);
|
2015-12-16 17:44:47 +01:00
|
|
|
|
$oOrder = $oThankyou->d3GetLastInquiry();
|
|
|
|
|
|
|
|
|
|
/** @var d3_dev_oxemail $oEmail */
|
2018-01-25 10:53:09 +01:00
|
|
|
|
$oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
|
2015-12-16 17:44:47 +01:00
|
|
|
|
echo $oEmail->d3GetInquiryMailContent($oOrder, $sTpl);
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
}
|