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