first commit

This commit is contained in:
2024-12-17 13:43:22 +01:00
commit 8e6cd8b410
21292 changed files with 3514826 additions and 0 deletions

View File

@@ -0,0 +1,175 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PrestaShop\Module\PsAccounts\Adapter;
class Configuration
{
const PS_ACCOUNTS_FIREBASE_ID_TOKEN = 'PS_ACCOUNTS_FIREBASE_ID_TOKEN';
const PS_PSX_FIREBASE_ID_TOKEN = 'PS_PSX_FIREBASE_ID_TOKEN';
const PS_ACCOUNTS_FIREBASE_REFRESH_TOKEN = 'PS_ACCOUNTS_FIREBASE_REFRESH_TOKEN';
const PS_PSX_FIREBASE_REFRESH_TOKEN = 'PS_PSX_FIREBASE_REFRESH_TOKEN';
const PS_CHECKOUT_SHOP_UUID_V4 = 'PS_CHECKOUT_SHOP_UUID_V4';
const PSX_UUID_V4 = 'PSX_UUID_V4';
const PS_PSX_FIREBASE_ADMIN_TOKEN = 'PS_PSX_FIREBASE_ADMIN_TOKEN';
const PS_ACCOUNTS_FIREBASE_ADMIN_TOKEN = 'PS_ACCOUNTS_FIREBASE_ADMIN_TOKEN';
const PS_PSX_FIREBASE_REFRESH_DATE = 'PS_PSX_FIREBASE_REFRESH_DATE';
const PS_PSX_FIREBASE_EMAIL = 'PS_PSX_FIREBASE_EMAIL';
const PS_ACCOUNTS_FIREBASE_EMAIL = 'PS_ACCOUNTS_FIREBASE_EMAIL';
const PS_PSX_FIREBASE_EMAIL_IS_VERIFIED = 'PS_PSX_FIREBASE_EMAIL_IS_VERIFIED';
const PS_ACCOUNTS_FIREBASE_EMAIL_IS_VERIFIED = 'PS_ACCOUNTS_FIREBASE_EMAIL_IS_VERIFIED';
const PS_PSX_FIREBASE_LOCAL_ID = 'PS_PSX_FIREBASE_LOCAL_ID';
const PS_ACCOUNTS_FIREBASE_LOCAL_ID = 'PS_ACCOUNTS_FIREBASE_LOCAL_ID';
const PS_ACCOUNTS_RSA_PUBLIC_KEY = 'PS_ACCOUNTS_RSA_PUBLIC_KEY';
const PS_ACCOUNTS_RSA_PRIVATE_KEY = 'PS_ACCOUNTS_RSA_PRIVATE_KEY';
const PS_ACCOUNTS_RSA_SIGN_DATA = 'PS_ACCOUNTS_RSA_SIGN_DATA';
/**
* @var int
*/
private $idShop = null;
/**
* @var int
*/
private $idShopGroup = null;
/**
* @var int
*/
private $idLang = null;
/**
* Configuration constructor.
*
* @param \Context $context
*/
public function __construct(\Context $context)
{
$this->setIdShop((int) $context->shop->id);
}
/**
* @return int
*/
public function getIdShop()
{
return $this->idShop;
}
/**
* @param int $idShop
*
* @return void
*/
public function setIdShop($idShop)
{
$this->idShop = $idShop;
}
/**
* @return int
*/
public function getIdShopGroup()
{
return $this->idShopGroup;
}
/**
* @param int $idShopGroup
*
* @return void
*/
public function setIdShopGroup($idShopGroup)
{
$this->idShopGroup = $idShopGroup;
}
/**
* @return int
*/
public function getIdLang()
{
return $this->idLang;
}
/**
* @param int $idLang
*
* @return void
*/
public function setIdLang($idLang)
{
$this->idLang = $idLang;
}
/**
* @param string $key
* @param string|bool $default
*
* @return mixed
*/
public function get($key, $default = false)
{
return $this->getRaw($key, $this->idLang, $this->idShopGroup, $this->idShop, $default);
}
/**
* @param string $key
* @param int|null $idLang
* @param int|null $idShopGroup
* @param int|null $idShop
* @param string|bool $default
*
* @return mixed
*/
public function getRaw($key, $idLang = null, $idShopGroup = null, $idShop = null, $default = false)
{
$value = \Configuration::get($key, $idLang, $idShopGroup, $idShop);
return $value ?: ($default !== false ? $default : $value);
}
/**
* @param string $key
* @param string|array $values
* @param bool $html
*
* @return mixed
*/
public function set($key, $values, $html = false)
{
return $this->setRaw($key, $values, $html, $this->idShopGroup, $this->idShop);
}
/**
* @param string $key
* @param string|array $values
* @param bool $html
* @param int|null $idShopGroup
* @param int|null $idShop
*
* @return mixed
*/
public function setRaw($key, $values, $html = false, $idShopGroup = null, $idShop = null)
{
return \Configuration::updateValue($key, $values, $html, $idShopGroup, $idShop);
}
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PrestaShop\Module\PsAccounts\Adapter;
use PrestaShop\Module\PsAccounts\Context\ShopContext;
/**
* Link adapter
*/
class Link
{
/**
* @var ShopContext
*/
private $shopContext;
/**
* Link object
*
* @var \Link
*/
private $link;
public function __construct(
ShopContext $shopContext,
\Link $link = null
) {
if (null === $link) {
$link = new \Link();
}
$this->shopContext = $shopContext;
$this->link = $link;
}
/**
* Adapter for getAdminLink from prestashop link class
*
* @param string $controller controller name
* @param bool $withToken include or not the token in the url
* @param array $sfRouteParams
* @param array $params
*
* @return string
*
* @throws \PrestaShopException
*/
public function getAdminLink($controller, $withToken = true, $sfRouteParams = [], $params = [])
{
if ($this->shopContext->isShop17()) {
return $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params);
}
$paramsAsString = '';
foreach ($params as $key => $value) {
$paramsAsString .= "&$key=$value";
}
return \Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/' . $this->link->getAdminLink($controller, $withToken) . $paramsAsString;
}
/**
* @return \Link
*/
public function getLink()
{
return $this->link;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;