Current File : /var/www/vinorea/modules/ipexportimport/controllers/front/importByGroups.php
<?php
/**
 *
 * NOTICE OF LICENSE
 *
 *  @author    SmartPresta <tehran.alishov@gmail.com>
 *  @copyright 2024 SmartPresta
 *  @license   Commercial License
 */

if (!defined('_PS_VERSION_')) {
    exit;
}

require_once dirname(__FILE__) . '/../../classes/EIAHelper.php';

class IpExportImportImportByGroupsModuleFrontController extends ModuleFrontController
{
    public $eIHelper;

    public function __construct()
    {
        // Call of the parent constructor method
        parent::__construct();
        
        $this->eIHelper = new EIAHelper($this->module);
    }

    public function init()
    {
        if (Configuration::getGlobalValue('IPIA_SCHDL_ENABLE')) {
            if (Tools::getValue('token') === md5(Configuration::getGlobalValue('IPEIA_SECURE_KEY'))) {
                error_reporting(E_ERROR | E_PARSE);
                ini_set('max_execution_time', 0);
                ini_set('memory_limit', '-1');
                require_once dirname(__FILE__) . '/../../classes/import/EIAImport.php';
                $import = new EIAImport($this);
                $import->import();
            } else {
                http_response_code(403);
                die($this->module->l('Token is incorrect.'));
            }
        } else {
            http_response_code(401);
            die($this->module->l('No schedule is enabled in the module.'));
        }
    }
}