Revision 779
Added by thorn over 16 years ago
search.php | ||
---|---|---|
23 | 23 |
|
24 | 24 |
*/ |
25 | 25 |
|
26 |
// we have to do some cleanup here, ASAP! |
|
27 |
|
|
28 | 26 |
if(!defined('WB_URL')) { |
29 | 27 |
header('Location: index.php'); |
30 | 28 |
exit(0); |
31 | 29 |
} |
32 | 30 |
|
33 |
// Include the WB functions file |
|
34 |
require_once(WB_PATH.'/framework/functions.php'); |
|
35 |
|
|
36 | 31 |
// Check if search is enabled |
37 | 32 |
if(SHOW_SEARCH != true) { |
38 | 33 |
echo $TEXT['SEARCH'].' '.$TEXT['DISABLED']; |
39 | 34 |
return; |
40 | 35 |
} |
41 | 36 |
|
37 |
// Include the WB functions file |
|
38 |
require_once(WB_PATH.'/framework/functions.php'); |
|
39 |
|
|
40 |
// Get search settings |
|
41 |
$table=TABLE_PREFIX.'search'; |
|
42 |
$query = $database->query("SELECT value FROM $table WHERE name = 'header' LIMIT 1"); |
|
43 |
$fetch_header = $query->fetchRow(); |
|
44 |
$query = $database->query("SELECT value FROM $table WHERE name = 'footer' LIMIT 1"); |
|
45 |
$fetch_footer = $query->fetchRow(); |
|
46 |
$query = $database->query("SELECT value FROM $table WHERE name = 'results_header' LIMIT 1"); |
|
47 |
$fetch_results_header = $query->fetchRow(); |
|
48 |
$query = $database->query("SELECT value FROM $table WHERE name = 'results_footer' LIMIT 1"); |
|
49 |
$fetch_results_footer = $query->fetchRow(); |
|
50 |
$query = $database->query("SELECT value FROM $table WHERE name = 'results_loop' LIMIT 1"); |
|
51 |
$fetch_results_loop = $query->fetchRow(); |
|
52 |
$query = $database->query("SELECT value FROM $table WHERE name = 'no_results' LIMIT 1"); |
|
53 |
$fetch_no_results = $query->fetchRow(); |
|
54 |
$query = $database->query("SELECT value FROM $table WHERE name = 'module_order' LIMIT 1"); |
|
55 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value']='faqbaker,manual,wysiwyg'; } |
|
56 |
$search_module_order = $res['value']; |
|
57 |
$query = $database->query("SELECT value FROM $table WHERE name = 'max_excerpt' LIMIT 1"); |
|
58 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = '15'; } |
|
59 |
$search_max_excerpt = (int)($res['value']); |
|
60 |
if(!is_numeric($search_max_excerpt)) { $search_max_excerpt = 15; } |
|
61 |
$query = $database->query("SELECT value FROM $table WHERE name = 'cfg_show_description' LIMIT 1"); |
|
62 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = 'true'; } |
|
63 |
if($res['value'] == 'false') { $cfg_show_description = false; } else { $cfg_show_description = true; } |
|
64 |
$query = $database->query("SELECT value FROM $table WHERE name = 'cfg_search_description' LIMIT 1"); |
|
65 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = 'true'; } |
|
66 |
if($res['value'] == 'false') { $cfg_search_description = false; } else { $cfg_search_description = true; } |
|
67 |
$query = $database->query("SELECT value FROM $table WHERE name = 'cfg_search_keywords' LIMIT 1"); |
|
68 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = 'true'; } |
|
69 |
if($res['value'] == 'false') { $cfg_search_keywords = false; } else { $cfg_search_keywords = true; } |
|
70 |
$query = $database->query("SELECT value FROM $table WHERE name = 'cfg_enable_old_search' LIMIT 1"); |
|
71 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = 'true'; } |
|
72 |
if($res['value'] == 'false') { $cfg_enable_old_search = false; } else { $cfg_enable_old_search = true; } |
|
73 |
$query = $database->query("SELECT value FROM $table WHERE name = 'cfg_enable_flush' LIMIT 1"); |
|
74 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = 'false'; } |
|
75 |
if($res['value'] == 'false') { $cfg_enable_flush = false; } else { $cfg_enable_flush = true; } |
|
76 |
$query = $database->query("SELECT value FROM $table WHERE name = 'time_limit' LIMIT 1"); // time-limit per module |
|
77 |
if($query->numRows() > 0) { $res = $query->fetchRow(); } else { $res['value'] = '0'; } |
|
78 |
$search_time_limit = (int)($res['value']); |
|
79 |
if($search_time_limit < 1) $search_time_limit = 0; |
|
80 |
|
|
42 | 81 |
// search-module-extension: get helper-functions |
43 | 82 |
require_once(WB_PATH.'/search/search_modext.php'); |
44 | 83 |
// search-module-extension: Get "search.php" for each module, if present |
... | ... | |
69 | 108 |
} |
70 | 109 |
} |
71 | 110 |
|
72 |
// Get the search type |
|
73 |
$match = 'all'; |
|
74 |
if(isset($_REQUEST['match'])) { |
|
75 |
$match = $wb->add_slashes(strip_tags($_REQUEST['match'])); |
|
111 |
// Get list of usernames and display names |
|
112 |
$query = $database->query("SELECT user_id,username,display_name FROM ".TABLE_PREFIX."users"); |
|
113 |
$users = array('0' => array('display_name' => $TEXT['UNKNOWN'], 'username' => strtolower($TEXT['UNKNOWN']))); |
|
114 |
if($query->numRows() > 0) { |
|
115 |
while($user = $query->fetchRow()) { |
|
116 |
$users[$user['user_id']] = array('display_name' => $user['display_name'], 'username' => $user['username']); |
|
117 |
} |
|
76 | 118 |
} |
77 | 119 |
|
78 | 120 |
// Get the path to search into. Normally left blank |
... | ... | |
110 | 152 |
} |
111 | 153 |
} |
112 | 154 |
|
113 |
// TODO: with the new method, there is no need for search_entities_string anymore. |
|
114 |
// When the old method disappears, it can be removed, too. |
|
115 |
// BTW: in this case, there is no need for |
|
116 |
// $text = umlauts_to_entities(strip_tags($content), strtoupper(DEFAULT_CHARSET), 0); |
|
117 |
// in wb/modules/wysiwyg/save.php anymore, too. Change that back to $text=strip_tags($content); |
|
155 |
// Get the search type |
|
156 |
$match = ''; |
|
157 |
if(isset($_REQUEST['match'])) { |
|
158 |
if($_REQUEST['match']=='any') $match = 'any'; |
|
159 |
elseif($_REQUEST['match']=='all') $match = 'all'; |
|
160 |
elseif($_REQUEST['match']=='exact') $match = 'exact'; |
|
161 |
else $match = 'all'; |
|
162 |
} else { |
|
163 |
$match = 'all'; |
|
164 |
} |
|
118 | 165 |
|
119 | 166 |
// Get search string |
120 |
$search_normal_string = 'unset'; // for regex
|
|
167 |
$search_normal_string = 'unset'; |
|
121 | 168 |
$search_entities_string = 'unset'; // for SQL's LIKE |
122 | 169 |
$search_display_string = ''; // for displaying |
170 |
$search_url_string = ''; // for $_GET |
|
123 | 171 |
$string = ''; |
124 | 172 |
if(isset($_REQUEST['string'])) { |
125 |
if ($match!='exact') {
|
|
173 |
if($match!='exact') { |
|
126 | 174 |
$string=str_replace(',', '', $_REQUEST['string']); |
127 | 175 |
} else { |
128 | 176 |
$string=$_REQUEST['string']; // $string will be cleaned below |
129 | 177 |
} |
130 | 178 |
// redo possible magic quotes |
131 | 179 |
$string = $wb->strip_slashes($string); |
180 |
$string = preg_replace('/\s+/', ' ', $string); |
|
132 | 181 |
$string = trim($string); |
133 | 182 |
// remove some bad chars |
134 | 183 |
$string = preg_replace('/(^|\s+)[|.]+(?=\s+|$)/', '', $string); |
135 | 184 |
$search_display_string = htmlspecialchars($string); |
136 |
// convert string to utf-8 |
|
137 |
$string = entities_to_umlauts($string, 'UTF-8'); |
|
138 | 185 |
$search_entities_string = addslashes(umlauts_to_entities(htmlspecialchars($string))); |
139 | 186 |
// mySQL needs four backslashes to match one in LIKE comparisons) |
140 | 187 |
$search_entities_string = str_replace('\\\\', '\\\\\\\\', $search_entities_string); |
188 |
// convert string to utf-8 |
|
189 |
$string = entities_to_umlauts($string, 'UTF-8'); |
|
141 | 190 |
// quote ' " and / -we need quoted / for regex |
142 | 191 |
$search_url_string = $string; |
143 | 192 |
$string = preg_quote($string); |
144 | 193 |
$search_normal_string = str_replace(array('\'','"','/'), array('\\\'','\"','\/'), $string); |
145 | 194 |
} |
146 |
|
|
147 |
// Get list of usernames and display names |
|
148 |
$query = $database->query("SELECT user_id,username,display_name FROM ".TABLE_PREFIX."users"); |
|
149 |
$users = array('0' => array('display_name' => $TEXT['UNKNOWN'], 'username' => strtolower($TEXT['UNKNOWN']))); |
|
150 |
if($query->numRows() > 0) { |
|
151 |
while($user = $query->fetchRow()) { |
|
152 |
$users[$user['user_id']] = array('display_name' => $user['display_name'], 'username' => $user['username']); |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
// Get search settings |
|
157 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'header' LIMIT 1"); |
|
158 |
$fetch_header = $query->fetchRow(); |
|
159 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'footer' LIMIT 1"); |
|
160 |
$fetch_footer = $query->fetchRow(); |
|
161 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_header' LIMIT 1"); |
|
162 |
$fetch_results_header = $query->fetchRow(); |
|
163 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_footer' LIMIT 1"); |
|
164 |
$fetch_results_footer = $query->fetchRow(); |
|
165 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_loop' LIMIT 1"); |
|
166 |
$fetch_results_loop = $query->fetchRow(); |
|
167 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'no_results' LIMIT 1"); |
|
168 |
$fetch_no_results = $query->fetchRow(); |
|
169 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'module_order' LIMIT 1"); |
|
170 |
if($query->numRows() > 0) { $fetch_module_order = $query->fetchRow(); |
|
171 |
} else { $fetch_module_order['value'] = ""; } |
|
172 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'max_excerpt' LIMIT 1"); |
|
173 |
if($query->numRows() > 0) { $fetch_max_excerpt = $query->fetchRow(); |
|
174 |
} else { $fetch_max_excerpt['value'] = '15'; } |
|
175 |
$search_max_excerpt = (int)$fetch_max_excerpt['value']; |
|
176 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'cfg_show_description' LIMIT 1"); |
|
177 |
if($query->numRows() > 0) { $fetch_cfg_show_description = $query->fetchRow(); |
|
178 |
} else { $fetch_cfg_show_description['value'] = 'true'; } |
|
179 |
if($fetch_cfg_show_description['value'] == 'false') { $cfg_show_description = false; |
|
180 |
} else { $cfg_show_description = true; } |
|
181 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'cfg_search_description' LIMIT 1"); |
|
182 |
if($query->numRows() > 0) { $fetch_cfg_search_description = $query->fetchRow(); |
|
183 |
} else { $fetch_cfg_search_description['value'] = 'true'; } |
|
184 |
if($fetch_cfg_search_description['value'] == 'false') { $cfg_search_description = false; |
|
185 |
} else { $cfg_search_description = true; } |
|
186 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'cfg_search_keywords' LIMIT 1"); |
|
187 |
if($query->numRows() > 0) { $fetch_cfg_search_keywords = $query->fetchRow(); |
|
188 |
} else { $fetch_cfg_search_keywords['value'] = 'true'; } |
|
189 |
if($fetch_cfg_search_keywords['value'] == 'false') { $cfg_search_keywords = false; |
|
190 |
} else { $cfg_search_keywords = true; } |
|
191 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'cfg_enable_old_search' LIMIT 1"); |
|
192 |
if($query->numRows() > 0) { $fetch_cfg_enable_old_search = $query->fetchRow(); |
|
193 |
} else { $fetch_cfg_enable_old_search['value'] = 'true'; } |
|
194 |
if($fetch_cfg_enable_old_search['value'] == 'false') { $cfg_enable_old_search = false; |
|
195 |
} else { $cfg_enable_old_search = true; } |
|
196 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'cfg_enable_flush' LIMIT 1"); |
|
197 |
if($query->numRows() > 0) { $fetch_cfg_enable_flush = $query->fetchRow(); |
|
198 |
} else { $fetch_cfg_enable_flush['value'] = 'false'; } |
|
199 |
if($fetch_cfg_enable_flush['value'] == 'false') { $cfg_enable_flush = false; |
|
200 |
} else { $cfg_enable_flush = true; } |
|
201 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'time_limit' LIMIT 1"); // time-limit per module |
|
202 |
if($query->numRows() > 0) { $fetch_search_time_limit = $query->fetchRow(); |
|
203 |
} else { $fetch_search_time_limit['value'] = 'false'; } |
|
204 |
$search_time_limit = (int)($fetch_search_time_limit['value']); |
|
205 |
if($search_time_limit < 1) $search_time_limit = 0; |
|
206 |
// Replace vars in search settings with values |
|
207 |
$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_RESULTS_FOR]'); |
|
208 |
$values = array($search_display_string, WB_URL, PAGE_EXTENSION, $TEXT['RESULTS_FOR']); |
|
209 |
$search_footer = str_replace($vars, $values, ($fetch_footer['value'])); |
|
210 |
$search_results_header = str_replace($vars, $values, ($fetch_results_header['value'])); |
|
211 |
$search_results_footer = str_replace($vars, $values, ($fetch_results_footer['value'])); |
|
212 |
$search_module_order = $fetch_module_order['value']; |
|
213 |
|
|
214 |
// check $search_max_excerpt |
|
215 |
if(!is_numeric($search_max_excerpt)) { |
|
216 |
$search_max_excerpt = 15; |
|
217 |
} |
|
218 |
|
|
219 |
// Work-out what to do (match all words, any words, or do exact match), and do relevant with query settings |
|
220 |
$all_checked = ''; |
|
221 |
$any_checked = ''; |
|
222 |
$exact_checked = ''; |
|
195 |
// make arrays from the search_..._strings above |
|
196 |
$search_url_array = explode(' ', $search_url_string); |
|
223 | 197 |
$search_normal_array = array(); |
224 | 198 |
$search_entities_array = array(); |
225 |
if($match != 'exact') { |
|
226 |
// Split string into array with explode() function |
|
199 |
if($match == 'exact') { |
|
200 |
$search_normal_array[]=$search_normal_string; |
|
201 |
$search_entities_array[]=$search_entities_string; |
|
202 |
} else { |
|
227 | 203 |
$exploded_string = explode(' ', $search_normal_string); |
228 | 204 |
// Make sure there is no blank values in the array |
229 | 205 |
foreach($exploded_string AS $each_exploded_string) { |
... | ... | |
231 | 207 |
$search_normal_array[] = $each_exploded_string; |
232 | 208 |
} |
233 | 209 |
} |
234 |
// Split $string_entities, too |
|
235 | 210 |
$exploded_string = explode(' ', $search_entities_string); |
236 | 211 |
// Make sure there is no blank values in the array |
237 | 212 |
foreach($exploded_string AS $each_exploded_string) { |
... | ... | |
239 | 214 |
$search_entities_array[] = $each_exploded_string; |
240 | 215 |
} |
241 | 216 |
} |
242 |
if ($match == 'any') { |
|
243 |
$any_checked = ' checked="checked"'; |
|
244 |
$logical_operator = ' OR'; |
|
245 |
} else { |
|
246 |
$all_checked = ' checked="checked"'; |
|
247 |
$logical_operator = ' AND'; |
|
248 |
} |
|
249 |
} else { |
|
250 |
$exact_checked = ' checked="checked"'; |
|
251 |
$exact_string=$search_normal_string; |
|
252 |
$search_normal_array[]=$exact_string; |
|
253 |
$exact_string=$search_entities_string; |
|
254 |
$search_entities_array[]=$exact_string; |
|
255 |
} |
|
256 |
// make an extra copy of search-string for use in a regex and another one for url |
|
217 |
} |
|
218 |
// make an extra copy of search_normal_array for use in regex |
|
257 | 219 |
require_once(WB_PATH.'/search/search_convert.php'); |
258 | 220 |
$search_words = array(); |
259 |
foreach ($search_normal_array AS $str) {
|
|
221 |
foreach($search_normal_array AS $str) { |
|
260 | 222 |
$str = strtr($str, $string_ul_umlauts); |
261 | 223 |
// special-feature: '|' means word-boundary (\b). Searching for 'the|' will find the, but not thema. |
262 |
// this doesn't work correctly for unicode-chars: '|test' will work, but '|über' not. |
|
224 |
// this doesn't(?) work correctly for unicode-chars: '|test' will work, but '|über' not.
|
|
263 | 225 |
$str = strtr($str, array('\\|'=>'\b')); |
264 | 226 |
$search_words[] = $str; |
265 | 227 |
} |
266 |
$search_url_array=explode(' ', $search_url_string); |
|
267 | 228 |
|
229 |
// Work-out what to do (match all words, any words, or do exact match), and do relevant with query settings |
|
230 |
$all_checked = ''; |
|
231 |
$any_checked = ''; |
|
232 |
$exact_checked = ''; |
|
233 |
if ($match == 'any') { |
|
234 |
$any_checked = ' checked="checked"'; |
|
235 |
$logical_operator = ' OR'; |
|
236 |
} elseif($match == 'all') { |
|
237 |
$all_checked = ' checked="checked"'; |
|
238 |
$logical_operator = ' AND'; |
|
239 |
} else { |
|
240 |
$exact_checked = ' checked="checked"'; |
|
241 |
} |
|
242 |
|
|
243 |
// Replace vars in search settings with values |
|
244 |
$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_RESULTS_FOR]'); |
|
245 |
$values = array($search_display_string, WB_URL, PAGE_EXTENSION, $TEXT['RESULTS_FOR']); |
|
246 |
$search_footer = str_replace($vars, $values, ($fetch_footer['value'])); |
|
247 |
$search_results_header = str_replace($vars, $values, ($fetch_results_header['value'])); |
|
248 |
$search_results_footer = str_replace($vars, $values, ($fetch_results_footer['value'])); |
|
249 |
|
|
268 | 250 |
// Do extra vars/values replacement |
269 | 251 |
$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]', '[SEARCH_PATH]'); |
270 | 252 |
$values = array($search_display_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, $search_path); |
... | ... | |
273 | 255 |
$values = array($TEXT['NO_RESULTS']); |
274 | 256 |
$search_no_results = str_replace($vars, $values, ($fetch_no_results['value'])); |
275 | 257 |
|
258 |
/* |
|
259 |
* Start of output |
|
260 |
*/ |
|
261 |
|
|
276 | 262 |
// Show search header |
277 | 263 |
echo $search_header; |
278 | 264 |
// Show search results_header |
... | ... | |
287 | 273 |
$modules = array(); |
288 | 274 |
if($get_modules->numRows() > 0) { |
289 | 275 |
while($module = $get_modules->fetchRow()) { |
290 |
$modules[] = $module['module']; // $modules is an array of strings
|
|
276 |
$modules[] = $module['module']; |
|
291 | 277 |
} |
292 | 278 |
} |
293 |
|
|
294 | 279 |
// sort module search-order |
295 | 280 |
// get the modules from $search_module_order first ... |
296 | 281 |
$sorted_modules = array(); |
... | ... | |
311 | 296 |
$sorted_modules[] = $item; |
312 | 297 |
} |
313 | 298 |
|
314 |
// First, use an alternative search-method, without sql's 'LIKE'. |
|
315 |
// 'LIKE' won't find upper/lower-variants of umlauts, cyrillic or greek chars without propperly set setlocale(); |
|
316 |
// and even if setlocale() is set, it won't work for multi-linguale sites. |
|
317 |
// Use the search-module-extension instead. |
|
299 |
|
|
300 |
// Use the module's search-extensions. |
|
318 | 301 |
// This is somewhat slower than the orginial method. |
319 | 302 |
|
320 | 303 |
// call $search_funcs['__before'] first |
... | ... | |
330 | 313 |
'page_modified_when' => 0, |
331 | 314 |
'page_modified_by' => 0, |
332 | 315 |
'users' => $users, // array of known user-id/user-name |
333 |
'search_words' => $search_words, // search-string, prepared for regex
|
|
316 |
'search_words' => $search_words, // array of strings, prepared for regex
|
|
334 | 317 |
'search_match' => $match, // match-type |
335 |
'search_url_array' => $search_url_array, // original search-string. ATTN: string is not quoted!
|
|
318 |
'search_url_array' => $search_url_array, // array of strings from the original search-string. ATTN: strings are not quoted!
|
|
336 | 319 |
'results_loop_string' => $fetch_results_loop['value'], |
337 | 320 |
'default_max_excerpt' => $search_max_excerpt, |
338 | 321 |
'time_limit' => $search_time_limit, // time-limit in secs |
... | ... | |
385 | 368 |
'page_modified_when' => $res['modified_when'], |
386 | 369 |
'page_modified_by' => $res['modified_by'], |
387 | 370 |
'users' => $users, |
388 |
'search_words' => $search_words, // needed for preg_match_all
|
|
371 |
'search_words' => $search_words, // needed for preg_match |
|
389 | 372 |
'search_match' => $match, |
390 | 373 |
'search_url_array' => $search_url_array, // needed for url-string only |
391 | 374 |
'results_loop_string' => $fetch_results_loop['value'], |
... | ... | |
424 | 407 |
'page_modified_when' => 0, |
425 | 408 |
'page_modified_by' => 0, |
426 | 409 |
'users' => $users, // array of known user-id/user-name |
427 |
'search_words' => $search_words, // search-string, prepared for regex
|
|
410 |
'search_words' => $search_words, // array of strings, prepared for regex
|
|
428 | 411 |
'search_match' => $match, // match-type |
429 |
'search_url_array' => $search_url_array, // original search-string. ATTN: string is not quoted!
|
|
412 |
'search_url_array' => $search_url_array, // array of strings from the original search-string. ATTN: strings are not quoted!
|
|
430 | 413 |
'results_loop_string' => $fetch_results_loop['value'], |
431 | 414 |
'default_max_excerpt' => $search_max_excerpt, |
432 | 415 |
'time_limit' => $search_time_limit, // time-limit in secs |
... | ... | |
445 | 428 |
SELECT page_id, page_title, menu_title, link, description, keywords, modified_when, modified_by, |
446 | 429 |
visibility, viewing_groups, viewing_users |
447 | 430 |
FROM $table |
448 |
WHERE visibility NOT IN ('none','deleted') AND searching = '1' $search_path_SQL"
|
|
449 |
); |
|
431 |
WHERE visibility NOT IN ('none','deleted') AND searching = '1' $search_path_SQL |
|
432 |
");
|
|
450 | 433 |
if($query_pages->numRows() > 0) { |
451 | 434 |
while($page = $query_pages->fetchRow()) { |
452 | 435 |
if (isset($pages_listed[$page['page_id']])) { |
... | ... | |
539 | 522 |
$sorted_modules[] = $item; |
540 | 523 |
} |
541 | 524 |
|
542 |
if($cfg_enable_old_search) { |
|
525 |
if($cfg_enable_old_search) { // this is the old (wb <= 2.6.7) search-function
|
|
543 | 526 |
$search_path_SQL = str_replace(' link ', ' '.TABLE_PREFIX.'pages.link ', $search_path_SQL); |
544 | 527 |
foreach($sorted_modules AS $module) { |
545 | 528 |
$query_start = ''; |
... | ... | |
599 | 582 |
$count = $count+1; |
600 | 583 |
} |
601 | 584 |
$prepared_query .= " ) ) ) ".$query_end; |
602 |
|
|
603 | 585 |
// Execute query |
604 | 586 |
$page_query = $database->query($prepared_query." ".$search_path_SQL); |
605 | 587 |
|
Also available in: Unified diff
Some cleanup in search.php