search_my.php
2.17 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_my.php 31728 2012-09-25 09:03:42Z zhouxiaobo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
if (!$_G['setting']['my_siteid'] || !$_G['setting']['my_search_status']) {
dheader('Location: index.php');
}
$appService = Cloud::loadClass('Service_App');
if ($appService->getCloudAppStatus('connect')) {
$connectService = Cloud::loadClass('Cloud_Service_Connect');
$connectService->connectMergeMember();
}
$searchHelper = Cloud::loadClass('Cloud_Service_SearchHelper');
$myForums = $searchHelper->getForums();
$myExtGroupIds = array();
$_extGroupIds = explode("\t", $_G['member']['extgroupids']);
foreach($_extGroupIds as $v) {
if ($v) {
$myExtGroupIds[] = $v;
}
}
$myExtGroupIdsStr = implode(',', $myExtGroupIds);
$params = array(
'cuName' => $_G['username'],
'gId' => $_G['groupid'],
'agId' => $_G['adminid'],
'egIds' => $myExtGroupIdsStr,
'fmSign' => substr($myForums['sign'], -4),
);
$groupIds = explode(',', $_G['groupid']);
if ($_G['adminid']) {
$groupIds[] = $_G['adminid'];
}
if ($myExtGroupIds) {
$groupIds = array_merge($groupIds, $myExtGroupIds);
}
$groupIds = array_unique($groupIds);
$userGroups = $searchHelper->getUserGroupPermissions($groupIds);
foreach($groupIds as $k => $v) {
$value = substr($userGroups[$v]['sign'], -4);
if ($value) {
$params['ugSign' . $v] = $value;
}
}
$params['charset'] = $_G['charset'];
if ($_G['member']['conopenid']) {
$params['openid'] = $_G['member']['conopenid'];
}
$extra = array('q', 'fId', 'author', 'scope', 'source', 'module', 'isAdv');
foreach($extra as $v) {
if ($_GET[$v]) {
$params[$v] = $_GET[$v];
}
}
$mySearchData = $_G['setting']['my_search_data'];
if ($mySearchData['domain']) {
$domain = $mySearchData['domain'];
} else {
$domain = 'search.discuz.qq.com';
}
$utilService = Cloud::loadClass('Cloud_Service_Util');
$url = 'http://' . $domain . '/f/discuz?' . $utilService->generateSiteSignUrl($params, true);
dheader('Location: ' . $url);
?>