check.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: check.php 36332 2016-12-30 01:44:19Z nemohou $
  7. */
  8. if(!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. require './source/class/class_core.php';
  12. $discuz = C::app();
  13. $discuz->init();
  14. if(!defined('DISCUZ_VERSION')) {
  15. require './source/discuz_version.php';
  16. }
  17. if(in_array('mobile', $_G['setting']['plugins']['available'])) {
  18. loadcache('wsq_checkinfo');
  19. if (!$_G['cache']['wsq_checkinfo'] || TIMESTAMP - $_G['cache']['wsq_checkinfo']['expiration'] > 600) {
  20. $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
  21. $forums = C::t('forum_forum')->fetch_all_by_status(1);
  22. foreach ($forums as $forum) {
  23. $posts += $forum['posts'];
  24. }
  25. loadcache('userstats');
  26. $array = array(
  27. 'discuzversion' => 'X3.2',
  28. 'charset' => CHARSET,
  29. 'version' => MOBILE_PLUGIN_VERSION,
  30. 'pluginversion' => $_G['setting']['plugins']['version']['mobile'],
  31. 'regname' => $_G['setting']['regname'],
  32. 'qqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
  33. 'wsqqqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
  34. 'wsqhideregister' => $_G['wechat']['setting']['wechat_allowregister'] && $_G['wechat']['setting']['wechat_allowfastregister'] ? '1' : '0',
  35. 'sitename' => $_G['setting']['bbname'],
  36. 'mysiteid' => $_G['setting']['my_siteid'],
  37. 'ucenterurl' => $_G['setting']['ucenterurl'],
  38. 'defaultfid' => $_G['wechat']['setting']['wsq_fid'],
  39. 'totalposts' => $posts,
  40. 'totalmembers' => $_G['cache']['userstats']['totalmembers'],
  41. );
  42. savecache('wsq_checkinfo', array('variable' => $array, 'expiration' => TIMESTAMP));
  43. } else {
  44. $array = $_G['cache']['wsq_checkinfo']['variable'];
  45. }
  46. } else {
  47. $array = array();
  48. }
  49. $array['testcookie'] = $_G['cookie']['testcookie'];
  50. $data = mobile_core::json($array);
  51. mobile_core::make_cors($_SERVER['REQUEST_METHOD'], REQUEST_METHOD_DOMAIN);
  52. echo $data;
  53. ?>