Changeset 1548

Show
Ignore:
Timestamp:
03/08/08 16:37:32 (2 months ago)
Author:
Neal
Message:

Fixed search pagination failing when a wildcard was included in the author field.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/punbb-1.3-dev/upload/search.php

    r1543 r1548  
    8282                if (!$keywords && !$author) 
    8383                        message($lang_search['No terms']); 
    84  
    85                 if ($author) 
    86                         $author = str_replace('*', '%', $author); 
    8784 
    8885                $show_as = (isset($_GET['show_as'])) ? $_GET['show_as'] : 'posts'; 
     
    216213                                'SELECT'        => 'u.id', 
    217214                                'FROM'          => 'users AS u', 
    218                                 'WHERE'         => 'u.username '.($db_type == 'pgsql' ? 'ILIKE' : 'LIKE').' \''.$db->escape($author).'\'' 
     215                                'WHERE'         => 'u.username '.($db_type == 'pgsql' ? 'ILIKE' : 'LIKE').' \''.$db->escape(str_replace('*', '%', $author)).'\'' 
    219216                        ); 
    220217 
     
    396393                                WHERE 
    397394                                        (fp.read_forum IS NULL OR fp.read_forum=1) 
    398                                         '.($author ? 'AND p.poster LIKE \''.$db->escape($author).'\'' : '').' 
     395                                        '.($author ? 'AND p.poster LIKE \''.$db->escape(str_replace('*', '%', $author)).'\'' : '').' 
    399396                                        '.($keywords ? 'AND MATCH(p.message) AGAINST(\''.$db->escape($keywords).'\' IN BOOLEAN MODE)' : '').' 
    400397                                        '.$forum_where.' 
     
    411408                                        WHERE 
    412409                                                (fp.read_forum IS NULL OR fp.read_forum=1) 
    413                                                 '.($author ? 'AND t.poster LIKE \''.$db->escape($author).'\'' : '').' 
     410                                                '.($author ? 'AND t.poster LIKE \''.$db->escape(str_replace('*', '%', $author)).'\'' : '').' 
    414411                                                '.($keywords ? 'AND MATCH(t.subject) AGAINST(\''.$db->escape($keywords).'\' IN BOOLEAN MODE)' : '').' 
    415412                                                '.$forum_where.' 
     
    420417                                        WHERE 
    421418                                                (fp.read_forum IS NULL OR fp.read_forum=1) 
    422                                                 '.($author ? 'AND p.poster LIKE \''.$db->escape($author).'\'' : '').' 
     419                                                '.($author ? 'AND p.poster LIKE \''.$db->escape(str_replace('*', '%', $author)).'\'' : '').' 
    423420                                                '.($keywords ? 'AND MATCH(p.message) AGAINST(\''.$db->escape($keywords).'\' IN BOOLEAN MODE)' : '').' 
    424421                                                '.$forum_where.'