Index: /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php	(revision 12380)
+++ /extensions/Comments_on_Albums/language/en_UK/plugin.lang.php	(revision 12381)
@@ -15,3 +15,7 @@
 $lang['COA_comment_validation_link'] = 'Validation (if enabled) of comments on albums is on <a href="admin.php?page=comments&section=albums">the same page</a> as the comments on pictures.';
 
+/* stuffs */
+$lang['Last comments on albums'] = 'Last comments on albums';
+$lang['Display last posted comments on albums'] = 'Display last posted comments on albums';
+
 ?>
Index: /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php	(revision 12380)
+++ /extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php	(revision 12381)
@@ -14,4 +14,8 @@
   Vous pouvez ajouter les votres dans le dossier <i>plugins/comments_on_pictures/template/s26</i>.';
 $lang['COA_comment_validation_link'] = 'La validation (si activée) des commentaires sur les albums ce fait <a href="admin.php?page=comments&section=albums">sur la même page</a> que pour les commentaires sur les photos.';
+
+/* stuffs */
+$lang['Last comments on albums'] = 'Derniers commentaires sur les albums';
+$lang['Display last posted comments on albums'] = 'Affiche les derniers commentaires postés sur les albums';
   
 ?>
Index: /extensions/Comments_on_Albums/main.inc.php
===================================================================
--- /extensions/Comments_on_Albums/main.inc.php	(revision 12380)
+++ /extensions/Comments_on_Albums/main.inc.php	(revision 12381)
@@ -30,4 +30,5 @@
 add_event_handler('loc_end_admin', 'COA_admin_comments');
 add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
+add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module');
 
 
@@ -102,3 +103,17 @@
 }
 
+function COA_register_stuffs_module($modules) 
+{
+  load_language('plugin.lang', COA_PATH);
+  
+  array_push($modules, array(
+    'path' => COA_PATH . '/stuffs_module',
+    'name' => l10n('Last comments on albums'),
+    'description' => l10n('Display last posted comments on albums'),
+  ));
+
+  return $modules;
+}
+
+
 ?>
Index: /extensions/Comments_on_Albums/stuffs_module/config.inc.php
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/config.inc.php	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/config.inc.php	(revision 12381)
@@ -0,0 +1,43 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!isset($datas)) $datas = array(5, 'on', 'default', '', '');
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+  if (empty($_POST['nb_comments']))
+  {
+    array_push($page['errors'], l10n('lastcoms_no_nb_comments'));
+  }
+  else
+  {
+    $datas = array(
+      $_POST['nb_comments'],
+      isset($_POST['show_admin_buttons']),
+      $_POST['nb_cadres'],
+      $_POST['width'],
+      $_POST['height']
+      );
+  }
+}
+
+// Parametrage du template
+$template->assign('nb_cadres', array(
+  'OPTIONS' => array('default' => 'default', 1 => 1, 2 => 2, 3 => 3),
+  'SELECTED' => $datas[2]));
+
+$template->assign(array(
+  'NB_COMMENTS' => $datas[0],
+  'WIDTH'       => $datas[3],
+  'HEIGHT'      => $datas[4]
+));
+if ($datas[1])
+{
+  $template->assign(array('SHOW_ADMIN_BUTTONS' => 'checked="checked"'));
+}
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/Comments_on_Albums/stuffs_module/config.tpl
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/config.tpl	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/config.tpl	(revision 12381)
@@ -0,0 +1,29 @@
+<table>
+	<tr>
+		<td align="right"><br>{'lastcoms_nb_comments'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+		<input type="text" size="3" maxlength="2" value="{$NB_COMMENTS}" name="nb_comments"/></td>
+	</tr>
+	<tr>
+		<td align="right"><br>{'lastcoms_show_buttons'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+		<input type="checkbox" name="show_admin_buttons" value="on" {$SHOW_ADMIN_BUTTONS}/></td>
+	</tr>
+  <tr>
+		<td align="right"><br>{'lastcoms_nb_cadres'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+    {html_options name=nb_cadres options=$nb_cadres.OPTIONS selected=$nb_cadres.SELECTED}
+    </td>
+	</tr>
+  <tr>
+		<td align="right"><br>{'lastcoms_dim'|@translate} : &nbsp;&nbsp; {'lastcoms_width'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+		<input type="text" size="3" maxlength="3" value="{$WIDTH}" name="width"/>&nbsp;px</td>
+	</tr>
+	<tr>
+		<td align="right">{'lastcoms_height'|@translate} &nbsp;&nbsp;</td>
+		<td>
+		<input type="text" size="3" maxlength="3" value="{$HEIGHT}" name="height"/>&nbsp;px</td>
+	</tr>
+</table>
+<br>
Index: /extensions/Comments_on_Albums/stuffs_module/cr_stuffs.tpl
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/cr_stuffs.tpl	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/cr_stuffs.tpl	(revision 12381)
@@ -0,0 +1,35 @@
+{combine_css path=$block.CR_PATH|@cat:'template/style.css'}
+
+<ul class="thumbnailCategories">
+  {foreach from=$block.contests item=contest}
+  <li class="{$block.SIZE_CLASS} {if !$contest.VISIBLE}novisible{/if}">
+    <div class="thumbnailCategory">
+      <div class="illustration">
+        <a href="{$contest.URL}">
+        {if $contest.STATUS != 'finished' AND !empty($contest.LOGO)}
+          <img src="{$contest.LOGO}" alt="{$contest.NAME}" style="max-height:120px;max-width:120px;">
+        {elseif !empty($contest.RESULTS.1.TN_SRC)}
+          <img src="{$contest.RESULTS.1.TN_SRC}" alt="{$contest.NAME|@replace:'"':' '}">
+        {/if}
+        </a>
+      </div>
+      <div class="description">
+        <h3><a href="{$contest.URL}">{$contest.NAME}</a></h3>
+        <div class="text">
+          <p class="Nb_images">{$contest.DATE_BEGIN} - {$contest.DATE_END}</p>
+          <span class="CR_finished">({$contest.DAYS})</span>
+          <p>
+          {if $contest.STATUS != 'finished' AND !empty($contest.SUMMARY)}
+            {$contest.SUMMARY}
+          {else}
+            {foreach from=$contest.RESULTS item=result}
+              {'CR_order_'|cat:$result.RANK|@translate} {'CR_place'|@translate} - <u>{$result.AUTHOR}</u><br>
+            {/foreach}
+          {/if}
+          </p>
+        </div>
+      </div>
+    </div>
+  </li>
+  {/foreach}
+</ul>
Index: /extensions/Comments_on_Albums/stuffs_module/index.php
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/index.php	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/index.php	(revision 12381)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Comments_on_Albums/stuffs_module/main.inc.php
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/main.inc.php	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/main.inc.php	(revision 12381)
@@ -0,0 +1,190 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $user, $conf;
+
+// +-----------------------------------------------------------------------+
+// |                         comments management                           |
+// +-----------------------------------------------------------------------+
+// comments deletion
+if (isset($_GET['delete_album']) and is_numeric($_GET['delete_album']) and is_admin())
+{
+    check_status(ACCESS_ADMINISTRATOR);
+    check_pwg_token();
+    $query = '
+DELETE FROM ' . COA_TABLE . '
+  WHERE id=' . $_GET['delete_album'] . '
+;';
+    pwg_query($query);
+}
+
+// comments validation
+if (isset($_GET['validate_album']) and is_numeric($_GET['validate_album']) and is_admin())
+{
+    check_status(ACCESS_ADMINISTRATOR);
+    check_pwg_token();
+    $query = '
+UPDATE ' . COA_TABLE . '
+  SET validated = \'true\'
+  , validation_date = NOW()
+  WHERE id=' . $_GET['validate_album'] . '
+;';
+    pwg_query($query);
+}
+
+// +-----------------------------------------------------------------------+
+// |                        last comments display                          |
+// +-----------------------------------------------------------------------+
+$comments = array();
+$element_ids = array();
+$category_ids = array();
+$max_width = 0;
+if (!is_admin())
+{
+  $clauses[] = 'validated="true"';
+}
+$clauses[] = get_sql_condition_FandF (
+    array ('forbidden_categories' => 'category_id',
+        'visible_categories' => 'category_id',
+        'visible_images' => 'ic.image_id'), '', true);
+
+$query = '
+SELECT
+    com.id AS comment_id,
+    com.category_id,
+    com.author,
+    com.author_id,
+    '.$conf['user_fields']['username'].' AS username,
+    com.date,
+    com.content,
+    com.validated
+  FROM '.COA_TABLE.' AS com
+    LEFT JOIN '.USERS_TABLE.' As u
+      ON u.'.$conf['user_fields']['id'].' = com.author_id
+  WHERE '.implode('
+    AND ', $clauses).'
+  GROUP BY
+    comment_id
+  ORDER BY date DESC
+  LIMIT 0, ' . $datas[0] . '
+;';
+
+$result = pwg_query($query);
+while ($row = mysql_fetch_assoc($result))
+{
+  array_push($comments, $row);
+  array_push($element_ids, $row['category_id']);
+}
+
+if (count($comments) > 0)
+{
+  $block['TITLE_URL'] = 'comments.php?display_mode=albums';
+  $block['comments'] = array();
+
+  // retrieving category informations
+  $query = '
+SELECT 
+    cat.id, 
+    cat.name, 
+    cat.permalink, 
+    cat.uppercats, 
+    com.id as comment_id,
+    img.id AS image_id,
+    img.path,
+    img.tn_ext
+  FROM '.CATEGORIES_TABLE.' AS cat
+    LEFT JOIN '.COA_TABLE.' AS com
+      ON com.category_id = cat.id
+    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 
+      ON ucc.cat_id = cat.id AND ucc.user_id = '.$user['id'].'
+    LEFT JOIN '.IMAGES_TABLE.' AS img
+      ON img.id = ucc.user_representative_picture_id
+  '.get_sql_condition_FandF(
+    array(
+      'forbidden_categories' => 'cat.id',
+      'visible_categories' => 'cat.id'
+      ), 
+    'WHERE'
+    ).'
+    AND cat.id IN ('.implode(',', $element_ids).')
+;';
+  $categories = hash_from_query($query, 'comment_id');
+
+  foreach ($comments as $comment)
+  {
+    // category url
+    $comment['cat_url'] = duplicate_index_url(
+      array(
+        'category' => array(
+          'id' => $categories[$comment['comment_id']]['id'], 
+          'name' => $categories[$comment['comment_id']]['name'], 
+          'permalink' => $categories[$comment['comment_id']]['permalink'],
+          ),
+        array('start')
+        )
+      );
+     
+    // category thumbnail
+    $comment['thumb'] = get_thumbnail_url(
+      array(
+        'id' => $categories[$comment['comment_id']]['image_id'],
+        'path' => $categories[$comment['comment_id']]['path'],
+        'tn_ext' => @$categories[$comment['comment_id']]['tn_ext'],
+        )
+     );
+
+    // author
+    $author = $comment['author'];
+    if (empty($comment['author']))
+    {
+      $author = l10n('guest');
+    }
+    
+    // comment content
+    $tpl_comment = array(
+      'ID' => $comment['comment_id'],
+      'U_PICTURE' => $comment['cat_url'],
+      'ALT' => trigger_event('render_category_name', $categories[$comment['comment_id']]['name']),
+      'TN_SRC' => $comment['thumb'],
+      'AUTHOR' => trigger_event('render_comment_author', $author),
+      'DATE' => format_date($comment['date'], true),
+      'CONTENT' => trigger_event('render_comment_content', $comment['content'], 'album'),
+      'WIDTH' => $datas[3],
+      'HEIGHT' => $datas[4],
+      );
+
+    switch ($datas[2])
+    {
+      case 1 :
+        $tpl_comment['CLASS'] = 'one_comment';
+        break;
+      case 2 :
+        $tpl_comment['CLASS'] = 'two_comment';
+        break;
+      case 3 :
+        $tpl_comment['CLASS'] = 'three_comment';
+        break;
+    }
+
+    // actions
+    if ( is_admin() and $datas[1])
+    {
+      $url = get_root_url().'index.php'.get_query_string_diff(array('delete_album','validate_album'));
+      $tpl_comment['U_DELETE'] = add_url_params($url, array(
+            'delete_album' => $comment['comment_id'],
+            'pwg_token' => get_pwg_token()));
+
+      if ($comment['validated'] != 'true')
+      {
+        $tpl_comment['U_VALIDATE'] = add_url_params($url, array(
+            'validate_album' => $comment['comment_id'],
+            'pwg_token' => get_pwg_token()));
+      }
+    }
+    
+    array_push($block['comments'], $tpl_comment);
+  }
+  $block['TEMPLATE'] = dirname(__FILE__).'/stuffs_lastcoms.tpl';
+}
+
+?>
Index: /extensions/Comments_on_Albums/stuffs_module/stuffs_lastcoms.tpl
===================================================================
--- /extensions/Comments_on_Albums/stuffs_module/stuffs_lastcoms.tpl	(revision 12381)
+++ /extensions/Comments_on_Albums/stuffs_module/stuffs_lastcoms.tpl	(revision 12381)
@@ -0,0 +1,40 @@
+<div id="comments">
+<ul class="thumbnailCategories">
+{foreach from=$block.comments item=comment}
+<li {if isset($comment.CLASS)}class="{$comment.CLASS}"{/if}>
+	<div class="thumbnailCategory">
+    {if isset($comment.TN_SRC)}
+    <div class="illustration">
+      <a href="{$comment.U_PICTURE}">
+        <img src="{$comment.TN_SRC}" alt="{$comment.ALT}"
+          style="{if !empty($comment.WIDTH)}max-width: {$comment.WIDTH}px; {/if}{if !empty($comment.HEIGHT)}max-height: {$comment.HEIGHT}px; {/if}"/>
+        <br>{$comment.ALT}
+      </a>
+    </div>
+    {/if}
+    <div class="description">
+      {if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) }
+      <div class="actions" style="float:right">
+        {if !empty($comment.U_DELETE)}
+          <a href="{$comment.U_DELETE}" title="{'delete this comment'|@translate}" onClick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">
+            <img src="{$ROOT_URL}{$themeconf.icon_dir}/delete.png" class="button" alt="[delete]" />
+          </a>
+        {/if}
+        {if !empty($comment.U_VALIDATE)}
+          <a href="{$comment.U_VALIDATE}" title="validate this comment">
+            <img src="{$ROOT_URL}{$themeconf.icon_dir}/validate_s.png" class="button" alt="[validate]" />
+          </a>
+        {/if}
+      </div>
+      {/if}
+      <span class="author">{$comment.AUTHOR}</span> - <span class="date">{$comment.DATE}</span>
+      <blockquote>{$comment.CONTENT}</blockquote>
+    </div>
+  </div>
+</li>
+{if isset($comment_separator)}
+<hr/>
+{/if}
+{/foreach}
+</ul>
+</div>
Index: /extensions/Comments_on_Albums/template/comments_page.tpl
===================================================================
--- /extensions/Comments_on_Albums/template/comments_page.tpl	(revision 12380)
+++ /extensions/Comments_on_Albums/template/comments_page.tpl	(revision 12381)
@@ -18,4 +18,5 @@
 {/html_head}
 
+{if isset($MENUBAR)}{$MENUBAR}{/if}
 <div id="content" class="content">
 
