Changeset 22175


Ignore:
Timestamp:
04/12/13 21:57:51 (7 years ago)
Author:
rvelices
Message:

fix quick search php warnings in some very rare cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_search.inc.php

    r19703 r22175  
    373373  for ($i=0; $i<count($tokens); $i++) 
    374374  { 
    375     if (strstr($token_modifiers[$i], 'q')===false) 
     375    if ( !($token_modifiers[$i] & QST_QUOTED) ) 
    376376    { 
    377377      if ( substr($tokens[$i], -1)=='*' ) 
    378378      { 
    379379        $tokens[$i] = rtrim($tokens[$i], '*'); 
    380         $token_modifiers[$i] .= '*'; 
     380        $token_modifiers[$i] |= QST_WILDCARD_END; 
    381381      } 
    382382    } 
     
    550550        array_splice($token_tag_ids[$i], $j, 1); 
    551551        array_splice($token_tag_scores[$i], $j, 1); 
     552        $j--; 
     553        continue; 
    552554      } 
    553555 
     
    561563    } 
    562564  } 
    563    
     565 
    564566  usort($all_tags, 'tag_alpha_compare'); 
    565567  foreach ( $all_tags as &$tag ) 
     
    767769  $allowed_images = array_flip( $allowed_images ); 
    768770  $divisor = 5.0 * count($allowed_images); 
    769   foreach ($allowed_images as $id=>$rank ) 
     771  foreach ($allowed_images as $id=> &$rank ) 
    770772  { 
    771773    $weight = isset($by_weights[$id]) ? $by_weights[$id] : 1; 
    772774    $weight -= $rank/$divisor; 
    773     $allowed_images[$id] = $weight; 
    774   } 
     775    $rank = $weight; 
     776  } 
     777  unset($rank); 
     778 
    775779  arsort($allowed_images, SORT_NUMERIC); 
    776780  $search_results['items'] = array_keys($allowed_images); 
Note: See TracChangeset for help on using the changeset viewer.