diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-10-12 03:27:34 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-10-12 03:27:34 +0000 |
commit | 4afa14cc8d3f26f841c92b083355004251d75087 (patch) | |
tree | 99606ff8bf43f5c30f50d191f3593a5ca6a43260 /index.php | |
parent | 36e0e6e8f1a455367f363048fc1825aebbd67eee (diff) |
- fix plugin menu link broken with xamp (realpath behaves differently)
- complete quick search rewriting
- now we can quote phrases as in google "New York" is not the same as New York
- user comments not searched anymore (faster)
- the big full text query does not use joins anymore (faster)
- related tags not shown on the index page, but now you can see the matching tags and matching categories
git-svn-id: http://piwigo.org/svn/trunk@2135 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 87 |
1 files changed, 50 insertions, 37 deletions
@@ -103,6 +103,7 @@ if ( count($page['items']) > 0) { $template_title.= ' ['.count($page['items']).']'; } +$template->assign_var('TITLE', $template_title); if (isset($page['flat']) or isset($page['chronology_field'])) { @@ -169,12 +170,6 @@ else // include menubar include(PHPWG_ROOT_PATH.'include/menubar.inc.php'); -$template->assign_vars( - array( - 'TITLE' => $template_title - ) - ); - if ('search' == $page['section']) { $template->assign_block_vars( @@ -199,42 +194,61 @@ if (isset($page['category']) and is_admin()) if (is_admin() and !empty($page['items']) ) { - $template->assign_block_vars( - 'caddie', - array( - 'URL' => - add_url_params(duplicate_index_url(), array('caddie'=>1) ) - ) - ); - } + $template->assign_block_vars( + 'caddie', + array( + 'URL' => + add_url_params(duplicate_index_url(), array('caddie'=>1) ) + ) + ); +} -if ( $page['section']=='search' and $page['start']==0 ) +if ( $page['section']=='search' and $page['start']==0 and + !isset($page['chronology_field']) and isset($page['qsearch_details']) ) { - $tags = get_common_tags($page['items'], - $conf['content_tag_cloud_items_number'], null); - if ( count($tags)>1 ) - { - $template->assign_block_vars('related_tags', array() ); + $template->assign_var('QUERY_SEARCH', + htmlspecialchars($page['qsearch_details']['q']) ); - $tags = add_level_to_tags($tags); - foreach ($tags as $tag) + $found_cat_ids = array_merge( + (array)@$page['qsearch_details']['matching_cats_no_images'], + (array)@$page['qsearch_details']['matching_cats'] ); + if (count($found_cat_ids)) + { + $hints = array(); + $query = ' +SELECT id, name, permalink FROM '.CATEGORIES_TABLE.' + WHERE id IN ('.implode(',', $found_cat_ids).') + ORDER BY name + LIMIT 10'; + $result = pwg_query($query); + while ( $row = mysql_fetch_assoc($result) ) { - $template->assign_block_vars( - 'related_tags.tag', array( - 'URL' => make_index_url( - array( - 'tags' => array($tag) - ) - ), - 'NAME' => $tag['name'], - 'TITLE' => l10n_dec( - '%d picture are also linked to current tags', - '%d pictures are also linked to current tags', - $tag['counter']), - 'CLASS' => 'tagLevel'.$tag['level'] - ) + $hints[] = get_cat_display_name( array($row) ); + } + $template->assign_block_vars( 'category_search_results', + array( + 'CONTENT' => implode(' — ', $hints) + ) ); + } + + $tags = find_tags( (array)@$page['qsearch_details']['matching_tags'] ); + if (count($tags)) + { + usort($tags, 'name_compare'); + $hints = array(); + foreach ( $tags as $tag ) + { + $hints[] = + '<a href="' . make_index_url(array('tags'=>array($tag))) . '">' + .$tag['name'] + .'</a>'; } + $template->assign_block_vars( 'tag_search_results', + array( + 'CONTENT' => implode(' — ', $hints) + ) + ); } } @@ -299,7 +313,6 @@ if (isset($page['comment']) and $page['comment'] != '') 'COMMENTS' => $page['comment'] ) ); - $header_infos['COMMENT'] = strip_tags($page['comment']); } //------------------------------------------------------------ log informations pwg_log(); |