install.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. helper::importControl('instance');
  3. class myInstance extends instance
  4. {
  5. /**
  6. * @param int $appID
  7. * @param string $checkResource
  8. */
  9. public function install($appID, $checkResource = 'true')
  10. {
  11. if(!empty($_POST))
  12. {
  13. form::data($this->config->instance->form->install)->get();
  14. $this->buildCustomConfig($appID);
  15. $this->checkCustomFields($appID);
  16. if(dao::isError()) return $this->sendError(dao::getError());
  17. if(!empty($this->config->instance->form->install->custom))
  18. {
  19. $this->config->instance->form->install = array_merge($this->config->instance->form->install, $this->config->instance->form->install->custom);
  20. }
  21. }
  22. parent::install($appID, $checkResource);
  23. }
  24. public function __construct($moduleName = '', $methodName = '')
  25. {
  26. parent::__construct($moduleName, $methodName);
  27. $runVersion = 'biz13.1';
  28. if(function_exists('ioncube_license_properties')) $properties = ioncube_license_properties();
  29. $contactEmail = !empty($properties['email']['value']) ? $properties['email']['value'] : 'co@zentao.net';
  30. $contactMobile = !empty($properties['mobile']['value']) ? $properties['mobile']['value'] : '4006 889923';
  31. $contactQQ = !empty($properties['qq']['value']) ? $properties['qq']['value'] : 'co@zentao.net';
  32. if($this->app->getModuleName() != 'upgrade')
  33. {
  34. $user = $this->dao->select("COUNT('*') as `count`")->from(TABLE_USER)
  35. ->where('deleted')->eq(0)
  36. ->fetch();
  37. if(!empty($properties['user']) and $properties['user']['value'] < $user->count) die(" <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dli'>
  38. <html xmlns='http://www.w3.org/1999/xhtml'>
  39. <head>
  40. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  41. <title>Error</title>
  42. </head>
  43. <body>
  44. <h2 style='color:red;text-align:center'>用户人数超出限制</h2>
  45. 您版本的用户数是{$properties['user']['value']},您目前系统中已有{$user->count}人,已经超过了限制,请联系我们增加人数授权。<br />
  46. Email:<a href='mailto:$contactEmail'>$contactEmail</a><br />
  47. 手机:13730922971<br />
  48. 电话:$contactMobile<br />
  49. QQ:$contactQQ<br />
  50. 微信:13730922971<br />
  51. 网址:<a href='http://www.zentao.net/goto.php?item=buybiz'>www.zentao.net</a><br />
  52. <br /><br /><br />
  53. <h2 style='color:red;text-align:center'>Users Count Exceeded</h2>
  54. The number of users is more than {$properties['user']['value']} as licensed. Please contact us to get more licenses.<br />
  55. email:<a href='mailto:support@zentaoalm.com'>support@zentaoalm.com</a><br />
  56. Web:<a href='http://www.zentao.pm'>www.zentao.pm</a><br />
  57. </body>
  58. </html>");
  59. }
  60. if(!empty($properties['version']['value']) and !defined('IN_UPGRADE'))
  61. {
  62. if(!isset($runVersion)) $runVersion = $this->config->version;
  63. $authorizedVersion = $properties['version']['value'];
  64. $isAuth = $runVersion == $authorizedVersion;
  65. if(!$isAuth && $this->config->edition != 'biz')
  66. {
  67. $this->app->loadLang('upgrade');
  68. $this->app->loadConfig('upgrade');
  69. $openRunVersion = zget($this->config->upgrade->bizVersion, str_replace('.', '_', $runVersion), $runVersion);
  70. $openAuthedVersion = $authorizedVersion;
  71. if($this->config->edition == 'max') $openAuthedVersion = zget($this->config->upgrade->maxVersion, str_replace('.', '_', $authorizedVersion), $authorizedVersion);
  72. if($this->config->edition == 'ipd') $openAuthedVersion = zget($this->config->upgrade->ipdVersion, str_replace('.', '_', $authorizedVersion), $authorizedVersion);
  73. $isAuth = $openRunVersion == $openAuthedVersion;
  74. }
  75. if(!$isAuth) die(" <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dli'>
  76. <html xmlns='http://www.w3.org/1999/xhtml'>
  77. <head>
  78. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  79. <title>Error</title>
  80. </head>
  81. <body>
  82. <h2 style='color:red;text-align:center'>没有授权此版本</h2>
  83. 您版本授权的版本是{$properties['version']['value']},当前使用的版本是{$runVersion},请联系我们重新购买授权。<br />
  84. Email:<a href='mailto:$contactEmail'>$contactEmail</a><br />
  85. 手机:13730922971<br />
  86. 电话:$contactMobile<br />
  87. QQ:$contactQQ<br />
  88. 微信:13730922971<br />
  89. 网址:<a href='http://www.zentao.net/goto.php?item=buybiz'>www.zentao.net</a><br />
  90. <br /><br /><br />
  91. <h2 style='color:red;text-align:center'>This version is not licensed.</h2>
  92. The licensed version is {$properties['version']['value']}. You are using {$runVersion}. Please contact us to buy the right licenses.<br />
  93. email:<a href='mailto:support@zentaoalm.com'>support@zentaoalm.com</a><br />
  94. Web:<a href='http://www.zentao.pm/'>www.zentao.pm/</a><br />
  95. </body>
  96. </html>");
  97. }
  98. if(!empty($properties['edition']['value']) and !defined('IN_UPGRADE'))
  99. {
  100. if($properties['edition']['value'] != $this->config->edition) die(" <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dli'>
  101. <html xmlns='http://www.w3.org/1999/xhtml'>
  102. <head>
  103. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  104. <title>Error</title>
  105. </head>
  106. <body>
  107. <h2 style='color:red;text-align:center'>没有授权此版本</h2>
  108. 您版本授权的版本是{$properties['edition']['value']},当前使用的版本是{$this->config->edition},请联系我们重新购买授权。<br />
  109. Email:<a href='mailto:$contactEmail'>$contactEmail</a><br />
  110. 手机:13730922971<br />
  111. 电话:$contactMobile<br />
  112. QQ:$contactQQ<br />
  113. 微信:13730922971<br />
  114. 网址:<a href='http://www.zentao.net/goto.php?item=buybiz'>www.zentao.net</a><br />
  115. <br /><br /><br />
  116. <h2 style='color:red;text-align:center'>This version is not licensed.</h2>
  117. The licensed version is {$properties['edition']['value']}. You are using {$this->config->edition}. Please contact us to buy the right licenses.<br />
  118. email:<a href='mailto:support@zentaoalm.com'>support@zentaoalm.com</a><br />
  119. Web:<a href='http://www.zentao.pm/'>www.zentao.pm/</a><br />
  120. </body>
  121. </html>");
  122. }
  123. if(!empty($properties['domain']))
  124. {
  125. $host = $_SERVER['HTTP_HOST'];
  126. $portPos = strrpos($host, ':');
  127. if($portPos !== false)
  128. {
  129. $port = substr($host, $portPos + 1);
  130. if(is_numeric($port)) $host = substr($host, 0, $portPos);
  131. }
  132. $host .= $_SERVER['REQUEST_URI'];
  133. $checkHost = false;
  134. $allowHosts = explode(',', $properties['domain']['value']);
  135. foreach($allowHosts as $allowHost)
  136. {
  137. if(strpos($host, $allowHost) !== false)
  138. {
  139. $checkHost = true;
  140. break;
  141. }
  142. }
  143. if(!$checkHost) die(" <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dli'>
  144. <html xmlns='http://www.w3.org/1999/xhtml'>
  145. <head>
  146. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  147. <title>Error</title>
  148. </head>
  149. <body>
  150. <h2 style='color:red;text-align:center'>绑定域名访问错误</h2>
  151. 您版本绑定的信息与您当前访问的地址不一致,如果有问题,请联系我们修改绑定信息。<br />
  152. Email:<a href='mailto:$contactEmail'>$contactEmail</a><br />
  153. 手机:13730922971<br />
  154. 电话:$contactMobile<br />
  155. QQ:$contactQQ<br />
  156. 微信:13730922971<br />
  157. 网址:<a href='http://www.zentao.net/goto.php?item=buybiz'>www.zentao.net</a><br />
  158. <br /><br /><br />
  159. <h2 style='color:red;text-align:center'>Domain Error</h2>
  160. The information bound to your version does not match the address you are currently accessing. If there is a problem, please contact us to modify the binding information.<br />
  161. email:<a href='mailto:support@zentaoalm.com'>support@zentaoalm.com</a><br />
  162. Web:<a href='http://www.zentao.pm'>www.zentao.pm</a><br />
  163. </body>
  164. </html>");
  165. };
  166. }
  167. }