reformat code

This commit is contained in:
2024-09-04 08:58:40 +02:00
parent ec1cb2f760
commit 291f095917
17 changed files with 1024 additions and 302 deletions

View File

@ -1,5 +1,18 @@
<?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
namespace D3\Devhelper\Modules\Application\Controller;
// .../?cl=thankyou[&d3orderid=23]
@ -19,21 +32,6 @@ use OxidEsales\Eshop\Core\Registry;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* 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 © D³ Data Development, Thomas Dartsch
* @author D³ Data Development - Daniel Seifert <info@shopmodule.com>
* @link http://www.oxidmodule.com
*/
class d3_dev_thankyou extends d3_dev_thankyou_parent
{
/**
@ -50,7 +48,7 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
&& !Registry::getConfig()->getActiveShop()->isProductiveMode()
&& Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_PREVENTDELBASKET)
) {
Registry::getSession()->setVariable( 'sess_challenge', $sSessChallenge );
Registry::getSession()->setVariable('sess_challenge', $sSessChallenge);
}
if ($this->d3DevCanShowThankyou()) {
@ -89,27 +87,27 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
return $ret;
}
protected function _d3authenticate ()
protected function _d3authenticate()
{
try {
$sUser = Registry::getRequest()->getRequestEscapedParameter( 'usr');
$sUser = Registry::getRequest()->getRequestEscapedParameter('usr');
$sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
if ( !$sUser || !$sPassword ) {
if (!$sUser || !$sPassword) {
$sUser = $_SERVER[ 'PHP_AUTH_USER' ];
$sPassword = $_SERVER[ 'PHP_AUTH_PW' ];
}
if ( !$sUser || !$sPassword ) {
if (!$sUser || !$sPassword) {
$sHttpAuthorization = $_REQUEST[ 'HTTP_AUTHORIZATION' ];
if ( $sHttpAuthorization ) {
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 ) {
$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 ];
}
@ -118,17 +116,16 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
}
/** @var User $oUser */
$oUser = oxNew(User::class);
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
if (!$sUser || !$sPassword || !$oUser->login($sUser, $sPassword)) {
/** @var UserException $oEx */
$oEx = oxNew(UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN');
throw $oEx;
}
}
catch ( Exception $oEx ) {
} catch (Exception $oEx) {
$oShop = Registry::getConfig()->getActiveShop();
header( 'WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
exit( 1 );
header('WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"');
header('HTTP/1.0 401 Unauthorized');
exit(1);
}
}