Project

General

Profile

« Previous | Next » 

Revision 369

Added by Matthias almost 18 years ago

Fixed search results generate invalid XHTML and notify warnings (#326)
Added support for getting page ID of page that referred search request (#327) (thanks to brofield)

View differences:

search.php
37 37
	$pages_listed = array();
38 38
	$items_listed = array();
39 39

  
40
	// Get the search type
41
	$match = 'all';
42
    if(isset($_REQUEST['match'])) {
43
        $match = $_REQUEST['match'];
44
    }
45

  
40 46
	// Get search string
41 47
	if(isset($_REQUEST['string'])) {
42
		if ($_REQUEST['match']!='exact') {
48
		if ($match!='exact') {
43 49
			$string=str_replace(',', '', $_REQUEST['string']);
44 50
		} else {
45 51
			$string=$_REQUEST['string'];
......
59 65
	$all_checked = '';
60 66
	$any_checked = '';
61 67
	$exact_checked = '';
62
	if($_REQUEST['match'] != 'exact') {
68
	if($match != 'exact') {
63 69
		// Split string into array with explode() function
64 70
		$exploded_string = explode(' ', $string);
65 71
		// Make sure there is no blank values in the array
......
69 75
				$string[] = $each_exploded_string;
70 76
			}
71 77
		}
72
		if ($_REQUEST['match'] == 'any') {
73
			$any_checked = ' checked';
78
		if ($match == 'any') {
79
			$any_checked = ' checked="checked"';
74 80
			$logical_operator = ' OR';
75 81
		} else {
76
			$all_checked = ' checked';
82
			$all_checked = ' checked="checked"';
77 83
			$logical_operator = ' AND';
78 84
		}
79 85
	} else {
80
		$exact_checked = ' checked';
86
		$exact_checked = ' checked="checked"';
81 87
		$exact_string=$string;
82 88
		$string=array();
83 89
		$string[]=$exact_string;
......
112 118
	$search_results_header = str_replace($vars, $values, ($fetch_results_header['value']));
113 119
	$search_results_footer = str_replace($vars, $values, ($fetch_results_footer['value']));
114 120
	// Do extra vars/values replacement
115
	$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_SEARCH]', '[TEXT_ALL_WORDS]', '[TEXT_ANY_WORDS]', '[TEXT_EXACT_MATCH]', '[TEXT_MATCH]', '[TEXT_MATCHING]', '[ALL_CHECKED]', '[ANY_CHECKED]', '[EXACT_CHECKED]');
116
	$values = array($search_string, WB_URL, PAGE_EXTENSION, $TEXT['SEARCH'], $TEXT['ALL_WORDS'], $TEXT['ANY_WORDS'], $TEXT['EXACT_MATCH'], $TEXT['MATCH'], $TEXT['MATCHING'], $all_checked, $any_checked, $exact_checked);
121
	$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_SEARCH]', '[TEXT_ALL_WORDS]', '[TEXT_ANY_WORDS]', '[TEXT_EXACT_MATCH]', '[TEXT_MATCH]', '[TEXT_MATCHING]', '[ALL_CHECKED]', '[ANY_CHECKED]', '[EXACT_CHECKED]', '[REFERRER_ID]');
122
	$values = array($search_string, WB_URL, PAGE_EXTENSION, $TEXT['SEARCH'], $TEXT['ALL_WORDS'], $TEXT['ANY_WORDS'], $TEXT['EXACT_MATCH'], $TEXT['MATCH'], $TEXT['MATCHING'], $all_checked, $any_checked, $exact_checked, REFERRER_ID);
117 123
	$search_header = str_replace($vars, $values, ($fetch_header['value']));
118 124
	
119 125
	// Show search header

Also available in: Unified diff