Code:function SearchNews(){
global $db, $prefix, $conf, $module_name;
$searchnews=stripslashes(check_html($_POST['searchnews'], 'nohtml'));
$searchcateg=stripslashes(check_html($_POST['select_categ'], 'nohtml'));
if ((!isset($searchnews)) OR ($searchnews == ' ') OR ($searchnews == '')){
OpenTable();
echo '<b>' , _MH_QUERYINVALID , '</b><br /><br /><a href="javascript:history.go(-1)">' , _MH_GOBACK , '</a>' , _MH_CHANGEIT;
CloseTable();
} else {
if ($conf['fullview'] == 'full'){
$searchwhere=$_POST['search_where'];
}
$s1 = ' ' . $searchnews;
$s2 = $searchnews . ' ';
$s3 = ' ' . $searchnews . ' ';
if ($searchcateg == 0) {
if ($conf['fullview'] == 'full'){
switch ($searchwhere) {
case 1:
$string = ' WHERE `news_title` LIKE \'%' . $searchnews . '%\'';
$text=_MH_INTIT;
break;
case 2:
$string = ' WHERE `news_description` LIKE \'%' . $s1 . '%\ OR `news_description` LIKE \'%' . $s2 . '%\ OR `news_description` LIKE \'%' . $s3 . '%\'';
$text=_MH_INDESCR;
break;
case 3:
$string = ' WHERE (`news_title` LIKE \'%' . $searchnews . '%\') OR (`news_description` LIKE \'%' . $s1 . '%\ OR `news_description` LIKE \'%' . $s2 . '%\ OR `news_description` LIKE \'%' . $s3 . '%\')';
$text=_MH_INTITDESC;
break;
}
} else {
$string = ' WHERE `news_title` LIKE \'%' . $searchnews . '%\'';
}
} else {
$row1 = $db->sql_fetchrow($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_categ` WHERE `categ_title` = \'' . $searchcateg . '\''));
$catid=$row1['categ_id'];
if ($conf['fullview'] == 'full'){
switch ($searchwhere) {
case 1:
$string = ' WHERE `news_cat` = \'' . $catid . '\' AND `news_title` LIKE \'%' . $searchnews . '%\'';
$text=_MH_INTIT;
break;
case 2:
$string = ' WHERE `news_cat` = \'' . $catid . '\' AND (`news_description` LIKE \'%' . $s1 . '%\ OR `news_description` LIKE \'%' . $s2 . '%\ OR `news_description` LIKE \'%' . $s3 . '%\')';
$text=_MH_INDESCR;
break;
case 3:
$string = ' WHERE `news_cat` = \'' . $catid . '\' AND (`news_title` LIKE \'%' . $searchnews . '%\' OR `news_description` LIKE \'%' . $s1 . '%\ OR `news_description` LIKE \'%' . $s2 . '%\ OR `news_description` LIKE \'%' . $s3 . '%\')';
$text=_MH_INTITDESC;
break;
}
} else {
$string = ' WHERE `news_cat` = \'' . $catid . '\' AND `news_title` LIKE \'%' . $searchnews . '%\'';
}
}
$sql = 'SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $string . ' AND `news_status` = 1 ORDER BY `news_pubdate` DESC';
$result = $db->sql_query($sql);
$nr_news = $db->sql_numrows($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $string . ' AND `news_status` = 1'));
OpenTable();
if (isset($text)){
echo _MH_THEREARE , '<b>' , $nr_news , '</b>' , _MH_SERCHRES , '<b>"' , $searchnews , '</b>"' , $text;
}
|