1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Additional filtering

This commit is contained in:
e107steved 2012-01-22 14:33:31 +00:00
parent 8982d293c4
commit 18b799c852

View File

@ -515,29 +515,39 @@ if ($perform_search)
$_GET['q'] = rawurlencode($_GET['q']); $_GET['q'] = rawurlencode($_GET['q']);
foreach ($search_info as $key => $a) foreach ($search_info as $key => $a)
{ {
if (isset($searchtype[$key]) || isset($searchtype['all'])) { if (isset($searchtype[$key]) || isset($searchtype['all']))
{
unset($text); unset($text);
if (file_exists($search_info[$key]['sfile'])) { if (file_exists($search_info[$key]['sfile']))
{
$pre_title = ($search_info[$key]['pre_title'] == 2) ? $search_info[$key]['pre_title_alt'] : $search_info[$key]['pre_title']; $pre_title = ($search_info[$key]['pre_title'] == 2) ? $search_info[$key]['pre_title_alt'] : $search_info[$key]['pre_title'];
$search_chars = $search_info[$key]['chars']; $search_chars = $search_info[$key]['chars'];
$search_res = $search_info[$key]['results']; $search_res = $search_info[$key]['results'];
@require_once($search_info[$key]['sfile']); @require_once($search_info[$key]['sfile']);
$parms = $results.",".$search_res.",".$_GET['r'].",".e_SELF."?q=".$_GET['q']."&t=".$key."&r=[FROM]"; $parms = $results.",".$search_res.",".$_GET['r'].",".e_SELF."?q=".$_GET['q']."&t=".$key."&r=[FROM]";
$core_parms = array('r' => '', 'q' => '', 't' => '', 's' => ''); $core_parms = array('r' => '', 'q' => '', 't' => '', 's' => '');
foreach ($_GET as $pparm_key => $pparm_value) { foreach ($_GET as $pparm_key => $pparm_value)
if (!isset($core_parms[$pparm_key])) { {
$parms .= "&".$pparm_key."=".$_GET[$pparm_key]; $temp = preg_replace('/[^\w_]/i','',$pparm_key);
$temp1 = preg_replace('/[^\w_ +]/i','',$pparm_value); // Filter 'non-word' charcters in search term
if (($temp == $pparm_key) && !isset($core_parms[$pparm_key]))
{
$parms .= "&".$pparm_key."=".$temp1;
} }
} }
if ($results > $search_res) { if ($results > $search_res)
{
$nextprev = ($results > $search_res) ? $tp -> parseTemplate("{NEXTPREV={$parms}}") : ""; $nextprev = ($results > $search_res) ? $tp -> parseTemplate("{NEXTPREV={$parms}}") : "";
$text .= "<div class='nextprev' style='text-align: center'>".$nextprev."</div>"; $text .= "<div class='nextprev' style='text-align: center'>".$nextprev."</div>";
} }
if ($results > 0) { if ($results > 0)
{
$res_from = $_GET['r'] + 1; $res_from = $_GET['r'] + 1;
$res_to = ($_GET['r'] + $search_res) > $results ? $results : ($_GET['r'] + $search_res); $res_to = ($_GET['r'] + $search_res) > $results ? $results : ($_GET['r'] + $search_res);
$res_display = $res_from." - ".$res_to." ".LAN_SEARCH_12." ".$results; $res_display = $res_from." - ".$res_to." ".LAN_SEARCH_12." ".$results;
} else { }
else
{
$res_display = ""; $res_display = "";
} }
$ns->tablerender(LAN_SEARCH_11." ".$res_display." ".LAN_SEARCH_13." ".(isset($_GET[$advanced_caption['id']]) ? $advanced_caption['title'][$_GET[$advanced_caption['id']]] : $search_info[$key]['qtype']), $text); $ns->tablerender(LAN_SEARCH_11." ".$res_display." ".LAN_SEARCH_13." ".(isset($_GET[$advanced_caption['id']]) ? $advanced_caption['title'][$_GET[$advanced_caption['id']]] : $search_info[$key]['qtype']), $text);