Changeset 629 for trunk/include/functions_category.inc.php
- Timestamp:
- Dec 2, 2004, 1:45:57 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r621 r629 417 417 // construction 418 418 $clauses = $temp_clauses = array(); 419 if (isset($search['fields'][' keywords']))420 419 if (isset($search['fields']['allwords'])) 420 { 421 421 $textfields = array('file', 'name', 'comment', 'keywords', 'author'); 422 422 foreach ($textfields as $textfield) 423 423 { 424 424 $local_clauses = array(); 425 foreach ($search['fields'][' keywords']['words'] as $word)425 foreach ($search['fields']['allwords']['words'] as $word) 426 426 { 427 427 array_push($local_clauses, $textfield." LIKE '%".$word."%'"); … … 430 430 array_walk($local_clauses,create_function('&$s','$s="(".$s.")";')); 431 431 array_push($temp_clauses, 432 implode(' '.$search['fields'][' keywords']['mode'].' ',432 implode(' '.$search['fields']['allwords']['mode'].' ', 433 433 $local_clauses)); 434 434 } 435 436 } 437 438 439 435 array_push($clauses, implode(' OR ', $temp_clauses)); 436 } 437 438 if (isset($search['fields']['author'])) 439 { 440 440 array_push($clauses, "author LIKE '%".$search['fields']['author']['words'][0]."%'"); 441 441 } 442 442 443 443 $datefields = array('date_available', 'date_creation'); … … 448 448 { 449 449 $local_clause = $datefield." "; 450 451 452 453 454 455 450 if (isset($search['fields'][$key]['mode'])) 451 { 452 $local_clause .=">"; 453 } 454 $local_clause .="= '"; 455 $local_clause.= str_replace('.', '-', 456 456 $search['fields'][$key]['words'][0]); 457 $local_clause.= "'"; 458 array_push($clauses, $local_clause); 459 460 if (isset($search['fields'][$key]['mode'])) 461 { 462 $search_tokens = explode('.', $search['fields'][$key]['words'][0]); 463 $start_time = mktime(0, 0, 0, $search_tokens[1], $search_tokens[2],$search_tokens[0]); 464 $search_duration = intval($search['fields'][$key]['mode']) * 86400; 465 $end_time = $start_time + $search_duration; 466 $end_sql_date = date('Y-m-d',$end_time); 467 $local_clause = $datefield." <= '".$end_sql_date."'"; 468 array_push($clauses, $local_clause); 469 } 470 } 471 } 457 $local_clause.= "'"; 458 array_push($clauses, $local_clause); 459 460 if (isset($search['fields'][$key]['mode'])) 461 { 462 $end_sql_date = str_replace('.', '-', 463 $search['fields'][$key]['mode']); 464 $local_clause = $datefield." <= '".$end_sql_date."'"; 465 array_push($clauses, $local_clause); 466 } 467 } 468 } 472 469 473 470 if (isset($search['fields']['cat']))
Note: See TracChangeset
for help on using the changeset viewer.