Revision 770
Added by thorn over 17 years ago
| search.php | ||
|---|---|---|
| 47 | 47 |
$query = $database->query("SELECT DISTINCT directory FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory NOT LIKE '%_searchext'");
|
| 48 | 48 |
if($query->numRows() > 0) {
|
| 49 | 49 |
while($module = $query->fetchRow()) {
|
| 50 |
$func_name = $module['directory']."_search"; |
|
| 51 | 50 |
$file = WB_PATH.'/modules/'.$module['directory'].'/search.php'; |
| 52 | 51 |
if(!file_exists($file)) {
|
| 53 | 52 |
$file = WB_PATH.'/modules/'.$module['directory'].'_searchext/search.php'; |
| ... | ... | |
| 58 | 57 |
if($file!='') {
|
| 59 | 58 |
include_once($file); |
| 60 | 59 |
if(function_exists($module['directory']."_search")) {
|
| 61 |
$search_funcs[$module['directory']] = $func_name;
|
|
| 60 |
$search_funcs[$module['directory']] = $module['directory']."_search";
|
|
| 62 | 61 |
} |
| 62 |
if(function_exists($module['directory']."_search_before")) {
|
|
| 63 |
$search_funcs['__before'][] = $module['directory']."_search_before"; |
|
| 64 |
} |
|
| 65 |
if(function_exists($module['directory']."_search_after")) {
|
|
| 66 |
$search_funcs['__after'][] = $module['directory']."_search_after"; |
|
| 67 |
} |
|
| 63 | 68 |
} |
| 64 | 69 |
} |
| 65 | 70 |
} |
| ... | ... | |
| 311 | 316 |
// and even if setlocale() is set, it won't work for multi-linguale sites. |
| 312 | 317 |
// Use the search-module-extension instead. |
| 313 | 318 |
// This is somewhat slower than the orginial method. |
| 319 |
|
|
| 320 |
// call $search_funcs['__before'] first |
|
| 321 |
$search_func_vars = array( |
|
| 322 |
'database' => $database, // database-handle |
|
| 323 |
'users' => $users, // array of known user-id/user-name |
|
| 324 |
'search_words' => $search_words, // search-string, prepared for regex |
|
| 325 |
'search_match' => $match, // match-type |
|
| 326 |
'search_url_array' => $search_url_array, // original search-string. ATTN: string is not quoted! |
|
| 327 |
'results_loop_string' => $fetch_results_loop['value'], |
|
| 328 |
'default_max_excerpt' => $search_max_excerpt, |
|
| 329 |
'time_limit' => $search_time_limit // time-limit in secs |
|
| 330 |
); |
|
| 331 |
foreach($search_funcs['__before'] as $func) {
|
|
| 332 |
$uf_res = call_user_func($func, $search_func_vars); |
|
| 333 |
} |
|
| 334 |
// now call module-based $search_funcs[] |
|
| 314 | 335 |
$seen_pages = array(); // seen pages per module. |
| 315 | 336 |
$pages_listed = array(); // seen pages. |
| 316 | 337 |
foreach($sorted_modules AS $module_name) {
|
| ... | ... | |
| 380 | 401 |
} |
| 381 | 402 |
} |
| 382 | 403 |
} |
| 404 |
// now call $search_funcs['__after'] |
|
| 405 |
$search_func_vars = array( |
|
| 406 |
'database' => $database, // database-handle |
|
| 407 |
'users' => $users, // array of known user-id/user-name |
|
| 408 |
'search_words' => $search_words, // search-string, prepared for regex |
|
| 409 |
'search_match' => $match, // match-type |
|
| 410 |
'search_url_array' => $search_url_array, // original search-string. ATTN: string is not quoted! |
|
| 411 |
'results_loop_string' => $fetch_results_loop['value'], |
|
| 412 |
'default_max_excerpt' => $search_max_excerpt, |
|
| 413 |
'time_limit' => $search_time_limit // time-limit in secs |
|
| 414 |
); |
|
| 415 |
foreach($search_funcs['__after'] as $func) {
|
|
| 416 |
$uf_res = call_user_func($func, $search_func_vars); |
|
| 417 |
} |
|
| 383 | 418 |
|
| 419 |
|
|
| 384 | 420 |
// Search page details only, such as description, keywords, etc, but only of unseen pages. |
| 385 | 421 |
$max_excerpt_num = 0; // we don't want excerpt here |
| 386 | 422 |
$divider = "."; |
Also available in: Unified diff
search: added missing code to allow query of external data and to process the search data itself