392 $where_req = ( count($where_req) > 0 ) ? "{$and_clause}" . implode(" AND\n ", $where_req) : ''; |
392 $where_req = ( count($where_req) > 0 ) ? "{$and_clause}" . implode(" AND\n ", $where_req) : ''; |
393 |
393 |
394 $sql = 'SELECT ' . $concat_column . ' AS id, p.name FROM ' . table_prefix . "page_text AS t\n" |
394 $sql = 'SELECT ' . $concat_column . ' AS id, p.name FROM ' . table_prefix . "page_text AS t\n" |
395 . " LEFT JOIN " . table_prefix . "pages AS p\n" |
395 . " LEFT JOIN " . table_prefix . "pages AS p\n" |
396 . " ON ( p.urlname = t.page_id AND p.namespace = t.namespace )\n" |
396 . " ON ( p.urlname = t.page_id AND p.namespace = t.namespace )\n" |
397 . " WHERE\n $where_any\n $where_req;"; |
397 . " WHERE p.visible = 1 AND (\n $where_any\n $where_req\n );"; |
398 if ( !($q = $db->sql_unbuffered_query($sql)) ) |
398 if ( !($q = $db->sql_unbuffered_query($sql)) ) |
399 $db->_die('Error is in perform_search(), includes/search.php, query 2. Parsed query dump follows:<pre>(indexable) ' . htmlspecialchars(print_r($query, true)) . '(non-indexable) ' . htmlspecialchars(print_r($query_phrase, true)) . '</pre>'); |
399 $db->_die('Error is in perform_search(), includes/search.php, query 2. Parsed query dump follows:<pre>(indexable) ' . htmlspecialchars(print_r($query, true)) . '(non-indexable) ' . htmlspecialchars(print_r($query_phrase, true)) . '</pre>'); |
400 |
400 |
401 if ( $row = $db->fetchrow() ) |
401 if ( $row = $db->fetchrow() ) |
402 { |
402 { |
464 $where_not = ( count($where_not) > 0 ) ? "$text_col NOT LIKE '%" . implode("%' AND $text_col NOT LIKE '%", $where_not) . "%'" : ''; |
464 $where_not = ( count($where_not) > 0 ) ? "$text_col NOT LIKE '%" . implode("%' AND $text_col NOT LIKE '%", $where_not) . "%'" : ''; |
465 |
465 |
466 $sql = 'SELECT ' . $concat_column . ' AS id, t.page_id, t.namespace, CHAR_LENGTH(t.page_text) AS page_length, t.page_text, p.name AS page_name FROM ' . table_prefix . "page_text AS t |
466 $sql = 'SELECT ' . $concat_column . ' AS id, t.page_id, t.namespace, CHAR_LENGTH(t.page_text) AS page_length, t.page_text, p.name AS page_name FROM ' . table_prefix . "page_text AS t |
467 LEFT JOIN " . table_prefix . "pages AS p |
467 LEFT JOIN " . table_prefix . "pages AS p |
468 ON ( p.urlname = t.page_id AND p.namespace = t.namespace ) |
468 ON ( p.urlname = t.page_id AND p.namespace = t.namespace ) |
469 WHERE $text_where $where_not;"; |
469 WHERE p.visible = 1 AND ( $text_where $where_not );"; |
470 if ( !($q = $db->sql_unbuffered_query($sql)) ) |
470 if ( !($q = $db->sql_unbuffered_query($sql)) ) |
471 $db->_die('Error is in perform_search(), includes/search.php, query 3'); |
471 $db->_die('Error is in perform_search(), includes/search.php, query 3'); |
472 |
472 |
473 $page_data = array(); |
473 $page_data = array(); |
474 if ( $row = $db->fetchrow() ) |
474 if ( $row = $db->fetchrow() ) |
497 // Iterate through $paths->pages and check the titles for search terms. Score accordingly. |
497 // Iterate through $paths->pages and check the titles for search terms. Score accordingly. |
498 // |
498 // |
499 |
499 |
500 foreach ( $paths->pages as $id => $page ) |
500 foreach ( $paths->pages as $id => $page ) |
501 { |
501 { |
502 if ( $page['namespace'] != 'Special' ) |
502 if ( $page['namespace'] != 'Special' || $page['visible'] == 0 ) |
503 continue; |
503 continue; |
504 if ( !is_int($id) ) |
504 if ( !is_int($id) ) |
505 continue; |
505 continue; |
506 $idstring = 'ns=' . $page['namespace'] . ';pid=' . $page['urlname_nons']; |
506 $idstring = 'ns=' . $page['namespace'] . ';pid=' . $page['urlname_nons']; |
507 $any = array_values(array_unique(array_merge($query['any'], $query_phrase['any']))); |
507 $any = array_values(array_unique(array_merge($query['any'], $query_phrase['any']))); |