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\Application\Controller;
use D3\Devhelper\Application\Model\Exception\UnauthorisedException;
@ -20,21 +33,6 @@ use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServ
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 d3dev extends FrontendController
{
public function init()
@ -44,28 +42,28 @@ class d3dev extends FrontendController
parent::init();
}
protected function _authenticate (): void
protected function _authenticate(): void
{
try {
$sUser = Registry::getRequest()->getRequestEscapedParameter('usr');
$sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
if ( !$sUser || !$sPassword ) {
if (!$sUser || !$sPassword) {
$request = ServerRequest::fromGlobals();
$sUser = $request->getServerParams()['PHP_AUTH_USER'];
$sPassword = $request->getServerParams()['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 ];
}
@ -73,15 +71,15 @@ class d3dev extends FrontendController
}
}
$oUser = oxNew( User::class );
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
throw oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
$oUser = oxNew(User::class);
if (!$sUser || !$sPassword || !$oUser->login($sUser, $sPassword)) {
throw oxNew(UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN');
}
} catch ( Exception ) {
} catch (Exception) {
$oShop = Registry::getConfig()->getActiveShop();
header( 'WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"' );
header('WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"');
http_response_code(401);
exit( 1 );
exit(1);
}
}
@ -93,26 +91,26 @@ class d3dev extends FrontendController
public function showOrderMailContent(): void
{
try {
header( 'Content-type: text/html; charset=' . Registry::getLang()->translateString( 'charset' ) );
header('Content-type: text/html; charset=' . Registry::getLang()->translateString('charset'));
/** @var ModuleSettingService $moduleSettingService */
$moduleSettingService = ContainerFactory::getInstance()->getContainer()->get( ModuleSettingServiceInterface::class );
$moduleSettingService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
if ( Registry::getConfig()->getActiveShop()->isProductiveMode() ||
! $moduleSettingService->getBoolean( ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER, 'd3dev' )
if (Registry::getConfig()->getActiveShop()->isProductiveMode() ||
! $moduleSettingService->getBoolean(ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER, 'd3dev')
) {
throw oxNew(UnauthorisedException::class);
}
$sTpl = Registry::getRequest()->getRequestEscapedParameter( 'type' );
$sTpl = Registry::getRequest()->getRequestEscapedParameter('type');
/** @var ModuleController\d3_dev_thankyou $oThankyou */
$oThankyou = oxNew( ThankYouController::class );
$oThankyou = oxNew(ThankYouController::class);
$oOrder = $oThankyou->d3GetLastOrder();
/** @var ModuleCore\d3_dev_oxemail $oEmail */
$oEmail = oxNew( Email::class );
echo $oEmail->d3GetOrderMailContent( $oOrder, $sTpl );
http_response_code( 200 );
$oEmail = oxNew(Email::class);
echo $oEmail->d3GetOrderMailContent($oOrder, $sTpl);
http_response_code(200);
} catch (UnauthorisedException $exception) {
echo $exception->getMessage();
http_response_code(401);

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\Application\Model\Exception;
use Exception;
@ -7,8 +20,8 @@ use OxidEsales\Eshop\Core\Exception\StandardException;
class NoOrderFoundException extends StandardException
{
public function __construct( $sMessage = "no order found", $iCode = 0, Exception $previous = null )
public function __construct($sMessage = "no order found", $iCode = 0, Exception $previous = null)
{
parent::__construct( $sMessage, $iCode, $previous );
parent::__construct($sMessage, $iCode, $previous);
}
}
}

View File

@ -1,13 +1,26 @@
<?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\Application\Model\Exception;
use OxidEsales\Eshop\Core\Exception\StandardException;
class UnauthorisedException extends StandardException
{
public function __construct( $sMessage = "unauthorised, disable productive and activate option", $iCode = 0, Exception $previous = null )
public function __construct($sMessage = "unauthorised, disable productive and activate option", $iCode = 0, Exception $previous = null)
{
parent::__construct( $sMessage, $iCode, $previous );
parent::__construct($sMessage, $iCode, $previous);
}
}
}

View File

@ -1,18 +1,16 @@
<?php
/**
* TPL Development Tool
* 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 (c) D3 Data Development (Inh. Thomas Dartsch)
*
* @copyright © D³ Data Development, Thomas Dartsch
* @package OrderManager
* @author D³ Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* 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
*/
$sLangName = "Deutsch";
@ -20,7 +18,7 @@ $sLangName = "Deutsch";
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
$aLang = [
//Navigation
'charset' => 'UTF-8',
@ -54,4 +52,4 @@ $aLang = array(
'SHOP_MODULE_sD3DevRedirectMail' => 'versendete Mails an diese Adresse umleiten',
'HELP_SHOP_MODULE_sD3DevRedirectMail' => 'Wenn leer, erfolgt keine Umleitung. Ohne '.
'zusätzliche Blockieroption werden die Mails dann an den original Empfänger gesendet.',
);
];