Changeset 2138 for trunk/include/functions_search.inc.php
- Timestamp:
- Oct 16, 2007, 3:46:09 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_search.inc.php
r2135 r2138 363 363 * 'as_is' => 1 (indicates the caller that items are ordered and permissions checked 364 364 * 'qs' => array( 365 * 'matching_tags' => array (85,86) -matching tags366 * 'matching_cats' => array (1,2,3) -matching categories365 * 'matching_tags' => array of matching tags 366 * 'matching_cats' => array of matching categories 367 367 * 'matching_cats_no_images' =>array(99) - matching categories without images 368 368 * )) … … 432 432 { // search name and url name (without accents) 433 433 $query = ' 434 SELECT id 434 SELECT id, name, url_name 435 435 FROM '.TAGS_TABLE.' 436 436 WHERE ('.str_replace($q_like_field, 'CONVERT(name, CHAR)', $q_like_clause).' 437 437 OR '.str_replace($q_like_field, 'url_name', $q_like_clause).')'; 438 $tag _ids = array_from_query($query, 'id');439 if ( !empty($tag_ids))438 $tags = hash_from_query($query, 'id'); 439 if ( !empty($tags) ) 440 440 { // we got some tags; get the images 441 $search_results['qs']['matching_tags']=$tag _ids;441 $search_results['qs']['matching_tags']=$tags; 442 442 $query = ' 443 443 SELECT image_id, COUNT(tag_id) AS weight 444 444 FROM '.IMAGE_TAG_TABLE.' 445 WHERE tag_id IN ('.implode(',', $tag_ids).')445 WHERE tag_id IN ('.implode(',',array_keys($tags)).') 446 446 GROUP BY image_id'; 447 447 $result = pwg_query($query); … … 458 458 global $user; 459 459 $query = ' 460 SELECT id, n b_images460 SELECT id, name, permalink, nb_images 461 461 FROM '.CATEGORIES_TABLE.' 462 462 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id … … 471 471 if ($row['nb_images']==0) 472 472 { 473 $search_results['qs']['matching_cats_no_images'][] = $row ['id'];473 $search_results['qs']['matching_cats_no_images'][] = $row; 474 474 } 475 475 else 476 476 { 477 $search_results['qs']['matching_cats'][ ] = $row['id'];477 $search_results['qs']['matching_cats'][$row['id']] = $row; 478 478 } 479 479 } … … 495 495 { 496 496 $where_clauses[]='category_id IN ('. 497 implode(',', $search_results['qs']['matching_cats']).')';497 implode(',',array_keys($search_results['qs']['matching_cats'])).')'; 498 498 } 499 499 $where_clauses = array( '('.implode("\n OR ",$where_clauses).')' );
Note: See TracChangeset
for help on using the changeset viewer.