includes/search.php
changeset 296 a21faa57e6c6
parent 294 444c34a3886b
child 318 eec2dfd2f0a3
--- a/includes/search.php	Fri May 09 23:33:11 2008 -0400
+++ b/includes/search.php	Thu Jun 12 10:58:48 2008 -0400
@@ -391,7 +391,7 @@
     $sql = 'SELECT ' . $concat_column . ' AS id, p.name FROM ' . table_prefix . "page_text AS t\n"
             . "  LEFT JOIN " . table_prefix . "pages AS p\n"
             . "    ON ( p.urlname = t.page_id AND p.namespace = t.namespace )\n"
-            . "  WHERE\n  $where_any\n  $where_req;";
+            . "  WHERE p.visible = 1 AND (\n    $where_any\n    $where_req\n  );";
     if ( !($q = $db->sql_unbuffered_query($sql)) )
       $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>');
 
@@ -463,7 +463,7 @@
   $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
             LEFT JOIN " . table_prefix . "pages AS p
               ON ( p.urlname = t.page_id AND p.namespace = t.namespace )
-            WHERE $text_where $where_not;";
+            WHERE p.visible = 1 AND ( $text_where $where_not );";
   if ( !($q = $db->sql_unbuffered_query($sql)) )
     $db->_die('Error is in perform_search(), includes/search.php, query 3');
 
@@ -496,7 +496,7 @@
 
   foreach ( $paths->pages as $id => $page )
   {
-    if ( $page['namespace'] != 'Special' )
+    if ( $page['namespace'] != 'Special' || $page['visible'] == 0 )
       continue;
     if ( !is_int($id) )
       continue;