Changeset 1252

Show
Ignore:
Timestamp:
01/13/08 12:51:11 (7 months ago)
Author:
Neal
Message:

Fixed a bug where people couldn't search by forum when they chose to see search results as topics (only affected MySQL(i) forums).
Fixed a bug where mods/admins could not search all forums even though they were given the option in the dropdown. Noticed by chrizz.

Files:

Legend:

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

    r1241 r1252  
    105105 
    106106                // Search a specific forum? 
    107                 $forum_sql = ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0')) ? ' AND t.forum_id = '.$forum : ''; 
     107                $forum_sql = ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0' && !$pun_user['is_admmod'])) ? ' AND t.forum_id = '.$forum : ''; 
    108108 
    109109                // If it's a search for keywords 
     
    340340        { 
    341341                // Are we limiting the results to a specific forum? 
    342                 if ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0')) 
     342                if ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0' && !$pun_user['is_admmod'])) 
    343343                        $forum_where = ' AND f.id = '.$forum; 
    344344                else 
     
    396396                                                (fp.read_forum IS NULL OR fp.read_forum=1) 
    397397                                                '.($keywords ? 'AND MATCH(t.subject) AGAINST(\''.$db->escape($keywords).'\' IN BOOLEAN MODE)' : '').' 
     398                                                '.$forum_where.' 
    398399                                        UNION 
    399400                                        SELECT 
     
    404405                                                '.($author ? 'AND p.poster LIKE \''.$db->escape($author).'\'' : '').' 
    405406                                                '.($keywords ? 'AND MATCH(p.message) AGAINST(\''.$db->escape($keywords).'\' IN BOOLEAN MODE)' : '').' 
     407                                                '.$forum_where.' 
    406408                                ) AS tmp 
    407409                                GROUP BY tid