* @copyright 2019 Futurenext srl * @license https://www.zakeke.com/privacy/#general_conditions */ class ZakekeCurrencyModuleFrontController extends ModuleFrontController { /** @var Zakeke */ public $module; /** @var int */ protected $id_product; /** @var string */ protected $status; /** @var int */ protected $id_enabled; public function init() { $this->content_only = true; if (!defined('_PS_BASE_URL_')) { define('_PS_BASE_URL_', Tools::getShopDomain(true)); } if (!defined('_PS_BASE_URL_SSL_')) { define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true)); } } public function initContent() { $this->process(); } public function postProcess() { if (Tools::getIsset('ws_key')) { $key = Tools::getValue('ws_key'); } else { header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized'); header( 'WWW-Authenticate: Basic realm=' .'"Welcome to PrestaShop Webservice, please enter the authentication key as the login."' ); die('401 Unauthorized'); } if (!WebserviceKey::isKeyActive($key)) { die('401 Unauthorized'); } } public function display() { ob_end_clean(); header('Content-Type: application/json'); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->ajaxDie(json_encode(array( 'iso_code' => $currency->iso_code ))); } }