Index: extensions/ExtendedDescription/include/events.inc.php
===================================================================
--- extensions/ExtendedDescription/include/events.inc.php	(revision 26968)
+++ extensions/ExtendedDescription/include/events.inc.php	(revision 27027)
@@ -129,22 +129,9 @@
 
   // [cat=xx]
-  $patterns[] = '#\[cat=(\d*)\]#ie';
-  $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_cat_thumb("$1")';
-
   // [img=xx.yy,xx.yy,xx.yy;left|right|;name|titleName|]
-  $patterns[] = '#\[img([^\]]*)\]#ie';
-  $replacements[] = ($param == 'subcatify_category_description') ? '' : '[img] must be replaced by [photo]';
-
   // [photo id=xx album=yy size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no]
-  $patterns[] = '#\[photo ([^\]]+)\]#ie';
-  $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1")';
-
   // [random album=xx size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no]
-  $patterns[] = '#\[random([^\]]*)\]#ie';
-  $replacements[] = ($param == 'subcatify_category_description') ? '' : 'extdesc_get_random_photo("$1")';
-
   // [slider album=xx nb_images=yy random=yes|no list=aa,bb,cc size=SQ|TH|XXS|XS|S|M|L|XL|XXL speed=z title=yes|no effect=... arrows=yes|no control=yes|no|thumb elastic=yes|no thumbs_size=dd]
-  $patterns[] = '#\[slider ([^\]]+)\]#ie';
-  $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_slider("$1")';
+  $generic_pattern = '#\[(cat=|img|photo|random|slider)([^\]]*)\]#i';
 
   // <!--complete-->, <!--more--> et <!--up-down-->
@@ -153,6 +140,7 @@
     case 'subcatify_category_description' :
       $patterns[] = '#^(.*?)(' . preg_quote($conf['ExtendedDescription']['complete']) . '|' . preg_quote($conf['ExtendedDescription']['more']) . '|' . preg_quote($conf['ExtendedDescription']['up-down']) . ').*$#is';
-      $replacements[] = '$1';
+      $replacement = '$1';
       $desc = preg_replace($patterns, $replacements, $desc);
+      $desc = preg_replace($generic_pattern, '', $desc);
       break;
 
@@ -161,4 +149,5 @@
       $replacements[] = '';
       $desc = preg_replace($patterns, $replacements, $desc);
+      $desc = preg_replace_callback($generic_pattern, 'extended_desc_generic_callback', $desc);
 
       if (substr_count($desc, $conf['ExtendedDescription']['up-down']))
@@ -170,5 +159,5 @@
 
     default:
-      $desc = preg_replace($patterns, $replacements, $desc);
+      $desc = preg_replace_callback($generic_pattern, 'extended_desc_generic_callback', $desc);
   }
 
@@ -176,4 +165,30 @@
 }
 
+function extended_desc_generic_callback($matches)
+{
+  switch ($matches[1])
+  {
+    case 'cat=':
+      return get_cat_thumb($matches[2]);
+      break;
+      
+    case 'img':
+      return '[img] must be replaced by [photo]';
+      break;
+      
+    case 'photo':
+      return get_photo_sized($matches[2]);
+      break;
+      
+    case 'random':
+      return extdesc_get_random_photo($matches[2]);
+      break;
+      
+    case 'slider':
+      return get_slider($matches[2]);
+      break;
+  }
+}
+
 /**
  * Parse ED tags on NBM mail
@@ -195,8 +210,12 @@
   global $template, $conf;
 
-  $template->concat('PLUGIN_INDEX_CONTENT_END', '
-    <div class="additional_info">
-    ' . $conf['ExtendedDescription']['bottom_comment'] . '
-    </div>');
+  if (!empty($conf['ExtendedDescription']['bottom_comment']))
+  {
+    $template->concat('PLUGIN_INDEX_CONTENT_END', '
+      <div class="additional_info">
+      ' . $conf['ExtendedDescription']['bottom_comment'] . '
+      </div>'
+      );
+  }
 }
 
Index: extensions/ExtendedDescription/include/functions.inc.php
===================================================================
--- extensions/ExtendedDescription/include/functions.inc.php	(revision 26968)
+++ extensions/ExtendedDescription/include/functions.inc.php	(revision 27027)
@@ -8,4 +8,10 @@
 {
   global $template, $user;
+
+  $elem_id = intval($elem_id);
+  if ($elem_id<=0)
+  {
+    return '';
+  }
 
   $query = '
@@ -193,5 +199,5 @@
   if (empty($params['album']))
   {
-    $query = '
+    $query.= '
   WHERE 1=1 '
       .get_sql_condition_FandF(array(
