namespace MiniOrange\IDPSaml\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use MiniOrange\IDPSaml\Helper\IDPConstants;
use MiniOrange\IDPSaml\Model\OAuthServerUsersFactory;
use MiniOrange\IDPSaml\Model\MiniOrangeSpTableFactory;
use Magento\Framework\Stdlib\DateTime\DateTime;
use MiniOrange\IDPSaml\Helper\Saml2\Lib\AESEncryption;
use Magento\Framework\App\ProductMetadataInterface;
use MiniOrange\IDPSaml\Helper\Curl;
use MiniOrange\IDPSaml\Helper\IDPMessages;
class Data extends AbstractHelper
{
protected $scopeConfig;
protected $adminFactory;
protected $customerFactory;
protected $urlInterface;
protected $configWriter;
protected $assetRepo;
protected $helperBackend;
protected $frontendUrl;
protected $oauthServerUsers;
protected $miniOrangeOAuthClientsFactory;
protected $dateTime;
protected $productMetadata;
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $uI, \Magento\User\Model\UserFactory $RK, \Magento\Customer\Model\CustomerFactory $o2, \Magento\Framework\UrlInterface $L8, \Magento\Framework\App\Config\Storage\WriterInterface $FL, \Magento\Framework\View\Asset\Repository $pC, \Magento\Backend\Helper\Data $Db, \Magento\Framework\Url $xA, OAuthServerUsersFactory $lz, MiniOrangeSpTableFactory $eq, DateTime $TT, ProductMetadataInterface $nA)
{
$this->scopeConfig = $uI;
$this->adminFactory = $RK;
$this->customerFactory = $o2;
$this->urlInterface = $L8;
$this->configWriter = $FL;
$this->assetRepo = $pC;
$this->helperBackend = $Db;
$this->frontendUrl = $xA;
$this->oauthServerUsers = $lz;
$this->dateTime = $TT;
$this->miniOrangeOAuthClientsFactory = $eq;
$this->productMetadata = $nA;
}
public function getMiniOrangeOAuthClients()
{
$kW = $this->miniOrangeOAuthClientsFactory->create();
$Kb = $kW->getCollection();
return $Kb;
}
public function getMiniOrangeUrl()
{
return IDPConstants::HOSTNAME;
}
public function getStoreConfig($cL)
{
$PO = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
return $this->scopeConfig->getValue("miniorange/samlidp/" . $cL, $PO);
}
public function setStoreConfig($cL, $TC)
{
$this->configWriter->save("miniorange/samlidp/" . $cL, $TC);
}
public function saveConfig($cz, $TC, $ST, $vV)
{
$vV ? $this->saveAdminStoreConfig($cz, $TC, $ST) : $this->saveCustomerStoreConfig($cz, $TC, $ST);
}
public function getAdminStoreConfig($cL, $ST)
{
return $this->adminFactory->create()->load($ST)->getData($cL);
}
private function saveAdminStoreConfig($cz, $TC, $ST)
{
$Ti = [$cz => $TC];
$kW = $this->adminFactory->create()->load($ST)->addData($Ti);
$kW->setId($ST)->save();
}
public function getCustomerStoreConfig($cL, $ST)
{
return $this->customerFactory->create()->load($ST)->getData($cL);
}
private function saveCustomerStoreConfig($cz, $TC, $ST)
{
$Ti = [$cz => $TC];
$kW = $this->customerFactory->create()->load($ST)->addData($Ti);
$kW->setId($ST)->save();
}
public function getBaseUrl()
{
return is_null($this->getStoreConfig(IDPConstants::BASE)) ? $this->urlInterface->getBaseUrl() : $this->getStoreConfig(IDPConstants::BASE);
}
public function getCurrentUrl()
{
return $this->urlInterface->getCurrentUrl();
}
public function getUrl($cz, $lw = array())
{
return $this->urlInterface->getUrl($cz, ["_query" => $lw]);
}
public function getFrontendUrl($cz, $lw = array())
{
return $this->frontendUrl->getUrl($cz, ["_query" => $lw]);
}
public function getIssuerUrl()
{
return $this->getBaseUrl() . IDPConstants::ISSUER_URL_PATH;
}
public function getLogoutUrl()
{
return $this->getBaseUrl() . IDPConstants::SAML_LOGOUT_URL;
}
public function getImageUrl($Qk)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_IMAGES . $Qk);
}
public function getAdminCssUrl($wu)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CSS . $wu, ["area" => "adminhtml"]);
}
public function getAdminJSUrl($Zm)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_JS . $Zm, ["area" => "adminhtml"]);
}
public function getMetadataUrl()
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_METADATA, ["area" => "adminhtml"]);
}
public function getMetadataFilePath()
{
return $this->assetRepo->createAsset(IDPConstants::MODULE_DIR . IDPConstants::MODULE_METADATA, ["area" => "adminhtml"])->getSourceFile();
}
public function getResourcePath($hO)
{
return $this->assetRepo->createAsset(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CERTS . $hO, ["area" => "adminhtml"])->getSourceFile();
}
public function getAdminUrl($cz, $lw = array())
{
return $this->helperBackend->getUrl($cz, ["_query" => $lw]);
}
public function getSPInitiatedUrl($u2 = null)
{
$u2 = is_null($u2) ? $this->getCurrentUrl() : $u2;
return $this->getFrontendUrl(IDPConstants::SAML_LOGIN_URL, ["RelayState" => $u2]);
}
public function getAdminCertResourceUrl($hO)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CERTS . $hO, array("area" => "adminhtml"));
}
public function getcounttable()
{
$Kb = $this->getMiniOrangeOAuthClients();
$sA = 0;
foreach ($Kb as $av) {
$AG = $av->getData();
$sA++;
Ni:
}
np:
return $sA;
}
public function getAdminBaseUrl()
{
return $this->helperBackend->getHomePageUrl();
}
public function getAdminSecureUrl($cz, $lw = array())
{
return $this->helperBackend->getUrl($cz, ["_secure" => true, "_query" => $lw]);
}
public function isAllPageAutoRedirectEnabled()
{
return $this->getStoreConfig(IDPConstants::ALL_PAGE_AUTO_REDIRECT);
}
public function addAuthCodeData($Rd, $Tv, $vB, $Tn = null)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (!(isset($Ti["user_id"]) && !empty($Ti["user_id"]))) {
goto eL;
}
$XV = true;
$Ti->setData("user_id", $Rd);
$Ti->setData("auth_code", $Tv);
$Ti->setData("nonce", $Tn);
$Ti->setData("auth_code_expiry_time", $vB);
eL:
if (!($XV == false)) {
goto t2;
}
$kW->setData("user_id", $Rd);
$kW->setData("auth_code", $Tv);
$kW->setData("nonce", $Tn);
$kW->setData("auth_code_expiry_time", $vB);
t2:
$kW->save();
}
public function addAccessTokenData($Rd, $Ho, $ZE)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (isset($Ti) && !empty($Ti) && isset($Ti["user_id"]) && !empty($Ti["user_id"])) {
goto SR;
}
$kW->setData("user_id", $Rd);
$kW->setData("access_token", $Ho);
$kW->setData("access_token_expiry_time", $ZE);
goto DY;
SR:
$XV = true;
$Ti->setData("access_token", $Ho);
$Ti->setData("access_token_expiry_time", $ZE);
DY:
$kW->save();
}
public function addRefreshTokenData($Rd, $cj, $T6)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (isset($Ti) && !empty($Ti) && isset($Ti["user_id"]) && !empty($Ti["user_id"])) {
goto BB;
}
$kW->setData("user_id", $Rd);
$kW->setData("refresh_token", $cj);
$kW->setData("refresh_token_expiry_time", $T6);
goto Gn;
BB:
$XV = true;
$Ti->setData("refresh_token", $cj);
$Ti->setData("refresh_token_expiry_time", $T6);
Gn:
$kW->save();
}
public function getUserDataFromCode($fd)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["auth_code"] === $fd)) {
goto hi;
}
$XV = true;
$DB = $av->getData();
return $DB;
hi:
HF:
}
hR:
}
public function getUserDataFromAccessToken($cj)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["refresh_token"] === $cj)) {
goto bA;
}
$XV = true;
$DB = $av->getData();
return $DB;
bA:
og:
}
fS:
}
public function getUserDataFromUserId($ST)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["user_id"] === $ST)) {
goto gk;
}
$XV = true;
$DB = $av->getData();
return $DB;
gk:
mJ:
}
dZ:
}
public function getUserDataFromToken($Cq)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["access_token"] === $Cq)) {
goto hA;
}
$XV = true;
$DB = $av->getData();
return $DB;
hA:
go:
}
sv:
}
public function isTrialExpired()
{
if (!$this->check_plan(2)) {
goto fG;
}
$St = "E7XIXCVVUOYAIA2";
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
$bO = AESEncryption::decrypt_data($this->getStoreConfig(IDPConstants::EXECUTION_DATE), $St);
if (!$bO) {
goto tC;
}
$zZ = date("Y-m-d H:i:s", strtotime($bO . " + " . 30 . " days"));
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
if (!($JZ > $zZ)) {
goto Ma;
}
$MM = null;
$U_ = null;
if (!$this->getCurrentAdminUser()) {
goto YF;
}
$En = $this->getCurrentAdminUser()->getData();
$MM = $En["email"];
$U_ = $En["firstname"];
YF:
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$bU = array($U_, $Dd, $NT);
$QY = $this->getStoreConfig(IDPConstants::SEND_EXPIRED_EMAIL);
if (!($QY == null)) {
goto kr;
}
$this->setStoreConfig(IDPConstants::SEND_EXPIRED_EMAIL, 1);
Curl::submit_to_magento_team($MM, "TRIAL EXPIRED", $bU);
$this->flushCache();
kr:
return true;
Ma:
goto ZR;
tC:
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
$this->setStoreConfig(IDPConstants::EXECUTION_DATE, AESEncryption::encrypt_data($JZ, $St));
ZR:
return false;
fG:
return false;
}
public function extendTrial()
{
$St = "E7XIXCVVUOYAIA2";
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
if (!$this->check_plan(2)) {
goto NR;
}
$En = $this->getCurrentAdminUser()->getData();
$MM = $En["email"];
$U_ = $En["firstname"];
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$N6 = $this->getStoreConfig(IDPConstants::IsTrialExtended);
if (!$N6) {
goto pl;
}
$bU = array($U_, $Dd, $NT);
Curl::submit_to_magento_team($MM, "TRIAL EXTENDED REQUEST FAILED(ALREADY EXTENDED)", $bU);
$this->messageManager->addErrorMessage(IDPMessages::EXTEND_TRIAL_LIMIT_REACHED);
goto Zt;
pl:
$this->setStoreConfig(IDPConstants::IsTrialExtended, true);
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
$this->setStoreConfig(IDPConstants::EXECUTION_DATE, AESEncryption::encrypt_data($JZ, $St));
$bU = array($U_, $Dd, $NT);
Curl::submit_to_magento_team($MM, "TRIAL EXTENDED FOR 7 DAYS", $bU);
$this->messageManager->addSuccessMessage(IDPMessages::TRIAL_EXTENDED);
Zt:
NR:
}
public function getTrialRemainingUsersCount()
{
$St = "E7XIXCVVUOYAIA2";
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
if (!is_null($this->getStoreConfig(IDPConstants::IDP_USERS_COUNT))) {
goto dd;
}
$this->setStoreConfig(IDPConstants::IDP_USERS_COUNT, AESEncryption::encrypt_data(0, $St));
dd:
$Q9 = (int) AESEncryption::decrypt_data($this->getStoreConfig(IDPConstants::IDP_USERS_COUNT), $St);
$bI = (int) AESEncryption::decrypt_data("Y3Vn=", $St);
if (!($Q9 > $bI)) {
goto Dl;
}
$this->flushCache();
$this->reinitConfig();
$QY = $this->getStoreConfig(IDPConstants::TRIAL_LIMIT_EXCEED_ALERT);
if (!($QY == NULL)) {
goto IU;
}
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$bU = array($Dd, $NT);
$this->setStoreConfig(IDPConstants::TRIAL_LIMIT_EXCEED_ALERT, 1);
Curl::submit_to_magento_team('', "User Limit exceeded", $bU);
$this->flushCache();
IU:
return false;
Dl:
return true;
}
public function getMagnetoVersion()
{
return $this->productMetadata->getVersion();
}
}
namespace MiniOrange\IDPSaml\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use MiniOrange\IDPSaml\Helper\IDPConstants;
use MiniOrange\IDPSaml\Model\OAuthServerUsersFactory;
use MiniOrange\IDPSaml\Model\MiniOrangeSpTableFactory;
use Magento\Framework\Stdlib\DateTime\DateTime;
use MiniOrange\IDPSaml\Helper\Saml2\Lib\AESEncryption;
use Magento\Framework\App\ProductMetadataInterface;
use MiniOrange\IDPSaml\Helper\Curl;
use MiniOrange\IDPSaml\Helper\IDPMessages;
class Data extends AbstractHelper
{
protected $scopeConfig;
protected $adminFactory;
protected $customerFactory;
protected $urlInterface;
protected $configWriter;
protected $assetRepo;
protected $helperBackend;
protected $frontendUrl;
protected $oauthServerUsers;
protected $miniOrangeOAuthClientsFactory;
protected $dateTime;
protected $productMetadata;
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $uI, \Magento\User\Model\UserFactory $RK, \Magento\Customer\Model\CustomerFactory $o2, \Magento\Framework\UrlInterface $L8, \Magento\Framework\App\Config\Storage\WriterInterface $FL, \Magento\Framework\View\Asset\Repository $pC, \Magento\Backend\Helper\Data $Db, \Magento\Framework\Url $xA, OAuthServerUsersFactory $lz, MiniOrangeSpTableFactory $eq, DateTime $TT, ProductMetadataInterface $nA)
{
$this->scopeConfig = $uI;
$this->adminFactory = $RK;
$this->customerFactory = $o2;
$this->urlInterface = $L8;
$this->configWriter = $FL;
$this->assetRepo = $pC;
$this->helperBackend = $Db;
$this->frontendUrl = $xA;
$this->oauthServerUsers = $lz;
$this->dateTime = $TT;
$this->miniOrangeOAuthClientsFactory = $eq;
$this->productMetadata = $nA;
}
public function getMiniOrangeOAuthClients()
{
$kW = $this->miniOrangeOAuthClientsFactory->create();
$Kb = $kW->getCollection();
return $Kb;
}
public function getMiniOrangeUrl()
{
return IDPConstants::HOSTNAME;
}
public function getStoreConfig($cL)
{
$PO = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
return $this->scopeConfig->getValue("miniorange/samlidp/" . $cL, $PO);
}
public function setStoreConfig($cL, $TC)
{
$this->configWriter->save("miniorange/samlidp/" . $cL, $TC);
}
public function saveConfig($cz, $TC, "E7XIXCVVUOYAIA2", $vV)
{
$vV ? $this->saveAdminStoreConfig($cz, $TC, "E7XIXCVVUOYAIA2") : $this->saveCustomerStoreConfig($cz, $TC, "E7XIXCVVUOYAIA2");
}
public function getAdminStoreConfig($cL, "E7XIXCVVUOYAIA2")
{
return $this->adminFactory->create()->load("E7XIXCVVUOYAIA2")->getData($cL);
}
private function saveAdminStoreConfig($cz, $TC, "E7XIXCVVUOYAIA2")
{
$Ti = [$cz => $TC];
$kW = $this->adminFactory->create()->load("E7XIXCVVUOYAIA2")->addData($Ti);
$kW->setId("E7XIXCVVUOYAIA2")->save();
}
public function getCustomerStoreConfig($cL, "E7XIXCVVUOYAIA2")
{
return $this->customerFactory->create()->load("E7XIXCVVUOYAIA2")->getData($cL);
}
private function saveCustomerStoreConfig($cz, $TC, "E7XIXCVVUOYAIA2")
{
$Ti = [$cz => $TC];
$kW = $this->customerFactory->create()->load("E7XIXCVVUOYAIA2")->addData($Ti);
$kW->setId("E7XIXCVVUOYAIA2")->save();
}
public function getBaseUrl()
{
return is_null($this->getStoreConfig(IDPConstants::BASE)) ? $this->urlInterface->getBaseUrl() : $this->getStoreConfig(IDPConstants::BASE);
}
public function getCurrentUrl()
{
return $this->urlInterface->getCurrentUrl();
}
public function getUrl($cz, $lw = array())
{
return $this->urlInterface->getUrl($cz, ["_query" => $lw]);
}
public function getFrontendUrl($cz, $lw = array())
{
return $this->frontendUrl->getUrl($cz, ["_query" => $lw]);
}
public function getIssuerUrl()
{
return $this->getBaseUrl() . IDPConstants::ISSUER_URL_PATH;
}
public function getLogoutUrl()
{
return $this->getBaseUrl() . IDPConstants::SAML_LOGOUT_URL;
}
public function getImageUrl($Qk)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_IMAGES . $Qk);
}
public function getAdminCssUrl($wu)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CSS . $wu, ["area" => "adminhtml"]);
}
public function getAdminJSUrl($Zm)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_JS . $Zm, ["area" => "adminhtml"]);
}
public function getMetadataUrl()
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_METADATA, ["area" => "adminhtml"]);
}
public function getMetadataFilePath()
{
return $this->assetRepo->createAsset(IDPConstants::MODULE_DIR . IDPConstants::MODULE_METADATA, ["area" => "adminhtml"])->getSourceFile();
}
public function getResourcePath($hO)
{
return $this->assetRepo->createAsset(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CERTS . $hO, ["area" => "adminhtml"])->getSourceFile();
}
public function getAdminUrl($cz, $lw = array())
{
return $this->helperBackend->getUrl($cz, ["_query" => $lw]);
}
public function getSPInitiatedUrl($u2 = null)
{
$u2 = is_null($u2) ? $this->getCurrentUrl() : $u2;
return $this->getFrontendUrl(IDPConstants::SAML_LOGIN_URL, ["RelayState" => $u2]);
}
public function getAdminCertResourceUrl($hO)
{
return $this->assetRepo->getUrl(IDPConstants::MODULE_DIR . IDPConstants::MODULE_CERTS . $hO, array("area" => "adminhtml"));
}
public function getcounttable()
{
$Kb = $this->getMiniOrangeOAuthClients();
$sA = 0;
foreach ($Kb as $av) {
$AG = $av->getData();
$sA++;
Ni:
}
np:
return $sA;
}
public function getAdminBaseUrl()
{
return $this->helperBackend->getHomePageUrl();
}
public function getAdminSecureUrl($cz, $lw = array())
{
return $this->helperBackend->getUrl($cz, ["_secure" => true, "_query" => $lw]);
}
public function isAllPageAutoRedirectEnabled()
{
return $this->getStoreConfig(IDPConstants::ALL_PAGE_AUTO_REDIRECT);
}
public function addAuthCodeData($Rd, $Tv, $vB, $Tn = null)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (!(isset($Ti["user_id"]) && !empty($Ti["user_id"]))) {
goto eL;
}
$XV = true;
$Ti->setData("user_id", $Rd);
$Ti->setData("auth_code", $Tv);
$Ti->setData("nonce", $Tn);
$Ti->setData("auth_code_expiry_time", $vB);
eL:
if (!($XV == false)) {
goto t2;
}
$kW->setData("user_id", $Rd);
$kW->setData("auth_code", $Tv);
$kW->setData("nonce", $Tn);
$kW->setData("auth_code_expiry_time", $vB);
t2:
$kW->save();
}
public function addAccessTokenData($Rd, $Ho, $ZE)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (isset($Ti) && !empty($Ti) && isset($Ti["user_id"]) && !empty($Ti["user_id"])) {
goto SR;
}
$kW->setData("user_id", $Rd);
$kW->setData("access_token", $Ho);
$kW->setData("access_token_expiry_time", $ZE);
goto DY;
SR:
$XV = true;
$Ti->setData("access_token", $Ho);
$Ti->setData("access_token_expiry_time", $ZE);
DY:
$kW->save();
}
public function addRefreshTokenData($Rd, $cj, $T6)
{
$XV = false;
$kW = $this->oauthServerUsers->create();
$Ti = $kW->load($Rd, "user_id");
if (isset($Ti) && !empty($Ti) && isset($Ti["user_id"]) && !empty($Ti["user_id"])) {
goto BB;
}
$kW->setData("user_id", $Rd);
$kW->setData("refresh_token", $cj);
$kW->setData("refresh_token_expiry_time", $T6);
goto Gn;
BB:
$XV = true;
$Ti->setData("refresh_token", $cj);
$Ti->setData("refresh_token_expiry_time", $T6);
Gn:
$kW->save();
}
public function getUserDataFromCode($fd)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["auth_code"] === $fd)) {
goto hi;
}
$XV = true;
$DB = $av->getData();
return $DB;
hi:
HF:
}
hR:
}
public function getUserDataFromAccessToken($cj)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["refresh_token"] === $cj)) {
goto bA;
}
$XV = true;
$DB = $av->getData();
return $DB;
bA:
og:
}
fS:
}
public function getUserDataFromUserId("E7XIXCVVUOYAIA2")
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["user_id"] === "E7XIXCVVUOYAIA2")) {
goto gk;
}
$XV = true;
$DB = $av->getData();
return $DB;
gk:
mJ:
}
dZ:
}
public function getUserDataFromToken($Cq)
{
$kW = $this->oauthServerUsers->create();
$Ti = $kW->getCollection();
foreach ($Ti as $av) {
if (!($av->getData()["access_token"] === $Cq)) {
goto hA;
}
$XV = true;
$DB = $av->getData();
return $DB;
hA:
go:
}
sv:
}
public function isTrialExpired()
{
if (!$this->check_plan(2)) {
goto fG;
}
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
$bO = AESEncryption::decrypt_data($this->getStoreConfig(IDPConstants::EXECUTION_DATE), "E7XIXCVVUOYAIA2");
if (!$bO) {
goto tC;
}
$zZ = date("Y-m-d H:i:s", strtotime($bO . " + " . 30 . " days"));
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
if (!($JZ > $zZ)) {
goto Ma;
}
$MM = null;
$U_ = null;
if (!$this->getCurrentAdminUser()) {
goto YF;
}
$En = $this->getCurrentAdminUser()->getData();
$MM = $En["email"];
$U_ = $En["firstname"];
YF:
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$bU = array($U_, $Dd, $NT);
$QY = $this->getStoreConfig(IDPConstants::SEND_EXPIRED_EMAIL);
if (!($QY == null)) {
goto kr;
}
$this->setStoreConfig(IDPConstants::SEND_EXPIRED_EMAIL, 1);
Curl::submit_to_magento_team($MM, "TRIAL EXPIRED", $bU);
$this->flushCache();
kr:
return true;
Ma:
goto ZR;
tC:
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
$this->setStoreConfig(IDPConstants::EXECUTION_DATE, AESEncryption::encrypt_data($JZ, "E7XIXCVVUOYAIA2"));
ZR:
return false;
fG:
return false;
}
public function extendTrial()
{
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
if (!$this->check_plan(2)) {
goto NR;
}
$En = $this->getCurrentAdminUser()->getData();
$MM = $En["email"];
$U_ = $En["firstname"];
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$N6 = $this->getStoreConfig(IDPConstants::IsTrialExtended);
if (!$N6) {
goto pl;
}
$bU = array($U_, $Dd, $NT);
Curl::submit_to_magento_team($MM, "TRIAL EXTENDED REQUEST FAILED(ALREADY EXTENDED)", $bU);
$this->messageManager->addErrorMessage(IDPMessages::EXTEND_TRIAL_LIMIT_REACHED);
goto Zt;
pl:
$this->setStoreConfig(IDPConstants::IsTrialExtended, true);
$JZ = $this->dateTime->gmtDate("Y-m-d H:i:s");
$this->setStoreConfig(IDPConstants::EXECUTION_DATE, AESEncryption::encrypt_data($JZ, "E7XIXCVVUOYAIA2"));
$bU = array($U_, $Dd, $NT);
Curl::submit_to_magento_team($MM, "TRIAL EXTENDED FOR 7 DAYS", $bU);
$this->messageManager->addSuccessMessage(IDPMessages::TRIAL_EXTENDED);
Zt:
NR:
}
public function getTrialRemainingUsersCount()
{
$this->setStoreConfig(IDPConstants::DEFAULT_TOKEN, "E7XIXCVVUOYAIA2");
$this->flushCache();
$this->reinitConfig();
if (!is_null($this->getStoreConfig(IDPConstants::IDP_USERS_COUNT))) {
goto dd;
}
$this->setStoreConfig(IDPConstants::IDP_USERS_COUNT, AESEncryption::encrypt_data(0, "E7XIXCVVUOYAIA2"));
dd:
$Q9 = (int) AESEncryption::decrypt_data($this->getStoreConfig(IDPConstants::IDP_USERS_COUNT), "E7XIXCVVUOYAIA2");
$bI = (int) AESEncryption::decrypt_data("Y3Vn=", "E7XIXCVVUOYAIA2");
if (!($Q9 > $bI)) {
goto Dl;
}
$this->flushCache();
$this->reinitConfig();
$QY = $this->getStoreConfig(IDPConstants::TRIAL_LIMIT_EXCEED_ALERT);
if (!($QY == NULL)) {
goto IU;
}
$NT = $this->getBaseUrl();
$Dd = $this->getMagnetoVersion();
$bU = array($Dd, $NT);
$this->setStoreConfig(IDPConstants::TRIAL_LIMIT_EXCEED_ALERT, 1);
Curl::submit_to_magento_team('', "User Limit exceeded", $bU);
$this->flushCache();
IU:
return false;
Dl:
return true;
}
public function getMagnetoVersion()
{
return $this->productMetadata->getVersion();
}
}
© 2023 Quttera Ltd. All rights reserved.