Index: trunk/include/calendar_base.class.php
===================================================================
--- trunk/include/calendar_base.class.php	(revision 27364)
+++ trunk/include/calendar_base.class.php	(revision 27369)
@@ -247,5 +247,5 @@
   GROUP BY period;';
 
-    $level_items = simple_hash_from_query($query, 'period', 'nb_images');
+    $level_items = query2array($query, 'period', 'nb_images');
 
     if ( count($level_items)==1 and
@@ -318,5 +318,5 @@
     
     $current = implode('-', $page['chronology_date'] );
-    $upper_items = array_from_query( $query, 'period');
+    $upper_items = query2array($query,null, 'period');
 
     usort($upper_items, 'version_compare');
Index: trunk/include/category_default.inc.php
===================================================================
--- trunk/include/category_default.inc.php	(revision 27364)
+++ trunk/include/category_default.inc.php	(revision 27369)
@@ -85,5 +85,5 @@
   GROUP BY image_id
 ;';
-    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+    $nb_comments_of = query2array($query, 'image_id', 'nb_comments');
   }
 }
Index: trunk/include/functions.inc.php
===================================================================
--- trunk/include/functions.inc.php	(revision 27364)
+++ trunk/include/functions.inc.php	(revision 27369)
@@ -1254,13 +1254,5 @@
 function simple_hash_from_query($query, $keyname, $valuename)
 {
-  $array = array();
-
-  $result = pwg_query($query);
-  while ($row = pwg_db_fetch_assoc($result))
-  {
-    $array[ $row[$keyname] ] = $row[$valuename];
-  }
-
-  return $array;
+	return query2array($query, $keyname, $valuename);
 }
 
@@ -1276,11 +1268,5 @@
 function hash_from_query($query, $keyname)
 {
-  $array = array();
-  $result = pwg_query($query);
-  while ($row = pwg_db_fetch_assoc($result))
-  {
-    $array[ $row[$keyname] ] = $row;
-  }
-  return $array;
+	return query2array($query, $keyname);
 }
 
@@ -1297,22 +1283,12 @@
 function array_from_query($query, $fieldname=false)
 {
-  $array = array();
-
-  $result = pwg_query($query);
   if (false === $fieldname)
   {
-    while ($row = pwg_db_fetch_assoc($result))
-    {
-      $array[] = $row;
-    }
+		return query2array($query);
   }
   else
   {
-    while ($row = pwg_db_fetch_assoc($result))
-    {
-      $array[] = $row[$fieldname];
-    }
-  }
-  return $array;
+		return query2array($query, null, $fieldname);
+  }
 }
 
Index: trunk/include/functions_category.inc.php
===================================================================
--- trunk/include/functions_category.inc.php	(revision 27364)
+++ trunk/include/functions_category.inc.php	(revision 27369)
@@ -206,5 +206,5 @@
     WHERE id IN ('.$cat['uppercats'].')
   ;';
-    $names = hash_from_query($query, 'id');
+    $names = query2array($query, 'id');
 
     // category names must be in the same order than uppercats list
@@ -303,5 +303,5 @@
                                     $fullname = true)
 {
-  $categories = array_from_query($query);
+  $categories = query2array($query);
   usort($categories, 'global_rank_compare');
   display_select_categories($categories, $selecteds, $blockname, $fullname);
@@ -363,5 +363,5 @@
   WHERE permalink IN ('.$in.')
 ;';
-  $perma_hash = hash_from_query($query, 'permalink');
+  $perma_hash = query2array($query, 'permalink');
 
   if ( empty($perma_hash) )
Index: trunk/include/functions_html.inc.php
===================================================================
--- trunk/include/functions_html.inc.php	(revision 27364)
+++ trunk/include/functions_html.inc.php	(revision 27369)
@@ -114,5 +114,5 @@
   FROM '.CATEGORIES_TABLE.'
 ;';
-    $cache['cat_names'] = hash_from_query($query, 'id');
+    $cache['cat_names'] = query2array($query, 'id');
   }
 
Index: trunk/include/functions_notification.inc.php
===================================================================
--- trunk/include/functions_notification.inc.php	(revision 27364)
+++ trunk/include/functions_notification.inc.php	(revision 27369)
@@ -218,5 +218,5 @@
       }
       $query = 'SELECT DISTINCT '.$field_id.' '.$query.';';
-      $infos = array_from_query($query);
+      $infos = query2array($query);
       return $infos;
       break;
@@ -457,5 +457,5 @@
   LIMIT '.$max_dates.'
 ;';
-  $dates = array_from_query($query);
+  $dates = query2array($query);
 
   for ($i=0; $i<count($dates); $i++)
@@ -472,5 +472,5 @@
   LIMIT '.$max_elements.'
 ;';
-      $dates[$i]['elements'] = array_from_query($query);
+      $dates[$i]['elements'] = query2array($query);
     }
 
@@ -490,5 +490,5 @@
   LIMIT '.$max_cats.'
 ;';
-      $dates[$i]['categories'] = array_from_query($query);
+      $dates[$i]['categories'] = query2array($query);
     }
   }
