<?php


@$vercode=''; //此处取值请自行修改

if(isset($_POST['vercode'])){
if ($_POST['vercode']!=$vercode){
 echo("[err]invalid vercode[/err]");
 exit();
}
}

define('APPTYPEID', 0);
define('CURSCRIPT', 'search');

require './source/class/class_core.php';

$discuz = C::app();

$modarray = array('my', 'user', 'curforum', 'newthread');

$cachelist = $slist = array();
//$mod = '';
$mod = 'curforum'; //zzcity add
$discuz->cachelist = $cachelist;
$discuz->init();

if(in_array($discuz->var['mod'], $modarray) || !empty($_G['setting']['search'][$discuz->var['mod']]['status'])) {
	$mod = $discuz->var['mod'];
} else {
	foreach($_G['setting']['search'] as $mod => $value) {
		if(!empty($value['status'])) {
			break;
		}
	}
}

//runhooks();

require_once libfile('function/search');


$navtitle = lang('core', 'title_search');

if($mod == 'curforum') {
	$mod = 'forum';
	$_GET['srchfid'] = array($_GET['srhfid']);
} elseif($mod == 'forum') {
	$_GET['srhfid'] = 0;
}

//require DISCUZ_ROOT.'./source/module/search/search_'.$mod.'.php';


/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: search_portal.php 8544 2010-04-21 05:25:03Z monkey $
 */

//if(!defined('IN_DISCUZ')) {
//	exit('Access Denied');
//}
define('NOROBOT', TRUE);

//if(!$_G['setting']['search']['forum']['status']) {
//	showmessage('search_forum_closed');
//}
//
//if(!$_G['adminid'] && !($_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');




$srchtxt = trim($_GET['subject']);
$srchtxt = isset($srchtxt) ? dhtmlspecialchars($srchtxt) : '';
$fid = $_GET['fid'];
$fid=$fid ?  $fid :0;
if (empty($srchtxt)){
 exit('[err]no subject[/err]');
}
$wherestr= $fid ? " and fid=$fid " : "";

//$srchtxtsql = addcslashes($srchtxt, '%_');
$srchtxtsql = $srchtxt;

$query =DB::fetch_first("SELECT tid FROM ".DB::table('forum_thread')." WHERE subject = '$srchtxtsql' $wherestr LIMIT 1");
if(!$query) {
 echo('[no]');
}else{
 echo('[yes]');
}


?>