Example #1
0
if ($cfg_notallowstr != '' && preg_match("#" . $cfg_notallowstr . "#i", $keyword)) {
    ShowMsg("你的搜索关键字中存在非法内容,被系统禁止!", "-1");
    exit;
}
if (($keyword == '' || strlen($keyword) < 2) && empty($typeid)) {
    ShowMsg('关键字不能小于2个字节!', '-1');
    exit;
}
//检查搜索间隔时间
$lockfile = DEDEDATA . '/time.lock.inc';
$lasttime = file_get_contents($lockfile);
if (!empty($lasttime) && $lasttime + $cfg_search_time > time()) {
    ShowMsg('管理员设定搜索时间间隔为' . $cfg_search_time . '秒,请稍后再试!', '-1');
    exit;
}
//开始时间
if (empty($starttime)) {
    $starttime = -1;
} else {
    $starttime = is_numeric($starttime) ? $starttime : -1;
    if ($starttime > 0) {
        $dayst = GetMkTime("2008-1-2 0:0:0") - GetMkTime("2008-1-1 0:0:0");
        $starttime = time() - $starttime * $dayst;
    }
}
$t1 = ExecTime();
$sp = new SearchView($typeid, $keyword, $orderby, $channeltype, $searchtype, $starttime, $pagesize, $kwtype, $mid);
$keyword = $oldkeyword;
$sp->Display();
PutFile($lockfile, time());
//echo ExecTime() - $t1;
  function GetArcList($limitstart=0,$perpage=10,$col=1,$titlelen=30,$infolen=250,
  $imgwidth=120,$imgheight=90,$achanneltype="all",$orderby=" aid desc ",$innertext="",$tablewidth="100")
  {

	    $typeid=$this->TypeID;
    	if($perpage=="") $perpage = 10;
		if($limitstart=="") $limitstart = 0;
		if($titlelen=="") $titlelen = 30;
		if($infolen=="") $infolen = 250;
	    if($achanneltype=="") $achanneltype = "0";
		$innertext = trim($innertext);
		if($innertext=="") $innertext = GetSysTemplets("search_list.htm");
		$ordersql = "order by ".$this->OrderBy;

		$query = "select * from #@__full_search left join #@__arctype on #@__arctype.ID=#@__full_search.typeid
				where aid in ($this->result) $ordersql limit $limitstart,$perpage ";

		$this->dsql->SetQuery($query);
		$this->dsql->Execute("al");
	    $artlist = "";
	    $this->dtp2->LoadSource($innertext);
		$tt = 0;
	    for($i=0;$i<$perpage;$i++)
		{
         if($row = $this->dsql->GetArray("al"))
         {
           //处理一些特殊字段
           $row["arcurl"] = $row["url"];
           $row["description"] = $this->GetRedKeyWord(cn_substr($row["addinfos"],$infolen));
           $row["title"] = $this->GetRedKeyWord(cn_substr($row["title"],$titlelen));
           $row["id"] =  $row["aid"];
           if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.gif";
           $row["picname"] = $row["litpic"];
           $row["typeurl"] = $this->GetListUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["siteurl"]);
           $row["info"] = $row["description"];
           $row["filename"] = $row["arcurl"];
           $row["stime"] = GetDateMK($row["uptime"]);
           $row["textlink"] = "<a href='".$row["filename"]."'>".$row["title"]."</a>";
           $row["typelink"] = "[<a href='".$row["typeurl"]."'>".$row["typename"]."</a>]";
           $row["imglink"] = "<a href='".$row["filename"]."'><img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'></a>";
           $row["image"] = "<img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'>";
           $row["phpurl"] = $GLOBALS["cfg_plus_dir"];
 		   $row["templeturl"] = $GLOBALS["cfg_templets_dir"];
 		   $row["memberurl"] = $GLOBALS["cfg_member_dir"];
           //---------------------------
           if(is_array($this->dtp2->CTags)){
       	     foreach($this->dtp2->CTags as $k=>$ctag){
       		 	   if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
       		 	   else $this->dtp2->Assign($k,"");
       	    }
           }
           $artlist .= $this->dtp2->GetResult();
           $tt = 1;
         }//if hasRow
         else{
         	if($tt == 0 && $this->KType == 1){
						$sp1 = new SearchView($this->TypeID,$this->Keyword,$this->ChannelType,$this->SearchType,0,$this->cacheid);
						$sp1->Display();
						$sp1->Close();
						exit;
	        }else{
	        	$artlist .= '';
	        }
         }
     }//Loop Line
     $this->dsql->FreeResult("al");
     return $artlist;
  }