// ====================================\
@include_once('_dir.php');
// ====================================/
include_once("$ROOT_PATH/common/all_head.php");
?>
//------------------------------------------\
$search_text=trim($search_text);
$search_text_html=to_html($search_text);
//------------------------------------------/
?>
/*
if (($tmp=to_url($search_text))!='')
echo "
- You may also try to seach for
'
$search_text_html' in
Forum.
";
*/
?>
if ($search_text!='') {
//=====================================================================================\
// $sql=trim(preg_replace('/[<>%\s]+/',' ',$search_text));
$text=trim(preg_replace('/[<>%\s]+/',' ',$search_text));
?>
// if ($sql!='') {
if ($text!='') {
// ============================================================================\
//-------------------- Regular Pages ---------------------\
/*
$sql=str_replace(' ','% ',to_sql_search($sql));
$res=db_query("select pageID,type,static_page,title,
if(url_name!='',url_name,pageID) as url_name
from site_pages
where (title like '$sql%' or title like '% $sql%'
or content1 like '$sql%' or content1 like '% $sql%'
or content1 like '%>$sql%'or content1 like '%\n$sql%'
or content2 like '$sql%' or content2 like '% $sql%'
or content2 like '%>$sql%' or content2 like '%\n$sql%')
and (type<2 or active)
order by type,priority");
*/
$cond=($tmp=make_search_condition($text,array('title','content1','content2'))) ?
" and $tmp" : ' and 0';
$res=db_query("select pageID,type,static_page,title,
if(url_name!='',url_name,pageID) as url_name
from site_pages
where (type<2 or active) $cond
order by type,priority");
$t=-1;
while ($row=@$sql_fetch_assoc($res)) {
@extract($row);
$uri=make_url($static_page,$url_name,$type);
$title=to_html($title);
if ($t<0 && $type<2) echo "
Found regular pages:
";
elseif ($t<2 && $type==2) echo "
Found articles:
";
echo "$title
";
$t=$type;
}
//-------------------- News ---------------------\
/*
$res=db_query("select nwsID,archive,title from news
where (title like '$sql%' or title like '% $sql%'
or content like '$sql%' or content like '% $sql%'
or content like '%>$sql%' or content like '%\n$sql%')
order by archive,time DESC");
*/
$cond=($tmp=make_search_condition($text,array('title','content'))) ?
$tmp : 0;
$res=db_query("select nwsID,archive,title
from news where $cond
order by archive,time DESC");
$t=0;
while ($row=@$sql_fetch_assoc($res)) {
@extract($row);
$uri="news".($archive ? '_1' : '').".html#$nwsID";
$title=to_html($title);
if (!$t) echo "
Found news:
";
echo "$title
";
$t=1;
}
//-------------------- Product Categories ---------------------\
if ($CAN_ADMIN_CATS) {
$cond=($tmp=make_search_condition($text,array('title','comment','description'))) ?
$tmp : 0;
$query="select c.catID as catID,title,comment,description
from sc_category as c
inner join sc_category_stat as cs on c.catID=cs.catID and cs.n_prod>0
where c.catID in ($CategItemsActKeys) and $cond
order by parID,priority,c.catID";
}
else {
$cond=($tmp=make_search_condition($text,
array(
"IF(cn.title!='',cn.title,c.title)",
"IF(cn.comment!='',cn.comment,c.comment)",
"IF(cn.description!='',cn.description,c.description)"
))) ?
$tmp : 0;
$query="select c.catID as catID,
IF(cn.title!='',cn.title,c.title) as title,
IF(cn.comment!='',cn.comment,c.comment) as comment,
IF(cn.description!='',cn.description,c.description) as description
from (sc_category as c
inner join sc_category_stat as cs on c.catID=cs.catID and cs.n_prod>0)
left join sc_category_newval as cn on c.catID=cn.catID
where c.catID in ($CategItemsActKeys) and $cond
order by parID,c.priority,c.catID";
}
$res=db_query($query);
$t=0;
while ($row=@$sql_fetch_assoc($res)) {
if (!$t) echo "
Found categories:
";
echo getCategPathStr($row['catID'],1),"
";
$t=1;
}
//-------------------- Products ---------------------\
echo '
';
//-------------------------------------\
$ModuleData=array(
'page' => (int)$args[0],
'pages_url' => 'search_.html',
'head_title' => 'Found Products',
'search_text' => $text,
'show_desc' => 1
);
include('modules/products_search.php');
//-------------------------------------/
// ============================================================================/
}
//=====================================================================================/
}
?>
include_once("$ROOT_PATH/common/all_tail.php");
?>