* @link http://www.oxidmodule.com */ class d3dev extends FrontendController { public function init() { $this->_authenticate(); parent::init(); } protected function _authenticate () { try { $sUser = Registry::getRequest()->getRequestEscapedParameter('usr'); $sPassword = Registry::getRequest()->getRequestEscapedParameter('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 ]; } } } } $oUser = oxNew( User::class ); if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { throw oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' ); } } catch ( Exception $oEx ) { $oShop = Registry::getConfig()->getActiveShop(); header( 'WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"' ); header( 'HTTP/1.0 401 Unauthorized' ); exit( 1 ); } } /** * @throws DatabaseConnectionException * @throws DatabaseErrorException */ public function showOrderMailContent() { header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset')); if (Registry::getConfig()->getActiveShop()->isProductiveMode() || false == Registry::getConfig()->getConfigParam(ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER) ) { Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); } $sTpl = Registry::getRequest()->getRequestEscapedParameter('type'); /** @var ModuleController\d3_dev_thankyou $oThankyou */ $oThankyou = oxNew(ThankYouController::class); $oOrder = $oThankyou->d3GetLastOrder(); /** @var ModuleCore\d3_dev_oxemail $oEmail */ $oEmail = oxNew(Email::class); echo $oEmail->d3GetOrderMailContent($oOrder, $sTpl); die(); } }