'; if($_POST['title_op']=='1') $title_op ='AND'; else $title_op = 'OR'; if($_POST['text_op']=='1') $text_op ='AND'; else $text_op = 'OR'; if($_POST['order']=='1') $order='DESC'; else $order='ASC'; switch($_POST['table']) { case '1': $table='news'; break; case '2': $table='articles'; break; default: $table='forum'; break; } $after=mktime(0,0,0,$am,$ad,$ay); $before=mktime(0,0,0,$bm,$bd,$by); if($after<1) $after=0; if($before<1) $before=time(); if($table=="forum") { $ergebnis=safe_query("SELECT * FROM ".PREFIX."forum_posts WHERE ( message LIKE '%$title1%' $text_op message LIKE '%$title2%' ) AND ( message LIKE '%$text1%' $text_op message LIKE '%$text2%' ) AND ( date between $after AND $before ) ORDER BY date $order "); } elseif($table=="news") { $ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE ( headline1 LIKE '%$title1%' OR headline2 LIKE '%$title1%' ) $title_op ( headline1 LIKE '%$title2%' OR headline2 LIKE '%$title2%' ) AND ( content1 LIKE '%$text1%' OR content2 LIKE '%$text1%' ) $text_op ( content1 LIKE '%$text2%' OR content2 LIKE '%$text2%' ) AND ( date between $after AND $before ) ORDER BY date $order"); } else { $ergebnis=safe_query("SELECT * FROM ".PREFIX."$table WHERE ( title LIKE '%$title1%' $title_op title LIKE '%$title2%' ) AND ( content LIKE '%$text1%' $text_op content LIKE '%$text2%' ) AND ( date between $after AND $before ) ORDER BY date $order"); } $anz=mysql_num_rows($ergebnis); echo"
$anz results found


"; if($anz) { $i=1; while($ds=mysql_fetch_array($ergebnis)) { if($i%2) { $bg1=BG_1; $bg2=BG_2; } else { $bg1=BG_3; $bg2=BG_4; } $date=date("d.m.Y", $ds[date]); $poster=''.getnickname($ds[poster]).''; if($table=="news") { $title=$ds[headline1]; $auszug=substr(strip_tags(cleartext($ds[content1])), 0, 180)."..."; $link='• link to news'; } elseif($table=="forum") { $title=gettopicname($ds[topicID]); $auszug=substr(strip_tags(cleartext($ds[message])), 0, 180)."..."; $link='• link to topic'; } elseif($table=="articles") { $title=$ds[title]; $auszug=substr(strip_tags(cleartext($ds[content])), 0, 180)."..."; $link='• link to article'; } eval ("\$search_result = \"".gettemplate("search_result")."\";"); echo $search_result; $i++; } } } elseif($_GET['action']=="quicksearch" && !empty($_POST['search'])) { $search = $_POST['search']; $results = Array(); echo'

'; $tables=array('articles', 'forum_posts', 'news'); foreach($tables as $table) { if($table=="forum_posts") $ergebnis=safe_query("SELECT * FROM ".PREFIX."forum_posts WHERE message LIKE '%$search%' ORDER BY date DESC"); elseif($table=="news") $ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE ( headline1 LIKE '%$search%' OR headline2 LIKE '%$search%' ) OR ( content1 LIKE '%$search%' OR content2 LIKE '%$search%' ) ORDER BY date DESC"); else $ergebnis=safe_query("SELECT * FROM ".PREFIX."$table WHERE title LIKE '%$search%' OR content LIKE '%$search%' ORDER BY date DESC"); while($ds=mysql_fetch_array($ergebnis)) { if($table=="articles") $tableid="articlesID"; if($table=="forum_posts") $results[]=$ds[date].':***:forum:***:'.$ds[topicID].':***:'.$ds[message].':***:'.$ds[poster].':***:'.$ds[topicID].':***:'.$ds[boardID]; elseif($table=="news") $results[]=$ds[date].':***:news:***:'.$ds[headline1].':***:'.$ds[content1].':***:'.$ds[poster].':***:'.$ds[newsID].':***:0'; else $results[] = $ds[date].':***:'.$table.':***:'.$ds[title].':***:'.$ds[content].':***:'.$ds[poster].':***:'.$ds[$tableid].':***:0'; } } $anz=count($results); echo"
$anz results found


"; if($anz) { natcasesort($results); $i=1; foreach($results as $result) { if($i%2) { $bg1=BG_1; $bg2=BG_2; } else { $bg1=BG_3; $bg2=BG_4; } $rs=explode(":***:", $result); $date=date("d.m.Y", $rs[0]); $poster=''.getnickname($rs[4]).''; if($rs[1]=="news") { $title=$rs[2]; $auszug=substr(strip_tags(cleartext($rs[3])), 0, 180)."..."; $link='• link to news'; } elseif($rs[1]=="forum") { $title=gettopicname($rs[2]); $auszug=substr(strip_tags(cleartext($rs[3])), 0, 180)."..."; $link='• link to topic'; } elseif($rs[1]=="articles") { $title=$rs[2]; $auszug=substr(strip_tags(cleartext($rs[3])), 0, 180)."..."; $link='• link to article'; } eval ("\$search_result = \"".gettemplate("search_result")."\";"); echo $search_result; $i++; } } } else { $bg1=BG_1; eval ("\$search_form = \"".gettemplate("search_form")."\";"); echo $search_form; } ?>