MINI_SHL
Current Path : D:/wwwroot/wangmei148/wwwroot/module/
Upload File :
Current File : D:/wwwroot/wangmei148/wwwroot/module/MySearch.php

<?php

/*
	[²å¼þÃû³Æ] È«Õ¾ËÑË÷ - Ì滻ģ°æµÄ{#modMySearch#}
	[ÊÊÓ÷¶Î§] ÎÄÕ·ÖÀà¼ìË÷Ò³
	[ÎÄ ¼þ Ãû] MySearch.php
	[¸üÐÂʱ¼ä] 2006/8/13
*/


function MySearch(){

	global $fsql,$charset,$PagesInfo,$ShowPages,$htmlstr,$CatchOpen;
	global $tbl_news_con,$tbl_cp_con,$tbl_down_con,$tbl_comment,$MenuInfo;


	$key=$_GET["key"];
	$page=$_GET["page"];
	$type=$_GET["type"];


	if($type==""){
		return "";
	}

	switch($type){
		case "news":
		$tbl=$tbl_news_con;
		$scl=" iffb='1' ";
		break;
		case "cp":
		$tbl=$tbl_cp_con;
		$scl=" iffb='1' ";
		break;
		case "down":
		$tbl=$tbl_down_con;
		$scl=" iffb='1' ";
		break;
		case "bbs":
		$tbl=$tbl_comment;
		$scl=" fabu='1' ";
		break;
		case "mybbs":
		$tbl=$tbl_mybbs;
		$scl=" fabu='1' ";
		break;

	}


	if($key!=""){
		$scl.=" and (title regexp '$key' or body regexp '$key') ";
	}


	

	//Ä£°æ½âÊÍ
	$Temp=LoadTemp(ROOTPATH."templates/".$MenuInfo["skin"]."/tpl_search.htm";
	$TempArr=SplitTblTemp($Temp);

	$str=$TempArr["start"];

	
	include(ROOTPATH."includes/func/pages.inc.php");
	$pages=new pages;

	$totalnums=TblCount($tbl,"id",$scl);
	
	$pages->setvar(array("type" => $type,"key" => $key));

	$pages->set($shownums,$totalnums);		                          
		
	$pagelimit=$pages->limit();	  

	$fsql->query("select * from $tbl where $scl order by $ord $sc limit $pagelimit");

	while($fsql->next_record()){
		
		$id=$fsql->f('id');
		$title=$fsql->f('title');
		$body=$fsql->f('body');
		$dtime=$fsql->f('dtime');
		$uptime=$fsql->f('uptime');
		$pid=$fsql->f('pid');
		$menuid=$fsql->f('menuid');

		if($type=="bbs"){
			$dtime=date($showtime,$uptime);
			if($pid=="0"){
				$link=ROOTPATH."comment_detail.php?commentid=$id";
			}else{
				$link=ROOTPATH."comment_detail.php?commentid=$pid";
			}
			
		}else{
			$dtime=date($showtime,$dtime);
			
			$fold=MenuFold($menuid);

			if($CatchOpen=="1"){
				$link=ROOTPATH.$fold."/html/".$id.".html";
			}else{
				$link=ROOTPATH.$fold."/html/?".$id.".html";
			}

		}
		



		if($cutword!="0"){$body=csubstr(ltrim(strip_tags($body)),0,$cutword,$charset);}

		$title=str_replace($key,"<font color=red>".$key."</font>",$title);
		$body=str_replace($key,"<font color=red>".$key."</font>",$body);

		$var=array (
		'title' => $title, 
		'link' => $link, 
		'target' => $target, 
		'dtime' => $dtime, 
		'body' => $body 
		);

		$str.=$TempArr["rowstart"];
		$str.=ShowTplTemp($TempArr["list"],$var);
		$str.=$TempArr["rowend"];
		

		

	}

	$str.=$TempArr["end"];

	$PagesInfo=$pages->ShowNow();
	$ShowPages=$pages->output(1);


		return $str;


}
?>