Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace MiniOrange\OAuth\Observer; use Magento\Framework\App\Request\Http;..

Decoded Output download

<?php 
 
 
namespace MiniOrange\OAuth\Observer; 
 
use Magento\Framework\App\Request\Http; 
use Magento\Framework\App\RequestInterface; 
use Magento\Framework\Event\ObserverInterface; 
use Magento\Framework\Message\ManagerInterface; 
use MiniOrange\OAuth\Controller\Actions\AdminLoginAction; 
use MiniOrange\OAuth\Controller\Actions\ShowTestResultsAction; 
use MiniOrange\OAuth\Helper\OAuthMessages; 
use Magento\Framework\Event\Observer; 
use MiniOrange\OAuth\Controller\Actions\ReadAuthorizationResponse; 
use MiniOrange\OAuth\Helper\OAuthConstants; 
use MiniOrange\OAuth\Helper\OAuthUtility; 
use Psr\Log\LoggerInterface; 
class OAuthObserver implements ObserverInterface 
{ 
    private $requestParams = array("option"); 
    private $controllerActionPair = array("account" => array("login", "create"), "auth" => array("login")); 
    private $messageManager; 
    private $storeManager; 
    private $logger; 
    private $readAuthorizationResponse; 
    private $oauthUtility; 
    private $adminLoginAction; 
    private $testAction; 
    private $_storeManager; 
    private $currentControllerName; 
    private $currentActionName; 
    private $urlInterface; 
    private $request; 
    protected $responseFactory; 
    public function __construct(ManagerInterface $yR, LoggerInterface $Xg, ReadAuthorizationResponse $OR, OAuthUtility $Nq, AdminLoginAction $lb, Http $U0, RequestInterface $AN, ShowTestResultsAction $tB, \Magento\Framework\UrlInterface $CV, \Magento\Store\Model\StoreManagerInterface $fW, \Magento\Framework\App\ResponseFactory $gN) 
    { 
        $this->messageManager = $yR; 
        $this->_storeManager = $fW; 
        $this->logger = $Xg; 
        $this->readAuthorizationResponse = $OR; 
        $this->oauthUtility = $Nq; 
        $this->adminLoginAction = $lb; 
        $this->currentControllerName = $U0->getControllerName(); 
        $this->currentActionName = $U0->getActionName(); 
        $this->request = $AN; 
        $this->urlInterface = $CV; 
        $this->testAction = $tB; 
        $this->responseFactory = $gN; 
    } 
    public function execute(Observer $Yx) 
    { 
        $this->oauthUtility->log_debug("Execute OAuthObserver"); 
        $x8 = $this->request->getParams(); 
        $Sl = $this->getCurrentWebsite(); 
        $sw = $this->getWebsiteIds(); 
        $zB = $this->oauthUtility->isBlank($sw) ? array() : json_decode($sw); 
        if ($this->oauthUtility->isBlank($zB)) { 
            goto Dlj; 
        } 
        $this->oauthUtility->log_debug("Excute OAuthObserver:before foreach loop excition"); 
        foreach ($zB as $ol => $zP) { 
            if (!($Sl == $ol)) { 
                goto NNO; 
            } 
            $ls = array_keys($this->request->getParams()); 
            $i6 = array_intersect($ls, $this->requestParams); 
            try { 
                $x8 = $this->request->getParams(); 
                $this->oauthUtility->log_debug("Excute OAuthObserver:params ="); 
                $d7 = $this->request->getPost(); 
                $Ao = $this->oauthUtility->getStoreConfig(OAuthConstants::IS_TEST); 
                if (!$this->checkIfUserShouldBeRedirected()) { 
                    goto SJJ; 
                } 
                $mM = $this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT_APP); 
                $this->oauthUtility->log_debug("Excute OAuthObserver:Appname=" . $mM); 
                $this->responseFactory->create()->setRedirect($this->oauthUtility->getSPInitiatedUrl($this->_storeManager->getStore()->getBaseUrl(), '') . $mM)->sendResponse(); 
                exit; 
                SJJ: 
                if (!(count($i6) > 0)) { 
                    goto aQn; 
                } 
                $this->oauthUtility->log_debug("In route data"); 
                $this->_route_data(array_values($i6)[0], $Yx, $x8, $d7); 
                aQn: 
            } catch (\Exception $zQ) { 
                $Ao = $this->oauthUtility->getStoreConfig(OAuthConstants::IS_TEST); 
                if (!$Ao) { 
                    goto r11; 
                } 
                $this->testAction->setOAuthException($zQ)->setHasExceptionOccurred(true)->execute(); 
                r11: 
                $this->messageManager->addErrorMessage($zQ->getMessage()); 
                $this->logger->debug($zQ->getMessage()); 
            } 
            NNO: 
            dXc: 
        } 
        ONf: 
        Dlj: 
    } 
    private function _route_data($vn, $Yx, $x8, $d7) 
    { 
        switch ($vn) { 
            case $this->requestParams[0]: 
                if (!($x8["option"] == OAuthConstants::LOGIN_ADMIN_OPT)) { 
                    goto C6_; 
                } 
                $this->adminLoginAction->execute(); 
                C6_: 
                goto mh4; 
        } 
        qss: 
        mh4: 
    } 
    private function checkIfUserShouldBeRedirected() 
    { 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT) && (str_contains($this->getCurrentUrl(), "customer/account/login") || str_contains($this->getCurrentUrl(), "customer/account/create")))) { 
            goto RVD; 
        } 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT) != "1" || $this->oauthUtility->isUserLoggedIn())) { 
            goto ezc; 
        } 
        return false; 
        ezc: 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::BACKDOOR) == "1" && array_key_exists(OAuthConstants::OAuth_SSO_FALSE, $this->request->getParams()))) { 
            goto GIb; 
        } 
        return false; 
        GIb: 
        $za = array_key_exists($this->currentControllerName, $this->controllerActionPair) ? $this->controllerActionPair[$this->currentControllerName] : null; 
        return !is_null($za) && is_array($za) ? in_array($this->currentActionName, $za) : false; 
        RVD: 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::B2B_AUTO_REDIRECT) && (str_contains($this->getCurrentUrl(), "customer/account/login") || !str_contains($this->getCurrentUrl(), "customer/account/create")))) { 
            goto U0Q; 
        } 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::B2B_AUTO_REDIRECT) != "1" || $this->oauthUtility->isUserLoggedIn())) { 
            goto q7e; 
        } 
        return false; 
        q7e: 
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::BACKDOOR) == "1" && array_key_exists(OAuthConstants::OAuth_SSO_FALSE, $this->request->getParams()))) { 
            goto LI5; 
        } 
        return false; 
        LI5: 
        $za = array_key_exists($this->currentControllerName, $this->controllerActionPair) ? $this->controllerActionPair[$this->currentControllerName] : null; 
        return !is_null($za) && is_array($za) ? in_array($this->currentActionName, $za) : false; 
        U0Q: 
        return false; 
    } 
    public function getWebsiteIds() 
    { 
        return $this->oauthUtility->getStoreConfig(OAuthConstants::WEBSITE_IDS); 
    } 
    public function getWebsiteCount() 
    { 
        return $this->oauthUtility->getStoreConfig(OAuthConstants::WEBSITE_COUNT); 
    } 
    public function getWebsiteLimit() 
    { 
        return $this->oauthUtility->getWebsiteLimit(); 
    } 
    public function getCurrentWebsite() 
    { 
        return $this->_storeManager->getStore()->getWebsiteId(); 
    } 
    public function getCurrentUrl() 
    { 
        return $this->urlInterface->getCurrentUrl(); 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php


namespace MiniOrange\OAuth\Observer;

use Magento\Framework\App\Request\Http;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Message\ManagerInterface;
use MiniOrange\OAuth\Controller\Actions\AdminLoginAction;
use MiniOrange\OAuth\Controller\Actions\ShowTestResultsAction;
use MiniOrange\OAuth\Helper\OAuthMessages;
use Magento\Framework\Event\Observer;
use MiniOrange\OAuth\Controller\Actions\ReadAuthorizationResponse;
use MiniOrange\OAuth\Helper\OAuthConstants;
use MiniOrange\OAuth\Helper\OAuthUtility;
use Psr\Log\LoggerInterface;
class OAuthObserver implements ObserverInterface
{
    private $requestParams = array("\x6f\x70\x74\151\157\156");
    private $controllerActionPair = array("\141\x63\143\157\x75\156\x74" => array("\x6c\157\x67\151\x6e", "\x63\x72\145\x61\x74\x65"), "\141\165\164\150" => array("\154\157\x67\151\x6e"));
    private $messageManager;
    private $storeManager;
    private $logger;
    private $readAuthorizationResponse;
    private $oauthUtility;
    private $adminLoginAction;
    private $testAction;
    private $_storeManager;
    private $currentControllerName;
    private $currentActionName;
    private $urlInterface;
    private $request;
    protected $responseFactory;
    public function __construct(ManagerInterface $yR, LoggerInterface $Xg, ReadAuthorizationResponse $OR, OAuthUtility $Nq, AdminLoginAction $lb, Http $U0, RequestInterface $AN, ShowTestResultsAction $tB, \Magento\Framework\UrlInterface $CV, \Magento\Store\Model\StoreManagerInterface $fW, \Magento\Framework\App\ResponseFactory $gN)
    {
        $this->messageManager = $yR;
        $this->_storeManager = $fW;
        $this->logger = $Xg;
        $this->readAuthorizationResponse = $OR;
        $this->oauthUtility = $Nq;
        $this->adminLoginAction = $lb;
        $this->currentControllerName = $U0->getControllerName();
        $this->currentActionName = $U0->getActionName();
        $this->request = $AN;
        $this->urlInterface = $CV;
        $this->testAction = $tB;
        $this->responseFactory = $gN;
    }
    public function execute(Observer $Yx)
    {
        $this->oauthUtility->log_debug("\105\x78\145\143\165\164\x65\x20\x4f\x41\x75\x74\150\117\142\163\145\162\x76\145\162");
        $x8 = $this->request->getParams();
        $Sl = $this->getCurrentWebsite();
        $sw = $this->getWebsiteIds();
        $zB = $this->oauthUtility->isBlank($sw) ? array() : json_decode($sw);
        if ($this->oauthUtility->isBlank($zB)) {
            goto Dlj;
        }
        $this->oauthUtility->log_debug("\105\x78\x63\165\164\x65\x20\117\101\165\164\x68\x4f\142\163\145\x72\166\x65\162\x3a\142\x65\146\x6f\162\145\x20\146\x6f\x72\145\x61\x63\x68\40\154\x6f\x6f\x70\40\145\x78\143\151\x74\151\x6f\156");
        foreach ($zB as $ol => $zP) {
            if (!($Sl == $ol)) {
                goto NNO;
            }
            $ls = array_keys($this->request->getParams());
            $i6 = array_intersect($ls, $this->requestParams);
            try {
                $x8 = $this->request->getParams();
                $this->oauthUtility->log_debug("\x45\x78\143\165\164\145\40\117\101\x75\164\150\117\142\163\x65\x72\x76\145\162\72\x70\x61\x72\141\155\x73\40\x3d");
                $d7 = $this->request->getPost();
                $Ao = $this->oauthUtility->getStoreConfig(OAuthConstants::IS_TEST);
                if (!$this->checkIfUserShouldBeRedirected()) {
                    goto SJJ;
                }
                $mM = $this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT_APP);
                $this->oauthUtility->log_debug("\105\170\143\x75\x74\x65\x20\117\101\165\164\x68\x4f\x62\163\145\x72\x76\145\162\x3a\x41\160\x70\156\141\x6d\x65\75" . $mM);
                $this->responseFactory->create()->setRedirect($this->oauthUtility->getSPInitiatedUrl($this->_storeManager->getStore()->getBaseUrl(), '') . $mM)->sendResponse();
                exit;
                SJJ:
                if (!(count($i6) > 0)) {
                    goto aQn;
                }
                $this->oauthUtility->log_debug("\111\x6e\40\x72\x6f\x75\164\x65\40\144\141\164\x61");
                $this->_route_data(array_values($i6)[0], $Yx, $x8, $d7);
                aQn:
            } catch (\Exception $zQ) {
                $Ao = $this->oauthUtility->getStoreConfig(OAuthConstants::IS_TEST);
                if (!$Ao) {
                    goto r11;
                }
                $this->testAction->setOAuthException($zQ)->setHasExceptionOccurred(true)->execute();
                r11:
                $this->messageManager->addErrorMessage($zQ->getMessage());
                $this->logger->debug($zQ->getMessage());
            }
            NNO:
            dXc:
        }
        ONf:
        Dlj:
    }
    private function _route_data($vn, $Yx, $x8, $d7)
    {
        switch ($vn) {
            case $this->requestParams[0]:
                if (!($x8["\x6f\x70\x74\x69\x6f\156"] == OAuthConstants::LOGIN_ADMIN_OPT)) {
                    goto C6_;
                }
                $this->adminLoginAction->execute();
                C6_:
                goto mh4;
        }
        qss:
        mh4:
    }
    private function checkIfUserShouldBeRedirected()
    {
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT) && (str_contains($this->getCurrentUrl(), "\143\x75\x73\x74\157\155\x65\x72\57\x61\143\x63\x6f\x75\x6e\164\57\x6c\x6f\147\151\156") || str_contains($this->getCurrentUrl(), "\x63\x75\x73\x74\x6f\155\x65\x72\57\x61\x63\143\x6f\x75\156\164\x2f\x63\162\145\141\x74\x65")))) {
            goto RVD;
        }
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::AUTO_REDIRECT) != "\x31" || $this->oauthUtility->isUserLoggedIn())) {
            goto ezc;
        }
        return false;
        ezc:
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::BACKDOOR) == "\61" && array_key_exists(OAuthConstants::OAuth_SSO_FALSE, $this->request->getParams()))) {
            goto GIb;
        }
        return false;
        GIb:
        $za = array_key_exists($this->currentControllerName, $this->controllerActionPair) ? $this->controllerActionPair[$this->currentControllerName] : null;
        return !is_null($za) && is_array($za) ? in_array($this->currentActionName, $za) : false;
        RVD:
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::B2B_AUTO_REDIRECT) && (str_contains($this->getCurrentUrl(), "\x63\165\x73\x74\x6f\x6d\x65\162\x2f\141\x63\143\157\x75\156\x74\x2f\x6c\x6f\147\x69\156") || !str_contains($this->getCurrentUrl(), "\143\x75\x73\164\157\155\145\x72\57\141\x63\x63\157\165\156\x74\57\x63\x72\145\x61\164\145")))) {
            goto U0Q;
        }
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::B2B_AUTO_REDIRECT) != "\61" || $this->oauthUtility->isUserLoggedIn())) {
            goto q7e;
        }
        return false;
        q7e:
        if (!($this->oauthUtility->getStoreConfig(OAuthConstants::BACKDOOR) == "\61" && array_key_exists(OAuthConstants::OAuth_SSO_FALSE, $this->request->getParams()))) {
            goto LI5;
        }
        return false;
        LI5:
        $za = array_key_exists($this->currentControllerName, $this->controllerActionPair) ? $this->controllerActionPair[$this->currentControllerName] : null;
        return !is_null($za) && is_array($za) ? in_array($this->currentActionName, $za) : false;
        U0Q:
        return false;
    }
    public function getWebsiteIds()
    {
        return $this->oauthUtility->getStoreConfig(OAuthConstants::WEBSITE_IDS);
    }
    public function getWebsiteCount()
    {
        return $this->oauthUtility->getStoreConfig(OAuthConstants::WEBSITE_COUNT);
    }
    public function getWebsiteLimit()
    {
        return $this->oauthUtility->getWebsiteLimit();
    }
    public function getCurrentWebsite()
    {
        return $this->_storeManager->getStore()->getWebsiteId();
    }
    public function getCurrentUrl()
    {
        return $this->urlInterface->getCurrentUrl();
    }
}

Function Calls

None

Variables

None

Stats

MD5 a60e81f31b654f852efb57596a770f77
Eval Count 0
Decode Time 56 ms