Index: /extensions/PWG_Stuffs/modules/bestrated/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/bestrated/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/bestrated/config.inc.php	(revision 5726)
@@ -0,0 +1,37 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!isset($datas))
+{
+  $datas = array(
+    'nb_images'     => 10,
+    'cat_display'   => 'all',
+    'cat_selection' => array(),
+  );
+}
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser())
+{
+  $datas = array(
+    'nb_images' => intval($_POST['nb_images']),
+    'cat_display' => $_POST['cat_display'],
+    'cat_selection' => $_POST['cat_selection'],
+    );
+  unset($_POST['on_picture']);
+}
+
+// Parametrage du template
+$query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';';
+display_select_cat_wrapper($query,array(),'category_selection');
+
+$template->assign(array(
+  'NB_IMAGES' => $datas['nb_images'],
+  'cat_display' => $datas['cat_display'],
+  'category_selected' => $datas['cat_selection']
+));
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/bestrated/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/bestrated/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/bestrated/config.tpl	(revision 5726)
@@ -0,0 +1,88 @@
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
+
+<table>
+	<tr>
+		<td align="right"><br>{'stuffs_mv_nb_images'|@translate} &nbsp;&nbsp;</td>
+		<td><br><input type="text" name="nb_images" size="3" maxlength="2" value="{$NB_IMAGES}"></td>
+	</tr>
+	<tr class="cat_options" style="display: none;">
+		<td align="right"><br>{'stuffs_mv_category_display'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+      <select name="cat_display">
+        <option label="{'stuffs_mv_all_cats'|@translate}" value="all" {if $cat_display == 'all'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_all_cats'|@translate}</option>
+        <option label="{'stuffs_mv_wo_thumb'|@translate}" value="wo_thumb" {if $cat_display == 'wo_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_wo_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_w_thumb'|@translate}" value="w_thumb" {if $cat_display == 'w_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_w_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_selected_cats'|@translate}" value="selected_cats" {if $cat_display == 'selected_cats'}selected="selected"{/if} onClick="javascript: show_cat_list();">{'stuffs_mv_selected_cats'|@translate}</option>
+      </select>
+    </td>
+	</tr>
+	<tr class="cat_selection" style="display: none;">
+		<td align="right">
+      <br>{'stuffs_mv_cat_selection'|@translate} &nbsp;&nbsp;
+      <br>({'stuffs_mv_hold_ctrl'|@translate}) &nbsp;&nbsp;</td>
+		<td><br>
+		  <select class="categoryList" name="cat_selection[]" multiple="multiple" size="30">
+        {html_options options=$category_selection selected=$category_selected}
+      </select></td>
+	</tr>
+</table>
+<br>
+
+{literal}
+<script type="text/javascript">
+resize = false;
+function show_cat_list()
+{
+  jQuery('.cat_selection').show();
+  if (!resize)
+  {
+    resize = true;
+    jQuery('.categoryList').resizable({
+      handles: "all",
+      animate: true,
+      animateDuration: "slow",
+      animateEasing: "swing",
+      preventDefault: true,
+      preserveCursor: true,
+      autoHide: true,
+      ghost: true
+    });
+  }
+}
+
+function hide_cat_list()
+{
+  jQuery('.cat_selection').hide();
+}
+
+jQuery().ready( function () {
+  jQuery("input[name='on_cats']").click( function() {
+    if (this.checked)
+    {
+      jQuery('.cat_options').show();
+      if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+        show_cat_list();
+    }
+    else
+    {
+      jQuery('.cat_options').hide();
+      hide_cat_list();
+    }
+  });
+});
+
+if (document.getElementsByName("on_cats")[0].checked)
+{
+  jQuery('.cat_options').show();
+  if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+  {
+    show_cat_list();
+  }
+}
+
+jQuery("table:eq(1) tr:eq(5)").hide();
+</script>
+{/literal}
+
Index: /extensions/PWG_Stuffs/modules/bestrated/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/bestrated/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/bestrated/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/bestrated/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/bestrated/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/bestrated/main.inc.php	(revision 5726)
@@ -0,0 +1,163 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $page, $user, $conf, $template;
+
+if (script_basename() == 'picture'
+  or ($datas['cat_display'] == 'wo_thumb' and !empty($page['items']))
+  or ($datas['cat_display'] == 'w_thumb' and empty($page['items']) and isset($page['category']))
+  or ($datas['cat_display'] == 'selected_cats' and isset($page['category']) and !in_array($page['category']['id'], $datas['cat_selection'])))
+{
+  return false;
+}
+
+$forbidden = get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'ic.category_id',
+        'visible_categories' => 'ic.category_id',
+        'visible_images' => 'i.id'
+      ),
+    'AND'
+  );
+
+$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';
+
+if (isset($page['category']))
+{
+  $query .= '
+        AND ( c.uppercats LIKE \''.$page['category']['uppercats'].',%\' OR c.id = '.$page['category']['id'].' )
+  ';
+}
+
+$query .= '
+      '.$forbidden.'
+      ORDER BY i.average_rate DESC, i.id ASC
+    LIMIT 0, '.$datas['nb_images'].'
+  ;';
+
+$pictures = array();
+$selection = array_from_query($query, 'id');
+ 
+if (count($selection) > 0)
+{
+  $rank_of = array_flip($selection);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $selection).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+
+    array_push($pictures, $row);
+  }
+
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+if (count($pictures) > 0)
+{
+  if ($user['show_nb_comments'])
+  {
+    $query = '
+SELECT image_id, COUNT(*) AS nb_comments
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated = \'true\'
+    AND image_id IN ('.implode(',', $selection).')
+  GROUP BY image_id
+;';
+    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+  }
+
+  // template thumbnail initialization
+  $template->set_filenames( array( 'pwgs_best_rated' => 'thumbnails.tpl',));
+
+  trigger_action('loc_begin_index_thumbnails', $pictures);
+  $tpl_thumbnails_var = array();
+
+  foreach ($pictures as $row)
+  {
+    // link on picture.php page
+    $url = duplicate_picture_url(
+          array(
+            'image_id' => $row['id'],
+            'image_file' => $row['file']
+          ),
+          array('start')
+        );
+    $url = add_url_params($url, array('pwgs_br' => implode(',',$selection)));
+
+    $tpl_var =
+      array(
+        'ID'        => $row['id'],
+        'TN_SRC'    => get_thumbnail_url($row),
+        'TN_ALT'    => $row['file'],
+        'TN_TITLE'  => get_thumbnail_title($row),
+        'ICON_TS'   => get_icon($row['date_available']),
+        'URL'       => $url,
+
+     /* Fields for template-extension usage */
+        'FILE_PATH' => $row['path'],
+        'FILE_POSTED' => $row['date_available'],
+        'FILE_CREATED' => $row['date_creation'],
+        'FILE_DESC' => $row['comment'],
+        'FILE_AUTHOR' => $row['author'],
+        'FILE_HIT' => $row['hit'],
+        'FILE_SIZE' => $row['filesize'],
+        'FILE_WIDTH' => $row['width'],
+        'FILE_HEIGHT' => $row['height'],
+        'FILE_METADATE' => $row['date_metadata_update'],
+        'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+                  true:false, /* lack of include/functions_picture.inc.php */
+      );
+
+    if ($user['show_nb_hits'])
+    {
+      $tpl_var['NB_HITS'] = $row['hit'];
+    }
+
+    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'] = '('.$row['average_rate'].') '.$name;
+    }
+
+    if ( isset($nb_comments_of) )
+    {
+      $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']];
+    }
+
+    $tpl_thumbnails_var[] = $tpl_var;
+  }
+
+  $tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
+  $template->assign('thumbnails', $tpl_thumbnails_var);
+
+  $block['CONTENT'] = $template->parse('pwgs_best_rated', true);
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/citation/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/citation/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/citation/config.inc.php	(revision 5726)
@@ -0,0 +1,39 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+if (!isset($datas)) {
+  $default_fr_value  = '<script type="text/javascript" ';
+  $default_fr_value .= 'src="http://citations.hasarddujour.com/'; 
+  $default_fr_value .= 'citation-hasard-du-jour.php?random"></script>';
+  $datas = array(
+      'quote_lang'    => array(
+          "fr_FR" => $default_fr_value
+        ),
+    );
+}
+$available_languages = get_languages();
+// Save configuration
+if (isset($_POST['submit']) and !is_adviser()) {
+  $new_data = array();
+  foreach (array_keys($available_languages) as $current_lang) {
+    $quote_value_key = 'quote_config_' . $current_lang;
+    if ((isset($_POST[$quote_value_key])) and
+        ("" != $_POST[$quote_value_key])) {
+      $new_data = array_merge(
+          $new_data,
+          array($current_lang => stripslashes($_POST[$quote_value_key]))
+        );
+    }
+  }
+  $datas = array(
+      'quote_lang'  => $new_data
+    );
+}
+global $user;
+$template->assign('MODULE_QUOTE_DATA', $datas['quote_lang']);
+$template->assign('MODULE_QUOTE_LANGUAGES', $available_languages);
+$template->set_filenames(array(
+    'module_options' => dirname(__FILE__) . '/config.tpl')
+  );
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+?>
Index: /extensions/PWG_Stuffs/modules/citation/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/citation/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/citation/config.tpl	(revision 5726)
@@ -0,0 +1,17 @@
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
+<table>
+    <tr>
+        <td align="center" colspan="2"><b>{'module_Citation_lang'|@translate}</b></td>
+        <td align="center"><b>{'module_Citation_code'|@translate}</b></td>
+    </tr>
+{foreach from=$MODULE_QUOTE_LANGUAGES item=language key=language_key}
+    <tr>
+        <td align="right">{$language}</td>
+        <td>&nbsp;</td>
+        <td><textarea cols="50" rows="2" name="quote_config_{$language_key}" id="quote_config_{$language_key}" class="description" style="height: 2em">{$MODULE_QUOTE_DATA[$language_key]}</textarea></td>
+    </tr>
+{/foreach}
+</table>
+<br>
Index: /extensions/PWG_Stuffs/modules/citation/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/citation/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/citation/index.php	(revision 5726)
@@ -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,v 1.2 2009/07/07 10:02:11 Criss Exp $
+// | last update   : $Date: 2009/07/07 10:02:11 $
+// | last modifier : $Author: Criss $
+// | revision      : $Revision: 1.2 $
+// +-----------------------------------------------------------------------+
+// | 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/PWG_Stuffs/modules/citation/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/citation/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/citation/main.inc.php	(revision 5726)
@@ -0,0 +1,11 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $user;
+
+if ((isset($datas['quote_lang'][$user['language']])) and
+    ("" != $datas['quote_lang'][$user['language']])) {
+  $block['CONTENT'] = $datas['quote_lang'][$user['language']];
+} else {
+  return false;
+}
+?>
Index: /extensions/PWG_Stuffs/modules/featuredphotos/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/featuredphotos/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/featuredphotos/config.inc.php	(revision 5726)
@@ -0,0 +1,8 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/featuredphotos/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/featuredphotos/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/featuredphotos/config.tpl	(revision 5726)
@@ -0,0 +1,1 @@
+<p>{'stuffs_no_options'|@translate}</p>
Index: /extensions/PWG_Stuffs/modules/featuredphotos/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/featuredphotos/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/featuredphotos/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/featuredphotos/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/featuredphotos/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/featuredphotos/main.inc.php	(revision 5726)
@@ -0,0 +1,144 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $page, $user, $conf, $template;
+
+$forbidden = get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'ic.category_id',
+        'visible_categories' => 'ic.category_id',
+        'visible_images' => 'i.id'
+      ),
+    'AND'
+  );
+  
+$query ='
+SELECT DISTINCT(i.id)
+  FROM '.IMAGES_TABLE.' AS i
+    INNER JOIN '.FAVORITES_TABLE.' AS f       ON f.image_id = i.id
+    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 f.user_id = '.$conf['webmaster_id'].'
+       '.$forbidden.';';
+
+$pictures = array();
+$selection = array_from_query($query, 'id');
+
+if (count($selection) > 0)
+{
+  $rank_of = array_flip($selection);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $selection).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+
+    array_push($pictures, $row);
+  }
+
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+if (count($pictures) > 0)
+{
+  if ($user['show_nb_comments'])
+  {
+    $query = '
+SELECT image_id, COUNT(*) AS nb_comments
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated = \'true\'
+    AND image_id IN ('.implode(',', $selection).')
+  GROUP BY image_id
+;';
+    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+  }
+
+  // template thumbnail initialization
+  $template->set_filenames( array( 'pwgs_feat' => 'thumbnails.tpl',));
+
+  trigger_action('loc_begin_index_thumbnails', $pictures);
+  $tpl_thumbnails_var = array();
+
+  foreach ($pictures as $row)
+  {
+    // link on picture.php page
+    $url = duplicate_picture_url(
+          array(
+            'image_id' => $row['id'],
+            'image_file' => $row['file']
+          ),
+          array('start')
+        );
+    $url = add_url_params($url, array('pwgs_ra' => implode(',',$selection)));
+
+    $tpl_var =
+      array(
+        'ID'        => $row['id'],
+        'TN_SRC'    => get_thumbnail_url($row),
+        'TN_ALT'    => $row['file'],
+        'TN_TITLE'  => get_thumbnail_title($row),
+        'ICON_TS'   => get_icon($row['date_available']),
+        'URL'       => $url,
+
+     /* Fields for template-extension usage */
+        'FILE_PATH' => $row['path'],
+        'FILE_POSTED' => $row['date_available'],
+        'FILE_CREATED' => $row['date_creation'],
+        'FILE_DESC' => $row['comment'],
+        'FILE_AUTHOR' => $row['author'],
+        'FILE_HIT' => $row['hit'],
+        'FILE_SIZE' => $row['filesize'],
+        'FILE_WIDTH' => $row['width'],
+        'FILE_HEIGHT' => $row['height'],
+        'FILE_METADATE' => $row['date_metadata_update'],
+        'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+                  true:false, /* lack of include/functions_picture.inc.php */
+      );
+
+    if ($user['show_nb_hits'])
+    {
+      $tpl_var['NB_HITS'] = $row['hit'];
+    }
+
+    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;
+    }
+
+    if ( isset($nb_comments_of) )
+    {
+      $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']];
+    }
+
+    $tpl_thumbnails_var[] = $tpl_var;
+  }
+
+  $tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
+  $template->assign('thumbnails', $tpl_thumbnails_var);
+
+  $block['CONTENT'] = $template->parse('pwgs_feat', true);
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/lastcoms/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/lastcoms/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/lastcoms/config.inc.php	(revision 5726)
@@ -0,0 +1,47 @@
+<?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']) and !is_adviser())
+{
+  if (empty($_POST['nb_comments']))
+  {
+    array_push($page['errors'], l10n('lastcoms_no_nb_comments'));
+  }
+  else
+  {
+    if (!isset($_POST['show_admin_buttons']))
+    {
+      $_POST['show_admin_buttons'] = 'off';
+    }
+    $datas = array(
+      $_POST['nb_comments'],
+      $_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] == 'on')
+{
+  $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/PWG_Stuffs/modules/lastcoms/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/lastcoms/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/lastcoms/config.tpl	(revision 5726)
@@ -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/PWG_Stuffs/modules/lastcoms/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/lastcoms/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/lastcoms/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/lastcoms/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/lastcoms/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/lastcoms/main.inc.php	(revision 5726)
@@ -0,0 +1,187 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $user, $conf;
+
+// +-----------------------------------------------------------------------+
+// |                         comments management                           |
+// +-----------------------------------------------------------------------+
+// comments deletion
+if (isset($_GET['delete']) and is_numeric($_GET['delete']) and is_admin() and !is_adviser())
+{
+    check_status(ACCESS_ADMINISTRATOR);
+    check_pwg_token();
+    $query = '
+DELETE FROM ' . COMMENTS_TABLE . '
+  WHERE id=' . $_GET['delete'] . '
+;';
+    pwg_query($query);
+}
+
+// comments validation
+if (isset($_GET['validate']) and is_numeric($_GET['validate']) and is_admin() and !is_adviser())
+{
+    check_status(ACCESS_ADMINISTRATOR);
+    check_pwg_token();
+    $query = '
+UPDATE ' . COMMENTS_TABLE . '
+  SET validated = \'true\'
+  , validation_date = NOW()
+  WHERE id=' . $_GET['validate'] . '
+;';
+    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.image_id
+   , ic.category_id
+   , com.author
+   , com.date
+   , com.content
+   , com.id AS comment_id
+   , com.validated
+   FROM ' . IMAGE_CATEGORY_TABLE . ' AS ic
+   INNER JOIN ' . COMMENTS_TABLE . ' AS com
+   ON ic.image_id = com.image_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['image_id']);
+  array_push($category_ids, $row['category_id']);
+}
+
+if (count($comments) > 0)
+{
+  $block['TITLE_URL'] = 'comments.php';
+  $block['comments'] = array();
+
+  // retrieving element informations
+  $elements = array();
+  $query = '
+SELECT id, name, file, path, tn_ext
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $element_ids).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $elements[$row['id']] = $row;
+  }
+
+  // retrieving category informations
+  $query = '
+SELECT id, name, permalink, uppercats
+  FROM '.CATEGORIES_TABLE.'
+  WHERE id IN ('.implode(',', $category_ids).')
+;';
+  $categories = hash_from_query($query, 'id');
+
+  foreach ($comments as $comment)
+  {
+    if (!empty($elements[$comment['image_id']]['name']))
+    {
+      $name=$elements[$comment['image_id']]['name'];
+    }
+    else
+    {
+      $name=get_name_from_file($elements[$comment['image_id']]['file']);
+    }
+
+    // source of the thumbnail picture
+    $thumbnail_src = get_thumbnail_url( $elements[$comment['image_id']] );
+
+    // link to the full size picture
+    $url = make_picture_url(
+            array(
+              'category' => $categories[ $comment['category_id'] ],
+              'image_id' => $comment['image_id'],
+              'image_file' => $elements[$comment['image_id']]['file'],
+            )
+          );
+
+    $author = $comment['author'];
+    if (empty($comment['author']))
+    {
+      $author = l10n('guest');
+    }
+
+    $tpl_comment =
+      array(
+        'U_PICTURE' => $url,
+        'TN_SRC' => $thumbnail_src,
+        'ALT' => $name,
+        'AUTHOR' => trigger_event('render_comment_author', $author),
+        'DATE' => format_date($comment['date'],'mysql_datetime',true),
+        'CONTENT' => trigger_event('render_comment_content',$comment['content']),
+        '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;
+    }
+
+    if ( is_admin() )
+    {
+      $url = get_root_url().'index.php'.get_query_string_diff(array('delete','validate'));
+      $tpl_comment['U_DELETE'] = add_url_params($url, array(
+            'delete' => $comment['comment_id'],
+            'pwg_token' => get_pwg_token()));
+
+            if ($comment['validated'] != 'true')
+      {
+        $tpl_comment['U_VALIDATE'] = add_url_params($url, array(
+            'validate' => $comment['comment_id'],
+            'pwg_token' => get_pwg_token()));
+      }
+    }
+
+    // Show comment editor link
+    if (defined('CE_PATH') and ((!is_a_guest() and ($user[$conf['user_fields']['username']] == $author)) or is_admin()))
+    {
+      load_language('plugin.lang', CE_PATH);
+      $tpl_comment['U_EDIT'] = add_url_params(get_root_url() . 'index.php', array(
+            CE_ACTION => CE_ACTION_EDIT,
+            CE_ID => $comment['comment_id'],
+            'pwg_token' => get_pwg_token()));
+    }
+    array_push($block['comments'], $tpl_comment);
+  }
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/logon/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/logon/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/logon/config.inc.php	(revision 5726)
@@ -0,0 +1,23 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+unset($template->_tpldata['user_perm.'], $template->_tpldata['group_perm.']);
+$_POST['users'] = array('guest');
+
+if (!isset($datas)) $datas = array('0');
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser()) {
+	if (!isset($_POST['remove_menubar_block'])) $_POST['remove_menubar_block']  = '0';
+    $datas = array($_POST['remove_menubar_block']);
+}
+
+// Parametrage du template
+if ($datas[0] == '1') $template->assign(array('REMOVE_MENUBAR_BLOCK' => 'checked="checked"'));
+
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/logon/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/logon/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/logon/config.tpl	(revision 5726)
@@ -0,0 +1,1 @@
+<p><input type="checkbox" name="remove_menubar_block" value="1" {$REMOVE_MENUBAR_BLOCK}/>{'logon_remove_menubar_block'|@translate}</p><br>
Index: /extensions/PWG_Stuffs/modules/logon/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/logon/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/logon/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/logon/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/logon/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/logon/main.inc.php	(revision 5726)
@@ -0,0 +1,32 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!is_a_guest()) return false;
+
+global $conf;
+
+// template initialization
+$block = array_merge($block, 
+  array(
+    'U_LOST_PASSWORD' => get_root_url().'password.php',
+    'F_LOGIN_ACTION' => get_root_url().'identification.php',
+    'authorize_remembering' => $conf['authorize_remembering'],
+    ));
+
+if ($conf['allow_user_registration'])
+{
+  $block['U_REGISTER'] = get_root_url().'register.php';
+}
+
+// Retirer le bloc identification rapide du menubar
+if ($datas[0] == '1')
+{
+  add_event_handler('blockmanager_apply', 'stuffs_hide_identification');
+  function stuffs_hide_identification($menu_ref_arr)
+  {
+    $menu = & $menu_ref_arr[0];
+    $menu->hide_block('mbIdentification');
+  }
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/mostvisited/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/mostvisited/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/mostvisited/config.inc.php	(revision 5726)
@@ -0,0 +1,37 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!isset($datas))
+{
+  $datas = array(
+    'nb_images'     => 5,
+    'cat_display'   => 'all',
+    'cat_selection' => array(),
+  );
+}
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser())
+{
+  $datas = array(
+    'nb_images' => intval($_POST['nb_images']),
+    'cat_display' => $_POST['cat_display'],
+    'cat_selection' => $_POST['cat_selection'],
+    );
+  unset($_POST['on_picture']);
+}
+
+// Parametrage du template
+$query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';';
+display_select_cat_wrapper($query,array(),'category_selection');
+
+$template->assign(array(
+  'NB_IMAGES' => $datas['nb_images'],
+  'cat_display' => $datas['cat_display'],
+  'category_selected' => $datas['cat_selection']
+));
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/mostvisited/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/mostvisited/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/mostvisited/config.tpl	(revision 5726)
@@ -0,0 +1,88 @@
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
+
+<table>
+	<tr>
+		<td align="right"><br>{'stuffs_mv_nb_images'|@translate} &nbsp;&nbsp;</td>
+		<td><br><input type="text" name="nb_images" size="3" maxlength="2" value="{$NB_IMAGES}"></td>
+	</tr>
+	<tr class="cat_options" style="display: none;">
+		<td align="right"><br>{'stuffs_mv_category_display'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+      <select name="cat_display">
+        <option label="{'stuffs_mv_all_cats'|@translate}" value="all" {if $cat_display == 'all'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_all_cats'|@translate}</option>
+        <option label="{'stuffs_mv_wo_thumb'|@translate}" value="wo_thumb" {if $cat_display == 'wo_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_wo_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_w_thumb'|@translate}" value="w_thumb" {if $cat_display == 'w_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_w_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_selected_cats'|@translate}" value="selected_cats" {if $cat_display == 'selected_cats'}selected="selected"{/if} onClick="javascript: show_cat_list();">{'stuffs_mv_selected_cats'|@translate}</option>
+      </select>
+    </td>
+	</tr>
+	<tr class="cat_selection" style="display: none;">
+		<td align="right">
+      <br>{'stuffs_mv_cat_selection'|@translate} &nbsp;&nbsp;
+      <br>({'stuffs_mv_hold_ctrl'|@translate}) &nbsp;&nbsp;</td>
+		<td><br>
+		  <select class="categoryList" name="cat_selection[]" multiple="multiple" size="30">
+        {html_options options=$category_selection selected=$category_selected}
+      </select></td>
+	</tr>
+</table>
+<br>
+
+{literal}
+<script type="text/javascript">
+resize = false;
+function show_cat_list()
+{
+  jQuery('.cat_selection').show();
+  if (!resize)
+  {
+    resize = true;
+    jQuery('.categoryList').resizable({
+      handles: "all",
+      animate: true,
+      animateDuration: "slow",
+      animateEasing: "swing",
+      preventDefault: true,
+      preserveCursor: true,
+      autoHide: true,
+      ghost: true
+    });
+  }
+}
+
+function hide_cat_list()
+{
+  jQuery('.cat_selection').hide();
+}
+
+jQuery().ready( function () {
+  jQuery("input[name='on_cats']").click( function() {
+    if (this.checked)
+    {
+      jQuery('.cat_options').show();
+      if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+        show_cat_list();
+    }
+    else
+    {
+      jQuery('.cat_options').hide();
+      hide_cat_list();
+    }
+  });
+});
+
+if (document.getElementsByName("on_cats")[0].checked)
+{
+  jQuery('.cat_options').show();
+  if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+  {
+    show_cat_list();
+  }
+}
+
+jQuery("table:eq(1) tr:eq(5)").hide();
+</script>
+{/literal}
+
Index: /extensions/PWG_Stuffs/modules/mostvisited/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/mostvisited/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/mostvisited/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/mostvisited/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/mostvisited/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/mostvisited/main.inc.php	(revision 5726)
@@ -0,0 +1,168 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $page, $user, $conf, $template, $pwg_event_handlers, $yop;
+
+if (script_basename() == 'picture'
+  or ($datas['cat_display'] == 'wo_thumb' and !empty($page['items']))
+  or ($datas['cat_display'] == 'w_thumb' and empty($page['items']) and isset($page['category']))
+  or ($datas['cat_display'] == 'selected_cats' and isset($page['category']) and !in_array($page['category']['id'], $datas['cat_selection'])))
+{
+  return false;
+}
+
+$forbidden = get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'ic.category_id',
+        'visible_categories' => 'ic.category_id',
+        'visible_images' => 'i.id'
+      ),
+    'AND'
+  );
+
+$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.hit > 0';
+
+if (isset($page['category']))
+{
+  $query .= '
+        AND ( c.uppercats LIKE \''.$page['category']['uppercats'].',%\' OR c.id = '.$page['category']['id'].' )
+  ';
+}
+
+$query .= '
+      '.$forbidden.'
+      ORDER BY i.hit DESC, i.file ASC
+    LIMIT 0, '.$datas['nb_images'].'
+  ;';
+
+$pictures = array();
+$selection = array_from_query($query, 'id');
+ 
+if (count($selection) > 0)
+{
+  $rank_of = array_flip($selection);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $selection).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+
+    array_push($pictures, $row);
+  }
+
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+if (count($pictures) > 0)
+{
+  if ($user['show_nb_comments'])
+  {
+    $query = '
+SELECT image_id, COUNT(*) AS nb_comments
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated = \'true\'
+    AND image_id IN ('.implode(',', $selection).')
+  GROUP BY image_id
+;';
+    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+  }
+
+  // template thumbnail initialization
+  $template->set_filenames( array( 'pwgs_most_visited' => 'thumbnails.tpl',));
+
+  trigger_action('loc_begin_index_thumbnails', $pictures);
+  $tpl_thumbnails_var = array();
+
+  foreach ($pictures as $row)
+  {
+    // link on picture.php page
+    $url = duplicate_picture_url(
+          array(
+            'image_id' => $row['id'],
+            'image_file' => $row['file']
+          ),
+          array('start')
+        );
+    $url = add_url_params($url, array('pwgs_mv' => implode(',',$selection)));
+
+    $tpl_var =
+      array(
+        'ID'        => $row['id'],
+        'TN_SRC'    => get_thumbnail_url($row),
+        'TN_ALT'    => $row['file'],
+        'TN_TITLE'  => get_thumbnail_title($row),
+        'ICON_TS'   => get_icon($row['date_available']),
+        'URL'       => $url,
+
+     /* Fields for template-extension usage */
+        'FILE_PATH' => $row['path'],
+        'FILE_POSTED' => $row['date_available'],
+        'FILE_CREATED' => $row['date_creation'],
+        'FILE_DESC' => $row['comment'],
+        'FILE_AUTHOR' => $row['author'],
+        'FILE_HIT' => $row['hit'],
+        'FILE_SIZE' => $row['filesize'],
+        'FILE_WIDTH' => $row['width'],
+        'FILE_HEIGHT' => $row['height'],
+        'FILE_METADATE' => $row['date_metadata_update'],
+        'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+                  true:false, /* lack of include/functions_picture.inc.php */
+      );
+
+    if ($user['show_nb_hits'])
+    {
+      $tpl_var['NB_HITS'] = $row['hit'];
+    }
+
+    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 ( !$user['show_nb_hits'])
+      {
+        $name = '('.$row['hit'].') '.$name;
+      }
+
+      $tpl_var['NAME'] = $name;
+    }
+
+    if ( isset($nb_comments_of) )
+    {
+      $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']];
+    }
+
+    $tpl_thumbnails_var[] = $tpl_var;
+  }
+
+  $tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
+  $template->assign('thumbnails', $tpl_thumbnails_var);
+
+  $block['CONTENT'] = $template->parse('pwgs_most_visited', true);
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/personal/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/personal/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/personal/config.inc.php	(revision 5726)
@@ -0,0 +1,22 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+if (!isset($datas)) $datas = array('');
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser()) {
+	$datas = array(stripslashes($_POST['personal_content']));
+}
+
+// Parametrage du template
+$template->assign('cat_style', array());
+$template->assign(array('PERSONAL_CONTENT' => $datas[0]));
+
+// TinyMCE
+trigger_action('tinymce', 'pwgstuffs');
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/personal/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/personal/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/personal/config.tpl	(revision 5726)
@@ -0,0 +1,7 @@
+<div style="text-align:center;">
+<br>
+<b>{'personal_content'|@translate}</b>
+<br>
+<textarea name="personal_content" id ="textarea" rows="10" cols="50" style="width:90%;">{$PERSONAL_CONTENT}</textarea>
+</div>
+<br>
Index: /extensions/PWG_Stuffs/modules/personal/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/personal/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/personal/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/personal/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/personal/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/personal/main.inc.php	(revision 5726)
@@ -0,0 +1,17 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$block['CONTENT'] = $datas[0];
+
+// Extended description
+if (function_exists('get_extended_desc'))
+{
+  $block['CONTENT'] = get_extended_desc($block['CONTENT']);
+}
+else
+{
+  $block['CONTENT'] = get_user_language_desc($block['CONTENT']);
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/random/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/random/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/random/config.inc.php	(revision 5726)
@@ -0,0 +1,37 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!isset($datas))
+{
+  $datas = array(
+    'nb_images'     => 10,
+    'cat_display'   => 'all',
+    'cat_selection' => array(),
+  );
+}
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser())
+{
+  $datas = array(
+    'nb_images' => intval($_POST['nb_images']),
+    'cat_display' => $_POST['cat_display'],
+    'cat_selection' => $_POST['cat_selection'],
+    );
+  unset($_POST['on_picture']);
+}
+
+// Parametrage du template
+$query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';';
+display_select_cat_wrapper($query,array(),'category_selection');
+
+$template->assign(array(
+  'NB_IMAGES' => $datas['nb_images'],
+  'cat_display' => $datas['cat_display'],
+  'category_selected' => $datas['cat_selection']
+));
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/random/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/random/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/random/config.tpl	(revision 5726)
@@ -0,0 +1,88 @@
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
+
+<table>
+	<tr>
+		<td align="right"><br>{'stuffs_mv_nb_images'|@translate} &nbsp;&nbsp;</td>
+		<td><br><input type="text" name="nb_images" size="3" maxlength="2" value="{$NB_IMAGES}"></td>
+	</tr>
+	<tr class="cat_options" style="display: none;">
+		<td align="right"><br>{'stuffs_mv_category_display'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+      <select name="cat_display">
+        <option label="{'stuffs_mv_all_cats'|@translate}" value="all" {if $cat_display == 'all'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_all_cats'|@translate}</option>
+        <option label="{'stuffs_mv_wo_thumb'|@translate}" value="wo_thumb" {if $cat_display == 'wo_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_wo_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_w_thumb'|@translate}" value="w_thumb" {if $cat_display == 'w_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_w_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_selected_cats'|@translate}" value="selected_cats" {if $cat_display == 'selected_cats'}selected="selected"{/if} onClick="javascript: show_cat_list();">{'stuffs_mv_selected_cats'|@translate}</option>
+      </select>
+    </td>
+	</tr>
+	<tr class="cat_selection" style="display: none;">
+		<td align="right">
+      <br>{'stuffs_mv_cat_selection'|@translate} &nbsp;&nbsp;
+      <br>({'stuffs_mv_hold_ctrl'|@translate}) &nbsp;&nbsp;</td>
+		<td><br>
+		  <select class="categoryList" name="cat_selection[]" multiple="multiple" size="30">
+        {html_options options=$category_selection selected=$category_selected}
+      </select></td>
+	</tr>
+</table>
+<br>
+
+{literal}
+<script type="text/javascript">
+resize = false;
+function show_cat_list()
+{
+  jQuery('.cat_selection').show();
+  if (!resize)
+  {
+    resize = true;
+    jQuery('.categoryList').resizable({
+      handles: "all",
+      animate: true,
+      animateDuration: "slow",
+      animateEasing: "swing",
+      preventDefault: true,
+      preserveCursor: true,
+      autoHide: true,
+      ghost: true
+    });
+  }
+}
+
+function hide_cat_list()
+{
+  jQuery('.cat_selection').hide();
+}
+
+jQuery().ready( function () {
+  jQuery("input[name='on_cats']").click( function() {
+    if (this.checked)
+    {
+      jQuery('.cat_options').show();
+      if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+        show_cat_list();
+    }
+    else
+    {
+      jQuery('.cat_options').hide();
+      hide_cat_list();
+    }
+  });
+});
+
+if (document.getElementsByName("on_cats")[0].checked)
+{
+  jQuery('.cat_options').show();
+  if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+  {
+    show_cat_list();
+  }
+}
+
+jQuery("table:eq(1) tr:eq(5)").hide();
+</script>
+{/literal}
+
Index: /extensions/PWG_Stuffs/modules/random/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/random/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/random/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/random/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/random/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/random/main.inc.php	(revision 5726)
@@ -0,0 +1,162 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $page, $user, $conf, $template;
+
+if (script_basename() == 'picture'
+  or ($datas['cat_display'] == 'wo_thumb' and !empty($page['items']))
+  or ($datas['cat_display'] == 'w_thumb' and empty($page['items']) and isset($page['category']))
+  or ($datas['cat_display'] == 'selected_cats' and isset($page['category']) and !in_array($page['category']['id'], $datas['cat_selection'])))
+{
+  return false;
+}
+
+$forbidden = get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'ic.category_id',
+        'visible_categories' => 'ic.category_id',
+        'visible_images' => 'i.id'
+      ),
+    'WHERE'
+  );
+
+$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
+    '.$forbidden;
+
+if (isset($page['category']))
+{
+  $query .= '
+        AND ( c.uppercats LIKE \''.$page['category']['uppercats'].',%\' OR c.id = '.$page['category']['id'].' )
+  ';
+}
+
+$query .= '
+    ORDER BY RAND(NOW())
+    LIMIT 0, '.$datas['nb_images'].'
+  ;';
+
+$pictures = array();
+$selection = array_from_query($query, 'id');
+ 
+if (count($selection) > 0)
+{
+  $rank_of = array_flip($selection);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $selection).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+
+    array_push($pictures, $row);
+  }
+
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+if (count($pictures) > 0)
+{
+  if ($user['show_nb_comments'])
+  {
+    $query = '
+SELECT image_id, COUNT(*) AS nb_comments
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated = \'true\'
+    AND image_id IN ('.implode(',', $selection).')
+  GROUP BY image_id
+;';
+    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+  }
+
+  // template thumbnail initialization
+  $template->set_filenames( array( 'pwgs_random' => 'thumbnails.tpl',));
+
+  trigger_action('loc_begin_index_thumbnails', $pictures);
+  $tpl_thumbnails_var = array();
+
+  foreach ($pictures as $row)
+  {
+    // link on picture.php page
+    $url = duplicate_picture_url(
+          array(
+            'image_id' => $row['id'],
+            'image_file' => $row['file']
+          ),
+          array('start')
+        );
+    $url = add_url_params($url, array('pwgs_ra' => implode(',',$selection)));
+
+    $tpl_var =
+      array(
+        'ID'        => $row['id'],
+        'TN_SRC'    => get_thumbnail_url($row),
+        'TN_ALT'    => $row['file'],
+        'TN_TITLE'  => get_thumbnail_title($row),
+        'ICON_TS'   => get_icon($row['date_available']),
+        'URL'       => $url,
+
+     /* Fields for template-extension usage */
+        'FILE_PATH' => $row['path'],
+        'FILE_POSTED' => $row['date_available'],
+        'FILE_CREATED' => $row['date_creation'],
+        'FILE_DESC' => $row['comment'],
+        'FILE_AUTHOR' => $row['author'],
+        'FILE_HIT' => $row['hit'],
+        'FILE_SIZE' => $row['filesize'],
+        'FILE_WIDTH' => $row['width'],
+        'FILE_HEIGHT' => $row['height'],
+        'FILE_METADATE' => $row['date_metadata_update'],
+        'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+                  true:false, /* lack of include/functions_picture.inc.php */
+      );
+
+    if ($user['show_nb_hits'])
+    {
+      $tpl_var['NB_HITS'] = $row['hit'];
+    }
+
+    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;
+    }
+
+    if ( isset($nb_comments_of) )
+    {
+      $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']];
+    }
+
+    $tpl_thumbnails_var[] = $tpl_var;
+  }
+
+  $tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
+  $template->assign('thumbnails', $tpl_thumbnails_var);
+
+  $block['CONTENT'] = $template->parse('pwgs_random', true);
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/recent/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/recent/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/recent/config.inc.php	(revision 5726)
@@ -0,0 +1,37 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!isset($datas))
+{
+  $datas = array(
+    'nb_images'     => 10,
+    'cat_display'   => 'all',
+    'cat_selection' => array(),
+  );
+}
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser())
+{
+  $datas = array(
+    'nb_images' => intval($_POST['nb_images']),
+    'cat_display' => $_POST['cat_display'],
+    'cat_selection' => $_POST['cat_selection'],
+    );
+  unset($_POST['on_picture']);
+}
+
+// Parametrage du template
+$query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';';
+display_select_cat_wrapper($query,array(),'category_selection');
+
+$template->assign(array(
+  'NB_IMAGES' => $datas['nb_images'],
+  'cat_display' => $datas['cat_display'],
+  'category_selected' => $datas['cat_selection']
+));
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/recent/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/recent/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/recent/config.tpl	(revision 5726)
@@ -0,0 +1,88 @@
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.resizable.packed.js"}
+
+<table>
+	<tr>
+		<td align="right"><br>{'stuffs_mv_nb_images'|@translate} &nbsp;&nbsp;</td>
+		<td><br><input type="text" name="nb_images" size="3" maxlength="2" value="{$NB_IMAGES}"></td>
+	</tr>
+	<tr class="cat_options" style="display: none;">
+		<td align="right"><br>{'stuffs_mv_category_display'|@translate} &nbsp;&nbsp;</td>
+		<td><br>
+      <select name="cat_display">
+        <option label="{'stuffs_mv_all_cats'|@translate}" value="all" {if $cat_display == 'all'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_all_cats'|@translate}</option>
+        <option label="{'stuffs_mv_wo_thumb'|@translate}" value="wo_thumb" {if $cat_display == 'wo_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_wo_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_w_thumb'|@translate}" value="w_thumb" {if $cat_display == 'w_thumb'}selected="selected"{/if} onClick="javascript: hide_cat_list();">{'stuffs_mv_w_thumb'|@translate}</option>
+        <option label="{'stuffs_mv_selected_cats'|@translate}" value="selected_cats" {if $cat_display == 'selected_cats'}selected="selected"{/if} onClick="javascript: show_cat_list();">{'stuffs_mv_selected_cats'|@translate}</option>
+      </select>
+    </td>
+	</tr>
+	<tr class="cat_selection" style="display: none;">
+		<td align="right">
+      <br>{'stuffs_mv_cat_selection'|@translate} &nbsp;&nbsp;
+      <br>({'stuffs_mv_hold_ctrl'|@translate}) &nbsp;&nbsp;</td>
+		<td><br>
+		  <select class="categoryList" name="cat_selection[]" multiple="multiple" size="30">
+        {html_options options=$category_selection selected=$category_selected}
+      </select></td>
+	</tr>
+</table>
+<br>
+
+{literal}
+<script type="text/javascript">
+resize = false;
+function show_cat_list()
+{
+  jQuery('.cat_selection').show();
+  if (!resize)
+  {
+    resize = true;
+    jQuery('.categoryList').resizable({
+      handles: "all",
+      animate: true,
+      animateDuration: "slow",
+      animateEasing: "swing",
+      preventDefault: true,
+      preserveCursor: true,
+      autoHide: true,
+      ghost: true
+    });
+  }
+}
+
+function hide_cat_list()
+{
+  jQuery('.cat_selection').hide();
+}
+
+jQuery().ready( function () {
+  jQuery("input[name='on_cats']").click( function() {
+    if (this.checked)
+    {
+      jQuery('.cat_options').show();
+      if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+        show_cat_list();
+    }
+    else
+    {
+      jQuery('.cat_options').hide();
+      hide_cat_list();
+    }
+  });
+});
+
+if (document.getElementsByName("on_cats")[0].checked)
+{
+  jQuery('.cat_options').show();
+  if (jQuery("select[name='cat_display']").val() == 'selected_cats')
+  {
+    show_cat_list();
+  }
+}
+
+jQuery("table:eq(1) tr:eq(5)").hide();
+</script>
+{/literal}
+
Index: /extensions/PWG_Stuffs/modules/recent/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/recent/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/recent/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/recent/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/recent/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/recent/main.inc.php	(revision 5726)
@@ -0,0 +1,164 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $page, $user, $conf, $template;
+
+if (script_basename() == 'picture'
+  or ($datas['cat_display'] == 'wo_thumb' and !empty($page['items']))
+  or ($datas['cat_display'] == 'w_thumb' and empty($page['items']) and isset($page['category']))
+  or ($datas['cat_display'] == 'selected_cats' and isset($page['category']) and !in_array($page['category']['id'], $datas['cat_selection'])))
+{
+  return false;
+}
+
+$forbidden = get_sql_condition_FandF
+  (
+    array
+      (
+        'forbidden_categories' => 'ic.category_id',
+        'visible_categories' => 'ic.category_id',
+        'visible_images' => 'i.id'
+      ),
+    'AND'
+  );
+
+$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.date_available >= SUBDATE(
+      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
+
+if (isset($page['category']))
+{
+  $query .= '
+        AND ( c.uppercats LIKE \''.$page['category']['uppercats'].',%\' OR c.id = '.$page['category']['id'].' )
+  ';
+}
+
+$query .= '
+    '.$forbidden.'
+    '. str_replace('ORDER BY ', 'ORDER BY date_available DESC, ', $conf['order_by']).'
+    LIMIT 0, '.$datas['nb_images'].'
+  ;';
+
+$pictures = array();
+$selection = array_from_query($query, 'id');
+ 
+if (count($selection) > 0)
+{
+  $rank_of = array_flip($selection);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $selection).')
+;';
+  $result = pwg_query($query);
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+
+    array_push($pictures, $row);
+  }
+
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+if (count($pictures) > 0)
+{
+  if ($user['show_nb_comments'])
+  {
+    $query = '
+SELECT image_id, COUNT(*) AS nb_comments
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated = \'true\'
+    AND image_id IN ('.implode(',', $selection).')
+  GROUP BY image_id
+;';
+    $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');
+  }
+
+  // template thumbnail initialization
+  $template->set_filenames( array( 'pwgs_recent' => 'thumbnails.tpl',));
+
+  trigger_action('loc_begin_index_thumbnails', $pictures);
+  $tpl_thumbnails_var = array();
+
+  foreach ($pictures as $row)
+  {
+    // link on picture.php page
+    $url = duplicate_picture_url(
+          array(
+            'image_id' => $row['id'],
+            'image_file' => $row['file']
+          ),
+          array('start')
+        );
+    $url = add_url_params($url, array('pwgs_re' => implode(',',$selection)));
+
+    $tpl_var =
+      array(
+        'ID'        => $row['id'],
+        'TN_SRC'    => get_thumbnail_url($row),
+        'TN_ALT'    => $row['file'],
+        'TN_TITLE'  => get_thumbnail_title($row),
+        'ICON_TS'   => get_icon($row['date_available']),
+        'URL'       => $url,
+
+     /* Fields for template-extension usage */
+        'FILE_PATH' => $row['path'],
+        'FILE_POSTED' => $row['date_available'],
+        'FILE_CREATED' => $row['date_creation'],
+        'FILE_DESC' => $row['comment'],
+        'FILE_AUTHOR' => $row['author'],
+        'FILE_HIT' => $row['hit'],
+        'FILE_SIZE' => $row['filesize'],
+        'FILE_WIDTH' => $row['width'],
+        'FILE_HEIGHT' => $row['height'],
+        'FILE_METADATE' => $row['date_metadata_update'],
+        'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
+                  true:false, /* lack of include/functions_picture.inc.php */
+      );
+
+    if ($user['show_nb_hits'])
+    {
+      $tpl_var['NB_HITS'] = $row['hit'];
+    }
+
+    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;
+    }
+
+    if ( isset($nb_comments_of) )
+    {
+      $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']];
+    }
+
+    $tpl_thumbnails_var[] = $tpl_var;
+  }
+
+  $tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
+  $template->assign('thumbnails', $tpl_thumbnails_var);
+
+  $block['CONTENT'] = $template->parse('pwgs_recent', true);
+}
+else
+{
+  return false;
+}
+
+?>
Index: /extensions/PWG_Stuffs/modules/tags/config.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/tags/config.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/tags/config.inc.php	(revision 5726)
@@ -0,0 +1,17 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (empty($datas)) $datas = array('cloud');
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']) and !is_adviser())
+{
+  $datas = array($_POST['tag_display']);
+}
+
+$template->assign($datas[0].'_CHECKED', 'checked="checked"');
+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: /extensions/PWG_Stuffs/modules/tags/config.tpl
===================================================================
--- /extensions/PWG_Stuffs/modules/tags/config.tpl	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/tags/config.tpl	(revision 5726)
@@ -0,0 +1,13 @@
+<table>
+  <tr>
+    <td>{'stuffs_tags_default_display'|@translate} :</td>
+    <td>&nbsp;&nbsp;<input type="radio" name="tag_display" value="cloud" {$cloud_CHECKED}>&nbsp;&nbsp;<i>{'stuffs_tags_cloud'|@translate}</i></td>
+  </tr>
+  <tr><td></td>
+    <td>&nbsp;&nbsp;<input type="radio" name="tag_display" value="letters" {$letters_CHECKED}>&nbsp;&nbsp;<i>{'stuffs_tags_letters'|@translate}</i></td>
+  </tr>
+  <tr><td></td>
+    <td>&nbsp;&nbsp;<input type="radio" name="tag_display" value="cumulus" {$cumulus_CHECKED}>&nbsp;&nbsp;<i>{'stuffs_tags_cumulus'|@translate}</i></td>
+  </tr>
+  <tr><td colspan="2"><br></td></tr>
+</table>
Index: /extensions/PWG_Stuffs/modules/tags/index.php
===================================================================
--- /extensions/PWG_Stuffs/modules/tags/index.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/tags/index.php	(revision 5726)
@@ -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/PWG_Stuffs/modules/tags/main.inc.php
===================================================================
--- /extensions/PWG_Stuffs/modules/tags/main.inc.php	(revision 5726)
+++ /extensions/PWG_Stuffs/modules/tags/main.inc.php	(revision 5726)
@@ -0,0 +1,150 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $conf, $template;
+
+function counter_compare($a, $b)
+{
+  if ($a['counter'] == $b['counter'])
+  {
+    return id_compare($a, $b);
+  }
+
+  return ($a['counter'] < $b['counter']) ? +1 : -1;
+}
+
+function id_compare($a, $b)
+{
+  return ($a['id'] < $b['id']) ? -1 : 1;
+}
+
+$pwgCumulus_installed = get_db_plugins('active','pwgCumulus');
+
+$block['TITLE_URL'] = 'tags.php';
+
+$tags = get_available_tags();
+
+if ((!$pwgCumulus_installed and $datas[0] == 'cumulus') or empty($datas[0]))
+{
+  $datas[0] = 'cloud';
+}
+
+if ($datas[0] == 'letters')
+{
+  // we want tags diplayed in alphabetic order
+  usort($tags, 'tag_alpha_compare');
+
+  $current_letter = null;
+  $nb_tags = count($tags);
+  $current_column = 1;
+  $current_tag_idx = 0;
+
+  $letter = array(
+    'tags' => array()
+    );
+
+  foreach ($tags as $tag)
+  {
+    $tag_letter = strtoupper(substr($tag['url_name'], 0, 1));
+
+    if ($current_tag_idx==0) {
+      $current_letter = $tag_letter;
+      $letter['TITLE'] = $tag_letter;
+    }
+
+    //lettre precedente differente de la lettre suivante
+    if ($tag_letter !== $current_letter)
+    {
+      if ($current_column<$conf['tag_letters_column_number']
+          and $current_tag_idx > $current_column*$nb_tags/$conf['tag_letters_column_number'] )
+      {
+        $letter['CHANGE_COLUMN'] = true;
+        $current_column++;
+      }
+
+      $letter['TITLE'] = $current_letter;
+
+      $template->append(
+        'letters',
+        $letter
+        );
+
+      $current_letter = $tag_letter;
+      $letter = array(
+        'tags' => array()
+        );
+    }
+
+    array_push(
+      $letter['tags'],
+      array_merge(
+        $tag,
+        array(
+          'URL' => make_index_url(
+            array(
+              'tags' => array($tag),
+              )
+            ),
+          )
+        )
+      );
+
+    $current_tag_idx++;
+  }
+
+  // flush last letter
+  if (count($letter['tags']) > 0)
+  {
+    unset($letter['CHANGE_COLUMN']);
+    $letter['TITLE'] = $current_letter;
+    $template->append(
+      'letters',
+      $letter
+      );
+  }
+}
+else
+{
+  usort($tags, 'counter_compare');
+  $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']);
+
+  // depending on its counter and the other tags counter, each tag has a level
+  $tags = add_level_to_tags($tags);
+
+  // we want tags diplayed in alphabetic order
+  usort($tags, 'tag_alpha_compare');
+
+  // display sorted tags
+  foreach ($tags as $tag)
+  {
+    $template->append(
+      'tags',
+      array_merge(
+        $tag,
+        array(
+          'URL' => make_index_url(
+            array(
+              'tags' => array($tag),
+              )
+            ),
+          )
+        )
+      );
+  }
+  if ($datas[0] == 'cumulus')
+  {
+    include_once PWG_CUMULUS_PLUGIN_ROOT . "/include/pwgCumulusContent.class.php";
+    $cumulus = new pwgCumulusContent(get_plugin_data('pwgCumulus'));
+    $cumulus->loc_begin_page_header();
+  }
+}
+
+$template->assign('display_mode', $datas[0]);
+
+if (get_db_plugins('active','typetags'))
+{
+  include(typetags_PATH . 'typetags.php');
+}
+
+?>
