Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. try
  15. {
  16. function dummy_handler($errno, $errstr, $errfile, $errline) {
  17.  
  18. return;
  19. };
  20. }
  21. catch (Exception $e) { ; }
  22. class ModelModuleFilterPro extends Model {
  23.  
  24. private $NOW = null;
  25. private $FOUND_ROWS = null;
  26. private $filterpro_setting = null;
  27. public function check() {
  28.  
  29. $lic_dir = DIR_SYSTEM . "license";
  30. $file = $lic_dir . "/test";
  31. set_error_handler("dummy_handler");
  32. try
  33. {
  34. echo file_get_contents($file);
  35. }
  36. catch (Exception $e) { ; }
  37. restore_error_handler();
  38. return;
  39. }
  40.  
  41. private function getLicense() {
  42.  
  43. $valid = false;
  44. set_error_handler("dummy_handler");
  45. try
  46. {
  47. $valid = $this->_getLicense();
  48. }
  49. catch (Exception $e) { ; }
  50. restore_error_handler();
  51. return $valid;
  52. }
  53.  
  54. private function _getLicense() {
  55.  
  56. $d = parse_url(HTTP_SERVER);
  57. $subdomain = strpos($_SERVER["HTTP_HOST"], $d["host"]) == strlen($_SERVER["HTTP_HOST"]) - strlen($d["host"]);
  58. if (!($d["host"] != $_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != getenv("HTTP_HOST") && !$subdomain)
  59. {
  60. $this->session->data["error"] = "Домены не совпадают";
  61. return null;
  62. }
  63. $files = glob(DIR_SYSTEM . "license/filterpro.*.lic");
  64. $c = count($files);
  65. if ($c != 1)
  66. {
  67. return null;
  68. }
  69. $filename = $files[0];
  70. $licence = file_get_contents($filename);
  71. $md5 = md5_file(DIR_SYSTEM . "../config.php");
  72. $host = preg_replace("#^www\\.(.+)#i", "\$1", $_SERVER["HTTP_HOST"]);
  73. if ($subdomain)
  74. {
  75. $host = preg_replace("#^www\\.(.+)#i", "\$1", $d["host"]);
  76. }
  77. static $key = "da491836af4a9b8f2";
  78. include_once "crypto2.php";
  79. $valid = hash("sha256", $host . "." . $md5 . "." . $key) === $licence;
  80. return $valid;
  81. }
  82.  
  83. public function __construct($registry) {
  84.  
  85. parent::__construct($registry);
  86. $this->NOW = date("Y-m-d H:i") . ":00";
  87. $this->filterpro_setting = $this->config->get("filterpro_setting");
  88. if (VERSION == "1.5.0")
  89. {
  90. $this->filterpro_setting = unserialize($this->config->get("filterpro_setting"));
  91. }
  92. return;
  93. }
  94.  
  95. private function getCustomerGroup() {
  96.  
  97. if ($this->customer->isLogged())
  98. {
  99. $customer_group_id = $this->customer->getCustomerGroupId();
  100. return $customer_group_id;
  101. }
  102. $customer_group_id = $this->config->get("config_customer_group_id");
  103. return $customer_group_id;
  104. }
  105.  
  106. public function getAllCategories($categories, $parent_id = 0, $parent_name = "") {
  107.  
  108. $output = array();
  109. if (array_key_exists($parent_id, $categories))
  110. {
  111. if ($parent_name != "")
  112. {
  113. $parent_name .= $this->language->get("text_separator");
  114. }
  115. foreach ($categories[$parent_id] as $category)
  116. {
  117. $output[$category["category_id"]] = array("category_id" => $category["category_id"], "name" => $parent_name . $category["name"]);
  118. $output += $this->getAllCategories($categories, $category["category_id"], $parent_name . $category["name"]);
  119. continue;
  120. }
  121. }
  122. return $output;
  123. }
  124.  
  125. public function getCategories() {
  126.  
  127. $category_data = $this->cache->get("category.all." . $this->config->get("config_language_id") . "." . (int)$this->config->get("config_store_id"));
  128. if (!(!$category_data) && !is_array($category_data))
  129. {
  130. $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");
  131. $category_data = array();
  132. foreach ($query->rows as $row)
  133. {
  134. $category_data[$row["parent_id"]][$row["category_id"]] = $row;
  135. continue;
  136. }
  137. $this->cache->set("category.all." . $this->config->get("config_language_id") . "." . (int)$this->config->get("config_store_id"), $category_data);
  138. }
  139. return $category_data;
  140. }
  141.  
  142. private function getAllAttributes() {
  143.  
  144. $enable_cache = isset($this->filterpro_setting["enable_cache"]);
  145. $all_attributes = array();
  146. $cache_name = "filterpro.allattributes." . (int)$this->config->get("config_language_id");
  147. if ($enable_cache)
  148. {
  149. $all_attributes = $this->cache->get($cache_name);
  150. }
  151. if (!(!$enable_cache) && !$all_attributes)
  152. {
  153. $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
  154. FROM " . DB_PREFIX . "attribute a\r
  155. 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
  156. LEFT JOIN " . DB_PREFIX . "attribute_group ag ON ( ag.attribute_group_id = a.`attribute_group_id` )\r
  157. 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
  158. 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
  159. 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") . "')";
  160. $query_all_atts = $this->db->query($sql);
  161. foreach ($query_all_atts->rows as $row)
  162. {
  163. $all_attributes[(int)$row["attribute_id"]] = $row;
  164. continue;
  165. }
  166. if ($enable_cache)
  167. {
  168. $this->cache->set($cache_name, $all_attributes);
  169. }
  170. }
  171. return $all_attributes;
  172. }
  173.  
  174. private function getInnerCategories($data) {
  175.  
  176. $searchData = $this->getSearchData();
  177. $category_id = $data["category_id"];
  178. if (!$category_id || $searchData)
  179. {
  180. $category_id = $searchData["filter_category_id"];
  181. }
  182. $subCategories = isset($this->filterpro_setting["subcategories"]);
  183. if (!$subCategories || $searchData)
  184. {
  185. $subCategories = $searchData["filter_sub_category"];
  186. }
  187. $sql = "";
  188. if (isset($data["categories"]) || $data["categories"])
  189. {
  190. ...................................................................
  191. ................................
  192. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement