Ignore:
Timestamp:
Jan 20, 2005, 12:52:59 AM (19 years ago)
Author:
plg
Message:
  • back to revision 1.63 + add author in fields list for allwords search
File:
1 edited

Legend:

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

    r707 r710  
    426426        $clauses = array();
    427427       
    428         // Author Search
    429           if (isset($search['fields']['author']))
     428        $textfields = array('file', 'name', 'comment', 'keywords', 'author');
     429        foreach ($textfields as $textfield)
     430        {
     431          if (isset($search['fields'][$textfield]))
    430432          {
    431433            $local_clauses = array();
    432             foreach ($search['fields']['author']['words'] as $word)
     434            foreach ($search['fields'][$textfield]['words'] as $word)
    433435            {
    434               array_push($local_clauses, "author LIKE '%".$word."%'");
     436              array_push($local_clauses, $textfield." LIKE '%".$word."%'");
    435437            }
    436438            // adds brackets around where clauses
    437439            array_walk($local_clauses,create_function('&$s','$s="(".$s.")";'));
    438440            array_push($clauses,
    439                        implode(' '.$search['fields']['author']['mode'].' ',
     441                       implode(' '.$search['fields'][$textfield]['mode'].' ',
    440442                               $local_clauses));
    441443          }
    442 
    443         // All words search (author included)
     444        }
     445
    444446        if (isset($search['fields']['allwords']))
    445447        {
    446                   $textfields = array('file', 'name', 'comment', 'keywords', 'author');
     448          $fields = array('file', 'name', 'comment', 'keywords', 'author');
    447449          // in the OR mode, request bust be :
    448450          // ((field1 LIKE '%word1%' OR field2 LIKE '%word1%')
     
    456458          {
    457459            $field_clauses = array();
    458             foreach ($textfields as $field)
     460            foreach ($fields as $field)
    459461            {
    460462              array_push($field_clauses, $field." LIKE '%".$word."%'");
Note: See TracChangeset for help on using the changeset viewer.