Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Loader)
- *
- * @ Version : 2.0.0.4
- * @ Author : DeZender
- * @ Release on : 21.10.2015
- * @ Official site : http://DeZender.Net
- *
- */
- try
- {
- function dummy_handler($errno, $errstr, $errfile, $errline) {
- return;
- };
- }
- catch (Exception $e) { ; }
- class ModelModuleFilterPro extends Model {
- private $NOW = null;
- private $FOUND_ROWS = null;
- private $filterpro_setting = null;
- public function check() {
- $lic_dir = DIR_SYSTEM . "license";
- $file = $lic_dir . "/test";
- set_error_handler("dummy_handler");
- try
- {
- echo file_get_contents($file);
- }
- catch (Exception $e) { ; }
- restore_error_handler();
- return;
- }
- private function getLicense() {
- $valid = false;
- set_error_handler("dummy_handler");
- try
- {
- $valid = $this->_getLicense();
- }
- catch (Exception $e) { ; }
- restore_error_handler();
- return $valid;
- }
- private function _getLicense() {
- $d = parse_url(HTTP_SERVER);
- $subdomain = strpos($_SERVER["HTTP_HOST"], $d["host"]) == strlen($_SERVER["HTTP_HOST"]) - strlen($d["host"]);
- if (!($d["host"] != $_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != getenv("HTTP_HOST") && !$subdomain)
- {
- $this->session->data["error"] = "Домены не совпадают";
- return null;
- }
- $files = glob(DIR_SYSTEM . "license/filterpro.*.lic");
- $c = count($files);
- if ($c != 1)
- {
- return null;
- }
- $filename = $files[0];
- $licence = file_get_contents($filename);
- $md5 = md5_file(DIR_SYSTEM . "../config.php");
- $host = preg_replace("#^www\\.(.+)#i", "\$1", $_SERVER["HTTP_HOST"]);
- if ($subdomain)
- {
- $host = preg_replace("#^www\\.(.+)#i", "\$1", $d["host"]);
- }
- static $key = "da491836af4a9b8f2";
- include_once "crypto2.php";
- $valid = hash("sha256", $host . "." . $md5 . "." . $key) === $licence;
- return $valid;
- }
- public function __construct($registry) {
- parent::__construct($registry);
- $this->NOW = date("Y-m-d H:i") . ":00";
- $this->filterpro_setting = $this->config->get("filterpro_setting");
- if (VERSION == "1.5.0")
- {
- $this->filterpro_setting = unserialize($this->config->get("filterpro_setting"));
- }
- return;
- }
- private function getCustomerGroup() {
- if ($this->customer->isLogged())
- {
- $customer_group_id = $this->customer->getCustomerGroupId();
- return $customer_group_id;
- }
- $customer_group_id = $this->config->get("config_customer_group_id");
- return $customer_group_id;
- }
- public function getAllCategories($categories, $parent_id = 0, $parent_name = "") {
- $output = array();
- if (array_key_exists($parent_id, $categories))
- {
- if ($parent_name != "")
- {
- $parent_name .= $this->language->get("text_separator");
- }
- foreach ($categories[$parent_id] as $category)
- {
- $output[$category["category_id"]] = array("category_id" => $category["category_id"], "name" => $parent_name . $category["name"]);
- $output += $this->getAllCategories($categories, $category["category_id"], $parent_name . $category["name"]);
- continue;
- }
- }
- return $output;
- }
- public function getCategories() {
- $category_data = $this->cache->get("category.all." . $this->config->get("config_language_id") . "." . (int)$this->config->get("config_store_id"));
- if (!(!$category_data) && !is_array($category_data))
- {
- $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE cd.language_id = '" . (int)$this->config->get("config_language_id") . "' AND c2s.store_id = '" . (int)$this->config->get("config_store_id") . "' ORDER BY c.parent_id, c.sort_order, cd.name");
- $category_data = array();
- foreach ($query->rows as $row)
- {
- $category_data[$row["parent_id"]][$row["category_id"]] = $row;
- continue;
- }
- $this->cache->set("category.all." . $this->config->get("config_language_id") . "." . (int)$this->config->get("config_store_id"), $category_data);
- }
- return $category_data;
- }
- private function getAllAttributes() {
- $enable_cache = isset($this->filterpro_setting["enable_cache"]);
- $all_attributes = array();
- $cache_name = "filterpro.allattributes." . (int)$this->config->get("config_language_id");
- if ($enable_cache)
- {
- $all_attributes = $this->cache->get($cache_name);
- }
- if (!(!$enable_cache) && !$all_attributes)
- {
- $sql = "SELECT a.`attribute_id`, ad.`name`, agd.name AS 'ag_name', at.`tooltip`, agt.tooltip AS 'ag_tooltip', ag.attribute_group_id, a.sort_order, ag.sort_order as 'ag_sort_order'\r
- FROM " . DB_PREFIX . "attribute a\r
- LEFT JOIN " . DB_PREFIX . "attribute_description ad ON ( a.attribute_id = ad.`attribute_id` AND ad.language_id = '" . (int)$this->config->get("config_language_id") . "')\r
- LEFT JOIN " . DB_PREFIX . "attribute_group ag ON ( ag.attribute_group_id = a.`attribute_group_id` )\r
- LEFT JOIN " . DB_PREFIX . "attribute_tooltip at ON ( a.attribute_id = at.`attribute_id` AND at.`language_id` = '" . (int)$this->config->get("config_language_id") . "' )\r
- LEFT JOIN " . DB_PREFIX . "attribute_group_tooltip agt ON ( ag.attribute_group_id = agt.`attribute_group_id` AND agt.`language_id` = '" . (int)$this->config->get("config_language_id") . "' )\r
- LEFT JOIN " . DB_PREFIX . "attribute_group_description agd ON ( agd.attribute_group_id = ag.`attribute_group_id` AND agd.language_id = '" . (int)$this->config->get("config_language_id") . "')";
- $query_all_atts = $this->db->query($sql);
- foreach ($query_all_atts->rows as $row)
- {
- $all_attributes[(int)$row["attribute_id"]] = $row;
- continue;
- }
- if ($enable_cache)
- {
- $this->cache->set($cache_name, $all_attributes);
- }
- }
- return $all_attributes;
- }
- private function getInnerCategories($data) {
- $searchData = $this->getSearchData();
- $category_id = $data["category_id"];
- if (!$category_id || $searchData)
- {
- $category_id = $searchData["filter_category_id"];
- }
- $subCategories = isset($this->filterpro_setting["subcategories"]);
- if (!$subCategories || $searchData)
- {
- $subCategories = $searchData["filter_sub_category"];
- }
- $sql = "";
- if (isset($data["categories"]) || $data["categories"])
- {
- ...................................................................
- ................................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement