includes/search.php
changeset 832 7152ca0a0ce9
parent 801 eb8b23f11744
child 945 c19242d13a49
equal deleted inserted replaced
831:45e887f23282 832:7152ca0a0ce9
   254             $inc = 1;
   254             $inc = 1;
   255 
   255 
   256             // Is this search term present in the page's title? If so, give extra points
   256             // Is this search term present in the page's title? If so, give extra points
   257             preg_match("/^ns=$ns_list;pid=(.+)$/", $match, $piecesparts);
   257             preg_match("/^ns=$ns_list;pid=(.+)$/", $match, $piecesparts);
   258             $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   258             $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   259             if ( isset($paths->pages[$pathskey]) )
   259             if ( isPage($pathskey) )
   260             {
   260             {
   261               $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   261               $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   262               if ( $test_func($paths->pages[$pathskey]['name'], $row['word']) || $test_func($paths->pages[$pathskey]['urlname_nons'], $row['word']) )
   262               if ( $test_func($paths->pages[$pathskey]['name'], $row['word']) || $test_func($paths->pages[$pathskey]['urlname_nons'], $row['word']) )
   263               {
   263               {
   264                 $inc = 1.5;
   264                 $inc = 1.5;
   296           $inc = 1;
   296           $inc = 1;
   297 
   297 
   298           // Is this search term present in the page's title? If so, give extra points
   298           // Is this search term present in the page's title? If so, give extra points
   299           preg_match("/^ns=$ns_list;pid=(.+)$/", $pages, $piecesparts);
   299           preg_match("/^ns=$ns_list;pid=(.+)$/", $pages, $piecesparts);
   300           $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   300           $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   301           if ( isset($paths->pages[$pathskey]) )
   301           if ( isPage($pathskey) )
   302           {
   302           {
   303             $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   303             $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   304             if ( $test_func($paths->pages[$pathskey]['name'], $row['word']) || $test_func($paths->pages[$pathskey]['urlname_nons'], $row['word']) )
   304             if ( $test_func($paths->pages[$pathskey]['name'], $row['word']) || $test_func($paths->pages[$pathskey]['urlname_nons'], $row['word']) )
   305             {
   305             {
   306               $inc = 1.5;
   306               $inc = 1.5;
   395         $inc = 1;
   395         $inc = 1;
   396 
   396 
   397         // Is this search term present in the page's title? If so, give extra points
   397         // Is this search term present in the page's title? If so, give extra points
   398         preg_match("/^ns=$ns_list;pid=(.+)$/", $id, $piecesparts);
   398         preg_match("/^ns=$ns_list;pid=(.+)$/", $id, $piecesparts);
   399         $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   399         $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
   400         if ( isset($paths->pages[$pathskey]) )
   400         if ( isPage($pathskey) )
   401         {
   401         {
   402           $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   402           $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
   403           foreach ( array_merge($query_phrase['any'], $query_phrase['req']) as $term )
   403           foreach ( array_merge($query_phrase['any'], $query_phrase['req']) as $term )
   404           {
   404           {
   405             if ( $test_func($paths->pages[$pathskey]['name'], $term) || $test_func($paths->pages[$pathskey]['urlname_nons'], $term) )
   405             if ( $test_func($paths->pages[$pathskey]['name'], $term) || $test_func($paths->pages[$pathskey]['urlname_nons'], $term) )