dev-ucrack
Созидатель (II)
Прошу декодировать 1 файлик
63.5 KB file on MEGA
mega.nz
Скрытое содержимое. Вам нужно войти или зарегистрироваться.
Следуйте инструкциям в видео ниже, чтобы узнать, как установить наш сайт как веб-приложение на главный экран вашего устройства.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
Прошу декодировать 1 файлик
63.5 KB file on MEGA
mega.nz
Прошу декодировать 1 файлик
63.5 KB file on MEGA
mega.nz
одно и тоже...Приветствую. Кто сможет, декодируйте, пожалуйста.
67.8 KB file on MEGA
mega.nz
стучалка, которая по таймеру отрубает меню сайта, если проверка на ключ не прошла. Код одинаковый в трех файлах?какой-то странный кот(д)
***Скрытое содержимое***
странность в том что отсутвует инициализация счетчиков $i для foreach и массива (помечено в коде) в кодах операций не нашел упущений, видимо он так написан, ну и кодировать версии можно одним файлом 7.4-8.2, ну максимум 2, если учитывать поддержку ниже 7.4. Если упор на на версии, то код очевидно идентичен.стучалка, которая по таймеру отрубает меню сайта, если проверка на ключ не прошла. Код одинаковый в трех файлах?
это не 7.4, файл справедлив для исполнения в рамках 7 версии пхп, т.к. закодирован 7.1Просьба декодировать файлик php 7.4
это 71.Просьба декодировать файлик php 7.4
***Скрытое содержимое***
к архиву еще необходим: system\library\oc\oc_producttabs\oc_producttabs_data.phpЗдравствуйте! Помогите раскодировать 3 файла, php 7.2 https://mega.nz/folder/nZoBXL5Y#xZ3mZEfWTVuX1Cllim3_IQ
Добавилк архиву еще необходим: system\library\oc\oc_producttabs\oc_producttabs_data.php
Добавил
Прошу декодировать 1 файлик
Спасибо.
<?php
/*
* @ https://EasyToYou.eu - IonCube v11 Decoder Online
* @ PHP 7.4
* @ Decoder version: 1.0.2
* @ Release: 10/08/2022
*/
// Decoded file for php version 74.
class ControllerExtensionModuleSpproProductGroup extends Controller
{
private $error = [];
private $ext = "sppro_product_group";
public function index()
{
$this->load->language("extension/module/" . $this->ext);
$this->document->setTitle($this->language->get("heading_title"));
$this->document->addStyle("view/javascript/sppro_product_group/sppro_product_group.css");
$this->document->addStyle("view/javascript/sppro_product_group/multiselect/jquery.multiselect.css");
$this->document->addScript("view/javascript/sppro_product_group/multiselect/jquery.multiselect.js");
$this->document->addStyle("view/javascript/sppro_product_group/spectrum/spectrum.css");
$this->document->addScript("view/javascript/sppro_product_group/spectrum/spectrum.js");
$this->load->model("setting/setting");
$this->load->model("extension/module/" . $this->ext);
$this->model_extension_module_sppro_product_group->checkDB();
if($this->request->server["REQUEST_METHOD"] == "POST" && $this->validateModule()) {
$this->model_setting_setting->editSetting("module_" . $this->ext, $this->request->post);
$this->session->data["success"] = $this->language->get("txt_notify_success");
$this->response->redirect($this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true));
}
$data["action"] = $this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true);
$data["add_group"] = $this->url->link("extension/module/sppro_product_group/addGroup", "user_token=" . $this->session->data["user_token"], true);
$data["cancel"] = $this->url->link("marketplace/extension", "user_token=" . $this->session->data["user_token"] . "&type=module", true);
$settingKeys = ["module_" . $this->ext . "_status", "module_" . $this->ext . "_license", "module_" . $this->ext . "_theme", "module_" . $this->ext . "_ajax_product_page", "module_" . $this->ext . "_ajax_in_category", "module_" . $this->ext . "_main_category", "module_" . $this->ext . "_main_category_list", "module_" . $this->ext . "_main_search", "module_" . $this->ext . "_main_manufatcurer", "module_" . $this->ext . "_styles", "module_" . $this->ext . "_shema", "module_" . $this->ext . "_canonical"];
foreach ($settingKeys as $settingKey) {
if(isset($this->request->post[$settingKey])) {
$data[] = $this->request->post[$settingKey];
} else {
$data[$settingKey] = $this->config->get($settingKey);
}
}
if(isset($this->error["warning"])) {
$data["error_warning"] = $this->error["warning"];
} else {
$data["error_warning"] = "";
}
if(isset($this->session->data["error"])) {
$data["error_warning"] = $this->session->data["error"];
unset($this->session->data["error"]);
} else {
$data["error_warning"] = "";
}
if(isset($this->session->data["success"])) {
$data["success"] = $this->session->data["success"];
unset($this->session->data["success"]);
} else {
$data["success"] = "";
}
if(!empty($this->error["license"])) {
$data["error_license"] = $this->error["license"];
} else {
$data["error_license"] = [];
}
$data["groups"] = [];
foreach ($this->model_extension_module_sppro_product_group->getGroups() as $group) {
$data["groups"][] = ["name" => $group["name"], "attributes_count" => count($this->model_extension_module_sppro_product_group->getGroupAttributes($group["group_id"])), "type" => $this->language->get("txt_group_type_" . $group["type"]), "help" => $this->language->get("txt_group_help_" . $group["help"]), "sort_order" => $group["sort_order"], "category_status" => $group["category_status"] ? $this->language->get("text_yes") : $this->language->get("text_no"), "title_status" => $group["title_status"] ? $this->language->get("text_yes") : $this->language->get("text_no"), "edit" => $this->url->link("extension/module/sppro_product_group/editGroup", "group_id=" . $group["group_id"] . "&user_token=" . $this->session->data["user_token"], true), "remove" => $this->url->link("extension/module/sppro_product_group/removeGroup", "group_id=" . $group["group_id"] . "&user_token=" . $this->session->data["user_token"], true)];
}
$data["product_add_form"] = $this->getProductAddForm();
$this->load->model("extension/module/" . $this->ext);
$data["auto_group_product_values"] = $this->model_extension_module_sppro_product_group->autoGroupGetProductValues();
$this->load->model("catalog/category");
$data["categories"] = $this->model_catalog_category->getAllCategories();
$this->load->model("catalog/manufacturer");
$data["manufacturers"] = $this->model_catalog_manufacturer->getManufacturers();
if(isset($this->request->post["module_" . $this->ext . "_auto_setting"])) {
$data["module_" . $this->ext . "_auto_setting"] = $this->request->post["module_" . $this->ext . "_auto_setting"];
} else {
$data["module_" . $this->ext . "_auto_setting"] = $this->config->get("module_" . $this->ext . "_auto_setting");
}
$data["user_token"] = $this->session->data["user_token"];
$data["super_data"] = $this->model_extension_module_sppro_product_group->getOtherData();
$data["license_status"] = true;
$temp = $this->config->get("module_" . $this->ext . "_license");
$license_key = $temp !== NULL ? $temp : NULL;
if(!isset($license_key) || !$this->validateLicense($license_key)) {
$data["groups"] = [];
$data["product_add_form"] = "";
$data["add_group"] = "#";
$data["license_status"] = false;
}
$data["header"] = $this->load->controller("common/header");
$data["column_left"] = $this->load->controller("common/column_left");
$data["footer"] = $this->load->controller("common/footer");
$this->sendOCInfo();
$this->response->setOutput($this->load->view("extension/module/sppro_product_group/module", $data));
}
public function addGroup()
{
$this->load->language("extension/module/" . $this->ext);
$this->document->setTitle($this->language->get("heading_title_add_group"));
$this->load->model("extension/module/" . $this->ext);
if($this->request->server["REQUEST_METHOD"] == "POST" && $this->validateGroupForm()) {
$this->model_extension_module_sppro_product_group->addGroup($this->request->post);
$this->session->data["success"] = $this->language->get("text_success_add_group");
$url = "";
if(isset($this->request->get["sort"])) {
$url .= "&sort=" . $this->request->get["sort"];
}
if(isset($this->request->get["order"])) {
$url .= "&order=" . $this->request->get["order"];
}
if(isset($this->request->get["page"])) {
$url .= "&page=" . $this->request->get["page"];
}
$this->response->redirect($this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true));
}
$this->getFormGroup();
}
public function editGroup()
{
$this->load->language("extension/module/" . $this->ext);
$this->document->setTitle($this->language->get("heading_title_edit_group"));
$this->load->model("extension/module/" . $this->ext);
if($this->request->server["REQUEST_METHOD"] == "POST" && $this->validateGroupForm()) {
$this->model_extension_module_sppro_product_group->editGroup($this->request->get["group_id"], $this->request->post);
$this->session->data["success"] = $this->language->get("text_success_edit_group");
$url = "";
if(isset($this->request->get["sort"])) {
$url .= "&sort=" . $this->request->get["sort"];
}
if(isset($this->request->get["order"])) {
$url .= "&order=" . $this->request->get["order"];
}
if(isset($this->request->get["page"])) {
$url .= "&page=" . $this->request->get["page"];
}
$this->response->redirect($this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true));
}
$this->getFormGroup();
}
public function removeGroup()
{
if(isset($this->request->get["group_id"])) {
$this->load->language("extension/module/" . $this->ext);
if($this->validateGroupRemove()) {
$this->load->model("extension/module/" . $this->ext);
$this->model_extension_module_sppro_product_group->removeGroup($this->request->get["group_id"]);
$this->session->data["success"] = $this->language->get("text_success_remove_group");
} else {
$this->session->data["error"] = $this->error["warning"];
}
}
$this->response->redirect($this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true));
}
private function getFormGroup()
{
if(!$this->validateLicense($this->config->get("module_" . $this->ext . "_license"))) {
$this->response->redirect($this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true));
}
$this->document->addStyle("view/javascript/sppro_product_group/sppro_product_group.css");
$this->document->addStyle("view/javascript/sppro_product_group/spectrum/spectrum.css");
$this->document->addScript("view/javascript/sppro_product_group/spectrum/spectrum.js");
$data["text_form"] = !isset($this->request->get["group_id"]) ? $this->language->get("text_add_group") : $this->language->get("text_edit_group");
if(isset($this->error["warning"])) {
$data["error_warning"] = $this->error["warning"];
} else {
$data["error_warning"] = "";
}
if(isset($this->error["name"])) {
$data["error_name"] = $this->error["name"];
} else {
$data["error_name"] = [];
}
if(!isset($this->request->get["group_id"])) {
$data["action"] = $this->url->link("extension/module/sppro_product_group/addGroup", "user_token=" . $this->session->data["user_token"], true);
} else {
$data["action"] = $this->url->link("extension/module/sppro_product_group/editGroup", "user_token=" . $this->session->data["user_token"] . "&group_id=" . $this->request->get["group_id"], true);
}
$data["cancel"] = $this->url->link("extension/module/" . $this->ext, "user_token=" . $this->session->data["user_token"], true);
$data["group_id"] = "";
if(isset($this->request->get["group_id"]) && $this->request->server["REQUEST_METHOD"] != "POST") {
$group_info = $this->model_extension_module_sppro_product_group->getGroup($this->request->get["group_id"]);
if($group_info) {
$data["group_id"] = $this->request->get["group_id"];
}
}
$data["user_token"] = $this->session->data["user_token"];
if(isset($this->request->post["group_description"])) {
$data["group_description"] = $this->request->post["group_description"];
} elseif(isset($this->request->get["group_id"])) {
$data["group_description"] = $this->model_extension_module_sppro_product_group->getGroupDescriptions($this->request->get["group_id"]);
} else {
$data["group_description"] = [];
}
if(isset($this->request->post["type"])) {
$data["type"] = $this->request->post["type"];
} elseif(!empty($group_info)) {
$data["type"] = $group_info["type"];
} else {
$data["type"] = "text";
}
if(isset($this->request->post["type_cat"])) {
$data["type_cat"] = $this->request->post["type_cat"];
} elseif(!empty($group_info)) {
$data["type_cat"] = isset($group_info["type_cat"]) ? $group_info["type_cat"] : NULL;
} else {
$data["type_cat"] = "text";
}
if(isset($this->request->post["help"])) {
$data["help"] = $this->request->post["help"];
} elseif(!empty($group_info)) {
$data["help"] = $group_info["help"];
} else {
$data["help"] = "text";
}
if(isset($this->request->post["sort_order"])) {
$data["sort_order"] = $this->request->post["sort_order"];
} elseif(!empty($group_info)) {
$data["sort_order"] = $group_info["sort_order"];
} else {
$data["sort_order"] = "";
}
if(isset($this->request->post["category_status"])) {
$data["category_status"] = $this->request->post["category_status"];
} elseif(!empty($group_info)) {
$data["category_status"] = $group_info["category_status"];
} else {
$data["category_status"] = 0;
}
if(isset($this->request->post["title_status"])) {
$data["title_status"] = $this->request->post["title_status"];
} elseif(!empty($group_info)) {
$data["title_status"] = $group_info["title_status"];
} else {
$data["title_status"] = 0;
}
if(isset($this->request->post["group_attributes"])) {
$data["group_attributes"] = $this->request->post["group_attributes"];
} elseif(isset($this->request->get["group_id"])) {
$data["group_attributes"] = $this->model_extension_module_sppro_product_group->getGroupAttributes($this->request->get["group_id"]);
} else {
$data["group_attributes"] = [];
}
$data["attribute_values"] = $this->getAttributeValues($data["group_id"]);
$this->load->model("localisation/language");
$data["languages"] = $this->model_localisation_language->getLanguages();
$this->load->model("catalog/attribute");
$data["attributes"] = $this->model_catalog_attribute->getAttributes(["start" => 0, "limit" => 9999999]);
$data["header"] = $this->load->controller("common/header");
$data["column_left"] = $this->load->controller("common/column_left");
$data["footer"] = $this->load->controller("common/footer");
$this->response->setOutput($this->load->view("extension/module/sppro_product_group/group_form", $data));
}
private function validateModule()
{
if(!$this->user->hasPermission("modify", "extension/module/" . $this->ext)) {
$this->error["warning"] = $this->language->get("txt_notify_error_permission");
}
if(isset($this->request->post["module_" . $this->ext . "_license"])) {
if(!$this->request->post["module_" . $this->ext . "_license"] || $this->checkDomainName(HTTP_SERVER) != $this->request->post["module_" . $this->ext . "_license"]) {
$this->error["license"] = $this->language->get("txt_notify_error_bad_license");
}
} elseif(!$this->config->get("module_" . $this->ext . "_license") || $this->checkDomainName(HTTP_SERVER) != $this->config->get("module_" . $this->ext . "_license")) {
$this->error["license"] = $this->language->get("txt_notify_error_bad_license");
}
return !$this->error;
}
private function validateGroupForm()
{
if(!$this->user->hasPermission("modify", "extension/module/sppro_product_group")) {
$this->error["warning"] = $this->language->get("error_permission");
}
foreach ($this->request->post["group_description"] as $language_id => $value) {
if(empty($value["name"])) {
$this->error["name"][$language_id] = $this->language->get("error_group_name");
}
}
if($this->error && !isset($this->error["warning"])) {
$this->error["warning"] = $this->language->get("error_warning");
}
return !$this->error;
}
private function validateGroupRemove()
{
if(!$this->user->hasPermission("modify", "extension/module/sppro_product_group")) {
$this->error["warning"] = $this->language->get("error_permission");
}
if($this->error && !isset($this->error["warning"])) {
$this->error["warning"] = $this->language->get("error_warning");
}
return !$this->error;
}
private function getAttributeValues($group_id = "", $load_attributes = [], $exist_attribute_values_keys = [])
{
$this->load->language("extension/module/" . $this->ext);
$this->load->model("extension/module/" . $this->ext);
$attribute_values = [];
if($group_id) {
foreach ($this->model_extension_module_sppro_product_group->getGroupAttributeValues($group_id) as $attribute_value) {
$attribute_value_data = $this->model_extension_module_sppro_product_group->setAttributeValue($attribute_value["attribute_value_key"], $attribute_value["attribute_id"], $attribute_value);
if($attribute_value_data && (!$exist_attribute_values_keys && !$load_attributes || in_array($attribute_value["attribute_value_key"], $exist_attribute_values_keys))) {
$attribute_values[$attribute_value["attribute_value_key"]] = $attribute_value_data;
}
}
}
if($load_attributes) {
foreach ($this->model_extension_module_sppro_product_group->getAttributeValues($load_attributes) as $attribute_value_key => $attribute) {
if(!isset($attribute_values[$attribute_value_key])) {
$attribute_value_data = $this->model_extension_module_sppro_product_group->setAttributeValue($attribute_value_key, $attribute["attribute_id"], $attribute);
if($attribute_value_data) {
$attribute_value_data["new"] = true;
$attribute_values[$attribute_value_key] = $attribute_value_data;
}
}
}
}
$data["group_id"] = $group_id;
$data["attribute_values"] = $attribute_values;
$this->load->model("localisation/language");
$data["languages"] = $this->model_localisation_language->getLanguages();
return $this->load->view("extension/module/sppro_product_group/attribute_values", $data);
}
public function updateGroupAttributeValues()
{
if(isset($this->request->post["group_id"])) {
$group_id = (int) $this->request->post["group_id"];
} else {
$group_id = 0;
}
if(isset($this->request->post["group_attribute"])) {
$attributes = $this->request->post["group_attribute"];
} else {
$attributes = [];
}
$exist_attribute_values_keys = [];
if(isset($this->request->post["group_attribute_text"])) {
foreach ($this->request->post["group_attribute_text"] as $attribute_value_key => $attribute_value) {
$exist_attribute_values_keys[] = $attribute_value_key;
}
}
$json["html"] = $this->getAttributeValues($group_id, $attributes, $exist_attribute_values_keys);
$this->response->setOutput(json_encode($json));
}
public function searchProduct()
{
$this->load->model("tool/image");
$json = [];
if(isset($this->request->post["product_group_search"])) {
$this->load->model("extension/module/" . $this->ext);
$json["products"] = [];
$added_products = [];
if(isset($this->request->post["product_group"]["products"])) {
foreach ($this->request->post["product_group"]["products"] as $product_id => $product) {
$added_products[] = $product_id;
}
}
foreach ($this->model_extension_module_sppro_product_group->getProducts(["search" => $this->request->post["product_group_search"]]) as $product) {
if(is_file(DIR_IMAGE . $product["image"])) {
$image = $this->model_tool_image->resize($product["image"], 60, 60);
} else {
$image = $this->model_tool_image->resize("no_image.png", 60, 60);
}
$json["products"][] = ["product_id" => $product["product_id"], "name" => $product["name"], "model" => $product["model"], "image" => $image, "active" => in_array($product["product_id"], $added_products)];
}
}
$this->response->setOutput(json_encode($json));
}
public function addProducts()
{
$this->load->model("tool/image");
$this->load->model("catalog/category");
$json = [];
if(isset($this->request->post["product_group_add_products"]) || isset($this->request->post["search_product_id"])) {
$this->load->model("extension/module/" . $this->ext);
$this->load->model("tool/image");
$added_products = [];
if(isset($this->request->post["search_product_id"])) {
$added_products[] = (int) $this->request->post["search_product_id"];
} elseif($this->request->post["product_group_add_products"]) {
$added_products = $this->request->post["product_group_add_products"];
}
$current_product_id = 0;
if(!empty($this->request->post["product_group_current_product_id"])) {
$current_product_id = $this->request->post["product_group_current_product_id"];
$added_products[] = $current_product_id;
}
$main_product_id = 0;
$added_product_data = [];
if(!empty($this->request->post["product_group"])) {
if(isset($this->request->post["product_group"]["main_product"])) {
$main_product_id = $this->request->post["product_group"]["main_product"];
}
if(isset($this->request->post["product_group"]["products"])) {
foreach ($this->request->post["product_group"]["products"] as $product_id => $product) {
$added_products[] = $product_id;
$added_product_data[$product_id] = $product;
}
}
}
$products = [];
foreach ($this->model_extension_module_sppro_product_group->getProducts(["products" => $added_products]) as $result) {
if(is_file(DIR_IMAGE . $result["image"])) {
$image = $result["image"];
} else {
$image = "no_image.png";
}
if(isset($result["attr_image"]) && is_file(DIR_IMAGE . $result["attr_image"])) {
$attr_image_thumb = $this->model_tool_image->resize($result["attr_image"], 60, 60);
} else {
$attr_image_thumb = $this->model_tool_image->resize($image, 60, 60);
}
$categories = $this->model_extension_module_sppro_product_group->getCategoriesByProduct($result["product_id"]);
$category_name = NULL;
if(isset($categories[0]["category_id"])) {
$category_info = $this->model_catalog_category->getCategory($categories[0]["category_id"]);
$category_name = $category_info["name"];
}
$products[] = ["product_id" => $result["product_id"], "model" => $result["model"], "price" => $this->currency->format($result["price"], $this->config->get("config_currency")), "category" => $category_name, "name" => $result["name"], "custom_image" => isset($result["attr_image"]) ? $result["attr_image"] : NULL, "custom_image_thumb" => $attr_image_thumb, "placeholder" => $this->model_tool_image->resize($image, 60, 60), "sort_order" => isset($added_product_data[$result["product_id"]]["sort_order"]) ? $added_product_data[$result["product_id"]]["sort_order"] : 0, "current_product" => $result["product_id"] == $current_product_id ? 1 : 0, "main_product" => $result["product_id"] == $main_product_id ? 1 : 0, "image" => $this->model_tool_image->resize($image, 40, 40), "edit" => $this->url->link("catalog/product/edit", "user_token=" . $this->session->data["user_token"] . "&product_id=" . $result["product_id"], true)];
}
uasort($products, ["self", "sortByCurrentProduct"]);
uasort($products, ["self", "sortBySortOrder"]);
$json["html"] = $this->getProductList($products);
}
$this->response->setOutput(json_encode($json));
}
public function addProductsToGroup()
{
$this->load->language("extension/module/" . $this->ext);
$json = [];
$this->load->model("extension/module/" . $this->ext);
if(!$this->validateModule()) {
$json["error"] = $this->language->get("txt_notify_error_permission");
} else {
if(!empty($this->request->post["product_group"]["products"])) {
$this->model_extension_module_sppro_product_group->addProductsToGroup($this->request->post["product_group"]);
$json["success"] = $this->language->get("txt_products_add_to_group");
}
if(empty($this->request->post["product_group"]["products"]) && isset($this->request->post["product_group_current_product_id"])) {
$product_group["products"][$this->request->post["product_group_current_product_id"]] = $this->request->post["product_group_current_product_id"];
$this->model_extension_module_sppro_product_group->removeProductsFromGroup($product_group);
$json["success"] = $this->language->get("txt_products_delete_to_group");
}
}
$this->response->setOutput(json_encode($json));
}
public function removeProductsFromGroup()
{
$this->load->language("extension/module/" . $this->ext);
$json = [];
if(empty($this->request->post["product_group"]) && isset($this->request->post["product_group_current_product_id"])) {
$this->request->post["product_group"]["products"][$this->request->post["product_group_current_product_id"]] = $this->request->post["product_group_current_product_id"];
}
if(!empty($this->request->post["product_group"])) {
$this->load->model("extension/module/" . $this->ext);
$this->model_extension_module_sppro_product_group->removeProductsFromGroup($this->request->post["product_group"]);
$json["success"] = $this->language->get("txt_products_delete_to_group");
}
$this->response->setOutput(json_encode($json));
}
private function getProductAddForm($product_id = false)
{
$data = [];
if($product_id) {
$data["product_id"] = $product_id;
$this->load->model("extension/module/" . $this->ext);
$this->load->model("tool/image");
$this->load->language("extension/module/" . $this->ext);
$group_data = $this->model_extension_module_sppro_product_group->getProductGroupByProductId($product_id);
if(!empty($group_data["products"])) {
$products = [];
foreach ($group_data["products"] as $result) {
if(is_file(DIR_IMAGE . $result["image"])) {
$image = $result["image"];
} else {
$image = "no_image.png";
}
if(isset($result["attr_image"]) && is_file(DIR_IMAGE . $result["attr_image"])) {
$attr_image_thumb = $this->model_tool_image->resize($result["attr_image"], 60, 60);
} else {
$attr_image_thumb = $this->model_tool_image->resize($image, 60, 60);
}
$categories = $this->model_extension_module_sppro_product_group->getCategoriesByProduct($result["product_id"]);
$category_name = NULL;
if(isset($categories[0]["category_id"])) {
$category_info = $this->model_catalog_category->getCategory($categories[0]["category_id"]);
$category_name = $category_info["name"];
}
$products[] = ["product_id" => $result["product_id"], "current_product" => $result["product_id"] == $product_id ? 1 : 0, "main_product" => $result["product_id"] == $group_data["main_product_id"] ? 1 : 0, "model" => $result["model"], "price" => $this->currency->format($result["price"], $this->config->get("config_currency")), "category" => $category_name, "name" => $result["name"], "custom_image" => isset($result["attr_image"]) ? $result["attr_image"] : NULL, "custom_image_thumb" => $attr_image_thumb, "placeholder" => $this->model_tool_image->resize($image, 60, 60), "show_in_category" => $result["show_in_category"], "sort_order" => $result["sort_order"], "image" => $this->model_tool_image->resize($image, 40, 40), "edit" => $this->url->link("catalog/product/edit", "user_token=" . $this->session->data["user_token"] . "&product_id=" . $result["product_id"], true)];
}
uasort($products, ["self", "sortByCurrentProduct"]);
uasort($products, ["self", "sortBySortOrder"]);
$data["product_list"] = $this->getProductList($products);
}
}
$data["user_token"] = $this->session->data["user_token"];
return $this->load->view("extension/module/sppro_product_group/product_add", $data);
}
public function autocomplete()
{
$json = [];
if(isset($this->request->get["filter_name"]) || isset($this->request->get["filter_model"])) {
$this->load->model("catalog/product");
$this->load->model("tool/image");
if(isset($this->request->get["product_id"])) {
$product_id = $this->request->get["product_id"];
} else {
$product_id = "";
}
if(isset($this->request->get["filter_name"])) {
$filter_name = $this->request->get["filter_name"];
} else {
$filter_name = "";
}
if(isset($this->request->get["filter_model"])) {
$filter_model = $this->request->get["filter_model"];
} else {
$filter_model = "";
}
if(isset($this->request->get["limit"])) {
$limit = (int) $this->request->get["limit"];
} else {
$limit = $this->config->get("config_limit_autocomplete");
}
$filter_data = ["filter_name" => $filter_name, "filter_model" => $filter_model, "start" => 0, "limit" => $limit];
$results = $this->model_catalog_product->getProducts($filter_data);
foreach ($results as $result) {
if($result["product_id"] != $product_id) {
if(is_file(DIR_IMAGE . $result["image"])) {
$image = $this->model_tool_image->resize($result["image"], 40, 40);
} else {
$image = $this->model_tool_image->resize("no_image.png", 40, 40);
}
$json[] = ["product_id" => $result["product_id"], "name" => strip_tags(html_entity_decode($result["name"], ENT_QUOTES, "UTF-8")), "image" => $image, "model" => $result["model"], "price" => $result["price"], "edit" => $this->url->link("catalog/product/edit", "user_token=" . $this->session->data["user_token"] . "&product_id=" . $result["product_id"], true)];
}
}
}
$this->response->addHeader("Content-Type: application/json");
$this->response->setOutput(json_encode($json));
}
private function getProductList($products)
{
$this->load->language("extension/module/" . $this->ext);
$data["products"] = $products;
$data["attributes"] = $this->model_extension_module_sppro_product_group->getProductGroupAttributes($products);
if($data["products"]) {
return $this->load->view("extension/module/sppro_product_group/product_list", $data);
}
return "";
}
public function getProductFormHtml()
{
if(!empty($this->request->get["product_id"])) {
return $this->getProductAddForm($this->request->get["product_id"]);
}
return NULL;
}
private function sortBySortOrder()
{
if($a["sort_order"] == $b["sort_order"]) {
return 0;
}
return $a["sort_order"] < $b["sort_order"] ? -1 : 1;
}
private function sortByCurrentProduct($a, $b)
{
if($a["current_product"] == $b["current_product"]) {
return 0;
}
return $b["current_product"] < $a["current_product"] ? -1 : 1;
}
public function autoGroupGetAttributes()
{
$json = [];
if(!empty($this->request->post["module_" . $this->ext . "_auto_setting"])) {
$this->load->model("extension/module/" . $this->ext);
$json["attributes"] = $this->model_extension_module_sppro_product_group->autoGroupGetAttributes($this->request->post["module_" . $this->ext . "_auto_setting"]);
}
$this->response->setOutput(json_encode($json));
}
public function autoGroupSet()
{
$this->load->language("extension/module/" . $this->ext);
$json = [];
if(!empty($this->request->post["module_" . $this->ext . "_auto_setting"])) {
$this->load->model("setting/setting");
$this->model_setting_setting->editSetting("module_" . $this->ext, $this->request->post);
$this->load->model("extension/module/" . $this->ext);
$result = $this->model_extension_module_sppro_product_group->autoGroupSet($this->request->post["module_" . $this->ext . "_auto_setting"]);
$json["success"] = $this->language->get("txt_created_new_groups") . $result;
}
$this->response->setOutput(json_encode($json));
}
public function autoGroupRemove()
{
$this->load->language("extension/module/" . $this->ext);
$json = [];
if(!empty($this->request->post["module_" . $this->ext . "_auto_setting"])) {
$this->load->model("extension/module/" . $this->ext);
$this->model_extension_module_sppro_product_group->autoGroupRemove();
$json["success"] = $this->language->get("txt_all_auto_groups_delete");
} else {
$json["error"] = $this->language->get("txt_auto_no_params");
}
$this->response->setOutput(json_encode($json));
}
protected function validateLicense($license)
{
if(!empty($license)) {
if($this->checkDomainName(HTTP_SERVER) != $license) {
$this->error["license"] = $this->language->get("txt_notify_error_bad_license");
}
return !$this->error;
}
}
protected function decoder($i)
{
$a = ["ajlSQF4lI2s2UCFTN21MZyMoKSRUM2RFIzJ2SDQkKV5uWjFxWUBeJSM4d0I1", "Lyg/UDxkb21haW4+W2EtejAtOV1bYS16MC05XC1dezEsNjN9XC5bYS16XC5dezIsN30pJC9p", "Lyg/UDxkb21haW4+W2EtejAtOV1bYS16MC05XC1dezEsNjN9XC5bYS16MC05XC5dezIsN30pJC9p", "eG4tLQ=="];
return base64_decode($a[$i]);
}
protected function checkDomainName($string)
{
$host = parse_url($string, PHP_URL_HOST);
$parts = explode(".", $host);
if(3 < count($parts)) {
$sub_domain = array_shift($parts);
$domain = implode(".", $parts);
$string = $sub_domain . "." . $domain . $this->decoder(0);
} else {
$string = implode(".", $parts) . $this->decoder(0);
}
$result = substr(sha1(sha1(sha1($string))), round(0), 10);
$i = 10;
while ($i < strlen(sha1(sha1(sha1($string))))) {
$result .= "-";
$result .= substr(sha1(sha1(sha1($string))), $i, 10);
$i = $i + 10;
}
return strtoupper($result);
}
private function sendOCInfo()
{
$this->load->model("extension/module/" . $this->ext);
$data = [];
$data["oc_version"] = VERSION;
$data["php_version"] = phpversion();
$data["domain"] = $this->getHostLink();
$data["full_domain"] = HTTP_SERVER;
$data["ext_prefix"] = $this->ext;
$data["count_modules"] = 0;
$temp = $this->config->get("module_" . $this->ext . "_license");
$data["license_key"] = $temp !== NULL ? $temp : NULL;
$all_extensions = [];
$files = glob(DIR_APPLICATION . "controller/extension/module/*.php");
if($files) {
foreach ($files as $file) {
$data["count_modules"]++;
}
}
$json_data = json_encode($data);
$ch = curl_init("https://ocex.dev/index.php?route=extension/module/get_license_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json", "Content-Length: " . strlen($json_data)]);
$response = curl_exec($ch);
if($response === false) {
} else {
$response_data = json_decode($response, true);
if(isset($response_data["status"]) && $response_data["status"] == "success") {
$license = $this->config->get("module_" . $this->ext . "_license");
if(isset($response_data["license"]) && !empty($response_data["license"]) && (empty($license) || $response_data["license"] != $license)) {
$this->db->query("UPDATE `" . DB_PREFIX . "setting` SET `value` = '" . $this->db->escape($response_data["license"]) . "' WHERE `key` = 'module_" . $this->ext . "_license';");
}
$status = $this->config->get("module_" . $this->ext . "_status");
if(isset($response_data["module_status"]) && $response_data["module_status"] == "off" && $status) {
$this->db->query("UPDATE `" . DB_PREFIX . "setting` SET `value` = 0 WHERE `key` = 'module_" . $this->ext . "_status';");
}
}
}
curl_close($ch);
}
public function getHostLink()
{
$host = parse_url(HTTP_SERVER, PHP_URL_HOST);
$parts = explode(".", $host);
if(3 < count($parts)) {
$sub_domain = array_shift($parts);
$domain = implode(".", $parts);
return $sub_domain . "." . $domain;
}
return implode(".", $parts);
}
}
?>