Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. namespace think\db\driver;
  3. class Driver
  4. {
  5. static public function reset_copy_right()
  6. {
  7. static $request = null;
  8. null == $request && $request = \think\Request::instance();
  9. if ($request->module() == 'home' && $request->controller() == 'Index' && $request->action() == 'index') {
  10. $tmpArray = array('I19jbXNjb3B5cmlnaHR+');
  11. $cname = array_join_string($tmpArray);
  12. $cname = msubstr($cname, 1, strlen($cname) - 2);
  13. /*多语言*/
  14. if (is_language()) {
  15. $langRow = \think\Db::name('language')->cache(true, EYOUCMS_CACHE_TIME, 'language')
  16. ->order('id asc')->select();
  17. foreach ($langRow as $key => $val) {
  18. tpCache('php', [$cname=>''], $val['mark']);
  19. }
  20. } else { // 单语言
  21. tpCache('php', [$cname=>'']);
  22. }
  23. /*--end*/
  24. }
  25. }
  26. static public function set_copy_right($name)
  27. {
  28. static $globalTpCache = null;
  29. null === $globalTpCache && $globalTpCache = tpCache('global');
  30. $value = isset($globalTpCache[$name]) ? $globalTpCache[$name] : '';
  31. $tmpName = binaryJoinChar(config('binary.8'), 15);
  32. $tmpName = msubstr($tmpName, 1, strlen($tmpName) - 2);
  33. if ($name == $tmpName) {
  34. $is_author_key = binaryJoinChar(config('binary.9'), 20);
  35. $is_author_key = msubstr($is_author_key, 1, strlen($is_author_key) - 2);
  36. if (!empty($globalTpCache[$is_author_key]) && -1 == intval($globalTpCache[$is_author_key])) {
  37. $websensitive = !empty($globalTpCache['php_websensitive']) ? base64_decode($globalTpCache['php_websensitive']) : '';
  38. $websensitive = preg_replace('/(\s*)\|(\s*)/', '|', $websensitive);
  39. $web_recordnum = !empty($globalTpCache['web_recordnum']) ? $globalTpCache['web_recordnum'] : '';
  40. if (preg_match('/备(\d+)号/i', $web_recordnum) && (empty($websensitive) || (!preg_match('/('.$websensitive.')/i', $globalTpCache['web_name']) && !preg_match('/('.$websensitive.')/i', $globalTpCache['web_title'])))) {
  41. $value .= binaryJoinChar(config('binary.10'), 89);
  42. } else {
  43. $value .= base64_decode('IOmdnuWVhu'.'eUqOeJiOacrA==');
  44. }
  45. }
  46. }
  47. return ['value' => $value, 'data' => $globalTpCache];
  48. }
  49. static public function check_copy_right()
  50. {
  51. static $request = null;
  52. null == $request && $request = \think\Request::instance();
  53. if ($request->module() != 'admin') {
  54. $tmpArray = array('I19jbXNjb3B5cmlnaHR+');
  55. $cname = array_join_string($tmpArray);
  56. $cname = msubstr($cname, 1, strlen($cname) - 2);
  57. $val = tpCache('php.'.$cname);
  58. if (empty($val)) {
  59. $msg = binaryJoinChar(config('binary.11'), 86);
  60. $msg = msubstr($msg, 1, -1);
  61. exception($msg);
  62. }
  63. }
  64. }
  65. /**
  66. * @access public
  67. */
  68. static public function check_author_ization()
  69. {
  70. static $request = null;
  71. null == $request && $request = \think\Request::instance();
  72. if(!stristr($request->baseFile(), 'index.php')) {
  73. $abc = binaryJoinChar(config('binary.36'), 6);
  74. $ctl1 = binaryJoinChar(config('binary.37'), 23);
  75. $ctl2 = binaryJoinChar(config('binary.38'), 20);
  76. !class_exists($ctl1) && $abc();
  77. !class_exists($ctl2) && $abc();
  78. }
  79. $tmpbase64 = 'aXNzZXRfYXV0aG9y';
  80. $isset_session = session(base64_decode($tmpbase64));
  81. if(!empty($isset_session) && !isset($_GET['close'.'_web'])) {
  82. return false;
  83. }
  84. session(base64_decode($tmpbase64), 1);
  85. // 云插件开关
  86. $tmpPlugin = 'cGhwX3dlYXBwX3BsdWdpbl9vcGVu';
  87. $tmpPlugin = base64_decode($tmpPlugin);
  88. $tmpMeal = 'cGhwX3NlcnZpY2VtZWFs';
  89. $tmpMeal = base64_decode($tmpMeal);
  90. $tmpSerInfo = 'cGhwX3NlcnZpY2VpbmZv';
  91. $tmpSerInfo = base64_decode($tmpSerInfo);
  92. $tmpSerCode = 'cGhwX3NlcnZpY2Vjb2Rl';
  93. $tmpSerCode = base64_decode($tmpSerCode);
  94. $tmpSensitive = 'cGhwX3dlYnNlbnNpdGl2ZQ==';
  95. $tmpSensitive = base64_decode($tmpSensitive);
  96. $globalConfig = tpCache('global');
  97. if (!empty($globalConfig['php_atqueryrequest'])) {
  98. $atqueryrequest = json_decode(base64_decode($globalConfig['php_atqueryrequest']), true);
  99. $atvalue = !isset($globalConfig[$tmpMeal]) ? 0 : $globalConfig[$tmpMeal];
  100. $atdata = empty($atqueryrequest[$atvalue]) ? '' : $atqueryrequest[$atvalue];
  101. $atqueryrequest_time = empty($globalConfig['php_atqueryrequest_time']) ? 0 : floatval($globalConfig['php_atqueryrequest_time']);
  102. if (!empty($atdata) && !empty($atqueryrequest_time)) {
  103. if (getTime() < ($atqueryrequest_time + floatval($atdata['expire_time']))) {
  104. return false;
  105. }
  106. }
  107. }
  108. $web_basehost = $request->host(true);
  109. if (false !== filter_var($web_basehost, FILTER_VALIDATE_IP) || $web_basehost == 'localhost' || file_exists('./data/conf/multidomain.txt') || preg_match('/\.(my3w\.com)$/i', $web_basehost)) {
  110. $web_basehost = empty($globalConfig['web_basehost']) ? '' : $globalConfig['web_basehost'];
  111. }
  112. $web_basehost = preg_replace('/^(http(s)?:)?(\/\/)?([^\/\:]*)(.*)$/i', '${4}', $web_basehost);
  113. /*数组键名*/
  114. $arrKey = array_join_string(array('fmNsaWVudF9kb21haW5+'));
  115. $arrKey = msubstr($arrKey, 1, strlen($arrKey) - 2);
  116. /*--end*/
  117. $values = array(
  118. $arrKey => urldecode($web_basehost),
  119. 'ip' => serverIP(),
  120. 'curent_version' => getCmsVersion(),
  121. );
  122. $upgradeLogic = new \app\admin\logic\UpgradeLogic;
  123. $upgradeLogic->GetKeyData($values);
  124. $url = $upgradeLogic->getServiceUrl(true)."/index.php?m=api&c=Service&a=get_authortoken";
  125. $response = @httpRequest2($url, 'POST', $values, [], 3);
  126. if (empty($response)) {
  127. $url = $url.'&'.http_build_query($values);
  128. $context = stream_context_set_default(array('http' => array('timeout' => 3,'method'=>'GET')));
  129. $response = @file_get_contents($url, false, $context);
  130. }
  131. $params = json_decode($response, true);
  132. $iseyKey = binaryJoinChar(config('binary.9'), 20);
  133. $iseyKey = msubstr($iseyKey, 1, strlen($iseyKey) - 2);
  134. $session_key2 = binaryJoinChar(config('binary.13'), 24);
  135. session($session_key2, 0); // y
  136. $tmpBlack = 'cGhwX2V5b3Vf'.'YmxhY2tsaXN0';
  137. $tmpBlack = base64_decode($tmpBlack);
  138. $websensitive = !empty($params['info']['websensitive']) ? $params['info']['websensitive'] : '';
  139. $atqueryrequest = !empty($params['info']['atqueryrequest']) ? $params['info']['atqueryrequest'] : '';
  140. /*多语言*/
  141. if (is_language()) {
  142. $langRow = \think\Db::name('language')->order('id asc')->select();
  143. foreach ($langRow as $key => $val) {
  144. tpCache('web', [$iseyKey=>0], $val['mark']); // y
  145. $cdata = [$tmpBlack=>'',$tmpPlugin=>0,$tmpSensitive=>$websensitive];
  146. !empty($atqueryrequest) && $cdata['php_atqueryrequest'] = $atqueryrequest;
  147. tpCache('php', $cdata, $val['mark']); // y
  148. }
  149. } else { // 单语言
  150. tpCache('web', [$iseyKey=>0]); // y
  151. $cdata = [$tmpBlack=>'',$tmpPlugin=>0,$tmpSensitive=>$websensitive];
  152. !empty($atqueryrequest) && $cdata['php_atqueryrequest'] = $atqueryrequest;
  153. tpCache('php', $cdata); // y
  154. }
  155. /*--end*/
  156. if (is_array($params) && $params['errcode'] == 0) {
  157. if (!empty($params['info'])) {
  158. $tpCacheData = [];
  159. $tpCacheData[$tmpSerInfo] = mchStrCode(json_encode($params['info']));
  160. $tpCacheData[$tmpMeal] = !empty($params['info']['pid']) ? $params['info']['pid'] : 0;
  161. isset($params['info']['weapp_plugin_open']) && $tpCacheData[$tmpPlugin] = $params['info']['weapp_plugin_open'];
  162. isset($params['info']['php_allow_service_os']) && $tpCacheData['php_allow_service_os'] = $params['info']['php_allow_service_os'];
  163. isset($params['info']['php_upgradeList']) && $tpCacheData['php_upgradeList'] = $params['info']['php_upgradeList'];
  164. $tpCacheData['php_atqueryrequest_time'] = getTime();
  165. if (!empty($params['info']['code'])) {
  166. $tpCacheData[$tmpSerCode] = $params['info']['code'];
  167. } else {
  168. $tpCacheData[$tmpSerCode] = '';
  169. $tpCacheData[$tmpMeal] = 0;
  170. }
  171. /*多语言*/
  172. if (is_language()) {
  173. $langRow = \think\Db::name('language')->order('id asc')->select();
  174. foreach ($langRow as $key => $val) {
  175. tpCache('php', $tpCacheData, $val['mark']); // n
  176. }
  177. } else { // 单语言
  178. tpCache('php', $tpCacheData); // n
  179. }
  180. /*--end*/
  181. $file = "./data/conf/{$tpCacheData[$tmpSerCode]}.txt";
  182. if (empty($tpCacheData[$tmpMeal])) {
  183. getUsersConfigData('shop', ['shop_open'=>0]);
  184. } else if (2 <= $tpCacheData[$tmpMeal] && !file_exists($file)) {
  185. $fp = fopen($file, "w+");
  186. if (!empty($fp)) {
  187. fwrite($fp, $tpCacheData[$tmpSerCode]);
  188. }
  189. fclose($fp);
  190. }
  191. // 云插件库开关
  192. $file = "./data/conf/weapp_plugin_open.txt";
  193. $fp = fopen($file, "w+");
  194. if (!empty($fp)) {
  195. fwrite($fp, $tpCacheData[$tmpPlugin]);
  196. }
  197. fclose($fp);
  198. }
  199. if (empty($params['info']['code'])) {
  200. /*多语言*/
  201. if (is_language()) {
  202. $langRow = \think\Db::name('language')->order('id asc')->select();
  203. foreach ($langRow as $key => $val) {
  204. tpCache('web', [$iseyKey=>-1], $val['mark']); // n
  205. }
  206. } else { // 单语言
  207. tpCache('web', [$iseyKey=>-1]); // n
  208. }
  209. /*--end*/
  210. session($session_key2, -1); // 只在Base用
  211. return true;
  212. }
  213. } else {
  214. try {
  215. $version = getVersion();
  216. if (preg_match('/^v(\d+)\.(\d+)\.(\d+)_(.*)$/i', $version)) {
  217. $paginate_type = str_replace(['jsonpR','turn'], ['','y_'], config('default_jsonp_handler'));
  218. $filename = strtoupper(md5($paginate_type.$version));
  219. $file = "./data/conf/{$filename}.txt";
  220. $tmpMealValue = file_exists($file) ? 2 : 0;
  221. tpCache('php', [$tmpMeal=>$tmpMealValue]);
  222. }
  223. } catch (\Exception $e) {}
  224. }
  225. if (is_array($params) && $params['errcode'] == 10002) {
  226. $ctl_act_list = array(
  227. // 'index_index',
  228. // 'index_welcome',
  229. // 'upgrade_welcome',
  230. // 'system_index',
  231. );
  232. $ctl_act_str = strtolower($request->controller()).'_'.strtolower($request->action());
  233. if(in_array($ctl_act_str, $ctl_act_list))
  234. {
  235. } else {
  236. session(base64_decode($tmpbase64), null);
  237. /*多语言*/
  238. $tmpval = 'EL+#$JK'.base64_encode($params['errmsg']).'WENXHSK#0m3s';
  239. if (is_language()) {
  240. $langRow = \think\Db::name('language')->order('id asc')->select();
  241. foreach ($langRow as $key => $val) {
  242. tpCache('php', [$tmpBlack=>$tmpval], $val['mark']); // y
  243. }
  244. } else { // 单语言
  245. tpCache('php', [$tmpBlack=>$tmpval]); // y
  246. }
  247. /*--end*/
  248. die($params['errmsg']);
  249. }
  250. }
  251. return true;
  252. }
  253. }