wsqindex.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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: wsqindex.php 34422 2014-04-23 09:56:17Z nemohou $
  7. */
  8. if (!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. define('MOBILE_HIDE_STICKY', !isset($_GET['hidesticky']) ? 1 : $_GET['hidesticky']);
  12. $_GET['mod'] = 'forumdisplay';
  13. include_once 'forum.php';
  14. class mobile_api {
  15. function common() {
  16. global $_G;
  17. $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
  18. if (!in_array('wechat', $_G['setting']['plugins']['available']) || !$_G['wechat']['setting']['wsq_fid']) {
  19. mobile_core::result(mobile_core::variable(array()));
  20. }
  21. $_GET['fid'] = $_G['fid'] = $_G['wechat']['setting']['wsq_fid'];
  22. loadforum();
  23. if (!empty($_GET['pw'])) {
  24. $_GET['action'] = 'pwverify';
  25. }
  26. $_G['forum']['allowglobalstick'] = false;
  27. }
  28. function output() {
  29. global $_G;
  30. include_once 'source/plugin/mobile/api/4/sub_threadlist.php';
  31. loadcache('mobile_stats');
  32. if (!$_G['cache']['mobile_stats'] || TIMESTAMP - $_G['cache']['mobile_stats']['expiration'] > 3600) {
  33. $forums = C::t('forum_forum')->fetch_all_by_status(1);
  34. foreach ($forums as $forum) {
  35. $posts += $forum['posts'];
  36. }
  37. loadcache('userstats');
  38. $_G['cache']['mobile_stats']['variable'] = array(
  39. 'totalposts' => $posts,
  40. 'totalmembers' => $_G['cache']['userstats']['totalmembers'],
  41. );
  42. savecache('mobile_stats', array('variable' => $_G['cache']['mobile_stats']['variable'], 'expiration' => TIMESTAMP));
  43. }
  44. $variable['stats'] = $_G['cache']['mobile_stats']['variable'];
  45. require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
  46. $variable['wsqsiteinfo'] = wsq::siteinfo();
  47. mobile_core::result(mobile_core::variable($variable));
  48. }
  49. }
  50. ?>