Index: extensions/PWG_Stuffs/trunk/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/main.inc.php	(revision 12401)
@@ -37,5 +37,5 @@
 function load_stuffs()
 {
-  global $template;
+  global $template, $conf;
 
   include(STUFFS_PATH . 'class.inc.php');
@@ -44,4 +44,5 @@
   $template->set_template_dir(STUFFS_PATH.'theme/template/');
   $template->set_filename('stuffs', 'stuffs_blocks.tpl');
+  $template->assign('SHOW_THUMBNAIL_CAPTION', $conf['show_thumbnail_caption']);
 
   $stuffs = new stuffs();
Index: extensions/PWG_Stuffs/trunk/modules/BestRated/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/modules/BestRated/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/modules/BestRated/main.inc.php	(revision 12401)
@@ -24,10 +24,10 @@
   );
 
-$query ='
+$query = '
 SELECT DISTINCT(i.id)
   FROM '.IMAGES_TABLE.' AS i
     INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id
     INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id
-  WHERE i.average_rate IS NOT NULL';
+  WHERE i.rating_score IS NOT NULL';
 
 if (isset($page['category']))
@@ -40,7 +40,7 @@
 $query .= '
       '.$forbidden.'
-      ORDER BY i.average_rate DESC, i.id ASC
-    LIMIT 0, '.$datas['nb_images'].'
-  ;';
+  ORDER BY i.rating_score DESC, i.id DESC
+  LIMIT 0, '.$datas['nb_images'].'
+;';
 
 $pictures = array();
@@ -127,17 +127,14 @@
     }
 
-    if ($conf['show_thumbnail_caption'])
-    {// name of the picture
-      if (isset($row['name']) and $row['name'] != '')
-      {
-        $name = $row['name'];
-      }
-      else
-      {
-        $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
-      }
+    if (isset($row['name']) and $row['name'] != '')
+    {
+      $name = $row['name'];
+    }
+    else
+    {
+      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
+    }
 
-      $tpl_var['NAME'] = '('.$row['average_rate'].') '.$name;
-    }
+    $tpl_var['NAME'] = '('.$row['rating_score'].') '.$name;
 
     if ( isset($nb_comments_of) )
Index: extensions/PWG_Stuffs/trunk/modules/FeaturedPhotos/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/modules/FeaturedPhotos/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/modules/FeaturedPhotos/main.inc.php	(revision 12401)
@@ -108,17 +108,14 @@
     }
 
-    if ($conf['show_thumbnail_caption'])
-    {// name of the picture
-      if (isset($row['name']) and $row['name'] != '')
-      {
-        $name = $row['name'];
-      }
-      else
-      {
-        $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
-      }
+    if (isset($row['name']) and $row['name'] != '')
+    {
+      $name = $row['name'];
+    }
+    else
+    {
+      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
+    }
 
-      $tpl_var['NAME'] = $name;
-    }
+    $tpl_var['NAME'] = $name;
 
     if ( isset($nb_comments_of) )
Index: extensions/PWG_Stuffs/trunk/modules/MostVisited/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/modules/MostVisited/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/modules/MostVisited/main.inc.php	(revision 12401)
@@ -127,22 +127,19 @@
     }
 
-    if ($conf['show_thumbnail_caption'])
-    {// name of the picture
-      if (isset($row['name']) and $row['name'] != '')
-      {
-        $name = $row['name'];
-      }
-      else
-      {
-        $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
-      }
+    if (isset($row['name']) and $row['name'] != '')
+    {
+      $name = $row['name'];
+    }
+    else
+    {
+      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
+    }
 
-      if ( !$user['show_nb_hits'])
-      {
-        $name = '('.$row['hit'].') '.$name;
-      }
+    if ( !$user['show_nb_hits'])
+    {
+      $name = '('.$row['hit'].') '.$name;
+    }
 
-      $tpl_var['NAME'] = $name;
-    }
+    $tpl_var['NAME'] = $name;
 
     if ( isset($nb_comments_of) )
Index: extensions/PWG_Stuffs/trunk/modules/Random/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/modules/Random/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/modules/Random/main.inc.php	(revision 12401)
@@ -121,22 +121,19 @@
       );
 
-    if ($user['show_nb_hits'])
+  if ($user['show_nb_hits'])
+  {
+    $tpl_var['NB_HITS'] = $row['hit'];
+  }
+
+    if (isset($row['name']) and $row['name'] != '')
     {
-      $tpl_var['NB_HITS'] = $row['hit'];
+      $name = $row['name'];
+    }
+    else
+    {
+      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
     }
 
-    if ($conf['show_thumbnail_caption'])
-    {// name of the picture
-      if (isset($row['name']) and $row['name'] != '')
-      {
-        $name = $row['name'];
-      }
-      else
-      {
-        $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
-      }
-
-      $tpl_var['NAME'] = $name;
-    }
+    $tpl_var['NAME'] = $name;
 
     if ( isset($nb_comments_of) )
Index: extensions/PWG_Stuffs/trunk/modules/Recent/main.inc.php
===================================================================
--- extensions/PWG_Stuffs/trunk/modules/Recent/main.inc.php	(revision 12357)
+++ extensions/PWG_Stuffs/trunk/modules/Recent/main.inc.php	(revision 12401)
@@ -122,17 +122,14 @@
     }
 
-    if ($conf['show_thumbnail_caption'])
-    {// name of the picture
-      if (isset($row['name']) and $row['name'] != '')
-      {
-        $name = $row['name'];
-      }
-      else
-      {
-        $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
-      }
+    if (isset($row['name']) and $row['name'] != '')
+    {
+      $name = $row['name'];
+    }
+    else
+    {
+      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
+    }
 
-      $tpl_var['NAME'] = $name;
-    }
+    $tpl_var['NAME'] = $name;
 
     if ( isset($nb_comments_of) )
