First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

View File

@@ -0,0 +1,149 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_album.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
require_once libfile('function/home');
if(!$_G['setting']['search']['album']['status']) {
showmessage('search_album_closed');
}
if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 8)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['album']['searchctrl'] = intval($_G['setting']['search']['album']['searchctrl']);
$srchmod = 4;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$srchtxt = $_GET['srchtxt'];
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
if(!submitcheck('searchsubmit', 1)) {
include template('search/album');
} else {
$orderby = in_array($_GET['orderby'], array('dateline', 'replies', 'views')) ? $_GET['orderby'] : 'lastpost';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
if(!empty($searchid)) {
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
$albumlist = array();
$maxalbum = $nowalbum = 0;
$query = C::t('home_album')->fetch_all_album(explode(',', $index['ids']), 'updatetime', $start_limit, $_G['tpp']);
foreach($query as $value) {
if($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
} elseif ($value['picnum']) {
$value['pic'] = STATICURL.'image/common/nopublish.jpg';
} else {
$value['pic'] = '';
}
$value['albumname'] = bat_highlight($value['albumname'], $keyword);
$albumlist[$value['albumid']] = $value;
}
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=album&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes");
$url_forward = 'search.php?mod=album&'.$_SERVER['QUERY_STRING'];
include template('search/album');
} else {
$searchstring = 'album|title|'.addslashes($srchtxt);
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['album']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=album', array('searchctrl' => $_G['setting']['search']['album']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
if(!$srchtxt && !$srchuid && !$srchuname) {
dheader('Location: search.php?mod=album');
}
if($_G['adminid'] != '1' && $_G['setting']['search']['album']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['album']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=album', array('maxspm' => $_G['setting']['search']['album']['maxspm']));
}
}
$num = $ids = 0;
$_G['setting']['search']['album']['maxsearchresults'] = $_G['setting']['search']['album']['maxsearchresults'] ? intval($_G['setting']['search']['album']['maxsearchresults']) : 500;
list($srchtxt, $srchtxtsql) = searchkey($keyword, "albumname LIKE '%{text}%'", true);
$query = C::t('home_album')->fetch_albumid_by_searchkey($srchtxtsql, $_G['setting']['search']['album']['maxsearchresults']);
foreach($query as $album) {
$ids .= ','.$album['albumid'];
$num++;
}
unset($query);
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $num,
'ids' => $ids
), true);
!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=album&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,159 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_blog.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
require_once libfile('function/home');
if(!$_G['setting']['search']['blog']['status']) {
showmessage('search_blog_closed');
}
if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 4)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['blog']['searchctrl'] = intval($_G['setting']['search']['blog']['searchctrl']);
$srchmod = 3;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$srchtxt = $_GET['srchtxt'];
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
if(!submitcheck('searchsubmit', 1)) {
include template('search/blog');
} else {
$orderby = in_array($_GET['orderby'], array('dateline', 'replies', 'views')) ? $_GET['orderby'] : 'lastpost';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
if(!empty($searchid)) {
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
$result = array();
$bloglist = array();
$pricount = 0;
$blogidarray = explode(',', $index['ids']);
$data_blog = C::t('home_blog')->fetch_all_blog($blogidarray, 'dateline', 'DESC', $start_limit, $_G['tpp']);
$data_blogfield = C::t('home_blogfield')->fetch_all($blogidarray);
foreach($data_blog as $curblogid => $value) {
$result = array_merge($result, (array)$data_blogfield[$curblogid]);
if(ckfriend($value['uid'], $value['friend'], $value['target_ids']) && ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1)) {
if($value['friend'] == 4) {
$value['message'] = $value['pic'] = '';
} else {
$value['message'] = bat_highlight($value['message'], $keyword);
$value['message'] = getstr($value['message'], 255, 0, 0, 0, -1);
}
$value['subject'] = bat_highlight($value['subject'], $keyword);
$value['dateline'] = dgmdate($value['dateline']);
$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
$bloglist[] = $value;
} else {
$pricount++;
}
}
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=blog&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes");
$url_forward = 'search.php?mod=blog&'.$_SERVER['QUERY_STRING'];
include template('search/blog');
} else {
$searchstring = 'blog|title|'.addslashes($srchtxt);
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['blog']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=blog', array('searchctrl' => $_G['setting']['search']['blog']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
if(!$srchtxt && !$srchuid && !$srchuname) {
dheader('Location: search.php?mod=blog');
}
if($_G['adminid'] != '1' && $_G['setting']['search']['blog']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['blog']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=blog', array('maxspm' => $_G['setting']['search']['blog']['maxspm']));
}
}
$num = $ids = 0;
$_G['setting']['search']['blog']['maxsearchresults'] = $_G['setting']['search']['blog']['maxsearchresults'] ? intval($_G['setting']['search']['blog']['maxsearchresults']) : 500;
list($srchtxt, $srchtxtsql) = searchkey($keyword, "subject LIKE '%{text}%'", true);
$query = C::t('home_blog')->fetch_blogid_by_subject($keyword, $_G['setting']['search']['blog']['maxsearchresults']);
foreach($query as $blog) {
$ids .= ','.$blog['blogid'];
$num++;
}
unset($query);
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $num,
'ids' => $ids
), true);
!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=blog&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_collection.php 31371 2012-08-21 01:51:24Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
require_once libfile('function/home');
if(!$_G['setting']['search']['collection']['status']) {
showmessage('search_collection_closed');
}
if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 64)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['collection']['searchctrl'] = intval($_G['setting']['search']['collection']['searchctrl']);
$srchmod = 7;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$srchtxt = $_GET['srchtxt'];
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
if(!submitcheck('searchsubmit', 1)) {
include template('search/collection');
} else {
$orderby = in_array($_GET['orderby'], array('follownum', 'threadnum', 'commentnum', 'dateline')) ? $_GET['orderby'] : 'dateline';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
if(!empty($searchid)) {
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
require_once libfile('function/discuzcode');
$collectionlist = array();
$maxcollection = $nowcollection = 0;
$query = C::t('forum_collection')->fetch_all(explode(',', $index['ids']), $orderby, $ascdesc, $start_limit, $_G['tpp']);
foreach($query as $value) {
$value['lastupdate'] = dgmdate($value['lastupdate']);
$value['shortdesc'] = cutstr(strip_tags(discuzcode($value['desc'])), 50);
$value['name'] = bat_highlight($value['name'], $keyword);
$collectionlist[$value['ctid']] = $value;
}
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=collection&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes");
$url_forward = 'search.php?mod=collection&'.$_SERVER['QUERY_STRING'];
include template('search/collection');
} else {
$searchstring = 'collection|title|'.addslashes($srchtxt);
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['collection']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=collection', array('searchctrl' => $_G['setting']['search']['collection']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
if(!$srchtxt && !$srchuid && !$srchuname) {
dheader('Location: search.php?mod=collection');
}
if($_G['adminid'] != '1' && $_G['setting']['search']['collection']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['collection']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=collection', array('maxspm' => $_G['setting']['search']['collection']['maxspm']));
}
}
$num = $ids = 0;
$_G['setting']['search']['collection']['maxsearchresults'] = $_G['setting']['search']['collection']['maxsearchresults'] ? intval($_G['setting']['search']['collection']['maxsearchresults']) : 500;
list($srchtxt, $srchtxtsql) = searchkey($keyword, "name LIKE '%{text}%' OR keyword LIKE '%{text}%'", true);
$query = C::t('forum_collection')->fetch_ctid_by_searchkey($srchtxtsql, $_G['setting']['search']['collection']['maxsearchresults']);
foreach($query as $collection) {
$ids .= ','.$collection['ctid'];
$num++;
}
unset($query);
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $num,
'ids' => $ids
), true);
!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=collection&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,417 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_forum.php 33198 2013-05-06 09:23:45Z jeffjzhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
if(!$_G['setting']['search']['forum']['status']) {
showmessage('search_forum_closed');
}
if(in_array($_G['adminid'], array(0, -1)) && !($_G['group']['allowsearch'] & 2)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['forum']['searchctrl'] = intval($_G['setting']['search']['forum']['searchctrl']);
require_once libfile('function/forumlist');
require_once libfile('function/forum');
require_once libfile('function/post');
loadcache(array('forums', 'posttable_info'));
$posttableselect = '';
if(!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
$posttableselect = '<select name="seltableid" id="seltableid" class="ps" style="display:none">';
foreach($_G['cache']['posttable_info'] as $posttableid => $data) {
$posttableselect .= '<option value="'.$posttableid.'"'.($_GET['posttableid'] == $posttableid ? ' selected="selected"' : '').'>'.($data['memo'] ? $data['memo'] : 'post_'.$posttableid).'</option>';
}
$posttableselect .= '</select>';
}
$srchmod = 2;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$seltableid = intval(getgpc('seltableid'));
if($srchtype != 'title' && $srchtype != 'fulltext') {
$srchtype = '';
}
$srchtxt = trim(getgpc('srchtxt'));
$srchuid = intval(getgpc('srchuid'));
$srchuname = isset($_GET['srchuname']) ? trim(str_replace('|', '', $_GET['srchuname'])) : '';;
$srchfrom = intval(getgpc('srchfrom'));
$before = intval(getgpc('before'));
$srchfid = getgpc('srchfid');
$srhfid = intval($_GET['srhfid']);
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
$forumselect = forumselect();
if(!empty($srchfid) && !is_numeric($srchfid)) {
$forumselect = str_replace('<option value="'.$srchfid.'">', '<option value="'.$srchfid.'" selected="selected">', $forumselect);
}
if(!submitcheck('searchsubmit', 1)) {
if(getgpc('adv')) {
include template('search/forum_adv');
} else {
include template('search/forum');
}
} else {
$orderby = in_array(getgpc('orderby'), array('dateline', 'replies', 'views')) ? $_GET['orderby'] : 'lastpost';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
$orderbyselected = array($orderby => 'selected="selected"');
$ascchecked = array($ascdesc => 'checked="checked""');
if(!empty($searchid)) {
require_once libfile('function/misc');
$page = max(1, intval(getgpc('page')));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
$searchstring = explode('|', $index['searchstring']);
$index['searchtype'] = $searchstring[0];//preg_replace("/^([a-z]+)\|.*/", "\\1", $index['searchstring']);
$searchstring[2] = base64_decode($searchstring[2]);
$srchuname = $searchstring[4];
$modfid = 0;
if($keyword) {
$modkeyword = str_replace(' ', ',', $keyword);
$fids = explode(',', str_replace('\\\'', '', $searchstring[5]));
foreach ($fids as $srchfid) {
if(!empty($srchfid) ) {
$forumselect = str_replace('<option value="'.$srchfid.'">', '<option value="'.$srchfid.'" selected="selected">', $forumselect);
}
}
if(count($fids) == 1 && in_array($_G['adminid'], array(1,2,3))) {
$modfid = $fids[0];
if($_G['adminid'] == 3 && !C::t('forum_moderator')->fetch_uid_by_fid_uid($modfid, $_G['uid'])) {
$modfid = 0;
}
}
}
$threadlist = $posttables = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',',$index['ids']), null, 0, $orderby, $start_limit, $_G['tpp'], '>=', $ascdesc) as $thread) {
$thread['subject'] = bat_highlight($thread['subject'], $keyword);
$thread['realtid'] = $thread['isgroup'] == 1 ? $thread['closed'] : $thread['tid'];
$threadlist[$thread['tid']] = procthread($thread, 'dt');
$posttables[$thread['posttableid']][] = $thread['tid'];
}
if($threadlist) {
foreach($posttables as $tableid => $tids) {
foreach(C::t('forum_post')->fetch_all_by_tid($tableid, $tids, true, '', 0, 0, 1) as $post) {
if($post['status'] & 1) {
$threadlist[$post['tid']]['message'] = lang('forum/template', 'message_single_banned');
} else {
$threadlist[$post['tid']]['message'] = bat_highlight(threadmessagecutstr($threadlist[$post['tid']], $post['message'], 200), $keyword);
}
}
}
}
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=forum&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes");
$url_forward = 'search.php?mod=forum&'.$_SERVER['QUERY_STRING'];
$fulltextchecked = $searchstring[1] == 'fulltext' ? 'checked="checked"' : '';
$specials = explode(',', $searchstring[9]);
$srchfilter = $searchstring[8];
$before = $searchstring[7];
$srchfrom = $searchstring[6];
foreach($specials as $key) {
$specialchecked[$key] = 'checked="checked""';
}
$srchfilterchecked[$srchfilter] = 'checked="checked""';
$beforechecked = array($before => 'checked="checked""');
$srchfromselected = array($srchfrom => 'selected="selected"');
$advextra = '&orderby='.$orderby.'&ascdesc='.$ascdesc.'&searchid='.$searchid.'&searchsubmit=yes';
if($_GET['adv']) {
include template('search/forum_adv');
} else {
include template('search/forum');
}
} else {
if($_G['group']['allowsearch'] & 32 && $srchtype == 'fulltext') {
periodscheck('searchbanperiods');
} elseif($srchtype != 'title') {
$srchtype = 'title';
}
$forumsarray = array();
if(!empty($srchfid)) {
foreach((is_array($srchfid) ? $srchfid : explode('_', $srchfid)) as $forum) {
if($forum = intval(trim($forum))) {
$forumsarray[] = $forum;
}
}
}
$fids = $comma = '';
foreach($_G['cache']['forums'] as $fid => $forum) {
if($forum['type'] != 'group' && (!$forum['viewperm'] && $_G['group']['readaccess']) || ($forum['viewperm'] && forumperm($forum['viewperm']))) {
if(!$forumsarray || in_array($fid, $forumsarray)) {
$fids .= "$comma'$fid'";
$comma = ',';
}
}
}
if($_G['setting']['threadplugins'] && $specialplugin) {
$specialpluginstr = implode("','", $specialplugin);
$special[] = 127;
} else {
$specialpluginstr = '';
}
$special = getgpc('special');
$specials = $special ? implode(',', $special) : '';
$srchfilter = in_array(getgpc('srchfilter'), array('all', 'digest', 'top')) ? $_GET['srchfilter'] : 'all';
$searchstring = 'forum|'.$srchtype.'|'.base64_encode($srchtxt).'|'.intval($srchuid).'|'.$srchuname.'|'.addslashes($fids).'|'.intval($srchfrom).'|'.intval($before).'|'.$srchfilter.'|'.$specials.'|'.$specialpluginstr.'|'.$seltableid;
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['forum']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=forum', array('searchctrl' => $_G['setting']['search']['forum']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
if(!$srchtxt && !$srchuid && !$srchuname && !$srchfrom && !in_array($srchfilter, array('digest', 'top')) && !is_array($special)) {
dheader('Location: search.php?mod=forum');
} elseif(isset($srchfid) && !empty($srchfid) && $srchfid != 'all' && !(is_array($srchfid) && in_array('all', $srchfid)) && empty($forumsarray)) {
showmessage('search_forum_invalid', 'search.php?mod=forum');
} elseif(!$fids) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if($_G['adminid'] != '1' && $_G['setting']['search']['forum']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['forum']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=forum', array('maxspm' => $_G['setting']['search']['forum']['maxspm']));
}
}
if($srchtype == 'fulltext' && $_G['setting']['sphinxon']) {
require_once libfile('class/sphinx');
$s = new SphinxClient();
$s->setServer($_G['setting']['sphinxhost'], intval($_G['setting']['sphinxport']));
$s->setMaxQueryTime(intval($_G['setting']['sphinxmaxquerytime']));
$s->SetRankingMode($_G['setting']['sphinxrank']);
$s->setLimits(0, intval($_G['setting']['sphinxlimit']), intval($_G['setting']['sphinxlimit']));
$s->setGroupBy('tid', SPH_GROUPBY_ATTR);
if($srchfilter == 'digest') {
$s->setFilterRange('digest', 1, 3, false);
}
if($srchfilter == 'top') {
$s->setFilterRange('displayorder', 1, 2, false);
} else {
$s->setFilterRange('displayorder', 0, 2, false);
}
if(!empty($srchfrom) && empty($srchtxt) && empty($srchuid) && empty($srchuname)) {
$expiration = TIMESTAMP + $cachelife_time;
$keywords = '';
if($before) {
$spx_timemix = 0;
$spx_timemax = TIMESTAMP - $srchfrom;
} else {
$spx_timemix = TIMESTAMP - $srchfrom;
$spx_timemax = TIMESTAMP;
}
} else {
$uids = array();
if($srchuname) {
$uids = array_keys(C::t('common_member')->fetch_all_by_like_username($srchuname, 0, 50));
if(count($uids) == 0) {
$uids = array(0);
}
} elseif($srchuid) {
$uids = array($srchuid);
}
if(is_array($uids) && count($uids) > 0) {
$s->setFilter('authorid', $uids, false);
}
if($srchtxt) {
if(preg_match("/\".*\"/", $srchtxt)) {
$spx_matchmode = "PHRASE";
$s->setMatchMode(SPH_MATCH_PHRASE);
} elseif(preg_match("(AND|\+|&|\s)", $srchtxt) && !preg_match("(OR|\|)", $srchtxt)) {
$srchtxt = preg_replace("/( AND |&| )/is", "+", $srchtxt);
$spx_matchmode = "ALL";
$s->setMatchMode(SPH_MATCH_ALL);
} else {
$srchtxt = preg_replace("/( OR |\|)/is", "+", $srchtxt);
$spx_matchmode = 'ANY';
$s->setMatchMode(SPH_MATCH_ANY);
}
$srchtxt = str_replace('*', '%', addcslashes($srchtxt, '%_'));
foreach(explode('+', $srchtxt) as $text) {
$text = trim(daddslashes($text));
if($text) {
$sqltxtsrch .= $andor;
$sqltxtsrch .= $srchtype == 'fulltext' ? "(p.message LIKE '%".str_replace('_', '\_', $text)."%' OR p.subject LIKE '%$text%')" : "t.subject LIKE '%$text%'";
}
}
$sqlsrch .= " AND ($sqltxtsrch)";
}
if(!empty($srchfrom)) {
if($before) {
$spx_timemix = 0;
$spx_timemax = TIMESTAMP - $srchfrom;
} else {
$spx_timemix = TIMESTAMP - $srchfrom;
$spx_timemax = TIMESTAMP;
}
$s->setFilterRange('lastpost', $spx_timemix, $spx_timemax, false);
}
if(!empty($specials)) {
$s->setFilter('special', explode(",", $special), false);
}
$keywords = str_replace('%', '+', $srchtxt).(trim($srchuname) ? '+'.str_replace('%', '+', $srchuname) : '');
$expiration = TIMESTAMP + $cachelife_text;
}
if($srchtype == "fulltext") {
$result = $s->query("'".$srchtxt."'", $_G['setting']['sphinxmsgindex']);
} else {
$result = $s->query($srchtxt, $_G['setting']['sphinxsubindex']);
}
$tids = array();
if($result) {
if(is_array($result['matches'])) {
foreach($result['matches'] as $value) {
if($value['attrs']['tid']) {
$tids[$value['attrs']['tid']] = $value['attrs']['tid'];
}
}
}
}
if(count($tids) == 0) {
$ids = 0;
$num = 0;
} else {
$ids = implode(",", $tids);
$num = $result['total_found'];
}
} else {
$digestltd = $srchfilter == 'digest' ? "t.digest>'0' AND" : '';
$topltd = $srchfilter == 'top' ? "AND t.displayorder>'0'" : "AND t.displayorder>='0'";
if(!empty($srchfrom) && empty($srchtxt) && empty($srchuid) && empty($srchuname)) {
$searchfrom = $before ? '<=' : '>=';
$searchfrom .= TIMESTAMP - $srchfrom;
$sqlsrch = "FROM ".DB::table('forum_thread')." t WHERE $digestltd t.fid IN ($fids) $topltd AND t.lastpost$searchfrom";
$expiration = TIMESTAMP + $cachelife_time;
$keywords = '';
} else {
$sqlsrch = $srchtype == 'fulltext' ?
"FROM ".DB::table(getposttable($seltableid))." p, ".DB::table('forum_thread')." t WHERE $digestltd t.fid IN ($fids) $topltd AND p.tid=t.tid AND p.invisible='0'" :
"FROM ".DB::table('forum_thread')." t WHERE $digestltd t.fid IN ($fids) $topltd";
if($srchuname) {
$srchuid = array_keys(C::t('common_member')->fetch_all_by_like_username($srchuname, 0, 50));
if(!$srchuid) {
$sqlsrch .= ' AND 0';
}
}/* elseif($srchuid) {
$srchuid = "'$srchuid'";
}*/
if($srchtxt) {
$srcharr = $srchtype == 'fulltext' ? searchkey($keyword, "(p.message LIKE '%{text}%' OR p.subject LIKE '%{text}%')", true) : searchkey($keyword,"t.subject LIKE '%{text}%'", true);
$srchtxt = $srcharr[0];
$sqlsrch .= $srcharr[1];
}
if($srchuid) {
$sqlsrch .= ' AND '.($srchtype == 'fulltext' ? 'p' : 't').'.authorid IN ('.dimplode((array)$srchuid).')';
}
if(!empty($srchfrom)) {
$searchfrom = ($before ? '<=' : '>=').(TIMESTAMP - $srchfrom);
$sqlsrch .= " AND t.lastpost$searchfrom";
}
if(!empty($specials)) {
$sqlsrch .= " AND special IN (".dimplode($special).")";
}
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
}
$num = $ids = 0;
$_G['setting']['search']['forum']['maxsearchresults'] = $_G['setting']['search']['forum']['maxsearchresults'] ? intval($_G['setting']['search']['forum']['maxsearchresults']) : 500;
$query = DB::query("SELECT ".($srchtype == 'fulltext' ? 'DISTINCT' : '')." t.tid, t.closed, t.author, t.authorid $sqlsrch ORDER BY tid DESC LIMIT ".$_G['setting']['search']['forum']['maxsearchresults']);
while($thread = DB::fetch($query)) {
$ids .= ','.$thread['tid'];
$num++;
}
DB::free_result($query);
}
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $num,
'ids' => $ids
), true);
!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=forum&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,204 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_group.php 30187 2012-05-16 03:24:35Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
require_once libfile('function/home');
require_once libfile('function/post');
if(!$_G['setting']['search']['group']['status']) {
showmessage('search_group_closed');
}
if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 16)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['group']['searchctrl'] = intval($_G['setting']['search']['group']['searchctrl']);
$srchmod = 5;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$srchtxt = $_GET['srchtxt'];
$srchfid = intval($_GET['srchfid']);
$viewgroup = intval($_GET['viewgroup']);
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
if(!submitcheck('searchsubmit', 1)) {
include template('search/group');
} else {
$orderby = in_array($_GET['orderby'], array('dateline', 'replies', 'views')) ? $_GET['orderby'] : 'lastpost';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
if(!empty($searchid)) {
require_once libfile('function/group');
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
$index['ids'] = dunserialize($index['ids']);
$searchstring = explode('|', $index['searchstring']);
$srchfid = $searchstring[2];
$threadlist = $grouplist = $posttables = array();
if($index['ids']['thread'] && ($searchstring[2] || empty($viewgroup))) {
require_once libfile('function/misc');
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $index['ids']['thread']), null, 0, $orderby, $start_limit, $_G['tpp'], '>=', $ascdesc);
foreach($threads as $value) {
$fids[$value['fid']] = $value['fid'];
}
$forums = C::t('forum_forum')->fetch_all_name_by_fid($fids);
foreach($threads as $thread) {
$thread['forumname'] = $forums[$thread['fid']]['name'];
$thread['subject'] = bat_highlight($thread['subject'], $keyword);
$thread['realtid'] = $thread['tid'];
$threadlist[$thread['tid']] = procthread($thread);
$posttables[$thread['posttableid']][] = $thread['tid'];
}
if($threadlist) {
foreach($posttables as $tableid => $tids) {
foreach(C::t('forum_post')->fetch_all_by_tid($tableid, $tids, true, '', 0, 0, 1) as $post) {
$threadlist[$post['tid']]['message'] = bat_highlight(threadmessagecutstr($threadlist[$post['tid']], $post['message'], 200), $keyword);
}
}
}
}
$groupnum = !empty($index['ids']['group']) ? count(explode(',', $index['ids']['group'])) - 1 : 0;
if($index['ids']['group'] && ($viewgroup || empty($searchstring[2]))) {
if(empty($viewgroup)) {
$index['ids']['group'] = implode(',', array_slice(explode(',', $index['ids']['group']), 0, 9));
}
if($viewgroup) {
$query = C::t('forum_forum')->fetch_all_info_by_fids(explode(',', $index['ids']['group']), 3, $_G['tpp'], 0, 0, 0, 0, 'sub', $start_limit);
} else {
$query = C::t('forum_forum')->fetch_all_info_by_fids(explode(',', $index['ids']['group']), 3, 0, 0, 0, 0, 0, 'sub');
}
foreach($query as $group) {
$group['icon'] = get_groupimg($group['icon'], 'icon');
$group['name'] = bat_highlight($group['name'], $keyword);
$group['description'] = bat_highlight($group['description'], $keyword);
$group['dateline'] = dgmdate($group['dateline'], 'u');
$grouplist[] = $group;
}
}
if(empty($viewgroup)) {
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=group&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes".($viewgroup ? '&viewgroup=1' : ''));
} else {
$multipage = multi($groupnum, $_G['tpp'], $page, "search.php?mod=group&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes".($viewgroup ? '&viewgroup=1' : ''));
}
$url_forward = 'search.php?mod=group&'.$_SERVER['QUERY_STRING'];
include template('search/group');
} else {
$srchuname = isset($_GET['srchuname']) ? trim($_GET['srchuname']) : '';
$searchstring = 'group|title|'.$srchfid.'|'.addslashes($srchtxt);
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['group']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=group', array('searchctrl' => $_G['setting']['search']['group']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
if(!$srchtxt && !$srchuid && !$srchuname) {
dheader('Location: search.php?mod=group');
}
if($_G['adminid'] != '1' && $_G['setting']['search']['group']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['group']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=group', array('maxspm' => $_G['setting']['search']['group']['maxspm']));
}
}
$num = $ids = $tnum = $tids = 0;
$_G['setting']['search']['group']['maxsearchresults'] = $_G['setting']['search']['group']['maxsearchresults'] ? intval($_G['setting']['search']['group']['maxsearchresults']) : 500;
list($srchtxt, $srchtxtsql) = searchkey($keyword, "subject LIKE '%{text}%'", true);
$threads = C::t('forum_thread')->fetch_all_by_tid_fid(0, $srchfid, 1, '', $keyword, $_G['setting']['search']['group']['maxsearchresults']);
foreach($threads as $value) {
$fids[$value['fid']] = $value['fid'];
}
$forums = C::t('forum_forum')->fetch_all_by_fid($fids);
foreach($threads as $thread) {
if($forums[$thread['fid']]['status'] == 3) {
$tids .= ','.$thread['tid'];
$tnum++;
}
}
if(!$srchfid) {
$srchtxtsql = str_replace('subject LIKE', 'name LIKE', $srchtxtsql);
$query = C::t('forum_forum')->fetch_all_fid_for_group(0, $_G['setting']['search']['group']['maxsearchresults'], 1, $srchtxtsql);
foreach($query as $group) {
$ids .= ','.$group['fid'];
$num++;
}
}
$allids = array('thread' => $tids, 'group' => $ids);
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $tnum,
'ids' => serialize($allids)
), true);
!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=group&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,145 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_portal.php 33522 2013-06-28 02:58:15Z laoguozhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
require_once libfile('function/home');
require_once libfile('function/portal');
if(!$_G['setting']['search']['portal']['status']) {
showmessage('search_portal_closed');
}
if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 1)) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$_G['setting']['search']['portal']['searchctrl'] = intval($_G['setting']['search']['portal']['searchctrl']);
$srchmod = 1;
$cachelife_time = 300; // Life span for cache of searching in specified range of time
$cachelife_text = 3600; // Life span for cache of text searching
$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;
$srchtxt = $_GET['srchtxt'];
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';
if(!submitcheck('searchsubmit', 1)) {
include template('search/portal');
} else {
$orderby = in_array($_GET['orderby'], array('aid')) ? $_GET['orderby'] : 'aid';
$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';
if(!empty($searchid)) {
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
if(!$index) {
showmessage('search_id_invalid');
}
$keyword = dhtmlspecialchars($index['keywords']);
$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
$index['keywords'] = rawurlencode($index['keywords']);
$articlelist = array();
$query = C::t('portal_article_title')->fetch_all_for_search(explode(',', $index['ids']), $orderby, $ascdesc, $start_limit, $_G['tpp']);
foreach($query as $article) {
$article['dateline'] = dgmdate($article['dateline']);
$article['pic'] = $article['pic'] ? pic_get($article['pic'], '', $article['thumb'], $article['remote'], 1, 1) : '';
$article['title'] = bat_highlight($article['title'], $keyword);
$article['summary'] = bat_highlight($article['summary'], $keyword);
$articlelist[] = $article;
}
$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=portal&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes");
$url_forward = 'search.php?mod=portal&'.$_SERVER['QUERY_STRING'];
include template('search/portal');
} else {
!($_G['group']['exempt'] & 2) && checklowerlimit('search');
$searchstring = 'portal|title|'.addslashes($srchtxt);
$searchindex = array('id' => 0, 'dateline' => '0');
foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['portal']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
break;
} elseif($_G['adminid'] != '1' && $index['flood']) {
showmessage('search_ctrl', 'search.php?mod=portal', array('searchctrl' => $_G['setting']['search']['portal']['searchctrl']));
}
}
if($searchindex['id']) {
$searchid = $searchindex['id'];
} else {
if(!$srchtxt) {
dheader('Location: search.php?mod=portal');
}
if($_G['adminid'] != '1' && $_G['setting']['search']['portal']['maxspm']) {
if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['portal']['maxspm']) {
showmessage('search_toomany', 'search.php?mod=portal', array('maxspm' => $_G['setting']['search']['portal']['maxspm']));
}
}
$num = $ids = 0;
$_G['setting']['search']['portal']['maxsearchresults'] = $_G['setting']['search']['portal']['maxsearchresults'] ? intval($_G['setting']['search']['portal']['maxsearchresults']) : 500;
list($srchtxt, $srchtxtsql) = searchkey($keyword, "title LIKE '%{text}%'", true);
$query = C::t('portal_article_title')->fetch_all_by_sql(' 1 '.$srchtxtsql, 'ORDER BY aid DESC ', 0, $_G['setting']['search']['portal']['maxsearchresults']);
foreach($query as $article) {
$ids .= ','.$article['aid'];
$num++;
}
$keywords = str_replace('%', '+', $srchtxt);
$expiration = TIMESTAMP + $cachelife_text;
$searchid = C::t('common_searchindex')->insert(array(
'srchmod' => $srchmod,
'keywords' => $keywords,
'searchstring' => $searchstring,
'useip' => $_G['clientip'],
'uid' => $_G['uid'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration,
'num' => $num,
'ids' => $ids
), true);
!($_G['portal']['exempt'] & 2) && updatecreditbyaction('search');
}
dheader("location: search.php?mod=portal&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));
}
}
?>

View File

@@ -0,0 +1,33 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: search_user.php 36349 2017-01-16 03:05:23Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
$url = '';
if($_G['setting']['domain']['app']['home'] || $_G['setting']['domain']['app']['default']) {
$domain = '';
if($_G['setting']['domain']['app']['home']) {
$domain = $_G['setting']['domain']['app']['home'];
} else {
$domain = $_G['setting']['domain']['app']['default'];
}
$url = $_G['scheme'].'://'.$domain.$_G['siteport'].'/';
}
$url .= 'home.php?mod=spacecp&ac=search';
if($_GET['srchtxt']) {
$url .= '&username='.$_GET['srchtxt'].'&searchsubmit=yes';
}
dheader('Location: '.$url);
?>