Changeset 2138
- Timestamp:
- Oct 16, 2007, 3:46:09 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 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).')' ); -
trunk/include/section_init.inc.php
r2135 r2138 539 539 elseif ('recent_cats'==$page['section']) 540 540 { 541 $page['meta_robots']['noindex']=1; 542 } 543 elseif ('search'==$page['section']) 544 { 541 545 $page['meta_robots']['nofollow']=1; 542 546 } -
trunk/index.php
r2135 r2138 210 210 htmlspecialchars($page['qsearch_details']['q']) ); 211 211 212 $ found_cat_ids = array_merge(212 $cats = array_merge( 213 213 (array)@$page['qsearch_details']['matching_cats_no_images'], 214 214 (array)@$page['qsearch_details']['matching_cats'] ); 215 if (count($found_cat_ids)) 216 { 215 if (count($cats)) 216 { 217 usort($cats, 'name_compare'); 217 218 $hints = array(); 218 $query = ' 219 SELECT id, name, permalink FROM '.CATEGORIES_TABLE.' 220 WHERE id IN ('.implode(',', $found_cat_ids).') 221 ORDER BY name 222 LIMIT 10'; 223 $result = pwg_query($query); 224 while ( $row = mysql_fetch_assoc($result) ) 219 foreach ( $cats as $cat ) 225 220 { 226 $hints[] = get_cat_display_name( array($ row) );221 $hints[] = get_cat_display_name( array($cat) ); 227 222 } 228 223 $template->assign_block_vars( 'category_search_results', … … 233 228 } 234 229 235 $tags = find_tags( (array)@$page['qsearch_details']['matching_tags'] );230 $tags = (array)@$page['qsearch_details']['matching_tags']; 236 231 if (count($tags)) 237 232 { -
trunk/popuphelp.php
r2126 r2138 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 // | branch : BSF (Best So Far) 8 // | file : $RCSfile$ 7 // | file : $Id$ 9 8 // | last update : $Date$ 10 9 // | last modifier : $Author$ … … 41 40 $title = l10n('PhpWebGallery Help'); 42 41 $page['page_banner'] = '<h1>'.$title.'</h1>'; 42 $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1); 43 43 include(PHPWG_ROOT_PATH.'include/page_header.php'); 44 44 -
trunk/search_rules.php
r1900 r2138 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | 6 // +-----------------------------------------------------------------------+ 7 // | branch : BSF (Best So Far) 5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 // +-----------------------------------------------------------------------+ 8 7 // | file : $Id$ 9 8 // | last update : $Date$ … … 50 49 $title = l10n('PhpWebGallery Help'); 51 50 $page['page_banner'] = '<h1>'.$title.'</h1>'; 51 $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1); 52 52 include(PHPWG_ROOT_PATH.'include/page_header.php'); 53 53
Note: See TracChangeset
for help on using the changeset viewer.