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 /* * @ https://EasyToYou.eu - IonCube v11 Decoder Online * @ PHP 7.2 & 7.3 * ..

Decoded Output download

<?php 
/* 
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online 
 * @ PHP 7.2 & 7.3 
 * @ Decoder version: 1.0.6 
 * @ Release: 10/08/2022 
 */ 
 
require_once DIR_SYSTEM . "/engine/neoseo_controller.php"; 
class ControllerToolNeoSeoExchange1c extends NeoSeoController 
{ 
    private $error = []; 
    public function __construct($registry) 
    { 
        parent::__construct($registry); 
        $this->_moduleSysName = "neoseo_exchange1c"; 
        $this->_logFile = $this->_moduleSysName . ".log"; 
        $this->debug = $this->config->get($this->_moduleSysName . "_debug") == 1; 
    } 
    public function _obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($dir) 
    { 
        $_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ = glob($dir . ".*", GLOB_MARK); 
        foreach ($_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ as $file) { 
            if (!is_dir($file)) { 
                $this->debug("  - " . $file); 
                unlink($file); 
            } 
        } 
        $_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ = glob($dir . "*", GLOB_MARK); 
        foreach ($_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ as $file) { 
            if (is_dir($file)) { 
                $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($file); 
            } else { 
                if (!is_link($file)) { 
                    $this->debug("  - " . $file); 
                    unlink($file); 
                } 
            } 
        } 
        if (file_exists($dir)) { 
            rmdir($dir); 
        } 
    } 
    public function _obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($src, $dst) 
    { 
        $dir = opendir($src); 
        @mkdir($dst); 
        while (false !== ($file = readdir($dir))) { 
            if ($file != "." && $file != "..") { 
                if (is_dir($src . "/" . $file)) { 
                    $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($src . "/" . $file, $dst . "/" . $file); 
                } else { 
                    copy($src . "/" . $file, $dst . "/" . $file); 
                } 
            } 
        } 
        closedir($dir); 
    } 
    public function delete_products_warehouses() 
    { 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_warehouse`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_warehouse`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_related_option_warehouse`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_products() 
    { 
        $this->load->model("catalog/product"); 
        $query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_product->deleteProduct($row["product_id"]); 
        } 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_1c_products() 
    { 
        $this->load->model("catalog/product"); 
        $query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product_to_1c`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_product->deleteProduct($row["product_id"]); 
        } 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_links() 
    { 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "category_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_categories() 
    { 
        $this->load->model("catalog/category"); 
        $query = $this->db->query("SELECT category_id FROM `" . DB_PREFIX . "category`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_category->deleteCategory($row["category_id"]); 
        } 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "category_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_manufacturers() 
    { 
        $this->load->model("catalog/manufacturer"); 
        $query = $this->db->query("SELECT manufacturer_id FROM `" . DB_PREFIX . "manufacturer`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_manufacturer->deleteManufacturer($row["manufacturer_id"]); 
        } 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_attributes() 
    { 
        $this->load->model("catalog/attribute"); 
        $query = $this->db->query("SELECT attribute_id FROM `" . DB_PREFIX . "attribute`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_attribute->deleteAttribute($row["attribute_id"]); 
        } 
        $this->load->model("catalog/attribute_group"); 
        $query = $this->db->query("SELECT attribute_group_id FROM `" . DB_PREFIX . "attribute_group`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_attribute_group->deleteAttributeGroup($row["attribute_group_id"]); 
        } 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function delete_options() 
    { 
        $this->load->model("catalog/option"); 
        $query = $this->db->query("SELECT option_id FROM `" . DB_PREFIX . "option`"); 
        foreach ($query->rows as $row) { 
            $this->model_catalog_option->deleteOption($row["option_id"]); 
        } 
        if ($this->config->get("neoseo_exchange1c_use_related_options")) { 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions"); 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_discount"); 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_option"); 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_special"); 
            $query = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . "relatedoptions_to_char'"); 
            if (0 < $query->num_rows) { 
                $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_to_char"); 
            } 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant"); 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant_option"); 
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant_product"); 
        } 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
    } 
    public function get_orders() 
    { 
        $query = $this->db->query("SELECT order_id FROM `" . DB_PREFIX . "order`"); 
        $result = []; 
        foreach ($query->rows as $row) { 
            $result[] = $row["order_id"]; 
        } 
        echo json_encode($result); 
    } 
    public function import() 
    { 
        $this->load->language("extension/module/neoseo_exchange1c"); 
        $this->load->model("tool/neoseo_exchange1c"); 
        if (empty($this->request->files["filename"]["name"])) { 
            $this->log("!     "); 
            return $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
        } 
        $filename = $this->request->files["filename"]["name"]; 
        $tmpfilename = $this->request->files["filename"]["tmp_name"]; 
        if (!$tmpfilename) { 
            $this->log($this->language->get("error_post_size")); 
            $this->session->data["warning"] = $this->language->get("error_post_size"); 
            $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
        } else { 
            $cache = DIR_CACHE . "exchange1c/"; 
            if (!is_dir($cache)) { 
                mkdir($cache); 
            } 
            $zip = new ZipArchive(); 
            $res = $zip->open($tmpfilename); 
            $this->debug("   " . $tmpfilename . ": " . $res); 
            if ($res === true) { 
                $this->debug(" : " . $filename); 
                $zip->extractTo($cache); 
                $files = scandir($cache); 
                $found = 0; 
                foreach ($files as $file) { 
                    if (is_file($cache . $file)) { 
                        $found++; 
                        $this->debug("  " . $file . "   " . $filename); 
                        $this->modeImport($file); 
                    } 
                } 
                if (!$found) { 
                    $this->log($this->language->get("error_empty_archive")); 
                    $this->session->data["warning"] = $this->language->get("error_empty_archive"); 
                    $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
                    return NULL; 
                } 
                if (is_dir($cache . "import_files")) { 
                    if (substr(VERSION, 0, 1) == "1") { 
                        $images = DIR_IMAGE . "data/import_files/"; 
                    } else { 
                        $images = DIR_IMAGE . "catalog/import_files/"; 
                    } 
                    if (is_dir($images) && $this->config->get("neoseo_exchange1c_use_tree_delete")) { 
                        $this->debug("     " . $images); 
                        $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($cache . "import_files/", $images); 
                        $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache . "import_files/"); 
                    } else { 
                        rename($cache . "import_files/", $images); 
                    } 
                } 
            } else { 
                $buffer = file_get_contents($tmpfilename, "r"); 
                if (strpos($buffer, "") || strpos($buffer, "")) { 
                    $this->debug("  : " . $filename); 
                    move_uploaded_file($tmpfilename, $cache . "offers.xml"); 
                    $this->modeImport("offers.xml"); 
                } else { 
                    if (strpos($buffer, "")) { 
                        $this->debug("  : " . $filename); 
                        move_uploaded_file($tmpfilename, $cache . "import.xml"); 
                        $this->modeImport("import.xml"); 
                    } else { 
                        if (strpos($buffer, "")) { 
                            $this->debug("  : " . $filename); 
                            move_uploaded_file($tmpfilename, $cache . "orders.xml"); 
                            $this->modeImport("orders.xml"); 
                        } else { 
                            if (strpos($buffer, "") && strpos($buffer, "")) { 
                                $this->debug("  : " . $filename); 
                                move_uploaded_file($tmpfilename, $cache . "contragents.xml"); 
                                $this->modeImport("contragents.xml"); 
                            } else { 
                                $this->log("!    : " . $filename . " / " . $buffer); 
                                $json["error"] = $this->language->get("text_upload_error"); 
                                $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
                            } 
                        } 
                    } 
                } 
            } 
            $this->session->data["success"] = $this->language->get("text_upload_success"); 
            $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
        } 
    } 
    public function export() 
    { 
        $this->load->model("tool/neoseo_exchange1c"); 
        $orders = $this->model_tool_neoseo_exchange1c->queryOrders(); 
        header("Content-Description: File Transfer"); 
        header("Content-Type: application/octet-stream"); 
        header("Content-Disposition: attachment; filename=orders.xml"); 
        header("Content-Transfer-Encoding: binary"); 
        header("Expires: 0"); 
        header("Cache-Control: must-revalidate"); 
        header("Pragma: public"); 
        header("Content-Length: " . strlen($orders)); 
        if ($this->config->get("neoseo_exchange1c_order_utf8") == 1) { 
            if ($this->config->get("neoseo_exchange1c_order_utf8_bom") == 1) { 
                echo chr(239) . chr(187) . chr(191) . $orders; 
            } else { 
                echo $orders; 
            } 
        } else { 
            echo @iconv("utf-8", "cp1251//TRANSLIT", @str_replace("encoding=\"utf-8\"", "encoding=\"cp-1251\"", $orders)); 
        } 
    } 
    public function export_product() 
    { 
        $this->load->model("catalog/option"); 
        $this->load->model("tool/neoseo_exchange1c"); 
        $options = $this->model_catalog_option->getOptions(); 
        $tmpArchiveName = tempnam("/tmp", "products_zip"); 
        $zip = new ZipArchive(); 
        if ($zip->open($tmpArchiveName) !== true) { 
            $this->log("   "); 
            exit; 
        } 
        foreach ($options as $option) { 
            $filenameTmp = tempnam("/tmp", "products_" . $option["name"]); 
            $filenameArchive = "products_" . $option["name"] . ".xlsx"; 
            $this->model_tool_neoseo_exchange1c->exportProducts($option["option_id"], $option["name"], $filenameTmp); 
            $zip->addFile($filenameTmp, $filenameArchive); 
        } 
        $filenameTmp = tempnam("/tmp", "products"); 
        $filenameArchive = "products.xlsx"; 
        $this->model_tool_neoseo_exchange1c->exportProducts(0, "", $filenameTmp); 
        $zip->addFile($filenameTmp, $filenameArchive); 
        $zip->close(); 
        header("Content-Type: application/zip"); 
        header("Content-Disposition: attachment;filename=products.zip"); 
        header("Cache-Control: max-age=0"); 
        header("Pragma: no-cache"); 
        header("Expires: 0"); 
        header("Content-length: " . filesize($tmpArchiveName)); 
        readfile($tmpArchiveName); 
        exit; 
    } 
    public function _obfuscated_FFAF96B3AC85A7B29289A6BEB8A786A99B8EA181999B91_($lines) 
    { 
        $res = []; 
        foreach (explode("
", trim($lines)) as $_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_) { 
            if (trim($_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_) != "") { 
                $res[] = trim($_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_); 
            } 
        } 
        return $res; 
    } 
    public function modeCheckauth() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]); 
        if (!$this->config->get("neoseo_exchange1c_status")) { 
            $this->debug("   "); 
            echo "failure
1c module OFF"; 
            exit; 
        } 
        if ($this->config->get("neoseo_exchange1c_ip_list") != "") { 
            $ip = $_SERVER["REMOTE_ADDR"]; 
            $allow_ips = $this->_obfuscated_FFAF96B3AC85A7B29289A6BEB8A786A99B8EA181999B91_($this->config->get("neoseo_exchange1c_ip_list")); 
            if (!in_array($ip, $allow_ips)) { 
                $this->debug("   IP : " . $ip . ".   IP : " . implode(",", $allow_ips)); 
                echo "failure
IP is not allowed"; 
                exit; 
            } 
        } 
        $login = ""; 
        $password = ""; 
        if (isset($_SERVER["REMOTE_USER"])) { 
            $tmp = explode(" ", $_SERVER["REMOTE_USER"]); 
            $tmp = explode(":", base64_decode($tmp[1])); 
            list($login, $password) = $tmp; 
        } else { 
            if (isset($_SERVER["REDIRECT_REMOTE_USER"])) { 
                $tmp = explode(" ", $_SERVER["REDIRECT_REMOTE_USER"]); 
                $tmp = explode(":", base64_decode($tmp[1])); 
                list($login, $password) = $tmp; 
            } else { 
                if (isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])) { 
                    $login = $_SERVER["PHP_AUTH_USER"]; 
                    $password = $_SERVER["PHP_AUTH_PW"]; 
                } 
            } 
        } 
        if (!$login) { 
            $this->debug("  "); 
            echo "failure
login required
Possible solution:
Add this line to your .htaccess file after RewriteEngine ON
RewriteRule .*neoseo_exchange1c.php\$ - [E=REMOTE_USER:%{HTTP:Authorization},L]
"; 
            exit; 
        } 
        if (!$password) { 
            $this->debug("  "); 
            echo "failure
password required
"; 
            exit; 
        } 
        if ($login != $this->config->get("neoseo_exchange1c_username")) { 
            $this->debug(" : '" . $login . "', : '" . $this->config->get("neoseo_exchange1c_username") . "'"); 
            echo "failure
error login
"; 
            exit; 
        } 
        if ($password != $this->config->get("neoseo_exchange1c_password")) { 
            $this->debug(" : '" . $password . "', : '" . $this->config->get("neoseo_exchange1c_password") . "'"); 
            echo "failure
error password
"; 
            exit; 
        } 
        $this->log("  : " . md5($this->config->get("neoseo_exchange1c_password"))); 
        echo "success
key
"; 
        echo md5($this->config->get("neoseo_exchange1c_password")) . "
"; 
    } 
    public function _obfuscated_FFB5888EB5B4AF8C818CAA9A8D8AB8A39BC0928398A881_() 
    { 
        $cache = DIR_CACHE . "exchange1c/"; 
        $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache); 
        mkdir($cache); 
    } 
    public function modeCatalogInit() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]); 
        $this->_obfuscated_FFB5888EB5B4AF8C818CAA9A8D8AB8A39BC0928398A881_(); 
        $limit = 104857600; 
        if ($this->config->get("neoseo_exchange1c_enable_zip")) { 
            $this->log("    zip"); 
            echo "zip=yes
"; 
        } else { 
            $this->log("     "); 
            echo "zip=no
"; 
        } 
        echo "file_limit=" . $limit . "
"; 
        $this->log("  "); 
    } 
    public function modeSaleInit() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]); 
        $limit = 104857600; 
        echo "zip=no
"; 
        echo "file_limit=" . $limit . "
"; 
        $this->debug("  "); 
    } 
    private function checkUploadFileTree($path, $curDir = NULL) 
    { 
        if (!$curDir) { 
            $curDir = DIR_CACHE . "exchange1c/"; 
        } 
        foreach (explode("/", $path) as $name) { 
            if ($name) { 
                if (file_exists($curDir . $name)) { 
                    if (is_dir($curDir . $name)) { 
                        $curDir = $curDir . $name . "/"; 
                    } else { 
                        unlink($curDir . $name); 
                    } 
                } 
                if (!mkdir($curDir . $name)) { 
                    $this->log("   : " . $curDir . $name); 
                } 
                $curDir = $curDir . $name . "/"; 
            } 
        } 
    } 
    public function modeFile() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"] . "&filename=" . $this->request->get["filename"]); 
        if (!isset($this->request->cookie["key"])) { 
            $this->log("type=catalog&mode=file:    "); 
        } else { 
            if ($this->request->cookie["key"] != md5($this->config->get("neoseo_exchange1c_password"))) { 
                $this->log("type=catalog&mode=file     "); 
                echo "failure
Session error"; 
            } else { 
                $wait_import_command = $this->config->get("neoseo_exchange1c_wait_import_command"); 
                $cache = DIR_CACHE . "exchange1c/"; 
                if (!is_dir($cache)) { 
                    mkdir($cache); 
                } 
                if (isset($this->request->get["filename"])) { 
                    $upload_file = $cache . $this->request->get["filename"]; 
                    $isImage = false; 
                    if (strpos($this->request->get["filename"], "import_files") !== false) { 
                        $isImage = true; 
                        if (substr(VERSION, 0, 1) == "1") { 
                            $cache = DIR_IMAGE . "data/"; 
                        } else { 
                            $cache = DIR_IMAGE . "catalog/"; 
                        } 
                        if (strpos($this->request->get["filename"], ".pdf") !== false) { 
                            $cache = DIR_DOWNLOAD; 
                            $upload_file = $cache . $this->request->get["filename"]; 
                            $upload_file = $cache . basename($upload_file); 
                            $this->checkUploadFileTree("", $cache); 
                        } else { 
                            $upload_file = $cache . $this->request->get["filename"]; 
                            $this->checkUploadFileTree(dirname($this->request->get["filename"]), $cache); 
                        } 
                    } 
                    $data = file_get_contents("php://input"); 
                    if ($data === false) { 
                        $this->log("type=catalog&mode=file:    "); 
                        echo "failure
No data file
"; 
                    } else { 
                        $isOrders = false; 
                        if (false !== strpos($data, "<")) { 
                            $isOrders = true; 
                            $upload_file = $cache . "orders.xml"; 
                        } 
                        $fp = fopen($upload_file, "wb"); 
                        if (!$fp) { 
                            $this->log("type=catalog&mode=file:    "); 
                            echo "failure
"; 
                            echo "Can not open file: " . $upload_file . "
"; 
                        } else { 
                            $result = fwrite($fp, $data); 
                            fclose($fp); 
                            if ($result === strlen($data)) { 
                                $this->log("  " . $upload_file . "  "); 
                                echo "success
"; 
                                chmod($upload_file, 511); 
                            } else { 
                                if (strlen($data) < $result) { 
                                    $this->log("type=catalog&mode=file: !     strlen,       .      php    !     !"); 
                                    echo "success
"; 
                                    chmod($upload_file, 511); 
                                } else { 
                                    $this->log("type=catalog&mode=file:    .   " . strlen($data) . ",   " . (int) $result); 
                                    echo "failure
"; 
                                } 
                            } 
                            if ($isImage) { 
                                return NULL; 
                            } 
                            if ($isOrders && !$wait_import_command) { 
                                $this->modeImport("orders.xml"); 
                            } else { 
                                $this->load->model("tool/neoseo_exchange1c"); 
                                $zip = new ZipArchive(); 
                                $res = $zip->open($upload_file); 
                                $this->debug("   - " . $res); 
                                if ($res !== true) { 
                                    if ((strpos($upload_file, "orders") !== false || strpos($upload_file, "documents") !== false) && !$wait_import_command) { 
                                        $this->model_tool_neoseo_exchange1c->parseOrders($this->request->get["filename"]); 
                                    } 
                                } else { 
                                    $this->debug(" : " . $upload_file); 
                                    $zip->extractTo($cache); 
                                    $files = scandir($cache); 
                                    $found = 0; 
                                    foreach ($files as $file) { 
                                        if (is_file($cache . $file)) { 
                                            $found++; 
                                            $this->debug("  " . $file . "   " . $upload_file); 
                                            if (strpos($file, "import") !== false) { 
                                                $this->model_tool_neoseo_exchange1c->parseImport($file); 
                                            } else { 
                                                if (strpos($file, "offers") !== false) { 
                                                    $this->model_tool_neoseo_exchange1c->parseOffers($file); 
                                                } else { 
                                                    if (strpos($file, "orders") !== false || strpos($file, "documents") !== false) { 
                                                        $this->model_tool_neoseo_exchange1c->parseOrders($file); 
                                                    } else { 
                                                        if (strpos($file, "contragents") !== false) { 
                                                            $this->model_tool_neoseo_exchange1c->parseContragents($file); 
                                                        } 
                                                    } 
                                                } 
                                            } 
                                        } 
                                    } 
                                    if (!$found) { 
                                        $this->log($this->language->get("error_empty_archive")); 
                                        $this->session->data["warning"] = $this->language->get("error_empty_archive"); 
                                        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL")); 
                                        return NULL; 
                                    } 
                                    if (is_dir($cache . "import_files")) { 
                                        $this->log("   .    "); 
                                        if (substr(VERSION, 0, 1) == "1") { 
                                            $images = DIR_IMAGE . "data/import_files/"; 
                                        } else { 
                                            $images = DIR_IMAGE . "catalog/import_files/"; 
                                        } 
                                        if (strpos($this->request->get["filename"], ".pdf") !== false) { 
                                            $cache = DIR_DOWNLOAD; 
                                        } 
                                        if (is_dir($images) && $this->config->get("neoseo_exchange1c_use_tree_delete")) { 
                                            $this->debug("     " . $images); 
                                            $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($cache . "import_files/", $images); 
                                            $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache . "import_files/"); 
                                        } else { 
                                            rename($cache . "import_files/", $images); 
                                        } 
                                    } 
                                } 
                            } 
                        } 
                    } 
                } else { 
                    $this->log("type=catalog&mode=file:    "); 
                    echo "failure
ERROR 10: No file name variable"; 
                } 
            } 
        } 
    } 
    public function modeImport($manual = false) 
    { 
        if ($manual) { 
            $filename = $manual; 
        } else { 
            if (isset($this->request->get["filename"])) { 
                $filename = $this->request->get["filename"]; 
                $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"] . "&filename=" . $filename); 
            } else { 
                echo "failure
ERROR 10: No file name variable"; 
                return 0; 
            } 
        } 
        $cache = DIR_CACHE . "exchange1c/"; 
        if (!is_dir($cache)) { 
            mkdir($cache); 
        } 
        $fullFileName = $cache . $filename; 
        if (!file_exists($fullFileName)) { 
            $this->log("  : " . $fullFileName); 
            echo "failure
ERROR 10: file not found"; 
            return 0; 
        } 
        $this->load->model("tool/neoseo_exchange1c"); 
        if (strpos($filename, "import") !== false) { 
            if ($this->config->get($this->_moduleSysName . "_user_answer_for_moy_sklad") == 1) { 
                $marker_filename = DIR_CACHE . "exchange1c/" . "import_marker.json"; 
                if (file_exists($marker_filename) && time() - filemtime($marker_filename) < 300) { 
                    $this->log("  : " . $marker_filename); 
                    $status = json_decode(file_get_contents($marker_filename), true); 
                    if ($status["status"] == "processing" || $status["status"] == "success") { 
                        $this->log("   import_marker : " . $status["status"]); 
                        if (!$manual) { 
                            echo $status["status"] . "
"; 
                        } 
                    } else { 
                        $this->log("  import_marker  : " . $status["status"]); 
                    } 
                } else { 
                    $status["status"] = "processing"; 
                    file_put_contents($marker_filename, json_encode($status)); 
                    $this->log("  import_marker  : " . $status["status"]); 
                    $this->model_tool_neoseo_exchange1c->parseImport($filename); 
                    $status["status"] = "success"; 
                    file_put_contents($marker_filename, json_encode($status)); 
                    $this->log("  import_marker  : " . $status["status"]); 
                } 
            } else { 
                $this->model_tool_neoseo_exchange1c->parseImport($filename); 
                if (!$manual) { 
                    echo "success
"; 
                } 
            } 
        } else { 
            if (strpos($filename, "offers") !== false || strpos($filename, "rests") !== false || strpos($filename, "prices") !== false) { 
                if ($this->config->get($this->_moduleSysName . "_user_answer_for_moy_sklad") == 1) { 
                    $marker_filename = DIR_CACHE . "exchange1c/" . "offer_marker.json"; 
                    if (file_exists($marker_filename) && time() - filemtime($marker_filename) < 300) { 
                        $this->log("  : " . $marker_filename); 
                        $status = json_decode(file_get_contents($marker_filename), true); 
                        if ($status["status"] == "processing" || $status["status"] == "success") { 
                            $this->log("   offer_marker : " . $status["status"]); 
                            if (!$manual) { 
                                echo $status["status"] . "
"; 
                            } 
                        } else { 
                            $this->log("  offer_marker  : " . $status["status"]); 
                        } 
                    } else { 
                        $status["status"] = "processing"; 
                        file_put_contents($marker_filename, json_encode($status)); 
                        $this->log("  offer_marker  : " . $status["status"]); 
                        $this->model_tool_neoseo_exchange1c->parseOffers($filename); 
                        $status["status"] = "success"; 
                        file_put_contents($marker_filename, json_encode($status)); 
                        $this->log("  offer_marker  : " . $status["status"]); 
                    } 
                } else { 
                    $this->model_tool_neoseo_exchange1c->parseOffers($filename); 
                    if (!$manual) { 
                        echo "success
"; 
                    } 
                } 
            } else { 
                if (strpos($filename, "orders") !== false || strpos($filename, "documents") !== false) { 
                    $this->model_tool_neoseo_exchange1c->parseOrders($filename); 
                    if (!$manual) { 
                        echo "success
"; 
                    } 
                } else { 
                    if (strpos($filename, "contragents") !== false) { 
                        $this->model_tool_neoseo_exchange1c->parseContragents($filename); 
                        if (!$manual) { 
                            echo "success
"; 
                        } 
                    } else { 
                        echo "failure
"; 
                        echo $filename; 
                    } 
                } 
            } 
        } 
        if ($this->config->get($this->_moduleSysName . "_update_auto_neoseo_filter_warehouse") == 1) { 
            $this->log("   \"\""); 
            $this->model_tool_neoseo_exchange1c->updateNeoSeoFilterWarehouse(); 
        } 
        if ($this->config->get($this->_moduleSysName . "_product_update_avaro") == 1) { 
            $this->log("   \"HYPER PRODUCT MODELS (hpmodel_links)\""); 
            $this->model_tool_neoseo_exchange1c->updateModuleHyperProductModels(); 
        } 
        $this->cache->delete("product"); 
    } 
    public function modeExport() 
    { 
        $this->load->model("tool/neoseo_exchange1c"); 
        $products = $this->model_tool_neoseo_exchange1c->queryProducts(); 
        header("Content-Type: text/xml; charset=utf-8", true); 
        echo $products; 
    } 
    public function modeExportAll() 
    { 
        $this->load->model("tool/neoseo_exchange1c"); 
        $products = $this->model_tool_neoseo_exchange1c->queryAllProducts(); 
        header("Content-Type: text/xml; charset=utf-8", true); 
        echo $products; 
    } 
    public function modeQueryOrders() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]); 
        $this->load->model("tool/neoseo_exchange1c"); 
        $orders = $this->model_tool_neoseo_exchange1c->queryOrders(); 
        if ($this->config->get("neoseo_exchange1c_order_utf8") == 1) { 
            header("Content-Type: text/html; charset=utf-8", true); 
            if ($this->config->get("neoseo_exchange1c_order_utf8_bom") == 1) { 
                echo chr(239) . chr(187) . chr(191) . $orders; 
            } else { 
                echo $orders; 
            } 
        } else { 
            header("Content-Type: text/html; charset=win-1251", true); 
            echo @iconv("utf-8", "cp1251//TRANSLIT", @str_replace("encoding=\"utf-8\"", "encoding=\"cp-1251\"", $orders)); 
        } 
    } 
    public function changeOrderExport1C() 
    { 
        $json = []; 
        if (!isset($this->request->post["order_id"]) && !isset($this->request->post["status"])) { 
            $json["success"] = false; 
            $this->response->setOutput(json_encode($json)); 
            return false; 
        } 
        $order_id = $this->request->post["order_id"]; 
        $this->load->model("tool/" . $this->_moduleSysName); 
        if ($this->request->post["status"] == "0") { 
            $this->model_tool_neoseo_exchange1c->addOrderTo1C($order_id); 
        } else { 
            $this->model_tool_neoseo_exchange1c->deleteOrderTo1C($order_id); 
        } 
        $json["success"] = true; 
        $this->response->setOutput(json_encode($json)); 
    } 
    public function deleteExportListOrders() 
    { 
        $this->load->language("extension/module/neoseo_exchange1c"); 
        $this->load->model("tool/" . $this->_moduleSysName); 
        $orders = $this->model_tool_neoseo_exchange1c->getAllOrderTo1C(); 
        if ($orders) { 
            foreach ($orders as $order) { 
                $this->model_tool_neoseo_exchange1c->deleteOrderTo1C($order["order_id"]); 
            } 
            $response = true; 
        } else { 
            $response = false; 
        } 
        if ($response) { 
            exit(json_encode(["message" => $this->language->get("text_cleaned")])); 
        } 
        exit(json_encode(["message" => $this->language->get("text_err_cleaned")])); 
    } 
    public function counterpartiesDelete() 
    { 
        $this->db->query("DELETE FROM `" . DB_PREFIX . "customer` WHERE customer_id in (SELECT customer_id FROM `" . DB_PREFIX . "customer_to_1c`)"); 
        $this->db->query("DELETE FROM `" . DB_PREFIX . "address` WHERE customer_id in (SELECT customer_id FROM `" . DB_PREFIX . "customer_to_1c`)"); 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "customer_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "token=" . $this->session->data["token"], "SSL")); 
    } 
    public function counterpartiesDeleteLinks() 
    { 
        $this->db->query("TRUNCATE `" . DB_PREFIX . "customer_to_1c`"); 
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "token=" . $this->session->data["token"], "SSL")); 
    } 
    public function _obfuscated_FFBEA4B9AFBBB9BD9D98A8A88DBCADB2BDB792A39098A1_() 
    { 
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]); 
        $this->load->model("tool/neoseo_exchange1c"); 
        $_obfuscated_0D07081A0F400F18170D4040092E340A39293B1F263011_ = $this->model_tool_neoseo_exchange1c->queryContragents(); 
        header("Content-Type: text/xml; charset=utf-8", true); 
        echo $_obfuscated_0D07081A0F400F18170D4040092E340A39293B1F263011_; 
    } 
    public function exportContragents() 
    { 
        $this->load->model("tool/neoseo_exchange1c"); 
        $c_data = $this->model_tool_neoseo_exchange1c->queryContragents(); 
        header("Content-Description: File Transfer"); 
        header("Content-Type: application/octet-stream"); 
        header("Content-Disposition: attachment; filename=contragents.xml"); 
        header("Content-Transfer-Encoding: binary"); 
        header("Expires: 0"); 
        header("Cache-Control: must-revalidate"); 
        header("Pragma: public"); 
        header("Content-Length: " . strlen($c_data)); 
        header("Content-Type: text/xml; charset=utf-8", true); 
        echo $c_data; 
    } 
} 
 
?>

Did this file decode correctly?

Original Code

<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.0.6
 * @ Release: 10/08/2022
 */

require_once DIR_SYSTEM . "/engine/neoseo_controller.php";
class ControllerToolNeoSeoExchange1c extends NeoSeoController
{
    private $error = [];
    public function __construct($registry)
    {
        parent::__construct($registry);
        $this->_moduleSysName = "neoseo_exchange1c";
        $this->_logFile = $this->_moduleSysName . ".log";
        $this->debug = $this->config->get($this->_moduleSysName . "_debug") == 1;
    }
    public function _obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($dir)
    {
        $_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ = glob($dir . ".*", GLOB_MARK);
        foreach ($_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ as $file) {
            if (!is_dir($file)) {
                $this->debug("  - " . $file);
                unlink($file);
            }
        }
        $_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ = glob($dir . "*", GLOB_MARK);
        foreach ($_obfuscated_0D1A142C5B2512133F340B240F1A332C273801175C3832_ as $file) {
            if (is_dir($file)) {
                $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($file);
            } else {
                if (!is_link($file)) {
                    $this->debug("  - " . $file);
                    unlink($file);
                }
            }
        }
        if (file_exists($dir)) {
            rmdir($dir);
        }
    }
    public function _obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($src, $dst)
    {
        $dir = opendir($src);
        @mkdir($dst);
        while (false !== ($file = readdir($dir))) {
            if ($file != "." && $file != "..") {
                if (is_dir($src . "/" . $file)) {
                    $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($src . "/" . $file, $dst . "/" . $file);
                } else {
                    copy($src . "/" . $file, $dst . "/" . $file);
                }
            }
        }
        closedir($dir);
    }
    public function delete_products_warehouses()
    {
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_warehouse`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_warehouse`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_related_option_warehouse`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_products()
    {
        $this->load->model("catalog/product");
        $query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product`");
        foreach ($query->rows as $row) {
            $this->model_catalog_product->deleteProduct($row["product_id"]);
        }
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_1c_products()
    {
        $this->load->model("catalog/product");
        $query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product_to_1c`");
        foreach ($query->rows as $row) {
            $this->model_catalog_product->deleteProduct($row["product_id"]);
        }
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_links()
    {
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_to_1c`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "product_option_to_1c`");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "category_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_categories()
    {
        $this->load->model("catalog/category");
        $query = $this->db->query("SELECT category_id FROM `" . DB_PREFIX . "category`");
        foreach ($query->rows as $row) {
            $this->model_catalog_category->deleteCategory($row["category_id"]);
        }
        $this->db->query("TRUNCATE `" . DB_PREFIX . "category_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_manufacturers()
    {
        $this->load->model("catalog/manufacturer");
        $query = $this->db->query("SELECT manufacturer_id FROM `" . DB_PREFIX . "manufacturer`");
        foreach ($query->rows as $row) {
            $this->model_catalog_manufacturer->deleteManufacturer($row["manufacturer_id"]);
        }
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_attributes()
    {
        $this->load->model("catalog/attribute");
        $query = $this->db->query("SELECT attribute_id FROM `" . DB_PREFIX . "attribute`");
        foreach ($query->rows as $row) {
            $this->model_catalog_attribute->deleteAttribute($row["attribute_id"]);
        }
        $this->load->model("catalog/attribute_group");
        $query = $this->db->query("SELECT attribute_group_id FROM `" . DB_PREFIX . "attribute_group`");
        foreach ($query->rows as $row) {
            $this->model_catalog_attribute_group->deleteAttributeGroup($row["attribute_group_id"]);
        }
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function delete_options()
    {
        $this->load->model("catalog/option");
        $query = $this->db->query("SELECT option_id FROM `" . DB_PREFIX . "option`");
        foreach ($query->rows as $row) {
            $this->model_catalog_option->deleteOption($row["option_id"]);
        }
        if ($this->config->get("neoseo_exchange1c_use_related_options")) {
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions");
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_discount");
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_option");
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_special");
            $query = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . "relatedoptions_to_char'");
            if (0 < $query->num_rows) {
                $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_to_char");
            }
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant");
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant_option");
            $this->db->query("TRUNCATE " . DB_PREFIX . "relatedoptions_variant_product");
        }
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
    }
    public function get_orders()
    {
        $query = $this->db->query("SELECT order_id FROM `" . DB_PREFIX . "order`");
        $result = [];
        foreach ($query->rows as $row) {
            $result[] = $row["order_id"];
        }
        echo json_encode($result);
    }
    public function import()
    {
        $this->load->language("extension/module/neoseo_exchange1c");
        $this->load->model("tool/neoseo_exchange1c");
        if (empty($this->request->files["filename"]["name"])) {
            $this->log("!     ");
            return $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
        }
        $filename = $this->request->files["filename"]["name"];
        $tmpfilename = $this->request->files["filename"]["tmp_name"];
        if (!$tmpfilename) {
            $this->log($this->language->get("error_post_size"));
            $this->session->data["warning"] = $this->language->get("error_post_size");
            $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
        } else {
            $cache = DIR_CACHE . "exchange1c/";
            if (!is_dir($cache)) {
                mkdir($cache);
            }
            $zip = new ZipArchive();
            $res = $zip->open($tmpfilename);
            $this->debug("   " . $tmpfilename . ": " . $res);
            if ($res === true) {
                $this->debug(" : " . $filename);
                $zip->extractTo($cache);
                $files = scandir($cache);
                $found = 0;
                foreach ($files as $file) {
                    if (is_file($cache . $file)) {
                        $found++;
                        $this->debug("  " . $file . "   " . $filename);
                        $this->modeImport($file);
                    }
                }
                if (!$found) {
                    $this->log($this->language->get("error_empty_archive"));
                    $this->session->data["warning"] = $this->language->get("error_empty_archive");
                    $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
                    return NULL;
                }
                if (is_dir($cache . "import_files")) {
                    if (substr(VERSION, 0, 1) == "1") {
                        $images = DIR_IMAGE . "data/import_files/";
                    } else {
                        $images = DIR_IMAGE . "catalog/import_files/";
                    }
                    if (is_dir($images) && $this->config->get("neoseo_exchange1c_use_tree_delete")) {
                        $this->debug("     " . $images);
                        $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($cache . "import_files/", $images);
                        $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache . "import_files/");
                    } else {
                        rename($cache . "import_files/", $images);
                    }
                }
            } else {
                $buffer = file_get_contents($tmpfilename, "r");
                if (strpos($buffer, "") || strpos($buffer, "")) {
                    $this->debug("  : " . $filename);
                    move_uploaded_file($tmpfilename, $cache . "offers.xml");
                    $this->modeImport("offers.xml");
                } else {
                    if (strpos($buffer, "")) {
                        $this->debug("  : " . $filename);
                        move_uploaded_file($tmpfilename, $cache . "import.xml");
                        $this->modeImport("import.xml");
                    } else {
                        if (strpos($buffer, "")) {
                            $this->debug("  : " . $filename);
                            move_uploaded_file($tmpfilename, $cache . "orders.xml");
                            $this->modeImport("orders.xml");
                        } else {
                            if (strpos($buffer, "") && strpos($buffer, "")) {
                                $this->debug("  : " . $filename);
                                move_uploaded_file($tmpfilename, $cache . "contragents.xml");
                                $this->modeImport("contragents.xml");
                            } else {
                                $this->log("!    : " . $filename . " / " . $buffer);
                                $json["error"] = $this->language->get("text_upload_error");
                                $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
                            }
                        }
                    }
                }
            }
            $this->session->data["success"] = $this->language->get("text_upload_success");
            $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
        }
    }
    public function export()
    {
        $this->load->model("tool/neoseo_exchange1c");
        $orders = $this->model_tool_neoseo_exchange1c->queryOrders();
        header("Content-Description: File Transfer");
        header("Content-Type: application/octet-stream");
        header("Content-Disposition: attachment; filename=orders.xml");
        header("Content-Transfer-Encoding: binary");
        header("Expires: 0");
        header("Cache-Control: must-revalidate");
        header("Pragma: public");
        header("Content-Length: " . strlen($orders));
        if ($this->config->get("neoseo_exchange1c_order_utf8") == 1) {
            if ($this->config->get("neoseo_exchange1c_order_utf8_bom") == 1) {
                echo chr(239) . chr(187) . chr(191) . $orders;
            } else {
                echo $orders;
            }
        } else {
            echo @iconv("utf-8", "cp1251//TRANSLIT", @str_replace("encoding=\"utf-8\"", "encoding=\"cp-1251\"", $orders));
        }
    }
    public function export_product()
    {
        $this->load->model("catalog/option");
        $this->load->model("tool/neoseo_exchange1c");
        $options = $this->model_catalog_option->getOptions();
        $tmpArchiveName = tempnam("/tmp", "products_zip");
        $zip = new ZipArchive();
        if ($zip->open($tmpArchiveName) !== true) {
            $this->log("   ");
            exit;
        }
        foreach ($options as $option) {
            $filenameTmp = tempnam("/tmp", "products_" . $option["name"]);
            $filenameArchive = "products_" . $option["name"] . ".xlsx";
            $this->model_tool_neoseo_exchange1c->exportProducts($option["option_id"], $option["name"], $filenameTmp);
            $zip->addFile($filenameTmp, $filenameArchive);
        }
        $filenameTmp = tempnam("/tmp", "products");
        $filenameArchive = "products.xlsx";
        $this->model_tool_neoseo_exchange1c->exportProducts(0, "", $filenameTmp);
        $zip->addFile($filenameTmp, $filenameArchive);
        $zip->close();
        header("Content-Type: application/zip");
        header("Content-Disposition: attachment;filename=products.zip");
        header("Cache-Control: max-age=0");
        header("Pragma: no-cache");
        header("Expires: 0");
        header("Content-length: " . filesize($tmpArchiveName));
        readfile($tmpArchiveName);
        exit;
    }
    public function _obfuscated_FFAF96B3AC85A7B29289A6BEB8A786A99B8EA181999B91_($lines)
    {
        $res = [];
        foreach (explode("\n", trim($lines)) as $_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_) {
            if (trim($_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_) != "") {
                $res[] = trim($_obfuscated_0D3F2B313713283C392126350D28011029152F34013E32_);
            }
        }
        return $res;
    }
    public function modeCheckauth()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]);
        if (!$this->config->get("neoseo_exchange1c_status")) {
            $this->debug("   ");
            echo "failure\n1c module OFF";
            exit;
        }
        if ($this->config->get("neoseo_exchange1c_ip_list") != "") {
            $ip = $_SERVER["REMOTE_ADDR"];
            $allow_ips = $this->_obfuscated_FFAF96B3AC85A7B29289A6BEB8A786A99B8EA181999B91_($this->config->get("neoseo_exchange1c_ip_list"));
            if (!in_array($ip, $allow_ips)) {
                $this->debug("   IP : " . $ip . ".   IP : " . implode(",", $allow_ips));
                echo "failure\nIP is not allowed";
                exit;
            }
        }
        $login = "";
        $password = "";
        if (isset($_SERVER["REMOTE_USER"])) {
            $tmp = explode(" ", $_SERVER["REMOTE_USER"]);
            $tmp = explode(":", base64_decode($tmp[1]));
            list($login, $password) = $tmp;
        } else {
            if (isset($_SERVER["REDIRECT_REMOTE_USER"])) {
                $tmp = explode(" ", $_SERVER["REDIRECT_REMOTE_USER"]);
                $tmp = explode(":", base64_decode($tmp[1]));
                list($login, $password) = $tmp;
            } else {
                if (isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])) {
                    $login = $_SERVER["PHP_AUTH_USER"];
                    $password = $_SERVER["PHP_AUTH_PW"];
                }
            }
        }
        if (!$login) {
            $this->debug("  ");
            echo "failure\nlogin required\nPossible solution:\nAdd this line to your .htaccess file after RewriteEngine ON\nRewriteRule .*neoseo_exchange1c.php\$ - [E=REMOTE_USER:%{HTTP:Authorization},L]\n";
            exit;
        }
        if (!$password) {
            $this->debug("  ");
            echo "failure\npassword required\n";
            exit;
        }
        if ($login != $this->config->get("neoseo_exchange1c_username")) {
            $this->debug(" : '" . $login . "', : '" . $this->config->get("neoseo_exchange1c_username") . "'");
            echo "failure\nerror login\n";
            exit;
        }
        if ($password != $this->config->get("neoseo_exchange1c_password")) {
            $this->debug(" : '" . $password . "', : '" . $this->config->get("neoseo_exchange1c_password") . "'");
            echo "failure\nerror password\n";
            exit;
        }
        $this->log("  : " . md5($this->config->get("neoseo_exchange1c_password")));
        echo "success\nkey\n";
        echo md5($this->config->get("neoseo_exchange1c_password")) . "\n";
    }
    public function _obfuscated_FFB5888EB5B4AF8C818CAA9A8D8AB8A39BC0928398A881_()
    {
        $cache = DIR_CACHE . "exchange1c/";
        $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache);
        mkdir($cache);
    }
    public function modeCatalogInit()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]);
        $this->_obfuscated_FFB5888EB5B4AF8C818CAA9A8D8AB8A39BC0928398A881_();
        $limit = 104857600;
        if ($this->config->get("neoseo_exchange1c_enable_zip")) {
            $this->log("    zip");
            echo "zip=yes\n";
        } else {
            $this->log("     ");
            echo "zip=no\n";
        }
        echo "file_limit=" . $limit . "\n";
        $this->log("  ");
    }
    public function modeSaleInit()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]);
        $limit = 104857600;
        echo "zip=no\n";
        echo "file_limit=" . $limit . "\n";
        $this->debug("  ");
    }
    private function checkUploadFileTree($path, $curDir = NULL)
    {
        if (!$curDir) {
            $curDir = DIR_CACHE . "exchange1c/";
        }
        foreach (explode("/", $path) as $name) {
            if ($name) {
                if (file_exists($curDir . $name)) {
                    if (is_dir($curDir . $name)) {
                        $curDir = $curDir . $name . "/";
                    } else {
                        unlink($curDir . $name);
                    }
                }
                if (!mkdir($curDir . $name)) {
                    $this->log("   : " . $curDir . $name);
                }
                $curDir = $curDir . $name . "/";
            }
        }
    }
    public function modeFile()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"] . "&filename=" . $this->request->get["filename"]);
        if (!isset($this->request->cookie["key"])) {
            $this->log("type=catalog&mode=file:    ");
        } else {
            if ($this->request->cookie["key"] != md5($this->config->get("neoseo_exchange1c_password"))) {
                $this->log("type=catalog&mode=file     ");
                echo "failure\nSession error";
            } else {
                $wait_import_command = $this->config->get("neoseo_exchange1c_wait_import_command");
                $cache = DIR_CACHE . "exchange1c/";
                if (!is_dir($cache)) {
                    mkdir($cache);
                }
                if (isset($this->request->get["filename"])) {
                    $upload_file = $cache . $this->request->get["filename"];
                    $isImage = false;
                    if (strpos($this->request->get["filename"], "import_files") !== false) {
                        $isImage = true;
                        if (substr(VERSION, 0, 1) == "1") {
                            $cache = DIR_IMAGE . "data/";
                        } else {
                            $cache = DIR_IMAGE . "catalog/";
                        }
                        if (strpos($this->request->get["filename"], ".pdf") !== false) {
                            $cache = DIR_DOWNLOAD;
                            $upload_file = $cache . $this->request->get["filename"];
                            $upload_file = $cache . basename($upload_file);
                            $this->checkUploadFileTree("", $cache);
                        } else {
                            $upload_file = $cache . $this->request->get["filename"];
                            $this->checkUploadFileTree(dirname($this->request->get["filename"]), $cache);
                        }
                    }
                    $data = file_get_contents("php://input");
                    if ($data === false) {
                        $this->log("type=catalog&mode=file:    ");
                        echo "failure\nNo data file\n";
                    } else {
                        $isOrders = false;
                        if (false !== strpos($data, "<")) {
                            $isOrders = true;
                            $upload_file = $cache . "orders.xml";
                        }
                        $fp = fopen($upload_file, "wb");
                        if (!$fp) {
                            $this->log("type=catalog&mode=file:    ");
                            echo "failure\n";
                            echo "Can not open file: " . $upload_file . "\n";
                        } else {
                            $result = fwrite($fp, $data);
                            fclose($fp);
                            if ($result === strlen($data)) {
                                $this->log("  " . $upload_file . "  ");
                                echo "success\n";
                                chmod($upload_file, 511);
                            } else {
                                if (strlen($data) < $result) {
                                    $this->log("type=catalog&mode=file: !     strlen,       .      php    !     !");
                                    echo "success\n";
                                    chmod($upload_file, 511);
                                } else {
                                    $this->log("type=catalog&mode=file:    .   " . strlen($data) . ",   " . (int) $result);
                                    echo "failure\n";
                                }
                            }
                            if ($isImage) {
                                return NULL;
                            }
                            if ($isOrders && !$wait_import_command) {
                                $this->modeImport("orders.xml");
                            } else {
                                $this->load->model("tool/neoseo_exchange1c");
                                $zip = new ZipArchive();
                                $res = $zip->open($upload_file);
                                $this->debug("   - " . $res);
                                if ($res !== true) {
                                    if ((strpos($upload_file, "orders") !== false || strpos($upload_file, "documents") !== false) && !$wait_import_command) {
                                        $this->model_tool_neoseo_exchange1c->parseOrders($this->request->get["filename"]);
                                    }
                                } else {
                                    $this->debug(" : " . $upload_file);
                                    $zip->extractTo($cache);
                                    $files = scandir($cache);
                                    $found = 0;
                                    foreach ($files as $file) {
                                        if (is_file($cache . $file)) {
                                            $found++;
                                            $this->debug("  " . $file . "   " . $upload_file);
                                            if (strpos($file, "import") !== false) {
                                                $this->model_tool_neoseo_exchange1c->parseImport($file);
                                            } else {
                                                if (strpos($file, "offers") !== false) {
                                                    $this->model_tool_neoseo_exchange1c->parseOffers($file);
                                                } else {
                                                    if (strpos($file, "orders") !== false || strpos($file, "documents") !== false) {
                                                        $this->model_tool_neoseo_exchange1c->parseOrders($file);
                                                    } else {
                                                        if (strpos($file, "contragents") !== false) {
                                                            $this->model_tool_neoseo_exchange1c->parseContragents($file);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if (!$found) {
                                        $this->log($this->language->get("error_empty_archive"));
                                        $this->session->data["warning"] = $this->language->get("error_empty_archive");
                                        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "user_token=" . $this->session->data["user_token"], "SSL"));
                                        return NULL;
                                    }
                                    if (is_dir($cache . "import_files")) {
                                        $this->log("   .    ");
                                        if (substr(VERSION, 0, 1) == "1") {
                                            $images = DIR_IMAGE . "data/import_files/";
                                        } else {
                                            $images = DIR_IMAGE . "catalog/import_files/";
                                        }
                                        if (strpos($this->request->get["filename"], ".pdf") !== false) {
                                            $cache = DIR_DOWNLOAD;
                                        }
                                        if (is_dir($images) && $this->config->get("neoseo_exchange1c_use_tree_delete")) {
                                            $this->debug("     " . $images);
                                            $this->_obfuscated_FF9498A78FC0B8919A8E97BF99BC88B599A8A5B4949681_($cache . "import_files/", $images);
                                            $this->_obfuscated_FFB0898C97918999BBA4C09C9C9F8AB09E93B8A18E9F81_($cache . "import_files/");
                                        } else {
                                            rename($cache . "import_files/", $images);
                                        }
                                    }
                                }
                            }
                        }
                    }
                } else {
                    $this->log("type=catalog&mode=file:    ");
                    echo "failure\nERROR 10: No file name variable";
                }
            }
        }
    }
    public function modeImport($manual = false)
    {
        if ($manual) {
            $filename = $manual;
        } else {
            if (isset($this->request->get["filename"])) {
                $filename = $this->request->get["filename"];
                $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"] . "&filename=" . $filename);
            } else {
                echo "failure\nERROR 10: No file name variable";
                return 0;
            }
        }
        $cache = DIR_CACHE . "exchange1c/";
        if (!is_dir($cache)) {
            mkdir($cache);
        }
        $fullFileName = $cache . $filename;
        if (!file_exists($fullFileName)) {
            $this->log("  : " . $fullFileName);
            echo "failure\nERROR 10: file not found";
            return 0;
        }
        $this->load->model("tool/neoseo_exchange1c");
        if (strpos($filename, "import") !== false) {
            if ($this->config->get($this->_moduleSysName . "_user_answer_for_moy_sklad") == 1) {
                $marker_filename = DIR_CACHE . "exchange1c/" . "import_marker.json";
                if (file_exists($marker_filename) && time() - filemtime($marker_filename) < 300) {
                    $this->log("  : " . $marker_filename);
                    $status = json_decode(file_get_contents($marker_filename), true);
                    if ($status["status"] == "processing" || $status["status"] == "success") {
                        $this->log("   import_marker : " . $status["status"]);
                        if (!$manual) {
                            echo $status["status"] . "\n";
                        }
                    } else {
                        $this->log("  import_marker  : " . $status["status"]);
                    }
                } else {
                    $status["status"] = "processing";
                    file_put_contents($marker_filename, json_encode($status));
                    $this->log("  import_marker  : " . $status["status"]);
                    $this->model_tool_neoseo_exchange1c->parseImport($filename);
                    $status["status"] = "success";
                    file_put_contents($marker_filename, json_encode($status));
                    $this->log("  import_marker  : " . $status["status"]);
                }
            } else {
                $this->model_tool_neoseo_exchange1c->parseImport($filename);
                if (!$manual) {
                    echo "success\n";
                }
            }
        } else {
            if (strpos($filename, "offers") !== false || strpos($filename, "rests") !== false || strpos($filename, "prices") !== false) {
                if ($this->config->get($this->_moduleSysName . "_user_answer_for_moy_sklad") == 1) {
                    $marker_filename = DIR_CACHE . "exchange1c/" . "offer_marker.json";
                    if (file_exists($marker_filename) && time() - filemtime($marker_filename) < 300) {
                        $this->log("  : " . $marker_filename);
                        $status = json_decode(file_get_contents($marker_filename), true);
                        if ($status["status"] == "processing" || $status["status"] == "success") {
                            $this->log("   offer_marker : " . $status["status"]);
                            if (!$manual) {
                                echo $status["status"] . "\n";
                            }
                        } else {
                            $this->log("  offer_marker  : " . $status["status"]);
                        }
                    } else {
                        $status["status"] = "processing";
                        file_put_contents($marker_filename, json_encode($status));
                        $this->log("  offer_marker  : " . $status["status"]);
                        $this->model_tool_neoseo_exchange1c->parseOffers($filename);
                        $status["status"] = "success";
                        file_put_contents($marker_filename, json_encode($status));
                        $this->log("  offer_marker  : " . $status["status"]);
                    }
                } else {
                    $this->model_tool_neoseo_exchange1c->parseOffers($filename);
                    if (!$manual) {
                        echo "success\n";
                    }
                }
            } else {
                if (strpos($filename, "orders") !== false || strpos($filename, "documents") !== false) {
                    $this->model_tool_neoseo_exchange1c->parseOrders($filename);
                    if (!$manual) {
                        echo "success\n";
                    }
                } else {
                    if (strpos($filename, "contragents") !== false) {
                        $this->model_tool_neoseo_exchange1c->parseContragents($filename);
                        if (!$manual) {
                            echo "success\n";
                        }
                    } else {
                        echo "failure\n";
                        echo $filename;
                    }
                }
            }
        }
        if ($this->config->get($this->_moduleSysName . "_update_auto_neoseo_filter_warehouse") == 1) {
            $this->log("   \"\"");
            $this->model_tool_neoseo_exchange1c->updateNeoSeoFilterWarehouse();
        }
        if ($this->config->get($this->_moduleSysName . "_product_update_avaro") == 1) {
            $this->log("   \"HYPER PRODUCT MODELS (hpmodel_links)\"");
            $this->model_tool_neoseo_exchange1c->updateModuleHyperProductModels();
        }
        $this->cache->delete("product");
    }
    public function modeExport()
    {
        $this->load->model("tool/neoseo_exchange1c");
        $products = $this->model_tool_neoseo_exchange1c->queryProducts();
        header("Content-Type: text/xml; charset=utf-8", true);
        echo $products;
    }
    public function modeExportAll()
    {
        $this->load->model("tool/neoseo_exchange1c");
        $products = $this->model_tool_neoseo_exchange1c->queryAllProducts();
        header("Content-Type: text/xml; charset=utf-8", true);
        echo $products;
    }
    public function modeQueryOrders()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]);
        $this->load->model("tool/neoseo_exchange1c");
        $orders = $this->model_tool_neoseo_exchange1c->queryOrders();
        if ($this->config->get("neoseo_exchange1c_order_utf8") == 1) {
            header("Content-Type: text/html; charset=utf-8", true);
            if ($this->config->get("neoseo_exchange1c_order_utf8_bom") == 1) {
                echo chr(239) . chr(187) . chr(191) . $orders;
            } else {
                echo $orders;
            }
        } else {
            header("Content-Type: text/html; charset=win-1251", true);
            echo @iconv("utf-8", "cp1251//TRANSLIT", @str_replace("encoding=\"utf-8\"", "encoding=\"cp-1251\"", $orders));
        }
    }
    public function changeOrderExport1C()
    {
        $json = [];
        if (!isset($this->request->post["order_id"]) && !isset($this->request->post["status"])) {
            $json["success"] = false;
            $this->response->setOutput(json_encode($json));
            return false;
        }
        $order_id = $this->request->post["order_id"];
        $this->load->model("tool/" . $this->_moduleSysName);
        if ($this->request->post["status"] == "0") {
            $this->model_tool_neoseo_exchange1c->addOrderTo1C($order_id);
        } else {
            $this->model_tool_neoseo_exchange1c->deleteOrderTo1C($order_id);
        }
        $json["success"] = true;
        $this->response->setOutput(json_encode($json));
    }
    public function deleteExportListOrders()
    {
        $this->load->language("extension/module/neoseo_exchange1c");
        $this->load->model("tool/" . $this->_moduleSysName);
        $orders = $this->model_tool_neoseo_exchange1c->getAllOrderTo1C();
        if ($orders) {
            foreach ($orders as $order) {
                $this->model_tool_neoseo_exchange1c->deleteOrderTo1C($order["order_id"]);
            }
            $response = true;
        } else {
            $response = false;
        }
        if ($response) {
            exit(json_encode(["message" => $this->language->get("text_cleaned")]));
        }
        exit(json_encode(["message" => $this->language->get("text_err_cleaned")]));
    }
    public function counterpartiesDelete()
    {
        $this->db->query("DELETE FROM `" . DB_PREFIX . "customer` WHERE customer_id in (SELECT customer_id FROM `" . DB_PREFIX . "customer_to_1c`)");
        $this->db->query("DELETE FROM `" . DB_PREFIX . "address` WHERE customer_id in (SELECT customer_id FROM `" . DB_PREFIX . "customer_to_1c`)");
        $this->db->query("TRUNCATE `" . DB_PREFIX . "customer_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "token=" . $this->session->data["token"], "SSL"));
    }
    public function counterpartiesDeleteLinks()
    {
        $this->db->query("TRUNCATE `" . DB_PREFIX . "customer_to_1c`");
        $this->response->redirect($this->url->link("extension/module/neoseo_exchange1c", "token=" . $this->session->data["token"], "SSL"));
    }
    public function _obfuscated_FFBEA4B9AFBBB9BD9D98A8A88DBCADB2BDB792A39098A1_()
    {
        $this->debug("type=" . $this->request->get["type"] . "&mode=" . $this->request->get["mode"]);
        $this->load->model("tool/neoseo_exchange1c");
        $_obfuscated_0D07081A0F400F18170D4040092E340A39293B1F263011_ = $this->model_tool_neoseo_exchange1c->queryContragents();
        header("Content-Type: text/xml; charset=utf-8", true);
        echo $_obfuscated_0D07081A0F400F18170D4040092E340A39293B1F263011_;
    }
    public function exportContragents()
    {
        $this->load->model("tool/neoseo_exchange1c");
        $c_data = $this->model_tool_neoseo_exchange1c->queryContragents();
        header("Content-Description: File Transfer");
        header("Content-Type: application/octet-stream");
        header("Content-Disposition: attachment; filename=contragents.xml");
        header("Content-Transfer-Encoding: binary");
        header("Expires: 0");
        header("Cache-Control: must-revalidate");
        header("Pragma: public");
        header("Content-Length: " . strlen($c_data));
        header("Content-Type: text/xml; charset=utf-8", true);
        echo $c_data;
    }
}

?>

Function Calls

None

Variables

None

Stats

MD5 f6a4e2714db60a9a051cdece0831b832
Eval Count 0
Decode Time 82 ms