* @link http://www.oxidmodule.com */ class d3_dev_thankyou extends d3_dev_thankyou_parent { /** * @throws DatabaseConnectionException * @throws DatabaseErrorException */ public function init() { $sSessChallenge = Registry::getSession()->getVariable('sess_challenge'); parent::init(); Registry::getSession()->setVariable('sess_challenge', $sSessChallenge); if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev") && false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode() && Registry::getConfig()->getConfigParam('blD3DevShowThankyou') ) { $this->_d3authenticate(); $oOrder = $this->d3GetLastOrder(); $oBasket = $oOrder->d3DevGetOrderBasket(); $this->_oBasket = $oBasket; } } protected function _d3authenticate () { try { $sUser = Registry::get(Request::class)->getRequestEscapedParameter( 'usr'); $sPassword = Registry::get(Request::class)->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 ]; } } } } /** @var User $oUser */ $oUser = oxNew(User::class); if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { /** @var UserException $oEx */ $oEx = oxNew(UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN'); throw $oEx; } } catch ( \Exception $oEx ) { $oShop = Registry::getConfig()->getActiveShop(); header( 'WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"' ); header( 'HTTP/1.0 401 Unauthorized' ); exit( 1 ); } } /** * @return bool|d3_dev_oxorder * @throws DatabaseConnectionException * @throws DatabaseErrorException */ public function d3GetLastOrder() { if (Registry::getConfig()->getActiveShop()->isProductiveMode()) { return false; } /** @var d3_dev_oxorder $oOrder */ $oOrder = oxNew(Order::class); $oOrder->d3getLastOrder(); return $oOrder; } /** * @return bool|d3_dev_d3inquiry * @throws DatabaseConnectionException */ public function d3GetLastInquiry() { if (Registry::getConfig()->getActiveShop()->isProductiveMode()) { return false; } /** @var d3_dev_d3inquiry $oInquiry */ $oInquiry = oxNew('d3inquiry'); $oInquiry->d3getLastInquiry(); return $oInquiry; } }