Advertisement
Guest User

Untitled

a guest
Jul 4th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 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.3
  8. * @ Author : DeZender
  9. * @ Release on : 06.05.2013
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class ControllerModuleSimple extends Controller {
  15.  
  16. private $_error = array();
  17. private $_defaultSettings = array();
  18. private $_settings = null;
  19. private $_language = null;
  20. public function install() {
  21.  
  22. $this->load->model("setting/setting");
  23. $this->load->model("setting/store");
  24. $this->load->model("module/simple");
  25. $stores = $this->getStores();
  26. $this->loadDefaultSettings();
  27. $settings = array("simple_settings" => !$this->_defaultSettings ? ($this->_defaultSettings) : "{}", "simple_address_format" => "{firstname} {lastname}, {city}, {address_1}", "simple_replace_cart" => false, "simple_replace_checkout" => false, "simple_replace_register" => false, "simple_replace_edit" => false, "simple_replace_address" => false, "simple_module" => array(), "simple_license" => "");
  28. foreach ($stores as $key => $value)
  29. {
  30. $this->model_setting_setting->editSetting("simple", $settings, $value["store_id"]);
  31. continue;
  32. }
  33. $this->model_module_simple->createTableForCustomerFields();
  34. $this->model_module_simple->createTableForAddressFields();
  35. $this->model_module_simple->createTableForOrderFields();
  36. return;
  37. }
  38.  
  39. private function getDomain($from) {
  40.  
  41. if ($from == "config_http")
  42. {
  43. $domain = HTTP_CATALOG;
  44. }
  45. else
  46. {
  47. if ($from == "config_https")
  48. {
  49. $domain = HTTPS_CATALOG;
  50. }
  51. else
  52. {
  53. $domain = isset($_SERVER["SERVER_NAME"]) ? ($_SERVER["SERVER_NAME"]) : "";
  54. }
  55. }
  56. $domain = str_replace("https://", "", $domain);
  57. $domain = str_replace("http://", "", $domain);
  58. $domain = str_replace("www.", "", $domain);
  59. $pos = utf8_strpos($domain, "/");
  60. if ($pos)
  61. {
  62. $domain = utf8_substr($domain, 0, $pos);
  63. }
  64. if (utf8_strpos($domain, ":") !== false)
  65. {
  66. $tmp = explode(":", $domain);
  67. if ((!empty($tmp) || is_array($tmp)) && count($tmp) == 2 || preg_match("/^[0-9]+\$/usi", $tmp[1]))
  68. {
  69. $domain = $tmp[0];
  70. }
  71. }
  72. $domain = trim($domain, "/");
  73. return trim($domain);
  74. }
  75.  
  76. private function saveLicense($value, $storeId) {
  77.  
  78. $license = $this->config->get("simple_license");
  79. if (is_null($license))
  80. {
  81. $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape($value) . "', `group` = 'simple', `key` = 'simple_license', store_id = '" . (int)$storeId . "'");
  82. return null;
  83. }
  84. $this->db->query("UPDATE " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape($value) . "' WHERE `group` = 'simple' AND `key` = 'simple_license' AND store_id = '" . (int)$storeId . "'");
  85. return;
  86. }
  87.  
  88. private function isLocal() {
  89.  
  90. $domainConfigHttp = $this->getDomain("config_http");
  91. $domainConfigHttps = $this->getDomain("config_https");
  92. $domainServer = $this->getDomain("server");
  93. $serverAddr = isset($_SERVER["SERVER_ADDR"]) ? ($_SERVER["SERVER_ADDR"]) : "";
  94. $remoteAddr = isset($_SERVER["REMOTE_ADDR"]) ? ($_SERVER["REMOTE_ADDR"]) : "";
  95. return strpos($domainConfigHttp, ".") === false && $domainConfigHttp == $domainConfigHttps && $domainConfigHttp == $domainServer && (($serverAddr == "127.0.0.1" && $remoteAddr == "127.0.0.1") && ($serverAddr == "::1" && $remoteAddr == "::1"));
  96. }
  97.  
  98. private function checkLicense() {
  99.  
  100. if ($this->isLocal())
  101. {
  102. return true;
  103. }
  104. $domainConfigHttp = $this->getDomain("config_http");
  105. $domainConfigHttps = $this->getDomain("config_https");
  106. $domainServer = $this->getDomain("server");
  107. if (((($domainConfigHttp != $domainServer) && $domainConfigHttp != $domainConfigHttps) && strpos($domainServer, $domainConfigHttp) === false) && strpos($domainConfigHttp, $domainServer) === false)
  108. {
  109. return false;
  110. }
  111. return md5($domainConfigHttp . "242816f50f6d2b0020102ae1eddea927") == $this->config->get("simple_license");
  112. }
  113. .....................................................................
  114. ................................
  115. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement