aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/functions_search.inc.php22
-rw-r--r--include/section_init.inc.php4
-rw-r--r--index.php17
-rw-r--r--popuphelp.php6
-rw-r--r--search_rules.php4
5 files changed, 26 insertions, 27 deletions
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index c34d31463..3d7d768a7 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -362,8 +362,8 @@ function get_qsearch_like_clause($q, $field)
* 'items' => array(85,68,79...)
* 'as_is' => 1 (indicates the caller that items are ordered and permissions checked
* 'qs' => array(
- * 'matching_tags' => array(85,86) - matching tags
- * 'matching_cats' => array(1,2,3) - matching categories
+ * 'matching_tags' => array of matching tags
+ * 'matching_cats' => array of matching categories
* 'matching_cats_no_images' =>array(99) - matching categories without images
* ))
*
@@ -431,18 +431,18 @@ SELECT i.id,
if (!empty($q_like_clause))
{ // search name and url name (without accents)
$query = '
-SELECT id
+SELECT id, name, url_name
FROM '.TAGS_TABLE.'
WHERE ('.str_replace($q_like_field, 'CONVERT(name, CHAR)', $q_like_clause).'
OR '.str_replace($q_like_field, 'url_name', $q_like_clause).')';
- $tag_ids = array_from_query( $query, 'id');
- if (!empty($tag_ids))
+ $tags = hash_from_query($query, 'id');
+ if ( !empty($tags) )
{ // we got some tags; get the images
- $search_results['qs']['matching_tags']=$tag_ids;
+ $search_results['qs']['matching_tags']=$tags;
$query = '
SELECT image_id, COUNT(tag_id) AS weight
FROM '.IMAGE_TAG_TABLE.'
- WHERE tag_id IN ('.implode(',',$tag_ids).')
+ WHERE tag_id IN ('.implode(',',array_keys($tags)).')
GROUP BY image_id';
$result = pwg_query($query);
while ($row = mysql_fetch_assoc($result))
@@ -457,7 +457,7 @@ SELECT image_id, COUNT(tag_id) AS weight
// Step 3 - search categories corresponding to the query $q ==================
global $user;
$query = '
-SELECT id, nb_images
+SELECT id, name, permalink, nb_images
FROM '.CATEGORIES_TABLE.'
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id
WHERE user_id='.$user['id'].'
@@ -470,11 +470,11 @@ SELECT id, nb_images
{ // weight is important when sorting images by relevance
if ($row['nb_images']==0)
{
- $search_results['qs']['matching_cats_no_images'][] = $row['id'];
+ $search_results['qs']['matching_cats_no_images'][] = $row;
}
else
{
- $search_results['qs']['matching_cats'][] = $row['id'];
+ $search_results['qs']['matching_cats'][$row['id']] = $row;
}
}
@@ -494,7 +494,7 @@ SELECT id, nb_images
if ( !empty($search_results['qs']['matching_cats']) )
{
$where_clauses[]='category_id IN ('.
- implode(',',$search_results['qs']['matching_cats']).')';
+ implode(',',array_keys($search_results['qs']['matching_cats'])).')';
}
$where_clauses = array( '('.implode("\n OR ",$where_clauses).')' );
if (!empty($images_where))
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index a43d5ea0d..99dad6182 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -538,6 +538,10 @@ elseif ('tags' == $page['section'])
}
elseif ('recent_cats'==$page['section'])
{
+ $page['meta_robots']['noindex']=1;
+}
+elseif ('search'==$page['section'])
+{
$page['meta_robots']['nofollow']=1;
}
if ( $filter['enabled'] )
diff --git a/index.php b/index.php
index 49125e8ac..3a084147e 100644
--- a/index.php
+++ b/index.php
@@ -209,21 +209,16 @@ if ( $page['section']=='search' and $page['start']==0 and
$template->assign_var('QUERY_SEARCH',
htmlspecialchars($page['qsearch_details']['q']) );
- $found_cat_ids = array_merge(
+ $cats = array_merge(
(array)@$page['qsearch_details']['matching_cats_no_images'],
(array)@$page['qsearch_details']['matching_cats'] );
- if (count($found_cat_ids))
+ if (count($cats))
{
+ usort($cats, 'name_compare');
$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) )
+ foreach ( $cats as $cat )
{
- $hints[] = get_cat_display_name( array($row) );
+ $hints[] = get_cat_display_name( array($cat) );
}
$template->assign_block_vars( 'category_search_results',
array(
@@ -232,7 +227,7 @@ SELECT id, name, permalink FROM '.CATEGORIES_TABLE.'
);
}
- $tags = find_tags( (array)@$page['qsearch_details']['matching_tags'] );
+ $tags = (array)@$page['qsearch_details']['matching_tags'];
if (count($tags))
{
usort($tags, 'name_compare');
diff --git a/popuphelp.php b/popuphelp.php
index 1fdf19c30..4c8ee5895 100644
--- a/popuphelp.php
+++ b/popuphelp.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -40,6 +39,7 @@ check_status(ACCESS_GUEST);
$page['body_id'] = 'thePopuphelpPage';
$title = l10n('PhpWebGallery Help');
$page['page_banner'] = '<h1>'.$title.'</h1>';
+$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
include(PHPWG_ROOT_PATH.'include/page_header.php');
if
diff --git a/search_rules.php b/search_rules.php
index b3b213352..3ab6825b1 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -2,9 +2,8 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
@@ -49,6 +48,7 @@ include_once( PHPWG_ROOT_PATH.'include/functions_search.inc.php' );
$page['body_id'] = 'thePopuphelpPage';
$title = l10n('PhpWebGallery Help');
$page['page_banner'] = '<h1>'.$title.'</h1>';
+$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
include(PHPWG_ROOT_PATH.'include/page_header.php');
$template->set_filenames(array('search_rules' => 'search_rules.tpl'));