Index: /tags/release-1_3RC1/about.php
===================================================================
--- /tags/release-1_3RC1/about.php	(revision 159)
+++ /tags/release-1_3RC1/about.php	(revision 159)
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************************
+ *                                about.php                                *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/about.vtp' );
+initialize_template();
+
+$tpl = array('about_page_title','about_title','about_message','about_return');
+templatize_array( $tpl, 'lang', $handle );
+$vtp->setVar( $handle, 'user_template', $user['template'] );
+
+$url = './category.php?'.$_SERVER['QUERY_STRING'];
+$vtp->setVar( $handle, 'back_url', add_session_id( $url ) );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/admin/admin.php
===================================================================
--- /tags/release-1_3RC1/admin/admin.php	(revision 159)
+++ /tags/release-1_3RC1/admin/admin.php	(revision 159)
@@ -0,0 +1,252 @@
+<?php
+/***************************************************************************
+ *                                 admin.php                               *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( '../template/'.$user['template'].'/admin/admin.vtp' );
+// language
+$tpl = array( 'menu_title', 'title_default', 'charset' );
+templatize_array( $tpl, 'lang', $handle );
+$vtp->setGlobalVar( $handle, 'user_template', $user['template'] );
+//--------------------------------------- validating page and creation of title
+$page_valide = false;
+$title = '';
+switch ( $_GET['page'] )
+{
+ case 'user_list':
+   $title = $lang['title_liste_users'];   $page_valide = true; break;
+ case 'user_modify':
+   $title = $lang['title_modify'];        $page_valide = true; break;
+ case 'user_perm':
+   if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1;
+   $query = 'SELECT status,username';
+   $query.= ' FROM '.PREFIX_TABLE.'users';
+   $query.= ' WHERE id = '.$_GET['user_id'];
+   $query.= ';';
+   $result = mysql_query( $query );
+   if ( mysql_num_rows( $result ) > 0 )
+   {
+     $row = mysql_fetch_array( $result );
+     $page['user_status']   = $row['status'];
+     if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest'];
+     $page['user_username'] = $row['username'];
+     $page_valide = true;
+     $title = $lang['title_user_perm'].' "'.$page['user_username'].'"';
+   }
+   else
+   {
+     $page_valide = false;
+   }
+   break;
+ case 'group_list' :
+   $title = $lang['title_groups'];        $page_valide = true; break;
+ case 'group_perm' :
+   if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1;
+   $query = 'SELECT name';
+   $query.= ' FROM '.PREFIX_TABLE.'groups';
+   $query.= ' WHERE id = '.$_GET['group_id'];
+   $query.= ';';
+   $result = mysql_query( $query );
+   if ( mysql_num_rows( $result ) > 0 )
+   {
+     $row = mysql_fetch_array( $result );
+     $title = $lang['title_group_perm'].' "'.$row['name'].'"';
+     $page_valide = true;
+   }
+   else
+   {
+     $page_valide = false;
+   }
+   break;
+ case 'stats':
+   $title = $lang['title_history'];       $page_valide = true; break;
+ case 'update':
+   $title = $lang['title_update'];        $page_valide = true; break;
+ case 'configuration':
+   $title = $lang['title_configuration']; $page_valide = true; break;
+ case 'help':
+   $title = $lang['title_instructions'];  $page_valide = true; break;
+ case 'cat_perm':
+   $title = $lang['title_cat_perm'];
+   if ( isset( $_GET['cat_id'] ) )
+   {
+     check_cat_id( $_GET['cat_id'] );
+     if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+     {
+       $result = get_cat_info( $page['cat'] );
+       $name = get_cat_display_name( $result['name'],' &gt; ', '' );
+       $title.= ' "'.$name.'"';
+     }
+   }
+   $page_valide = true;
+   break;
+ case 'cat_list':
+   $title = $lang['title_categories'];    $page_valide = true; break;
+ case 'cat_modify':
+   $title = $lang['title_edit_cat'];      $page_valide = true; break;
+ case 'infos_images':
+   $title = $lang['title_info_images'];   $page_valide = true; break;
+ case 'waiting':
+   $title = $lang['title_waiting'];       $page_valide = true; break;
+ case 'thumbnail':
+   $title = $lang['title_thumbnails'];
+   if ( isset( $_GET['dir'] ) )
+   {
+     $title.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
+     // $_GET['dir'] contains :
+     // ../galleries/vieux_lyon ou
+     // ../galleries/vieux_lyon/visite ou
+     // ../galleries/vieux_lyon/visite/truc ...
+     $dir = explode( "/", $_GET['dir'] );
+     $title.= $dir[2];
+     for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
+     {
+       $title.= ' &gt; '.$dir[$i];
+     }
+     $title.= "</span>";
+   }
+   $page_valide = true;
+   break;
+ case 'comments' :
+   $title = $lang['title_comments'];
+   $page_valide = true;
+   break;
+ case 'picture_modify' :
+   $title = $lang['title_picmod'];
+   $page_valide = true;
+   break;
+ default:
+   $title = $lang['title_default']; break;
+}
+if ( $title == '' ) $title = $lang['title_default'];
+$vtp->setGlobalVar( $handle, 'title', $title );
+//--------------------------------------------------------------------- summary
+$link_start = './admin.php?page=';
+// configuration
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'configuration' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_config'] );
+$vtp->closeSession( $handle, 'summary' );
+// users
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'user_list' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
+$vtp->closeSession( $handle, 'summary' );
+// groups
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'group_list' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_groups'] );
+$vtp->closeSession( $handle, 'summary' );
+// categories
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',add_session_id( $link_start.'cat_list'));
+$vtp->setVar( $handle, 'summary.name', $lang['menu_categories'] );
+$vtp->closeSession( $handle, 'summary' );
+// waiting
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'waiting' ) );
+$query = 'SELECT id';
+$query.= ' FROM '.PREFIX_TABLE.'waiting';
+$query.= " WHERE validated='false'";
+$query.= ';';
+$result = mysql_query( $query );
+$nb_waiting = '';
+if ( mysql_num_rows( $result ) > 0 )
+{
+  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
+}
+$vtp->setVar( $handle, 'summary.name', $lang['menu_waiting'].$nb_waiting );
+$vtp->closeSession( $handle, 'summary' );
+// comments
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'comments' ) );
+$query = 'SELECT id';
+$query.= ' FROM '.PREFIX_TABLE.'comments';
+$query.= " WHERE validated='false'";
+$query.= ';';
+$result = mysql_query( $query );
+$nb_waiting = '';
+if ( mysql_num_rows( $result ) > 0 )
+{
+  $nb_waiting =  ' [ '.mysql_num_rows( $result ).' ]';
+}
+$vtp->setVar( $handle, 'summary.name', $lang['menu_comments'].$nb_waiting );
+$vtp->closeSession( $handle, 'summary' );
+// update
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'update' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_update'] );
+$vtp->closeSession( $handle, 'summary' );
+// thumbnails
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'thumbnail' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_thumbnails'] );
+$vtp->closeSession( $handle, 'summary' );
+// history
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'stats' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_history'] );
+$vtp->closeSession( $handle, 'summary' );
+// instructions
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+              add_session_id( $link_start.'help' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_instructions'] );
+$vtp->closeSession( $handle, 'summary' );
+// back to thumbnails page
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link', add_session_id( '../category.php' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_back'] );
+$vtp->closeSession( $handle, 'summary' );
+//------------------------------------------------------------- content display
+if ( $page_valide )
+{
+  include ( $_GET['page'].'.php' );
+}
+else
+{
+  $vtp->setVar(
+    $handle, 'sub',
+    '<div style="text-align:center">'.$lang['default_message'].'</div>' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/admin/cat_list.php
===================================================================
--- /tags/release-1_3RC1/admin/cat_list.php	(revision 159)
+++ /tags/release-1_3RC1/admin/cat_list.php	(revision 159)
@@ -0,0 +1,384 @@
+<?php
+/***************************************************************************
+ *                                  cat_list.php                           *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   website              : http://www.phpwebgallery.net                   *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/cat_list.vtp' );
+$tpl = array( 'cat_edit','cat_up','cat_down','cat_image_info',
+              'cat_permission','cat_update','cat_add','cat_parent','submit',
+              'cat_virtual','delete','cat_first','cat_last' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//--------------------------------------------------- adding a virtual category
+$errors = array();
+if ( isset( $_POST['submit'] ) )
+{
+  if ( !preg_match( '/^\s*$/', $_POST['virtual_name'] ) )
+  {
+    // we have then to add the virtual category
+    $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
+    $query.= ' (name,id_uppercat) VALUES ';
+    if ( $_POST['associate'] == -1 )
+    {
+      $_POST['associate'] = 'NULL';
+    }
+    $query.= " ('".$_POST['virtual_name']."',".$_POST['associate'].")";
+    $query.= ';';
+    mysql_query( $query );
+  }
+  else
+  {
+    array_push( $errors, $lang['cat_error_name'] );
+  }
+}
+//---------------------------------------------------------------  rank updates
+if ( isset( $_GET['up'] ) and is_numeric( $_GET['up'] ) )
+{
+  // 1. searching level (id_uppercat)
+  //    and rank of the category to move
+  $query = 'SELECT id_uppercat,rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id = '.$_GET['up'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $level = $row['id_uppercat'];
+  $rank  = $row['rank'];
+  // 2. searching the id and the rank of the category
+  //    just above at the same level
+  $query = 'SELECT id,rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE rank < '.$rank;
+  if ( $level == '' )
+  {
+    $query.= ' AND id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' AND id_uppercat = '.$level;
+  }
+  $query.= ' ORDER BY rank DESC';
+  $query.= ' LIMIT 0,1';
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $new_rank     = $row['rank'];
+  $replaced_cat = $row['id'];
+  // 3. exchanging ranks between the two categories
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = '.$new_rank;
+  $query.= ' WHERE id = '.$_GET['up'];
+  $query.= ';';
+  mysql_query( $query );
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = '.$rank;
+  $query.= ' WHERE id = '.$replaced_cat;
+  $query.= ';';
+  mysql_query( $query );
+}
+if ( isset( $_GET['down'] ) and is_numeric( $_GET['down'] ) )
+{
+  // 1. searching level (id_uppercat)
+  //    and rank of the category to move
+  $query = 'SELECT id_uppercat,rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id = '.$_GET['down'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $level = $row['id_uppercat'];
+  $rank  = $row['rank'];
+  // 2. searching the id and the rank of the category
+  //    just below at the same level
+  $query = 'SELECT id,rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE rank > '.$rank;
+  if ( $level == '' )
+  {
+    $query.= ' AND id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' AND id_uppercat = '.$level;
+  }
+  $query.= ' ORDER BY rank ASC';
+  $query.= ' LIMIT 0,1';
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $new_rank     = $row['rank'];
+  $replaced_cat = $row['id'];
+  // 3. exchanging ranks between the two categories
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = '.$new_rank;
+  $query.= ' WHERE id = '.$_GET['down'];
+  $query.= ';';
+  mysql_query( $query );
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = '.$rank;
+  $query.= ' WHERE id = '.$replaced_cat;
+  $query.= ';';
+  mysql_query( $query );
+}
+if ( isset( $_GET['last'] ) and is_numeric( $_GET['last'] ) )
+{
+  // 1. searching level (id_uppercat) of the category to move
+  $query = 'SELECT id_uppercat,rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id = '.$_GET['last'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $level = $row['id_uppercat'];
+  // 2. searching the highest rank of the categories of the same parent
+  $query = 'SELECT MAX(rank) AS max_rank';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id_uppercat';
+  if ( $level == '' ) $query.= ' IS NULL';
+  else                $query.= ' = '.$level;
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $max_rank = $row['max_rank'];
+  // 3. updating the rank of our category to be after the previous max rank
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = '.($max_rank + 1);
+  $query.= ' WHERE id = '.$_GET['last'];
+  $query.= ';';
+  mysql_query( $query );
+}
+if ( isset( $_GET['first'] ) and is_numeric( $_GET['first'] ) )
+{
+  // to place our category as first, we simply say that is rank is 0, then
+  // reordering will move category ranks correctly (first rank should be 1
+  // and not 0)
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+  $query.= ' SET rank = 0';
+  $query.= ' WHERE id = '.$_GET['first'];
+  $query.= ';';
+  mysql_query( $query );
+}
+if ( isset( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
+{
+  delete_category( $_GET['delete'] );
+}
+//------------------------------------------------------------------ reordering
+function ordering( $id_uppercat )
+{
+  $rank = 1;
+		
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  if ( !is_numeric( $id_uppercat ) )
+  {
+    $query.= ' WHERE id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' WHERE id_uppercat = '.$id_uppercat;
+  }
+  $query.= ' ORDER BY rank ASC, dir ASC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $query = 'UPDATE '.PREFIX_TABLE.'categories';
+    $query.= ' SET rank = '.$rank;
+    $query.= ' WHERE id = '.$row['id'];
+    $query.= ';';
+    mysql_query( $query );
+    $rank++;
+    ordering( $row['id'] );
+  }
+}
+ordering( 'NULL' );
+//-------------------------------------------------------------- errors display
+if ( count( $errors ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  foreach ( $errors as $error ) {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.content', $error );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+//---------------------------------------------------------------- page display
+function display_cat_manager( $id_uppercat, $indent,
+                              $uppercat_visible, $level )
+{
+  global $lang,$conf,$sub,$vtp,$page;
+		
+  // searching the min_rank and the max_rank of the category
+  $query = 'SELECT MIN(rank) AS min, MAX(rank) AS max';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  if ( !is_numeric( $id_uppercat ) )
+  {
+    $query.= ' WHERE id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' WHERE id_uppercat = '.$id_uppercat;
+  }
+  $query.= ';';
+  $result = mysql_query( $query );
+  $row    = mysql_fetch_array( $result );
+  $min_rank = $row['min'];
+  $max_rank = $row['max'];
+		
+  // will we use <th> or <td> lines ?
+  $td    = 'td';
+  $class = '';
+  if ( $level > 0 ) $class = 'row'.$level;
+  else              $td = 'th';
+		
+  $query = 'SELECT id,name,dir,nb_images,status,rank,site_id,visible';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  if ( !is_numeric( $id_uppercat ) )
+  {
+    $query.= ' WHERE id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' WHERE id_uppercat = '.$id_uppercat;
+  }
+  $query.= ' ORDER BY rank ASC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $subcat_visible = true;
+
+    $vtp->addSession( $sub, 'cat' );
+    $vtp->setVar( $sub, 'cat.td', $td );
+    $vtp->setVar( $sub, 'cat.class', $class );
+    $vtp->setVar( $sub, 'cat.indent', $indent );
+    $vtp->setVar( $sub, 'cat.name', $row['name'] );
+    if ( $row['dir'] != '' )
+    {
+      $vtp->addSession( $sub, 'storage' );
+      $vtp->setVar( $sub, 'storage.dir', $row['dir'] );
+      $vtp->closeSession( $sub, 'storage' );
+      // category can't be deleted
+      $vtp->addSession( $sub, 'no_delete' );
+      $vtp->closeSession( $sub, 'no_delete' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'virtual' );
+      $vtp->closeSession( $sub, 'virtual' );
+      // category can be deleted
+      $vtp->addSession( $sub, 'delete' );
+      $url = './admin.php?page=cat_list&amp;delete='.$row['id'];
+      $vtp->setVar( $sub, 'delete.delete_url', add_session_id( $url ) );
+      $vtp->closeSession( $sub, 'delete' );
+    }
+    if ( $row['visible'] == 'false' or !$uppercat_visible )
+    {
+      $subcat_visible = false;
+      $vtp->setVar( $sub, 'cat.invisible', $lang['cat_invisible'] );
+    }
+    if ( $row['status'] == 'private' )
+    {
+      $vtp->setVar( $sub, 'cat.private', $lang['private'] );
+    }
+    $vtp->setVar( $sub, 'cat.nb_picture', $row['nb_images'] );
+    $url = add_session_id( './admin.php?page=cat_modify&amp;cat='.$row['id'] );
+    $vtp->setVar( $sub, 'cat.edit_url', $url );
+    if ( $row['rank'] != $min_rank )
+    {
+      $vtp->addSession( $sub, 'up' );
+      $url = add_session_id( './admin.php?page=cat_list&amp;up='.$row['id'] );
+      $vtp->setVar( $sub, 'up.up_url', $url );
+      $vtp->closeSession( $sub, 'up' );
+    }
+    else if ( $min_rank != $max_rank )
+    {
+      $vtp->addSession( $sub, 'no_up' );
+      $url = add_session_id( './admin.php?page=cat_list&amp;last='.$row['id']);
+      $vtp->setVar( $sub, 'no_up.last_url', $url );
+      $vtp->closeSession( $sub, 'no_up' );
+    }
+    if ( $row['rank'] != $max_rank )
+    {
+      $vtp->addSession( $sub, 'down' );
+      $url = add_session_id( './admin.php?page=cat_list&amp;down='.$row['id']);
+      $vtp->setVar( $sub, 'down.down_url', $url );
+      $vtp->closeSession( $sub, 'down' );
+    }
+    else if ( $min_rank != $max_rank )
+    {
+      $vtp->addSession( $sub, 'no_down' );
+      $url = add_session_id('./admin.php?page=cat_list&amp;first='.$row['id']);
+      $vtp->setVar( $sub, 'no_down.first_url', $url );
+      $vtp->closeSession( $sub, 'no_down' );
+    }
+    if ( $row['nb_images'] > 0 )
+    {
+      $vtp->addSession( $sub, 'image_info' );
+      $url = add_session_id( './admin.php?page=infos_images&amp;cat_id='
+                             .$row['id'] );
+      $vtp->setVar( $sub, 'image_info.image_info_url', $url );
+      $vtp->closeSession( $sub, 'image_info' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'no_image_info' );
+      $vtp->closeSession( $sub, 'no_image_info' );
+    }
+    if ( $row['status'] == 'private' )
+    {
+      $vtp->addSession( $sub, 'permission' );
+      $url=add_session_id('./admin.php?page=cat_perm&amp;cat_id='.$row['id']);
+      $vtp->setVar( $sub, 'permission.url', $url );
+      $vtp->closeSession( $sub, 'permission' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'no_permission' );
+      $vtp->closeSession( $sub, 'no_permission' );
+    }
+    // you can individually update a category only if it is on the main site
+    // and if it's not a virtual category (a category is virtual if there is
+    // no directory associated)
+    if ( $row['site_id'] == 1 and $row['dir'] != '' )
+    {
+      $vtp->addSession( $sub, 'update' );
+      $url = add_session_id('./admin.php?page=update&amp;update='.$row['id']);
+      $vtp->setVar( $sub, 'update.update_url', $url );
+      $vtp->closeSession( $sub, 'update' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'no_update' );
+      $vtp->closeSession( $sub, 'no_update' );
+    }
+
+    $vtp->closeSession( $sub, 'cat' );
+
+    display_cat_manager( $row['id'], $indent.str_repeat( '&nbsp', 4 ),
+                         $subcat_visible, $level + 1 );
+  }
+}
+display_cat_manager( 'NULL', str_repeat( '&nbsp', 4 ), true, 0 );
+// add a virtual category ?
+$vtp->addSession( $sub, 'associate_cat' );
+$vtp->setVar( $sub, 'associate_cat.value', '-1' );
+$vtp->setVar( $sub, 'associate_cat.content', '' );
+$vtp->closeSession( $sub, 'associate_cat' );
+$page['plain_structure'] = get_plain_structure();
+$structure = create_structure( '', array() );
+display_categories( $structure, '&nbsp;' );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/cat_modify.php
===================================================================
--- /tags/release-1_3RC1/admin/cat_modify.php	(revision 159)
+++ /tags/release-1_3RC1/admin/cat_modify.php	(revision 159)
@@ -0,0 +1,215 @@
+<?php
+/***************************************************************************
+ *                               cat_modify.php                            *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/cat_modify.vtp' );
+$tpl = array( 'remote_site','editcat_confirm','editcat_back','editcat_title1',
+              'editcat_name','editcat_comment','editcat_status',
+              'editcat_visible','editcat_visible_info', 'submit',
+              'editcat_uploadable','cat_virtual','cat_parent' );
+templatize_array( $tpl, 'lang', $sub );
+//---------------------------------------------------------------- verification
+if ( !is_numeric( $_GET['cat'] ) )
+{
+  $_GET['cat'] = '-1';
+}
+//--------------------------------------------------------- form criteria check
+if ( isset( $_POST['submit'] ) )
+{
+  // if new status is different from previous one, deletion of all related
+  // links for access rights
+  $query = 'SELECT status';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id = '.$_GET['cat'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+
+  if ( $_POST['status'] != $row['status'] )
+  {
+    // deletion of all access for groups concerning this category
+    $query = 'DELETE';
+    $query.= ' FROM '.PREFIX_TABLE.'group_access';
+    $query.= ' WHERE cat_id = '.$_GET['cat'];
+    mysql_query( $query );
+    // deletion of all access for users concerning this category
+    $query = 'DELETE';
+    $query.= ' FROM '.PREFIX_TABLE.'user_access';
+    $query.= ' WHERE cat_id = '.$_GET['cat'];
+    mysql_query( $query );
+  }
+  
+  $query = 'UPDATE '.PREFIX_TABLE.'categories';
+
+  $query.= ' SET name = ';
+  if ( $_POST['name'] == '' )
+    $query.= 'NULL';
+  else
+    $query.= "'".htmlentities( $_POST['name'], ENT_QUOTES)."'";
+
+  $query.= ', comment = ';
+  if ( $_POST['comment'] == '' )
+    $query.= 'NULL';
+  else
+    $query.= "'".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
+
+  $query.= ", status = '".$_POST['status']."'";
+  $query.= ", visible = '".$_POST['visible']."'";
+
+  if ( isset( $_POST['uploadable'] ) )
+    $query.= ", uploadable = '".$_POST['uploadable']."'";
+
+  if ( isset( $_POST['associate'] ) )
+  {
+    $query.= ', id_uppercat = ';
+    if ( $_POST['associate'] == -1 ) $query.= 'NULL';
+    else                             $query.= $_POST['associate'];
+  }
+  $query.= ' WHERE id = '.$_GET['cat'];
+  $query.= ';';
+  mysql_query( $query );
+
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= " WHERE username != '".$conf['webmaster']."'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array ( $result ) )
+  {
+    check_favorites( $row['id'] );
+  }
+  $vtp->addSession( $sub, 'confirmation' );
+  $url = add_session_id( './admin.php?page=cat_list' );
+  $vtp->setVar( $sub, 'confirmation.back_url', $url );
+  $vtp->closeSession( $sub, 'confirmation' );
+}
+//------------------------------------------------------------------------ form
+$form_action = './admin.php?page=cat_modify&amp;cat='.$_GET['cat'];
+$vtp->setVar( $sub, 'form_action', add_session_id( $form_action ) );
+
+$query = 'SELECT a.id,name,dir,status,comment,uploadable';
+$query.= ',id_uppercat,site_id,galleries_url,visible';
+$query.= ' FROM '.PREFIX_TABLE.'categories as a, '.PREFIX_TABLE.'sites as b';
+$query.= ' WHERE a.id = '.$_GET['cat'];
+$query.= ' AND a.site_id = b.id';
+$query.= ';';
+$row = mysql_fetch_array( mysql_query( $query ) );
+$result = get_cat_info( $row['id'] );
+// cat name
+$cat_name = get_cat_display_name( $result['name'], ' - ', '' );
+$vtp->setVar( $sub, 'cat:name', $cat_name );
+// cat dir
+if ( $row['dir'] != '' )
+{
+  $vtp->addSession( $sub, 'storage' );
+  $vtp->setVar( $sub, 'storage.dir', $row['dir'] );
+  $vtp->closeSession( $sub, 'storage' );
+}
+else
+{
+  $vtp->addSession( $sub, 'virtual' );
+  $vtp->closeSession( $sub, 'virtual' );
+}
+// remote site ?
+if ( $row['site_id'] != 1 )
+{
+  $vtp->addSession( $sub, 'server' );
+  $vtp->setVar( $sub, 'server.url', $row['galleries_url'] );
+  $vtp->closeSession( $sub, 'server' );
+}
+$vtp->setVar( $sub, 'name',    $row['name'] );
+$vtp->setVar( $sub, 'comment', $row['comment'] );
+// status : public, private...
+$options = get_enums( PREFIX_TABLE.'categories', 'status' );
+foreach ( $options as $option  ) {
+  $vtp->addSession( $sub, 'status_option' );
+  $vtp->setVar( $sub, 'status_option.option', $lang[$option] );
+  $vtp->setVar( $sub, 'status_option.value', $option );
+  if ( $option == $row['status'] )
+  {
+    $vtp->setVar( $sub, 'status_option.checked', ' checked="checked"' );  
+  }
+  $vtp->closeSession( $sub, 'status_option' );
+}
+// visible : true or false
+$vtp->addSession( $sub, 'visible_option' );
+$vtp->setVar( $sub, 'visible_option.value', 'true' );
+$vtp->setVar( $sub, 'visible_option.option', $lang['yes'] );
+$checked = '';
+if ( $row['visible'] == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'visible_option.checked', $checked );
+$vtp->closeSession( $sub, 'visible_option' );
+$vtp->addSession( $sub, 'visible_option' );
+$vtp->setVar( $sub, 'visible_option.value', 'false' );
+$vtp->setVar( $sub, 'visible_option.option', $lang['no'] );
+$checked = '';
+if ( $row['visible'] == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'visible_option.checked', $checked );
+$vtp->closeSession( $sub, 'visible_option' );
+// uploadable : true or false
+// a category can be uploadable if :
+//  1. upload is authorized
+//  2. category is not virtual
+//  3. category is on the main site
+if ( $conf['upload_available'] and $row['dir'] != '' and $row['site_id'] == 1 )
+{
+  $vtp->addSession( $sub, 'uploadable' );
+  $vtp->addSession( $sub, 'uploadable_option' );
+  $vtp->setVar( $sub, 'uploadable_option.value', 'true' );
+  $vtp->setVar( $sub, 'uploadable_option.option', $lang['yes'] );
+  $checked = '';
+  if ( $row['uploadable'] == 'true' )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $sub, 'uploadable_option.checked', $checked );
+  $vtp->closeSession( $sub, 'uploadable_option' );
+  $vtp->addSession( $sub, 'uploadable_option' );
+  $vtp->setVar( $sub, 'uploadable_option.value', 'false' );
+  $vtp->setVar( $sub, 'uploadable_option.option', $lang['no'] );
+  $checked = '';
+  if ( $row['uploadable'] == 'false' )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $sub, 'uploadable_option.checked', $checked );
+  $vtp->closeSession( $sub, 'uploadable_option' );
+  $vtp->closeSession( $sub, 'uploadable' );
+}
+// can the parent category be changed ? (is the category virtual ?)
+if ( $row['dir'] == '' )
+{
+  $vtp->addSession( $sub, 'parent' );
+  $vtp->addSession( $sub, 'associate_cat' );
+  $vtp->setVar( $sub, 'associate_cat.value', '-1' );
+  $vtp->setVar( $sub, 'associate_cat.content', '' );
+  $vtp->closeSession( $sub, 'associate_cat' );
+  $structure = create_structure( '', array() );
+  display_categories( $structure, '&nbsp;', $row['id_uppercat'], $row['id'] );
+  $vtp->closeSession( $sub, 'parent' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/cat_perm.php
===================================================================
--- /tags/release-1_3RC1/admin/cat_perm.php	(revision 159)
+++ /tags/release-1_3RC1/admin/cat_perm.php	(revision 159)
@@ -0,0 +1,215 @@
+<?php
+/***************************************************************************
+ *                               cat_perm.php                              *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/cat_perm.vtp' );
+$error = array();
+$tpl = array( 'permuser_authorized','permuser_forbidden','menu_groups',
+              'submit','menu_users','permuser_parent_forbidden' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//-------------------------------------------------------------- category infos
+if ( isset( $_GET['cat_id'] ) )
+{
+  check_cat_id( $_GET['cat_id'] );
+  if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+  {
+    $result = get_cat_info( $page['cat'] );
+    $page['cat_name']    = $result['name'];
+    $page['id_uppercat'] = $result['id_uppercat'];
+  }
+}
+//---------------------------------------------------------- permission updates
+if ( isset( $_POST['submit'] ) )
+{
+  // groups access update
+  $query = 'DELETE';
+  $query.= ' FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE cat_id = '.$page['cat'];
+  $query.= ';';
+  mysql_query( $query );
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'groups';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $radioname = 'groupaccess-'.$row['id'];
+    if ( $_POST[$radioname] == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'group_access';
+      $query.= ' (cat_id,group_id) VALUES';
+      $query.= ' ('.$page['cat'].','.$row['id'].')';
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+  // users access update
+  $query = 'DELETE';
+  $query.= ' FROM '.PREFIX_TABLE.'user_access';
+  $query.= ' WHERE cat_id = '.$page['cat'];
+  $query.= ';';
+  mysql_query( $query );
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $radioname = 'useraccess-'.$row['id'];
+    if ( $_POST[$radioname] == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
+      $query.= ' (cat_id,user_id) VALUES';
+      $query.= ' ('.$page['cat'].','.$row['id'].')';
+      $query.= ';';
+      mysql_query( $query );
+    }
+    check_favorites( $row['id'] );
+  }
+  // echo "<div class=\"info\">".$lang['permuser_info_message']." [ <a href=\"".add_session_id_to_url( "./admin.php?page=cat" )."\">".$lang['editcat_back']."</a> ]</div>";
+}
+//---------------------------------------------------------------------- groups
+$query = 'SELECT id,name';
+$query.= ' FROM '.PREFIX_TABLE.'groups';
+$query. ';';
+$result = mysql_query( $query );
+if ( mysql_num_rows( $result ) > 0 )
+{
+  $vtp->addSession( $sub, 'groups' );
+  // creating an array with all authorized groups for this category
+  $query = 'SELECT group_id';
+  $query.= ' FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE cat_id = '.$_GET['cat_id'];
+  $query.= ';';
+  $subresult = mysql_query( $query );
+  $authorized_groups = array();
+  while ( $subrow = mysql_fetch_array( $subresult ) )
+  {
+    array_push( $authorized_groups, $subrow['group_id'] );
+  }
+  // displaying each group
+  while( $row = mysql_fetch_array( $result ) )
+  {
+    $vtp->addSession( $sub, 'group' );
+    if ( in_array( $row['id'], $authorized_groups ) )
+    {
+      $vtp->setVar( $sub, 'group.color', 'green' );
+      $vtp->setVar( $sub, 'group.authorized_checked', ' checked="checked"' );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'group.color', 'red' );
+      $vtp->setVar( $sub, 'group.forbidden_checked', ' checked="checked"' );
+    }
+    $vtp->setVar( $sub, 'group.groupname', $row['name'] );
+    $vtp->setVar( $sub, 'group.id', $row['id'] );
+    $url = './admin.php?page=group_perm&amp;group_id='.$row['id'];
+    $vtp->setVar( $sub, 'group.group_perm_link', add_session_id( $url ) );
+    $vtp->closeSession( $sub, 'group' );
+  }
+  $vtp->closeSession( $sub, 'groups' );
+}
+//----------------------------------------------------------------------- users
+$query = 'SELECT id,username,status';
+$query.= ' FROM '.PREFIX_TABLE.'users';
+$query.= " WHERE username != '".$conf['webmaster']."'";
+$query.= ';';
+$result = mysql_query( $query );
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'user' );
+  $vtp->setVar( $sub, 'user.id', $row['id'] );
+  $url = add_session_id( './admin.php?page=user_perm&amp;user_id='.$row['id']);
+  $vtp->setVar( $sub, 'user.user_perm_link', $url);
+  if ( $row['username'] == 'guest' )
+  {
+    $row['username'] = $lang['guest'];
+  }
+  $vtp->setVar( $sub, 'user.username', $row['username'] );
+
+  // for color of user : (red means access forbidden, green authorized) we
+  // ask all forbidden categories, including the groups rights
+  $restrictions = get_restrictions( $row['id'], $row['status'], false );
+  $is_user_allowed = is_user_allowed( $page['cat'], $restrictions );
+  if ( $is_user_allowed == 0 )
+  {
+    $vtp->setVar( $sub, 'user.color', 'green' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'user.color', 'red' );
+  }
+  // for permission update button, we only ask forbidden categories for the
+  // user, not taking into account the groups the user belongs to
+  $restrictions = get_restrictions( $row['id'], $row['status'], false, false );
+  $is_user_allowed = is_user_allowed( $page['cat'], $restrictions );
+  if ( $is_user_allowed == 2 )
+  {
+    $vtp->addSession( $sub, 'parent_forbidden' );
+    $url = './admin.php?page=cat_perm&amp;cat_id='.$page['id_uppercat'];
+    $vtp->setVar( $sub, 'parent_forbidden.url', add_session_id( $url ) );
+    $vtp->closeSession( $sub, 'parent_forbidden' );
+  }
+  if ( $is_user_allowed == 0 )
+  {
+    $vtp->setVar( $sub, 'user.authorized_checked', ' checked="checked"' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'user.forbidden_checked', ' checked="checked"' );
+  }
+  // user's group(s)
+  $query = 'SELECT g.name as groupname, g.id as groupid';
+  $query.= ' FROM '.PREFIX_TABLE.'groups as g';
+  $query.= ', '.PREFIX_TABLE.'user_group as ug';
+  $query.= ' WHERE ug.group_id = g.id';
+  $query.= ' AND ug.user_id = '.$row['id'];
+  $query.= ';';
+  $subresult = mysql_query( $query );
+  if ( mysql_num_rows( $subresult ) > 0 )
+  {
+    $vtp->addSession( $sub, 'usergroups' );
+    $i = 0;
+    while( $subrow = mysql_fetch_array( $subresult ) )
+    {
+      $vtp->addSession( $sub, 'usergroup' );
+      if ( in_array( $subrow['groupid'], $authorized_groups ) )
+      {
+        $vtp->setVar( $sub, 'usergroup.color', 'green' );
+      }
+      else
+      {
+        $vtp->setVar( $sub, 'usergroup.color', 'red' );
+      }
+      $vtp->setVar( $sub, 'usergroup.name', $subrow['groupname'] );
+      if ( $i < mysql_num_rows( $subresult ) - 1 )
+      {
+        $vtp->setVar( $sub, 'usergroup.separation', ',' );
+      }
+      $vtp->closeSession( $sub, 'usergroup' );
+      $i++;
+    }
+    $vtp->closeSession( $sub, 'usergroups' );
+  }
+  $vtp->closeSession( $sub, 'user' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/comments.php
===================================================================
--- /tags/release-1_3RC1/admin/comments.php	(revision 159)
+++ /tags/release-1_3RC1/admin/comments.php	(revision 159)
@@ -0,0 +1,251 @@
+<?php
+/***************************************************************************
+ *                               comments.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+$page['plain_structure'] = get_plain_structure();
+//------------------------------------------------------------------- functions
+function display_pictures( $mysql_result, $maxtime, $validation_box = false )
+{
+  global $vtp,$sub,$lang,$conf,
+    $array_cat_directories,$array_cat_site_id,$array_cat_names;
+
+  while ( $row = mysql_fetch_array( $mysql_result ) )
+  {
+    $vtp->addSession( $sub, 'picture' );
+    // 2. for each picture, getting informations for displaying thumbnail and
+    //    link to the full size picture
+    $query = 'SELECT name,file,storage_category_id as cat_id,tn_ext';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' WHERE id = '.$row['image_id'];
+    $query.= ';';
+    $subresult = mysql_query( $query );
+    $subrow = mysql_fetch_array( $subresult );
+
+    if ( $array_cat_directories[$subrow['cat_id']] == '' )
+    {
+      $array_cat_directories[$subrow['cat_id']] =
+        get_complete_dir( $subrow['cat_id'] );
+      $cat_result = get_cat_info( $subrow['cat_id'] );
+      $array_cat_site_id[$subrow['cat_id']] = $cat_result['site_id'];
+      $array_cat_names[$subrow['cat_id']] =
+        get_cat_display_name( $cat_result['name'], ' &gt; ', '' );
+    }
+    $cat_directory = $array_cat_directories[$row['cat_id']];
+    $file = get_filename_wo_extension( $subrow['file'] );
+    // name of the picture
+    $name = $array_cat_names[$subrow['cat_id']].' &gt; ';
+    if ( $subrow['name'] != '' )
+    {
+      $name.= $subrow['name'];
+    }
+    else
+    {
+      $name.= str_replace( '_', ' ', $file );
+    }
+    $name.= ' [ '.$subrow['file'].' ]';
+    $vtp->setVar( $sub, 'picture.title', $name );
+    // source of the thumbnail picture
+    $src = '';
+    if ( $array_cat_site_id[$subrow['cat_id']] == 1 )
+    {
+      $src.= '.';
+    }
+    $src.= $array_cat_directories[$subrow['cat_id']];
+    $src.= 'thumbnail/'.$conf['prefix_thumbnail'];
+    $src.= $file.'.'.$subrow['tn_ext'];
+    $vtp->setVar( $sub, 'picture.thumb_src', $src );
+    // link to the full size picture
+    $url = '../picture.php?cat='.$subrow['cat_id'];
+    $url.= '&amp;image_id='.$row['image_id'];
+    $vtp->setVar( $sub, 'picture.thumb_url', add_session_id( $url ) );
+    // 3. for each picture, retrieving all comments
+    $query = 'SELECT id,date,author,content';
+    $query.= ' FROM '.PREFIX_TABLE.'comments';
+    $query.= ' WHERE image_id = '.$row['image_id'];
+    $query.= ' AND date > '.$maxtime;
+    if ( $validation_box ) $query.= " AND validated = 'false'";
+    $query.= ' ORDER BY date DESC';
+    $query.= ';';
+    $subresult = mysql_query( $query );
+    while ( $subrow = mysql_fetch_array( $subresult ) )
+    {
+      $vtp->addSession( $sub, 'comment' );
+      $author = $subrow['author'];
+      if ( $subrow['author'] == '' ) $author = $lang['guest'];
+      $vtp->setVar( $sub, 'comment.author', $author );
+      $displayed_date = format_date( $subrow['date'], 'unix', true );
+      $vtp->setVar( $sub, 'comment.date', $displayed_date );
+      $vtp->setVar( $sub, 'comment.content', nl2br( $subrow['content'] ) );
+      $vtp->addSession( $sub, 'delete' );
+      $url = './admin.php?page=comments';
+      if ( isset( $_GET['last_days'] ) ) $url.= '&amp;last_days='.MAX_DAYS;
+      if ( isset( $_GET['show_unvalidated'] ) )
+        $url.= '&amp;show_unvalidated=true';
+      $url.= '&amp;del='.$subrow['id'];
+      $vtp->setVar( $sub, 'delete.link', add_session_id( $url ) );
+      $vtp->closeSession( $sub, 'delete' );
+      // if the comment has to be validated, we display a checkbox
+      if ( $validation_box )
+      {
+        $vtp->addSession( $sub, 'validation' );
+        $vtp->setVar( $sub, 'validation.id', $subrow['id'] );
+        $vtp->closeSession( $sub, 'validation' );
+      }
+      $vtp->closeSession( $sub, 'comment' );
+    }
+    $vtp->closeSession( $sub, 'picture' );
+  }
+}
+//------------------------------------------------------------ comment deletion
+if ( isset( $_GET['del'] ) and is_numeric( $_GET['del'] ) )
+{
+  $query = 'DELETE FROM '.PREFIX_TABLE.'comments';
+  $query.= ' WHERE id = '.$_GET['del'];
+  $query.= ';';
+  mysql_query( $query );
+}
+//--------------------------------------------------------- comments validation
+if ( isset( $_POST['submit'] ) )
+{
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'comments';
+  $query.= " WHERE validated = 'false'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    if ( $_POST['validate-'.$row['id']] == 'true' )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'comments';
+      $query.= " SET validated = 'true'";
+      $query.= ' WHERE id = '.$row['id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/comments.vtp' );
+$tpl = array( 'stats_last_days','delete','close','submit','open' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//--------------------------------------------------- number of days to display
+if ( isset( $_GET['last_days'] ) ) define( MAX_DAYS, $_GET['last_days'] );
+else                               define( MAX_DAYS, 0 );
+//----------------------------------------- non specific section initialization
+$array_cat_directories = array();
+$array_cat_names       = array();
+$array_cat_site_id     = array();
+//------------------------------------------------------- last comments display
+$vtp->addSession( $sub, 'section' );
+$vtp->setVar( $sub, 'section.title', $lang['comments_last_title'] );
+$vtp->addSession( $sub, 'last_days' );
+foreach ( $conf['last_days'] as $option ) {
+  $vtp->addSession( $sub, 'last_day_option' );
+  $vtp->setVar( $sub, 'last_day_option.option', $option );
+  $url = './admin.php?page=comments';
+  $url.= '&amp;last_days='.($option - 1);
+  $vtp->setVar( $sub, 'last_day_option.link', add_session_id( $url ) );
+  if ( $option == MAX_DAYS + 1 )
+  {
+    $vtp->setVar( $sub, 'last_day_option.style', 'font-weight:bold;');
+  }
+  $vtp->closeSession( $sub, 'last_day_option' );
+}
+$vtp->closeSession( $sub, 'last_days' );
+if ( isset( $_GET['last_days'] ) )
+{
+  $vtp->addSession( $sub, 'close' );
+  $url = './admin.php?page=comments';
+  if ( isset( $_GET['show_unvalidated'] ) )
+  {
+    $url.= '&amp;show_unvalidated='.$_GET['show_unvalidated'];
+  }
+  $vtp->setVar( $sub, 'close.url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'close' );
+  // 1. retrieving picture ids which have comments recently added
+  $date = date( 'Y-m-d', time() - ( MAX_DAYS*24*60*60 ) );
+  list($year,$month,$day) = explode( '-', $date);
+  $maxtime = mktime( 0,0,0,$month,$day,$year );
+  $query = 'SELECT DISTINCT(image_id) as image_id';
+  $query.= ' FROM '.PREFIX_TABLE.'comments';
+  $query.=     ', '.PREFIX_TABLE.'images as images';
+  $query.= ' WHERE image_id = images.id';
+  $query.= ' AND date > '.$maxtime;
+  $query.= ' ORDER BY date_available DESC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  display_pictures( $result, $maxtime );
+}
+$vtp->closeSession( $sub, 'section' );
+//---------------------------------------------- non validated comments display
+$vtp->addSession( $sub, 'section' );
+$vtp->setVar( $sub, 'section.title', $lang['comments_non_validated_title'] );
+if ( isset( $_GET['show_unvalidated'] ) )
+{
+  // form starts
+  $vtp->addSession( $sub, 'start_form' );
+  $action = './admin.php?page=comments';
+  if ( isset( $_GET['last_days'] ) )
+  {
+    $action.= '&amp;last_days='.$_GET['last_days'];
+  }
+  $action.= '&amp;show_unvalidated=true';
+  $vtp->setVar( $sub, 'start_form.action', add_session_id( $action ) );
+  $vtp->closeSession( $sub, 'start_form' );
+  // close this section ?
+  $vtp->addSession( $sub, 'close' );
+  $url = './admin.php?page=comments';
+  if ( isset( $_GET['last_days'] ) )
+  {
+    $url.= '&amp;last_days='.$_GET['last_days'];
+  }
+  $vtp->setVar( $sub, 'close.url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'close' );
+  // retrieving all picture ids which have unvalidated comments
+  $query = 'SELECT DISTINCT(image_id) as image_id';
+  $query.= ' FROM '.PREFIX_TABLE.'comments as comments';
+  $query.=     ', '.PREFIX_TABLE.'images as images';
+  $query.= ' WHERE image_id = images.id';
+  $query.= " AND comments.validated = 'false'";
+  $query.= ' ORDER BY date_available DESC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  display_pictures( $result, 0, true );
+  $vtp->addSession( $sub, 'submit' );
+  $vtp->closeSession( $sub, 'submit' );
+  // form ends
+  $vtp->addSession( $sub, 'end_form' );
+  $vtp->closeSession( $sub, 'end_form' );
+}
+else
+{
+  $vtp->addSession( $sub, 'open' );
+  $url = './admin.php?page=comments';
+  if ( isset( $_GET['last_days'] ) )
+  {
+    $url.= '&amp;last_days='.$_GET['last_days'];
+  }
+  $url.= '&amp;show_unvalidated=true';
+  $vtp->setVar( $sub, 'open.url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'open' );
+}
+$vtp->closeSession( $sub, 'section' );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle, 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/configuration.php
===================================================================
--- /tags/release-1_3RC1/admin/configuration.php	(revision 159)
+++ /tags/release-1_3RC1/admin/configuration.php	(revision 159)
@@ -0,0 +1,1005 @@
+<?
+/***************************************************************************
+ *                             configuration.php                           *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include_once( './include/isadmin.inc.php' );
+	
+$Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A", 
+                "Â" => "A", "Ã" => "A", "Ä" => "A", "Å" => "A", 
+                "Æ" => "A", "Ç" => "C", "È" => "E", "É" => "E", 
+                "Ê" => "E", "Ë" => "E", "Ì" => "I", "Í" => "I", 
+                "Î" => "I", "Ï" => "I", "Ð" => "D", "Ñ" => "N", 
+                "Ò" => "O", "Ó" => "O", "Ô" => "O", "Õ" => "O", 
+                "Ö" => "O", "Ø" => "O", "Ù" => "U", "Ú" => "U", 
+                "Û" => "U", "Ü" => "U", "Ý" => "Y", "ß" => "s", 
+                "à" => "a", "á" => "a", "â" => "a", "ã" => "a", 
+                "ä" => "a", "å" => "a", "æ" => "a", "ç" => "c", 
+                "è" => "e", "é" => "e", "ê" => "e", "ë" => "e", 
+                "ì" => "i", "í" => "i", "î" => "i", "ï" => "i", 
+                "ð" => "o", "ñ" => "n", "ò" => "o", "ó" => "o", 
+                "ô" => "o", "õ" => "o", "ö" => "o", "ø" => "o", 
+                "ù" => "u", "ú" => "u", "û" => "u", "ü" => "u", 
+                "ý" => "y", "ÿ" => "y");
+//------------------------------ verification and registration of modifications
+$conf_infos =
+array( 'prefix_thumbnail','webmaster','mail_webmaster','access',
+       'session_id_size','session_time','session_keyword','max_user_listbox',
+       'show_comments','nb_comment_page','upload_available',
+       'upload_maxfilesize', 'upload_maxwidth','upload_maxheight',
+       'upload_maxwidth_thumbnail','upload_maxheight_thumbnail','log',
+       'comments_validation','comments_forall','authorize_cookies',
+       'mail_notification' );
+$default_user_infos =
+array( 'nb_image_line','nb_line_page','language','maxwidth',
+       'maxheight','expand','show_nb_comments','short_period','long_period',
+       'template' );
+$error = array();
+if ( isset( $_POST['submit'] ) )
+{
+  $int_pattern = '/^\d+$/';
+  // empty session table if asked
+  if ( $_POST['empty_session_table'] == 1 )
+  {
+    $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
+    $query.= ' WHERE expiration < '.time().';';
+    mysql_query( $query );
+  }
+  // deletion of site as asked
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'sites';
+  $query.= " WHERE galleries_url <> './galleries/';";
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $site = 'delete_site_'.$row['id'];
+    if ( $_POST[$site] == 1 )
+    {
+      delete_site( $row['id'] );
+      // if any picture of this site were linked to another categories, we
+      // have to update the informations of those categories. To make it
+      // simple, we just update all the categories
+      update_category( 'all' );
+    }
+  }
+  // thumbnail prefix must not contain accentuated characters
+  $old_prefix = $_POST['prefix_thumbnail'];
+  $prefix = strtr( $_POST['prefix_thumbnail'], $Caracs );
+  if ( $old_prefix != $prefix )
+  {
+    array_push( $error, $lang['conf_err_prefixe'] );
+  }
+  // mail must be formatted as follows : name@server.com
+  $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
+  if ( !preg_match( $pattern, $_POST['mail_webmaster'] ) )
+  {
+    array_push( $error, $lang['conf_err_mail'] );
+  }
+  // periods must be integer values, they represents number of days
+  if ( !preg_match( $int_pattern, $_POST['short_period'] )
+       or !preg_match( $int_pattern, $_POST['long_period'] ) )
+  {
+    array_push( $error, $lang['err_periods'] );
+  }
+  else
+  {
+    // long period must be longer than short period
+    if ( $_POST['long_period'] <= $_POST['short_period']
+         or $_POST['short_period'] <= 0 )
+    {
+      array_push( $error, $lang['err_periods_2'] );
+    }
+  }
+  // session_id size must be an integer between 4 and 50
+  if ( !preg_match( $int_pattern, $_POST['session_id_size'] )
+       or $_POST['session_id_size'] < 4
+       or $_POST['session_id_size'] > 50 )
+  {
+    array_push( $error, $lang['conf_err_sid_size'] );
+  }
+  // session_time must be an integer between 5 and 60, in minutes
+  if ( !preg_match( $int_pattern, $_POST['session_time'] )
+       or $_POST['session_time'] < 5
+       or $_POST['session_time'] > 60 )
+  {
+    array_push( $error, $lang['conf_err_sid_time'] );
+  }
+  // max_user_listbox must be an integer between 0 and 255 included
+  if ( !preg_match( $int_pattern, $_POST['max_user_listbox'] )
+       or $_POST['max_user_listbox'] < 0
+       or $_POST['max_user_listbox'] > 255 )
+  {
+    array_push( $error, $lang['conf_err_max_user_listbox'] );
+  }
+  // the number of comments per page must be an integer between 5 and 50
+  // included
+  if ( !preg_match( $int_pattern, $_POST['nb_comment_page'] )
+       or $_POST['nb_comment_page'] < 5
+       or $_POST['nb_comment_page'] > 50 )
+  {
+    array_push( $error, $lang['conf_err_comment_number'] );
+  }
+  // the maximum upload filesize must be an integer between 10 and 1000
+  if ( !preg_match( $int_pattern, $_POST['upload_maxfilesize'] )
+       or $_POST['upload_maxfilesize'] < 10
+       or $_POST['upload_maxfilesize'] > 1000 )
+  {
+    array_push( $error, $lang['conf_err_upload_maxfilesize'] );
+  }
+  // the maximum width of uploaded pictures must be an integer superior to
+  // 10
+  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth'] )
+       or $_POST['upload_maxwidth'] < 10 )
+  {
+    array_push( $error, $lang['conf_err_upload_maxwidth'] );
+  }
+  // the maximum height  of uploaded pictures must be an integer superior to
+  // 10
+  if ( !preg_match( $int_pattern, $_POST['upload_maxheight'] )
+       or $_POST['upload_maxheight'] < 10 )
+  {
+    array_push( $error, $lang['conf_err_upload_maxheight'] );
+  }
+  // the maximum width of uploaded thumbnails must be an integer superior to
+  // 10
+  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth_thumbnail'] )
+       or $_POST['upload_maxwidth_thumbnail'] < 10 )
+  {
+    array_push( $error, $lang['conf_err_upload_maxwidth_thumbnail'] );
+  }
+  // the maximum width of uploaded thumbnails must be an integer superior to
+  // 10
+  if ( !preg_match( $int_pattern, $_POST['upload_maxheight_thumbnail'] )
+       or $_POST['upload_maxheight_thumbnail'] < 10 )
+  {
+    array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
+  }
+
+  if ( $_POST['maxwidth'] != ''
+       and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
+             or $_POST['maxwidth'] < 50 ) )
+  {
+    array_push( $error, $lang['err_maxwidth'] );
+  }
+  if ( $_POST['maxheight']
+       and ( !preg_match( $int_pattern, $_POST['maxheight'] )
+             or $_POST['maxheight'] < 50 ) )
+  {
+    array_push( $error, $lang['err_maxheight'] );
+  }
+  // updating configuraiton if no error found
+  if ( count( $error ) == 0 )
+  {
+    mysql_query( 'DELETE FROM '.PREFIX_TABLE.'config;' );
+    $query = 'INSERT INTO '.PREFIX_TABLE.'config';
+    $query.= ' (';
+    foreach ( $conf_infos as $i => $conf_info ) {
+      if ( $i > 0 ) $query.= ',';
+      $query.= $conf_info;
+    }
+    $query.= ')';
+    $query.= ' VALUES';
+    $query.= ' (';
+    foreach ( $conf_infos as $i => $conf_info ) {
+      if ( $i > 0 ) $query.= ',';
+      if ( $_POST[$conf_info] == '' ) $query.= 'NULL';
+      else                            $query.= "'".$_POST[$conf_info]."'";
+    }
+    $query.= ')';
+    $query.= ';';
+    mysql_query( $query );
+
+    $query = 'UPDATE '.PREFIX_TABLE.'users';
+    $query.= ' SET';
+    foreach ( $default_user_infos as $i => $default_user_info ) {
+      if ( $i > 0 ) $query.= ',';
+      else          $query.= ' ';
+      $query.= $default_user_info;
+      $query.= ' = ';
+      if ( $_POST[$default_user_info] == '' )
+      {
+        $query.= 'NULL';
+      }
+      else
+      {
+        $query.= "'".$_POST[$default_user_info]."'";
+      }
+    }
+    $query.= " WHERE username = 'guest'";
+    $query.= ';';
+    mysql_query( $query );
+  }
+//--------------------------------------------------------- data initialization
+  foreach ( $conf_infos as $conf_info ) {
+    $$conf_info = $_POST[$conf_info];
+  }
+  foreach ( $default_user_infos as $default_user_info ) {
+    $$default_user_info = $_POST[$default_user_info];
+  }
+}
+else
+{
+//--------------------------------------------------------- data initialization
+  $query  = 'SELECT';
+  foreach ( $conf_infos as $i => $conf_info ) {
+    if ( $i > 0 ) $query.= ',';
+    else          $query.= ' ';
+    $query.= $conf_info;
+  }
+  $query .= ' FROM '.PREFIX_TABLE.'config;';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  foreach ( $conf_infos as $conf_info ) {
+    $$conf_info = $row[$conf_info];
+  }
+
+  $query  = 'SELECT';
+  foreach ( $default_user_infos as $i => $default_user_info ) {
+    if ( $i > 0 ) $query.= ',';
+    else          $query.= ' ';
+    $query.= $default_user_info;
+  }
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= " WHERE username = 'guest'";
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  foreach ( $default_user_infos as $default_user_info ) {
+    $$default_user_info = $row[$default_user_info];
+  }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open(
+  '../template/'.$user['template'].'/admin/configuration.vtp' );
+
+$tpl = array( 'conf_confirmation','remote_site','delete',
+              'conf_remote_site_delete_info','submit','errors_title' );
+templatize_array( $tpl, 'lang', $sub );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  for ( $i = 0; $i < sizeof( $error ); $i++ )
+  {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.li', $error[$i] );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+//-------------------------------------------------------- confirmation display
+if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
+{
+  $vtp->addSession( $sub, 'confirmation' );
+  $vtp->closeSession( $sub, 'confirmation' );
+}
+//----------------------------------------------------------------- form action
+$form_action = add_session_id( './admin.php?page=configuration' );
+$vtp->setVar( $sub, 'form_action', $form_action );
+//------------------------------------------------------- general configuration
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'title_line' );
+$vtp->setVar( $sub, 'title_line.title', $lang['conf_general_title'] );
+$vtp->closeSession( $sub, 'title_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+// webmaster name
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_webmaster'] );
+$vtp->addSession( $sub, 'hidden' );
+$vtp->setVar( $sub, 'hidden.text', $webmaster );
+$vtp->setVar( $sub, 'hidden.name', 'webmaster' );
+$vtp->setVar( $sub, 'hidden.value', $webmaster );
+$vtp->closeSession( $sub, 'hidden' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_webmaster_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// webmaster mail address
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_mail'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'mail_webmaster' );
+$vtp->setVar( $sub, 'text.value', $mail_webmaster );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_mail_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// prefix for thumbnails
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_prefix'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'prefix_thumbnail' );
+$vtp->setVar( $sub, 'text.value', $prefix_thumbnail );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_prefix_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// access type
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_access'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'access' );
+$vtp->setVar( $sub, 'radio.value', 'free' );
+$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
+$checked = '';
+if ( $access == 'free' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'access' );
+$vtp->setVar( $sub, 'radio.value', 'restricted' );
+$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
+$checked = '';
+if ( $access == 'restricted' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_access_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// maximum user number to display in the listbox of identification page
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name',
+              $lang['conf_general_max_user_listbox'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'max_user_listbox' );
+$vtp->setVar( $sub, 'text.value', $max_user_listbox );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_general_max_user_listbox_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// activate log
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_log'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'log' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $log == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'log' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $log == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_general_log_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// mail notification for admins
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name',
+              $lang['conf_general_mail_notification'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'mail_notification' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $mail_notification == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'mail_notification' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $mail_notification == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_general_mail_notification_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+//------------------------------------------------------ comments configuration
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'title_line' );
+$vtp->setVar( $sub, 'title_line.title', $lang['conf_comments_title'] );
+$vtp->closeSession( $sub, 'title_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+// show comments ?
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_show_comments'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'show_comments' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $show_comments == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'show_comments' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $show_comments == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_comments_show_comments_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// coments for all ? true -> guests can post messages
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_forall'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $comments_forall == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_forall' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $comments_forall == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_comments_forall_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// number of comments per page
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name',
+              $lang['conf_comments_comments_number'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'nb_comment_page' );
+$vtp->setVar( $sub, 'text.value', $nb_comment_page );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_comments_comments_number_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// coments validation
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_validation'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_validation' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$checked = '';
+if ( $comments_validation == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'comments_validation' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$checked = '';
+if ( $comments_validation == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_comments_validation_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+//-------------------------------------------------- default user configuration
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'title_line' );
+$vtp->setVar( $sub, 'title_line.title', $lang['conf_default_title'] );
+$vtp->closeSession( $sub, 'title_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+// default language
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_language'] );
+$vtp->addSession( $sub, 'select' );
+$vtp->setVar( $sub, 'select.name', 'language' );
+$option = get_languages( '../language/' );
+for ( $i = 0; $i < sizeof( $option ); $i++ )
+{
+  $vtp->addSession( $sub, 'option' );
+  $vtp->setVar( $sub, 'option.option', $option[$i] );
+  if ( $option[$i] == $language )
+  {
+    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
+  }
+  $vtp->closeSession( $sub, 'option' );
+}
+$vtp->closeSession( $sub, 'select' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_language_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// number of image per row
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_image_per_row'] );
+$vtp->addSession( $sub, 'select' );
+$vtp->setVar( $sub, 'select.name', 'nb_image_line' );
+for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
+{
+  $vtp->addSession( $sub, 'option' );
+  $vtp->setVar( $sub, 'option.option', $conf['nb_image_row'][$i] );
+  if ( $conf['nb_image_row'][$i] == $nb_image_line )
+  {
+    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
+  }
+  $vtp->closeSession( $sub, 'option' );
+}
+$vtp->closeSession( $sub, 'select' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_default_nb_image_per_row_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// number of row per page
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_row_per_page'] );
+$vtp->addSession( $sub, 'select' );
+$vtp->setVar( $sub, 'select.name', 'nb_line_page' );
+for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
+{
+  $vtp->addSession( $sub, 'option' );
+  $vtp->setVar( $sub, 'option.option', $conf['nb_row_page'][$i] );
+  if ( $conf['nb_row_page'][$i] == $nb_line_page )
+  {
+    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
+  }
+  $vtp->closeSession( $sub, 'option' );
+}
+$vtp->closeSession( $sub, 'select' );
+$vtp->setVar( $sub, 'param_line.def',
+              $lang['conf_default_nb_row_per_page_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// template
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_theme'] );
+$vtp->addSession( $sub, 'select' );
+$vtp->setVar( $sub, 'select.name', 'template' );
+$option = get_dirs( '../template/' );
+for ( $i = 0; $i < sizeof( $option ); $i++ )
+{
+  $vtp->addSession( $sub, 'option' );
+  $vtp->setVar( $sub, 'option.option', $option[$i] );
+  if ( $option[$i] == $template )
+  {
+    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
+  }
+  $vtp->closeSession( $sub, 'option' );
+}
+$vtp->closeSession( $sub, 'select' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_theme_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// short period time
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_short_period'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'short_period' );
+$vtp->setVar( $sub, 'text.value', $short_period );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_short_period_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// long period time
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_long_period'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'long_period' );
+$vtp->setVar( $sub, 'text.value', $long_period );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_long_period_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// max displayed width
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['maxwidth'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'maxwidth' );
+$vtp->setVar( $sub, 'text.value', $maxwidth );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxwidth_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// max displayed height
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['maxheight'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'maxheight' );
+$vtp->setVar( $sub, 'text.value', $maxheight );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxheight_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// expand all categories ?
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_expand'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'expand' );
+
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$checked = '';
+if ( $expand == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'expand' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$checked = '';
+if ( $expand == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_expand_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// show number of comments on thumbnails page
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['customize_show_nb_comments'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$checked = '';
+if ( $show_nb_comments == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$checked = '';
+if ( $show_nb_comments == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_show_nb_comments_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+//-------------------------------------------------------- upload configuration
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'title_line' );
+$vtp->setVar( $sub, 'title_line.title', $lang['conf_upload_title'] );
+$vtp->closeSession( $sub, 'title_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+// is upload available ?
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_available'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'upload_available' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$checked = '';
+if ( $upload_available == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'upload_available' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$checked = '';
+if ( $upload_available == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_available_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// max filesize uploadable
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxfilesize'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'upload_maxfilesize' );
+$vtp->setVar( $sub, 'text.value', $upload_maxfilesize );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxfilesize_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// maxwidth uploadable
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxwidth'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'upload_maxwidth' );
+$vtp->setVar( $sub, 'text.value', $upload_maxwidth );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxwidth_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// maxheight uploadable
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxheight'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'upload_maxheight' );
+$vtp->setVar( $sub, 'text.value', $upload_maxheight );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// maxwidth for thumbnail
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name',$lang['conf_upload_maxwidth_thumbnail']);
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'upload_maxwidth_thumbnail' );
+$vtp->setVar( $sub, 'text.value', $upload_maxwidth_thumbnail );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar($sub,'param_line.def',$lang['conf_upload_maxwidth_thumbnail_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// maxheight for thumbnail
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub,'param_line.name',$lang['conf_upload_maxheight_thumbnail']);
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'upload_maxheight_thumbnail' );
+$vtp->setVar( $sub, 'text.value', $upload_maxheight_thumbnail );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_thumbnail_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+//------------------------------------------------------ sessions configuration
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'title_line' );
+$vtp->setVar( $sub, 'title_line.title', $lang['conf_session_title'] );
+$vtp->closeSession( $sub, 'title_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+// authorize cookies ?
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_cookie'] );
+$vtp->addSession( $sub, 'group' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
+$vtp->setVar( $sub, 'radio.value', 'true' );
+$checked = '';
+if ( $authorize_cookies == 'true' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'authorize_cookies' );
+$vtp->setVar( $sub, 'radio.value', 'false' );
+$checked = '';
+if ( $authorize_cookies == 'false' )
+{
+  $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->setVar( $sub, 'radio.option', $lang['no'] );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->closeSession( $sub, 'group' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_cookie_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// session size
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_size'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'session_id_size' );
+$vtp->setVar( $sub, 'text.value', $session_id_size );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_size_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// session length
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_time'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'session_time' );
+$vtp->setVar( $sub, 'text.value', $session_time );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_time_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// session keyword
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_key'] );
+$vtp->addSession( $sub, 'text' );
+$vtp->setVar( $sub, 'text.name', 'session_keyword' );
+$vtp->setVar( $sub, 'text.value', $session_keyword );
+$vtp->closeSession( $sub, 'text' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_key_info']);
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// session deletion
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'param_line' );
+$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_delete'] );
+$vtp->addSession( $sub, 'check' );
+$vtp->addSession( $sub, 'box' );
+$vtp->setVar( $sub, 'box.name', 'empty_session_table' );
+$vtp->setVar( $sub, 'box.value', '1' );
+$vtp->setVar( $sub, 'box.checked', ' checked="checked"' );
+$vtp->closeSession( $sub, 'box' );
+$vtp->closeSession( $sub, 'check' );
+$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_delete_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+
+$vtp->addSession( $sub, 'line' );
+$vtp->addSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'space_line' );
+$vtp->closeSession( $sub, 'line' );
+//------------------------------------------------ remote sites administration 
+$query = 'select id,galleries_url';
+$query.= ' from '.PREFIX_TABLE.'sites';
+$query.= " where galleries_url <> './galleries/';";
+$result = mysql_query( $query );
+if ( mysql_num_rows( $result ) > 0 )
+{
+  $vtp->addSession( $sub, 'remote_sites' );
+  $i = 0;
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $vtp->addSession( $sub, 'site' );
+    $vtp->setVar( $sub, 'site.url', $row['galleries_url'] );
+    $vtp->setVar( $sub, 'site.id', $row['id'] );
+    if ( $i == 0 )
+    {
+      $vtp->addSession( $sub, 'rowspan' );
+      $vtp->setVar( $sub, 'rowspan.nb_sites', mysql_num_rows( $result ) );
+      $vtp->closeSession( $sub, 'rowspan' );
+    }
+    $vtp->closeSession( $sub, 'site' );
+    $i++;
+  }
+  $vtp->closeSession( $sub, 'remote_sites' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/create_listing_file.php
===================================================================
--- /tags/release-1_3RC1/admin/create_listing_file.php	(revision 159)
+++ /tags/release-1_3RC1/admin/create_listing_file.php	(revision 159)
@@ -0,0 +1,179 @@
+<?php
+/***************************************************************************
+ *                          create_listing_file.php                        *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+$prefix_thumbnail = 'TN-';
+	
+$conf['picture_ext'] = array ( 'jpg', 'gif', 'png', 'JPG', 'GIF', 'PNG' );
+
+$listing = '';
+
+$end = strrpos( $_SERVER['PHP_SELF'], '/' ) + 1;
+$local_folder = substr( $_SERVER['PHP_SELF'], 0, $end );
+$url = 'http://'.$_SERVER['HTTP_HOST'].$local_folder;
+
+$listing.= "<url>$url</url>";
+	
+// get_dirs retourne un tableau contenant tous les sous-répertoires d'un
+// répertoire
+function get_dirs( $rep, $indent, $level )
+{
+  $sub_rep = array();
+  $i = 0;
+  $dirs = "";
+  if ( $opendir = opendir ( $rep ) )
+  {
+    while ( $file = readdir ( $opendir ) )
+    {
+      if ( $file != "."
+           and $file != ".."
+           and is_dir ( $rep."/".$file )
+           and $file != "thumbnail" )
+      {
+        $sub_rep[$i++] = $file;
+        if ( !preg_match( '/^[a-zA-Z0-9-_.]+$/', $file ) )
+        {
+          echo '<span style="color:red;">"'.$file.'" : ';
+          echo 'The name of the directory should be composed of ';
+          echo 'letters, figures, "-", "_" or "." ONLY';
+          echo '</span><br />';
+        }
+      }
+    }
+  }
+  // write of the dirs
+  for ( $i = 0; $i < sizeof( $sub_rep ); $i++ )
+  {
+    $dirs.= "\n".$indent.'<dir'.$level.' name="'.$sub_rep[$i].'">';
+    $dirs.= get_pictures( $rep.'/'.$sub_rep[$i], $indent.'  ' );
+    $dirs.= get_dirs( $rep.'/'.$sub_rep[$i], $indent.'  ', $level + 1 );
+    $dirs.= "\n".$indent.'</dir'.$level.'>';
+  }
+  return $dirs;		
+}
+
+// get_extension returns the part of the string after the last "."
+function get_extension( $filename )
+{
+  return substr( strrchr( $filename, '.' ), 1, strlen ( $filename ) );
+}
+
+// get_filename_wo_extension returns the part of the string before the last
+// ".".
+// get_filename_wo_extension( 'test.tar.gz' ) -> 'test.tar'
+function get_filename_wo_extension( $filename )
+{
+  return substr( $filename, 0, strrpos( $filename, '.' ) );
+}
+
+function is_image( $filename )
+{
+  global $conf;
+
+  if ( !is_dir( $filename )
+       and in_array( get_extension( $filename ), $conf['picture_ext'] ) )
+  {
+    return true;
+  }
+  return false;
+}
+
+function TN_exists( $dir, $file )
+{
+  global $conf, $prefix_thumbnail;
+
+  $titre = get_filename_wo_extension( $file );
+
+  for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
+  {
+    $base_tn_name = $dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.';
+    $ext = $conf['picture_ext'][$i];
+    if ( is_file( $base_tn_name.$ext ) )
+    {
+      return $ext;
+    }
+  }
+  echo 'The thumbnail is missing for '.$dir.'/'.$file;
+  echo '-> '.$dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.xxx';
+  echo ' ("xxx" can be : ';
+  for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
+  {
+    if ( $i > 0 )
+    {
+      echo ', ';
+    }
+    echo '"'.$conf['picture_ext'][$i].'"';
+  }
+  echo ')<br />';
+  return false;
+}
+
+function get_pictures( $rep, $indent )
+{
+  $pictures = array();		
+
+  $tn_ext = '';
+  $root = '';
+  if ( $opendir = opendir ( $rep ) )
+  {
+    while ( $file = readdir ( $opendir ) )
+    {
+      if ( is_image( $file ) and $tn_ext = TN_exists( $rep, $file ) )
+      {
+        $picture = array();
+
+        $picture['file']     = $file;
+        $picture['tn_ext']   = $tn_ext;
+        $picture['date']     = date('Y-m-d',filemtime( $rep.'/'.$file ) );
+        $picture['filesize'] = floor( filesize( $rep."/".$file ) / 1024 );
+        $image_size = @getimagesize( $rep."/".$file );
+        $picture['width']    = $image_size[0];
+        $picture['height']   = $image_size[1];
+
+        array_push( $pictures, $picture );
+      }
+    }
+  }
+  // write of the node <root> with all the pictures at the root of the
+  // directory
+  $root.= "\n".$indent."<root>";
+  if ( sizeof( $pictures ) > 0 )
+  {
+    for( $i = 0; $i < sizeof( $pictures ); $i++ )
+    {
+      $root.= "\n".$indent.'  ';
+      $root.= '<picture';
+      $root.= ' file="'.     $pictures[$i]['file'].     '"';
+      $root.= ' tn_ext="'.   $pictures[$i]['tn_ext'].   '"';
+      $root.= ' date="'.     $pictures[$i]['date'].     '"';
+      $root.= ' filesize="'. $pictures[$i]['filesize']. '"';
+      $root.= ' width="'.    $pictures[$i]['width'].    '"';
+      $root.= ' height="'.   $pictures[$i]['height'].   '"';
+      $root.= ' />';
+    }
+  }
+  $root.= "\n".$indent.'</root>';
+  return $root;
+}
+
+$listing.= get_dirs( '.', '', 0 );
+
+if ( $fp = @fopen("./listing.xml","w") )
+{
+  fwrite( $fp, $listing );
+  fclose( $fp );
+}
+else
+{
+  echo "I can't write the file listing.xml";
+}
+
+echo "listing.xml created";
+?>
Index: /tags/release-1_3RC1/admin/group_list.php
===================================================================
--- /tags/release-1_3RC1/admin/group_list.php	(revision 159)
+++ /tags/release-1_3RC1/admin/group_list.php	(revision 159)
@@ -0,0 +1,138 @@
+<?php
+/***************************************************************************
+ *                                 group_list.php                          *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/group_list.vtp' );
+$tpl = array( 'group_add','add','listuser_permission','delete',
+              'group_confirm','yes','no','group_list_title' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//-------------------------------------------------------------- delete a group
+$error = array();
+if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
+{
+  $query = 'SELECT name';
+  $query.= ' FROM '.PREFIX_TABLE.'groups';
+  $query.= ' WHERE id = '.$_GET['delete'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  // confirm group deletion ?
+  if ( $_GET['confirm'] != 1 )
+  {
+    $vtp->addSession( $sub, 'deletion' );
+    $vtp->setVar( $sub, 'deletion.name', $row['name'] );
+    $yes_url = './admin.php?page=group_list&amp;delete='.$_GET['delete'];
+    $yes_url.= '&amp;confirm=1';
+    $vtp->setVar( $sub, 'deletion.yes_url', add_session_id( $yes_url ) );
+    $no_url = './admin.php?page=group_list';
+    $vtp->setVar( $sub, 'deletion.no_url', add_session_id( $no_url ) );
+    $vtp->closeSession( $sub, 'deletion' );
+  }
+  // group deletion confirmed
+  else
+  {
+    $vtp->addSession( $sub, 'confirmation' );
+    $query = 'SELECT COUNT(*) AS nb_result';
+    $query.= ' FROM '.PREFIX_TABLE.'groups';
+    $query.= ' WHERE id = '.$_GET['delete'];
+    $query.= ';';
+    $row2 = mysql_fetch_array( mysql_query( $query ) );
+    if ( $row2['nb_result'] > 0 )
+    {
+      delete_group( $_GET['delete'] );
+      $vtp->setVar( $sub, 'confirmation.class', 'info' );
+      $info = '"'.$row['name'].'" '.$lang['listuser_info_deletion'];
+      $vtp->setVar( $sub, 'confirmation.info', $info );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'confirmation.class', 'erreur' );
+      $vtp->setVar( $sub, 'confirmation.info', $lang['group_err_unknown'] );
+    }
+    $vtp->closeSession( $sub, 'confirmation' );
+  }
+}
+//----------------------------------------------------------------- add a group
+if ( isset( $_POST['submit'] ) )
+{
+  if ( preg_match( "/'/", $_POST['name'] )
+       or preg_match( '/"/', $_POST['name'] ) )
+  {
+    array_push( $error, $lang['group_add_error1'] );
+  }
+  if ( count( $error ) == 0 )
+  {
+    // is the group not already existing ?
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'groups';
+    $query.= " WHERE name = '".$_POST['name']."'";
+    $query.= ';';
+    $result = mysql_query( $query );
+    if ( mysql_num_rows( $result ) > 0 )
+    {
+      array_push( $error, $lang['group_add_error2'] );
+    }
+  }
+  if ( count( $error ) == 0 )
+  {
+    // creating the group
+    $query = ' INSERT INTO '.PREFIX_TABLE.'groups';
+    $query.= " (name) VALUES ('".$_POST['name']."')";
+    $query.= ';';
+    mysql_query( $query );
+  }
+}
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  for ( $i = 0; $i < sizeof( $error ); $i++ )
+  {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.li', $error[$i] );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+//----------------------------------------------------------------- groups list
+$vtp->addSession( $sub, 'groups' );
+
+$query = 'SELECT id,name';
+$query.= ' FROM '.PREFIX_TABLE.'groups';
+$query.= ' ORDER BY id ASC';
+$query.= ';';
+$result = mysql_query( $query );
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'group' );
+  $vtp->setVar( $sub, 'group.name', $row['name'] );
+  $url = './admin.php?page=group_perm&amp;group_id='.$row['id'];
+  $vtp->setVar( $sub, 'group.permission_url', add_session_id( $url ) );
+  $url = './admin.php?page=group_list&amp;delete='.$row['id'];
+  $vtp->setVar( $sub, 'group.deletion_url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'group' );
+}
+
+$vtp->closeSession( $sub, 'groups' );
+//------------------------------------------------------- create new group form
+$action = './admin.php?'.$_SERVER['QUERY_STRING'];
+$vtp->setVar( $sub, 'form_action', $action );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/group_perm.php
===================================================================
--- /tags/release-1_3RC1/admin/group_perm.php	(revision 159)
+++ /tags/release-1_3RC1/admin/group_perm.php	(revision 159)
@@ -0,0 +1,109 @@
+<?php
+/***************************************************************************
+ *                               group_perm.php                            *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/group_perm.vtp' );
+$error = array();
+$tpl = array( 'permuser_authorized','permuser_forbidden','submit',
+              'permuser_parent_forbidden','permuser_info_message',
+              'adduser_info_back','permuser_only_private' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//--------------------------------------------------------------------- updates
+if ( isset( $_POST['submit'] ) )
+{
+  // cleaning the user_access table for this group
+  $query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE group_id = '.$_GET['group_id'];
+  $query.= ';';
+  mysql_query( $query );
+  // selecting all private categories
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= " WHERE status = 'private'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $radioname = 'access-'.$row['id'];
+    if ( $_POST[$radioname] == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'group_access';
+      $query.= ' (group_id,cat_id) VALUES';
+      $query.= ' ('.$_GET['group_id'].','.$row['id'].')';
+      $query.= ';';
+      mysql_query ( $query );
+    }
+  }
+  $vtp->addSession( $sub, 'confirmation' );
+  $url = './admin.php?page=group_list';
+  $vtp->setVar( $sub, 'confirmation.back_url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'confirmation' );
+}
+//---------------------------------------------------------------- form display
+$restrictions = get_group_restrictions( $_GET['group_id'] );
+$action = './admin.php?page=group_perm&amp;group_id='.$_GET['group_id'];
+$vtp->setVar( $sub, 'action', add_session_id( $action ) );
+// only private categories are listed
+$query = 'SELECT id';
+$query.= ' FROM '.PREFIX_TABLE.'categories';
+$query.= " WHERE status = 'private'";
+$query.= ';';
+$result = mysql_query( $query );
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'category' );
+  $vtp->setVar( $sub, 'category.id', $row['id'] );
+  $url = './admin.php?page=cat_perm&amp;cat_id='.$row['id'];
+  $vtp->setVar( $sub, 'category.cat_perm_link', add_session_id( $url ) );
+  // Is the group allowed to access this category
+  $is_group_allowed = is_group_allowed( $row['id'], $restrictions );
+  if ( $is_group_allowed == 0 )
+  {
+    $vtp->setVar( $sub, 'category.color', 'green' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'category.color', 'red' );
+  }
+  // category name
+  $cat_infos = get_cat_info( $row['id'] );
+  $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
+                                'font-weight:bold;' );
+  $vtp->setVar( $sub, 'category.name', $name );
+  // any subcat forbidden for this group ?
+  if ( $is_group_allowed == 2 )
+  {
+    $vtp->addSession( $sub, 'parent_forbidden' );
+    $vtp->closeSession( $sub, 'parent_forbidden' );
+  }
+  // forbidden or authorized access ?
+  if ( $is_group_allowed == 0 or $is_group_allowed == 2 )
+  {
+    $vtp->setVar( $sub, 'category.authorized_checked', ' checked="checked"' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'category.forbidden_checked', ' checked="checked"' );
+  }
+  $vtp->closeSession( $sub, 'category' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/help.php
===================================================================
--- /tags/release-1_3RC1/admin/help.php	(revision 159)
+++ /tags/release-1_3RC1/admin/help.php	(revision 159)
@@ -0,0 +1,48 @@
+<?php
+/***************************************************************************
+ *                                  help.php                               *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/help.vtp' );
+$tpl = array( );
+templatize_array( $tpl, 'lang', $sub );
+//----------------------------------------------------- help categories display
+$categories = array( 'images','thumbnails','database','remote','upload',
+                     'virtual','groups','access','infos' );
+foreach ( $categories as $category ) {
+  $vtp->addSession( $sub, 'cat' );
+  if ( $category == 'images' )
+  {
+    $vtp->addSession( $sub, 'illustration' );
+    $vtp->setVar( $sub, 'illustration.pic_src', './images/admin.png' );
+    $vtp->setVar( $sub, 'illustration.pic_alt', '' );
+    $vtp->setVar( $sub, 'illustration.caption', $lang['help_images_intro'] );
+    $vtp->closeSession( $sub, 'illustration' );
+  }
+  $vtp->setVar( $sub, 'cat.name', $lang['help_'.$category.'_title'] );
+  foreach ( $lang['help_'.$category] as $item ) {
+    $vtp->addSession( $sub, 'item' );
+    $vtp->setVar( $sub, 'item.content', $item );
+    $vtp->closeSession( $sub, 'item' );
+  }
+
+  $vtp->closeSession( $sub, 'cat' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/images/index.htm
===================================================================
--- /tags/release-1_3RC1/admin/images/index.htm	(revision 159)
+++ /tags/release-1_3RC1/admin/images/index.htm	(revision 159)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>PhpWebGallery</title>
+    </head>
+    <body>
+        No access authorized
+    </body>
+</html>
Index: /tags/release-1_3RC1/admin/include/functions.php
===================================================================
--- /tags/release-1_3RC1/admin/include/functions.php	(revision 159)
+++ /tags/release-1_3RC1/admin/include/functions.php	(revision 159)
@@ -0,0 +1,435 @@
+<?php
+/***************************************************************************
+ *                               functions.php                             *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+$tab_ext_create_TN = array ( 'jpg', 'png', 'JPG', 'PNG' );
+
+// is_image returns true if the given $filename (including the path) is a
+// picture according to its format and its extension.
+// As GD library can only generate pictures from jpeg and png files, if you
+// ask if the filename is an image for thumbnail creation (second parameter
+// set to true), the only authorized formats are jpeg and png.
+function is_image( $filename, $create_thumbnail = false )
+{
+  global $conf, $tab_ext_create_TN;
+
+  if ( is_file( $filename ) )
+  {
+    $size = getimagesize( $filename );
+    // $size[2] == 1 means GIF
+    // $size[2] == 2 means JPG
+    // $size[2] == 3 means PNG
+    if ( !$create_thumbnail )
+    {
+      if ( in_array( get_extension( $filename ), $conf['picture_ext'] )
+           and ( $size[2] == 1 or $size[2] == 2 or $size[2] == 3 ) )
+      {
+        return true;
+      }
+    }
+    else
+    {
+      if ( in_array( get_extension( $filename ), $tab_ext_create_TN )
+           and ( $size[2] == 2 or $size[2] == 3 ) )
+      {
+        return true;
+      }
+    }
+  }
+  return false;
+}
+	
+function TN_exists( $dir, $file )
+{
+  global $conf;
+
+  $filename = get_filename_wo_extension( $file );
+  foreach ( $conf['picture_ext'] as $ext ) {
+    $test = $dir.'/thumbnail/'.$conf['prefix_thumbnail'].$filename.'.'.$ext;
+    if ( is_file ( $test ) )
+    {
+      return $ext;
+    }
+  }
+  return false;
+}	
+	
+// The function delete_site deletes a site
+// and call the function delete_category for each primary category of the site
+function delete_site( $id )
+{
+  // destruction of the categories of the site
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE site_id = '.$id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    delete_category( $row['id'] );
+  }
+		
+  // destruction of the site
+  $query = 'DELETE FROM '.PREFIX_TABLE.'sites';
+  $query.= ' WHERE id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+}
+	
+// The function delete_category deletes the category identified by the $id
+// It also deletes (in the database) :
+//    - all the images of the images (thanks to delete_image, see further)
+//    - all the links between images and this category
+//    - all the restrictions linked to the category
+// The function works recursively.
+function delete_category( $id )
+{
+  // destruction of all the related images
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' WHERE storage_category_id = '.$id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    delete_image( $row['id'] );
+  }
+
+  // destruction of the links between images and this category
+  $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
+  $query.= ' WHERE category_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the access linked to the category
+  $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
+  $query.= ' WHERE cat_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+  $query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE cat_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the sub-categories
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id_uppercat = '.$id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while( $row = mysql_fetch_array( $result ) )
+  {
+    delete_category( $row['id'] );
+  }
+
+  // destruction of the category
+  $query = 'DELETE FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+}
+	
+// The function delete_image deletes the image identified by the $id
+// It also deletes (in the database) :
+//    - all the comments related to the image
+//    - all the links between categories and this image
+//    - all the favorites associated to the image
+function delete_image( $id )
+{
+  global $count_deleted;
+		
+  // destruction of the comments on the image
+  $query = 'DELETE FROM '.PREFIX_TABLE.'comments';
+  $query.= ' WHERE image_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the links between images and this category
+  $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
+  $query.= ' WHERE image_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the favorites associated with the picture
+  $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
+  $query.= ' WHERE image_id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+		
+  // destruction of the image
+  $query = 'DELETE FROM '.PREFIX_TABLE.'images';
+  $query.= ' WHERE id = '.$id;
+  $query.= ';';
+  mysql_query( $query );
+  $count_deleted++;
+}
+	
+// The delete_user function delete a user identified by the $user_id
+// It also deletes :
+//     - all the access linked to this user
+//     - all the links to any group
+//     - all the favorites linked to this user
+//     - all sessions linked to this user
+function delete_user( $user_id )
+{
+  // destruction of the access linked to the user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the group links for this user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the favorites associated with the user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the sessions linked with the user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  mysql_query( $query );
+		
+  // destruction of the user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'users';
+  $query.= ' WHERE id = '.$user_id;
+  $query.= ';';
+  mysql_query( $query );
+}
+
+// delete_group deletes a group identified by its $group_id.
+// It also deletes :
+//     - all the access linked to this group
+//     - all the links between this group and any user
+function delete_group( $group_id )
+{
+  // destruction of the access linked to the group
+  $query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE group_id = '.$group_id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the group links for this group
+  $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
+  $query.= ' WHERE group_id = '.$group_id;
+  $query.= ';';
+  mysql_query( $query );
+
+  // destruction of the group
+  $query = 'DELETE FROM '.PREFIX_TABLE.'groups';
+  $query.= ' WHERE id = '.$group_id;
+  $query.= ';';
+  mysql_query( $query );
+}
+
+// The check_favorites function deletes all the favorites of a user if he is
+// not allowed to see them (the category or an upper category is restricted
+// or invisible)
+function check_favorites( $user_id )
+{
+  $query = 'SELECT status';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= ' WHERE id = '.$user_id;
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $status = $row['status'];
+  // retrieving all the restricted categories for this user
+  $restricted_cat = get_all_restrictions( $user_id, $status );
+  // retrieving all the favorites for this user and comparing their
+  // categories to the restricted categories
+  $query = 'SELECT image_id';
+  $query.= ' FROM '.PREFIX_TABLE.'favorites';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  $result = mysql_query ( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // for each picture, we have to check all the categories it belongs
+    // to. Indeed if a picture belongs to category_1 and category_2 and that
+    // category_2 is not restricted to the user, he can have the picture as
+    // favorite.
+    $query = 'SELECT DISTINCT(category_id) as category_id';
+    $query.= ' FROM '.PREFIX_TABLE.'image_category';
+    $query.= ' WHERE image_id = '.$row['image_id'];
+    $query.= ';';
+    $picture_result = mysql_query( $query );
+    $picture_cat = array();
+    while ( $picture_row = mysql_fetch_array( $picture_result ) )
+    {
+      array_push( $picture_cat, $picture_row['category_id'] );
+    }
+    if ( count( array_diff( $picture_cat, $restricted_cat ) ) > 0 )
+    {
+      $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
+      $query.= ' WHERE image_id = '.$row['image_id'];
+      $query.= ' AND user_id = '.$user_id;
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+}
+
+// update_category updates calculated informations about a category :
+// date_last and nb_images. It also verifies that the representative picture
+// is really linked to the category.
+function update_category( $id = 'all' )
+{
+  if ( $id == 'all' )
+  {
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ';';
+    $result = mysql_query( $query );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      // recursive call
+      update_category( $row['id'] );
+    }
+  }
+  else if ( is_numeric( $id ) )
+  {
+    // updating the number of pictures
+    $query = 'SELECT COUNT(*) as nb_images';
+    $query.= ' FROM '.PREFIX_TABLE.'image_category';
+    $query.= ' WHERE category_id = '.$id;
+    $query.= ';';
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    $query = 'UPDATE '.PREFIX_TABLE.'categories';
+    $query.= ' SET nb_images = '.$row['nb_images'];
+    $query.= ' WHERE id = '.$id;
+    $query.= ';';
+    mysql_query( $query );
+    // updating the date_last
+    $query = 'SELECT date_available';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
+    $query.= ' WHERE category_id = '.$id;
+    $query.= ' ORDER BY date_available DESC';
+    $query.= ' LIMIT 0,1';
+    $query.= ';';
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    $query = 'UPDATE '.PREFIX_TABLE.'categories';
+    $query.= " SET date_last = '".$row['date_available']."'";
+    $query.= ' WHERE id = '.$id;
+    $query.= ';';
+    mysql_query( $query );
+    // updating the representative_picture_id : if the representative
+    // picture of the category is not any more linked to the category, we
+    // have to set representative_picture_id to NULL
+    $query = 'SELECT representative_picture_id';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE id = '.$id;
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    // if the category has no representative picture (ie
+    // representative_picture_id == NULL) we don't update anything
+    if ( $row['representative_picture_id'] != '' )
+    {
+      $query = 'SELECT image_id';
+      $query.= ' FROM '.PREFIX_TABLE.'image_category';
+      $query.= ' WHERE category_id = '.$id;
+      $query.= ' AND image_id = '.$row['representative_picture_id'];
+      $query.= ';';
+      $result = mysql_query( $query );
+      if ( mysql_num_rows( $result ) == 0 )
+      {
+        $query = 'UPDATE '.PREFIX_TABLE.'categories';
+        $query.= ' SET representative_picture_id = NULL';
+        $query.= ' WHERE id = '.$id;
+        $query.= ';';
+        mysql_query( $query );
+      }
+    }
+  }
+}
+
+function check_date_format( $date )
+{
+  // date arrives at this format : DD/MM/YYYY
+  list($day,$month,$year) = explode( '/', $date );
+  return checkdate ( $month, $day, $year );
+}
+
+function date_convert( $date )
+{
+  // date arrives at this format : DD/MM/YYYY
+  // It must be transformed in YYYY-MM-DD
+  list($day,$month,$year) = explode( '/', $date );
+  return $year.'-'.$month.'-'.$day;
+}
+
+function date_convert_back( $date )
+{
+  // date arrives at this format : YYYY-MM-DD
+  // It must be transformed in DD/MM/YYYY
+  if ( $date != '' )
+  {
+    list($year,$month,$day) = explode( '-', $date );
+    return $day.'/'.$month.'/'.$year;
+  }
+  else
+  {
+    return '';
+  }
+}
+
+// get_keywords returns an array with relevant keywords found in the string
+// given in argument. Keywords must be separated by comma in this string.
+// keywords must :
+//   - be longer or equal to 3 characters
+//   - not contain ', " or blank characters
+//   - unique in the string ("test,test" -> "test")
+function get_keywords( $keywords_string )
+{
+  $keywords = array();
+
+  $candidates = explode( ',', $keywords_string );
+  foreach ( $candidates as $candidate ) {
+    if ( strlen($candidate) >= 3 and !preg_match( '/(\'|"|\s)/', $candidate ) )
+      array_push( $keywords, $candidate );
+  }
+
+  return array_unique( $keywords );
+}
+
+function display_categories( $categories, $indent,
+                             $selected = -1, $forbidden = -1 )
+{
+  global $vtp,$sub;
+
+  foreach ( $categories as $category ) {
+    if ( $category['id'] != $forbidden )
+    {
+      $vtp->addSession( $sub, 'associate_cat' );
+      $vtp->setVar( $sub, 'associate_cat.value',   $category['id'] );
+      $content = $indent.'- '.$category['name'];
+      $vtp->setVar( $sub, 'associate_cat.content', $content );
+      if ( $category['id'] == $selected )
+        $vtp->setVar( $sub, 'associate_cat.selected', ' selected="selected"' );
+      $vtp->closeSession( $sub, 'associate_cat' );
+      display_categories( $category['subcats'], $indent.str_repeat('&nbsp;',3),
+                          $selected, $forbidden );
+    }
+  }
+}
+?>
Index: /tags/release-1_3RC1/admin/include/index.htm
===================================================================
--- /tags/release-1_3RC1/admin/include/index.htm	(revision 159)
+++ /tags/release-1_3RC1/admin/include/index.htm	(revision 159)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>PhpWebGallery</title>
+    </head>
+    <body>
+        No access authorized
+    </body>
+</html>
Index: /tags/release-1_3RC1/admin/include/isadmin.inc.php
===================================================================
--- /tags/release-1_3RC1/admin/include/isadmin.inc.php	(revision 159)
+++ /tags/release-1_3RC1/admin/include/isadmin.inc.php	(revision 159)
@@ -0,0 +1,34 @@
+<?php
+/***************************************************************************
+ *                              isadmin.inc.php                            *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+define( PREFIX_INCLUDE, '.' );
+
+include_once( '../include/config.inc.php' );
+include_once( '../include/user.inc.php' );
+include( './include/functions.php' );
+
+$isadmin = true;
+include_once( '../language/'.$user['language'].'.php' );
+
+if ( $user['status'] != 'admin' )
+{
+  echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
+  echo '<a href="../identification.php">'.$lang['ident_title'].'</a></div>';
+  exit();
+}
+?>
Index: /tags/release-1_3RC1/admin/index.htm
===================================================================
--- /tags/release-1_3RC1/admin/index.htm	(revision 159)
+++ /tags/release-1_3RC1/admin/index.htm	(revision 159)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>PhpWebGallery</title>
+    </head>
+    <body>
+        No access authorized
+    </body>
+</html>
Index: /tags/release-1_3RC1/admin/infos_images.php
===================================================================
--- /tags/release-1_3RC1/admin/infos_images.php	(revision 159)
+++ /tags/release-1_3RC1/admin/infos_images.php	(revision 159)
@@ -0,0 +1,291 @@
+<?php
+/***************************************************************************
+ *                             infos_images.php                            *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include_once( './include/isadmin.inc.php' );
+include_once( '../template/'.$user['template'].'/htmlfunctions.inc.php' );
+//-------------------------------------------------------------- initialization
+check_cat_id( $_GET['cat_id'] );
+if ( isset( $page['cat'] ) )
+{
+//--------------------------------------------------- update individual options
+  $query = 'SELECT id,file';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
+  $query.= ' WHERE category_id = '.$page['cat'];
+  $query.= ';';
+  $result = mysql_query( $query );
+  $i = 1;
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $name          = 'name-'.$row['id'];
+    $author        = 'author-'.$row['id'];
+    $comment       = 'comment-'.$row['id'];
+    $date_creation = 'date_creation-'.$row['id'];
+    $keywords      = 'keywords-'.$row['id'];
+    if ( isset( $_POST[$name] ) )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'images';
+
+      $query.= ' SET name = ';
+      if ( $_POST[$name] == '' )
+        $query.= 'NULL';
+      else
+        $query.= "'".htmlentities( $_POST[$name], ENT_QUOTES )."'";
+
+      $query.= ', author = ';
+      if ( $_POST[$author] == '' )
+        $query.= 'NULL';
+      else
+        $query.= "'".htmlentities($_POST[$author],ENT_QUOTES)."'";
+
+      $query.= ', comment = ';
+      if ( $_POST[$comment] == '' )
+        $query.= 'NULL';
+      else
+        $query.= "'".htmlentities($_POST[$comment],ENT_QUOTES)."'";
+
+      $query.= ', date_creation = ';
+      if ( check_date_format( $_POST[$date_creation] ) )
+        $query.= "'".date_convert( $_POST[$date_creation] )."'";
+      else if ( $_POST[$date_creation] == '' )
+        $query.= 'NULL';
+
+      $query.= ', keywords = ';
+      $keywords_array = get_keywords( $_POST[$keywords] );
+      if ( count( $keywords_array ) == 0 )
+        $query.= 'NULL';
+      else
+      {
+        $query.= "'";
+        foreach ( $keywords_array as $i => $keyword ) {
+          if ( $i > 0 ) $query.= ',';
+          $query.= $keyword;
+        }
+        $query.= "'";
+      }
+
+      $query.= ' WHERE id = '.$row['id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+    // add link to another category
+    if ( $_POST['check-'.$row['id']] == 1 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+      $query.= ' (image_id,category_id) VALUES';
+      $query.= ' ('.$row['id'].','.$_POST['associate'].')';
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+  update_category( $_POST['associate'] );
+//------------------------------------------------------ update general options
+  if ( $_POST['use_common_author'] == 1 )
+  {
+    $query = 'SELECT image_id';
+    $query.= ' FROM '.PREFIX_TABLE.'image_category';
+    $query.= ' WHERE category_id = '.$page['cat'];
+    $result = mysql_query( $query );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'images';
+      if ( $_POST['author_cat'] == '' )
+      {
+        $query.= ' SET author = NULL';
+      }
+      else
+      {
+        $query.= ' SET author = ';
+        $query.= "'".htmlentities( $_POST['author_cat'], ENT_QUOTES )."'";
+      }
+      $query.= ' WHERE id = '.$row['image_id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+  if ( $_POST['use_common_date_creation'] == 1 )
+  {
+    if ( check_date_format( $_POST['date_creation_cat'] ) )
+    {
+      $date = date_convert( $_POST['date_creation_cat'] );
+      $query = 'SELECT image_id';
+      $query.= ' FROM '.PREFIX_TABLE.'image_category';
+      $query.= ' WHERE category_id = '.$page['cat'];
+      $result = mysql_query( $query );
+      while ( $row = mysql_fetch_array( $result ) )
+      {
+        $query = 'UPDATE '.PREFIX_TABLE.'images';
+        if ( $_POST['date_creation_cat'] == '' )
+        {
+          $query.= ' SET date_creation = NULL';
+        }
+        else
+        {
+          $query.= " SET date_creation = '".$date."'";
+        }
+        $query.= ' WHERE id = '.$row['image_id'];
+        $query.= ';';
+        mysql_query( $query );
+      }
+    }
+    else
+    {
+      echo $lang['err_date'];
+    }
+  }
+  if ( isset( $_POST['common_keywords'] ) and $_POST['keywords_cat'] != '' )
+  {
+    $query = 'SELECT id,keywords';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
+    $query.= ' WHERE category_id = '.$page['cat'];
+    $query.= ';';
+    $result = mysql_query( $query );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      $specific_keywords = explode( ',', $row['keywords'] );
+      $common_keywords   = get_keywords( $_POST['keywords_cat'] );
+      // first possiblity : adding the given keywords to all the pictures
+      if ( $_POST['common_keywords'] == 'add' )
+      {
+        $keywords = array_merge( $specific_keywords, $common_keywords );
+        $keywords = array_unique( $keywords );
+      }
+      // second possiblity : removing the given keywords from all pictures
+      // (without deleting the other specific keywords
+      if ( $_POST['common_keywords'] == 'remove' )
+      {
+        $keywords = array_diff( $specific_keywords, $common_keywords );
+      }
+      // cleaning the keywords array, sometimes, an empty value still remain
+      $keywords = array_remove( $keywords, '' );
+      // updating the picture with new keywords array
+      $query = 'UPDATE '.PREFIX_TABLE.'images';
+      $query.= ' SET keywords = ';
+      if ( count( $keywords ) == 0 )
+      {
+        $query.= 'NULL';
+      }
+      else
+      {
+        $query.= '"';
+        $i = 0;
+        foreach ( $keywords as $keyword ) {
+          if ( $i++ > 0 ) $query.= ',';
+          $query.= $keyword;
+        }
+        $query.= '"';
+      }
+      $query.= ' WHERE id = '.$row['id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+//--------------------------------------------------------- form initialization
+  $page['nb_image_page'] = 5;
+
+  if( !isset( $_GET['start'] )
+      or !is_numeric( $_GET['start'] )
+      or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
+  {
+    $page['start'] = 0;
+  }
+  else
+  {
+    $page['start'] = $_GET['start'];
+  }
+
+  if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 )
+  {
+    $page['start'] =
+      floor( $_GET['num'] / $page['nb_image_page'] ) * $page['nb_image_page'];
+  }
+  // retrieving category information
+  $page['plain_structure'] = get_plain_structure();
+  $result = get_cat_info( $page['cat'] );
+  $cat['name'] = $result['name'];
+  $cat['nb_images'] = $result['nb_images'];
+//----------------------------------------------------- template initialization
+  $sub = $vtp->Open('../template/'.$user['template'].'/admin/infos_image.vtp');
+  $tpl = array( 'infoimage_general','author','infoimage_useforall','submit',
+                'infoimage_creation_date','infoimage_detailed','thumbnail',
+                'infoimage_title','infoimage_comment',
+                'infoimage_creation_date','keywords',
+                'infoimage_addtoall','infoimage_removefromall',
+                'infoimage_keyword_separation','infoimage_associate' );
+  templatize_array( $tpl, 'lang', $sub );
+  $vtp->setGlobalVar( $sub, 'user_template',   $user['template'] );
+//------------------------------------------------------------------------ form
+  $url = './admin.php?page=infos_images&amp;cat_id='.$page['cat'];
+  $url.= '&amp;start='.$page['start'];
+  $vtp->setVar( $sub, 'form_action', add_session_id( $url ) ); 
+  $page['navigation_bar'] = create_navigation_bar(
+    $url, $cat['nb_images'],$page['start'], $page['nb_image_page'], '' );
+  $vtp->setVar( $sub, 'navigation_bar', $page['navigation_bar'] );
+  $cat_name = get_cat_display_name( $cat['name'], ' - ', 'font-style:italic;');
+  $vtp->setVar( $sub, 'cat_name', $cat_name );
+
+  $array_cat_directories = array();
+
+  $query = 'SELECT id,file,comment,author,tn_ext,name,date_creation,keywords';
+  $query.= ',storage_category_id,category_id';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
+  $query.= ' WHERE category_id = '.$page['cat'];
+  $query.= $conf['order_by'];
+  $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page'];
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $vtp->addSession( $sub, 'picture' );
+    $vtp->setVar( $sub, 'picture.id', $row['id'] );
+    $vtp->setVar( $sub, 'picture.filename', $row['file'] );
+    $vtp->setVar( $sub, 'picture.name', $row['name'] );
+    $vtp->setVar( $sub, 'picture.author', $row['author'] );
+    $vtp->setVar( $sub, 'picture.comment', $row['comment'] );
+    $vtp->setVar( $sub, 'picture.keywords', $row['keywords'] );
+    $vtp->setVar( $sub, 'picture.date_creation',
+                  date_convert_back( $row['date_creation'] ) );
+    $file = get_filename_wo_extension( $row['file'] );
+    $vtp->setVar( $sub, 'picture.default_name', $file );
+    // creating url to thumbnail
+    if ( $array_cat_directories[$row['storage_category_id']] == '' )
+    {
+      $array_cat_directories[$row['storage_category_id']] =
+        get_complete_dir( $row['storage_category_id'] );
+    }
+    $thumbnail_url = $array_cat_directories[$row['storage_category_id']];
+    if ( preg_match( '/^\.\/galleries/', $thumbnail_url ) )
+    {
+      $thumbnail_url = '.'.$thumbnail_url;
+    }
+    $thumbnail_url.= 'thumbnail/';
+    $thumbnail_url.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
+    $vtp->setVar( $sub, 'picture.thumbnail_url', $thumbnail_url );
+    $url = './admin.php?page=picture_modify&amp;image_id='.$row['id'];
+    $vtp->setVar( $sub, 'picture.url', add_session_id( $url ) );
+    $vtp->closeSession( $sub, 'picture' );
+  }
+  $structure = create_structure( '', array() );
+  display_categories( $structure, '&nbsp;' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/install.php
===================================================================
--- /tags/release-1_3RC1/admin/install.php	(revision 159)
+++ /tags/release-1_3RC1/admin/install.php	(revision 159)
@@ -0,0 +1,297 @@
+<?php
+/***************************************************************************
+ *                                install.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//-------------------------------------------------------------------- includes
+define( PREFIX_INCLUDE, '.' );
+include( '../include/vtemplate.class.php' );
+include( '../include/functions.inc.php' );
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( '../template/default/admin/install.vtp' );
+$vtp->setGlobalVar( $handle, 'release', '1.3' );
+//-------------------------------------------------------------------- language
+if ( isset( $_GET['language'] ) )
+{
+  $isadmin = true;
+  $lang = array();
+  include( '../language/'.$_GET['language'].'.php' );
+  $tpl = array( 'step1_err_copy', 'step1_err_copy_2', 'step1_err_copy_next',
+                'errors_title', 'step1_title','step1_host','step1_host_info',
+                'step1_user','step1_user_info','step1_pass','step1_pass_info',
+                'step1_database','step1_database_info','step1_prefix',
+                'step1_prefix_info','submit','infos_title','step2_title',
+                'conf_general_webmaster','conf_general_webmaster_info',
+                'step2_pwd','step2_pwd_info','step2_pwd_conf',
+                'step2_pwd_conf_info','conf_general_mail',
+                'conf_general_mail_info','install_end_title',
+                'install_end_message');
+  templatize_array( $tpl, 'lang', $handle );
+  $vtp->setGlobalVar( $handle, 'language', $_GET['language'] );
+}
+//---------------------- Step 1 : connection informations, write of config file
+if ( $_GET['step'] == 1 )
+{
+  $errors = array();
+  $infos  = array();
+  // creation of ./include/mysql.inc.php : file containing database
+  // connection informations
+  if ( isset( $_POST['cfgBase'] )
+       and isset( $_POST['cfgUser'] )
+       and isset( $_POST['cfgPassword'] )
+       and isset( $_POST['cfgHote'] ) )
+  {
+    if ( @mysql_connect( $_POST['cfgHote'],
+                         $_POST['cfgUser'],
+                         $_POST['cfgPassword'] ) )
+    {
+      if ( @mysql_select_db($_POST['cfgBase'] ) )
+      {
+        array_push( $infos, $lang['step1_confirmation'] );
+      }
+      else
+      {
+        array_push( $errors, $lang['step1_err_db'] );
+      }
+    }
+    else
+    {
+      array_push( $errors, $lang['step1_err_server'] );
+    }
+			
+    if ( count( $errors ) == 0 )
+    {
+      $file_content = "<?php";
+      $file_content.= "\n\$cfgBase = '".     $_POST['cfgBase']."';";
+      $file_content.= "\n\$cfgUser = '".     $_POST['cfgUser']."';";
+      $file_content.= "\n\$cfgPassword = '". $_POST['cfgPassword']."';";
+      $file_content.= "\n\$cfgHote = '".     $_POST['cfgHote']."';";
+      $file_content.= "\n\$prefixeTable = '".$_POST['prefixeTable']."';";
+      $file_content.= "\n?>";
+      // writting the configuration file
+      if ( $fp = @fopen( '../include/mysql.inc.php', 'a+' ) )
+      {
+        fwrite( $fp, $file_content ); 
+        fclose( $fp );
+      }
+      $cfgHote     = '';
+      $cfgUser     = '';
+      $cfgPassword = '';
+      $cfgBase     = '';
+      include( '../include/mysql.inc.php' );
+      $file_OK = false;
+      if ( @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) )
+      {
+        if ( @mysql_select_db( $cfgBase ) ) $file_OK = true;
+      }
+      if ( !$file_OK )
+      {
+        $vtp->addSession( $handle, 'error_copy' );
+        $html_content = htmlentities( $file_content, ENT_QUOTES );
+        $html_content = nl2br( $html_content );
+        $vtp->setVar( $handle, 'error_copy.file_content', $html_content );
+        $vtp->closeSession( $handle, 'error_copy' );
+      }
+      else
+      {
+        $url = 'install.php?step=2&language='.$_GET['language'];
+        header( 'Request-URI: '.$url );  
+        header( 'Content-Location: '.$url);  
+        header( 'Location: '.$url );
+        exit();
+      }
+    }
+  }
+  // errors display
+  if ( sizeof( $errors ) != 0 )
+  {
+    $vtp->addSession( $handle, 'errors' );
+    foreach ( $errors as $error ) {
+      $vtp->addSession( $handle, 'error' );
+      $vtp->setVar( $handle, 'error.content', $error );
+      $vtp->closeSession( $handle, 'error' );
+    }
+    $vtp->closeSession( $handle, 'errors' );
+  }
+  // infos display
+  if ( sizeof( $infos ) != 0 )
+  {
+    $vtp->addSession( $handle, 'infos' );
+    foreach ( $infos as $info ) {
+      $vtp->addSession( $handle, 'info' );
+      $vtp->setVar( $handle, 'info.content', $info );
+      $vtp->closeSession( $handle, 'info' );
+    }
+    $vtp->closeSession( $handle, 'infos' );
+  }
+  // form display (if necessary)
+  if ( !isset( $_POST['submit'] ) or sizeof( $errors ) > 0 )
+  {
+    $vtp->addSession( $handle, 'step1' );
+
+    // host
+    if ( !isset( $_POST['cfgHote'] ) )
+      $vtp->setVar( $handle, 'step1.f_host', 'localhost' );
+    else
+      $vtp->setVar( $handle, 'step1.f_host', $_POST['cfgHote'] );
+    // user
+    $vtp->setVar( $handle, 'step1.f_user', $_POST['cfgUser'] );
+    // base
+    $vtp->setVar( $handle, 'step1.f_base', $_POST['cfgBase'] );
+    // prefixeTable
+    if ( !isset( $_POST['prefixeTable'] ) )
+      $vtp->setVar( $handle, 'step1.f_prefixeTable', 'phpwebgallery_' );
+    else
+      $vtp->setVar( $handle, 'step1.f_prefixeTable', $_POST['prefixeTable'] );
+
+    $vtp->closeSession( $handle, 'step1' );
+  }
+}
+//------------------------------------- Step 2 : creation of tables in database
+else if ( $_GET['step'] == 2 )
+{
+  $errors = array();
+  $infos  = array();
+
+  include( '../include/mysql.inc.php' );
+  mysql_connect( $cfgHote, $cfgUser, $cfgPassword )
+    or die ( "Can't connect to database host" );
+  mysql_select_db( $cfgBase )
+    or die ( "Connection to host succeeded, but database selection failed" );
+		
+  if ( !isset( $_POST['submit'] ) )
+  {
+    // tables creation, based on phpwebgallery_structure.sql
+    $sql_lines = file( './phpwebgallery_structure.sql' );
+    $query = '';
+    foreach ( $sql_lines as $sql_line ) {
+      $sql_line = trim( $sql_line );
+      if ( preg_match( '/(^--|^$)/', $sql_line ) ) continue;
+      $query.= ' '.$sql_line;
+      // if we reached the end of query, we execute it and reinitialize the
+      // variable "query"
+      if ( preg_match( '/;$/', $sql_line ) )
+      {
+        $query = trim( $query );
+        $query = str_replace( 'phpwebgallery_', $prefixeTable, $query );
+        // we don't execute "DROP TABLE" queries
+        if ( !preg_match( '/^DROP TABLE/i', $query ) )
+          mysql_query( $query );
+        $query = '';
+      }
+    }
+  }
+
+  if ( isset( $_POST['submit'] ) )
+  {
+    // webmaster login must be
+    // 1. non empty
+    // 2. without characters ' or "
+    $webmaster = preg_replace( '/\s{2,}/', ' ', $_POST['webmaster'] );
+    $webmaster = trim( $webmaster );
+    if ( $webmaster == '' )
+      array_push( $errors, $lang['step2_err_login1'] );
+    if ( preg_match( '/[\'"]/', $webmaster ) )
+      array_push( $errors, $lang['step2_err_login3'] );
+    // the webmaster string must be the same as its confirmation
+    if ( $_POST['pwdWebmaster'] != $_POST['pwdWebmasterConf'] )
+      array_push( $errors, $lang['step2_err_pass'] );
+    // mail address must have this format : name@server.com
+    $error_mail_address = validate_mail_address( $_POST['mail_webmaster'] );
+    if ( $error_mail_address != '' )
+      array_push( $errors, $error_mail_address );
+    if ( $_POST['mail_webmaster'] == '' )
+      array_push( $errors, $lang['reg_err_mail_address'] );
+
+    // if no error found till here : insertion of data in tables
+    if ( count( $errors ) == 0 )
+    {
+      $query = 'DELETE FROM '.$prefixeTable.'config';
+      mysql_query( $query );
+
+      $query = 'INSERT INTO '.$prefixeTable.'config';
+      $query.= ' (webmaster,mail_webmaster) VALUES ';
+      $query.= " ('".$webmaster."','".$_POST['mail_webmaster']."')";
+      $query.= ';';
+      mysql_query( $query );
+
+      $query = 'INSERT INTO '.$prefixeTable.'sites';
+      $query.= " (id,galleries_url) VALUES (1, './galleries/')";
+      $query.= ';';
+      mysql_query( $query );
+
+      // webmaster admin user
+      $query = 'INSERT INTO '.$prefixeTable.'users';
+      $query.= ' (id,username,password,status,language) VALUES ';
+      $query.= "(1,'".$webmaster."','".md5( $_POST['pwdWebmaster'] )."'";
+      $query.= ",'admin','".$_GET['language']."')";
+      $query.= ';';
+      mysql_query($query);
+
+      // guest user
+      $query = 'INSERT INTO '.$prefixeTable.'users';
+      $query.= '(id,username,password,status,language) VALUES ';
+      $query.= "(2,'guest','','guest','francais')";
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+
+  // errors display
+  if ( sizeof( $errors ) != 0 )
+  {
+    $vtp->addSession( $handle, 'errors' );
+    foreach ( $errors as $error ) {
+      $vtp->addSession( $handle, 'error' );
+      $vtp->setVar( $handle, 'error.content', $error );
+      $vtp->closeSession( $handle, 'error' );
+      }
+    $vtp->closeSession( $handle, 'errors' );
+  }
+
+  if ( !isset( $_POST['submit'] ) or sizeof( $errors ) > 0 )
+  {
+    $vtp->addSession( $handle, 'step2' );
+    $vtp->setVar( $handle, 'step2.f_webmaster', $_POST['webmaster'] );
+    $vtp->setVar( $handle, 'step2.f_mail_webmaster', $_POST['mail_webmaster']);
+    $vtp->closeSession( $handle, 'step2' );
+  }
+
+  // end of installation message
+  if ( isset( $_POST['submit'] ) and count( $errors ) == 0 )
+  {
+    $vtp->addSession( $handle, 'install_end' );
+    $vtp->closeSession( $handle, 'install_end' );
+  }
+}
+//---------------------------------------------------- Step 0 : language choice
+else
+{
+  $vtp->addSession( $handle, 'step0' );
+  $languages = get_languages( '../language/' );
+  foreach ( $languages as $language ) {
+    $vtp->addSession( $handle, 'language' );
+    $vtp->setVar( $handle, 'language.name', $language );
+    $vtp->closeSession( $handle, 'language' );
+  }
+  $vtp->closeSession( $handle, 'step0' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/admin/phpwebgallery_structure.sql
===================================================================
--- /tags/release-1_3RC1/admin/phpwebgallery_structure.sql	(revision 159)
+++ /tags/release-1_3RC1/admin/phpwebgallery_structure.sql	(revision 159)
@@ -0,0 +1,244 @@
+-- MySQL dump 8.21
+--
+-- Host: localhost    Database: devel
+---------------------------------------------------------
+-- Server version	3.23.49-log
+
+--
+-- Table structure for table 'phpwebgallery_categories'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_categories;
+CREATE TABLE phpwebgallery_categories (
+  id smallint(5) unsigned NOT NULL auto_increment,
+  date_last date default NULL,
+  nb_images mediumint(8) unsigned NOT NULL default '0',
+  name varchar(255) NOT NULL default '',
+  id_uppercat smallint(5) unsigned default NULL,
+  comment text,
+  dir varchar(255) default NULL,
+  rank tinyint(3) unsigned default NULL,
+  status enum('public','private') NOT NULL default 'public',
+  site_id tinyint(4) unsigned NOT NULL default '1',
+  visible enum('true','false') NOT NULL default 'true',
+  uploadable enum('true','false') NOT NULL default 'false',
+  representative_picture_id mediumint(8) unsigned default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_comments'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_comments;
+CREATE TABLE phpwebgallery_comments (
+  id int(11) unsigned NOT NULL auto_increment,
+  image_id mediumint(8) unsigned NOT NULL default '0',
+  date int(11) unsigned NOT NULL default '0',
+  author varchar(255) default NULL,
+  content longtext,
+  validated enum('true','false') NOT NULL default 'false',
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_config'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_config;
+CREATE TABLE phpwebgallery_config (
+  prefix_thumbnail varchar(10) default 'TN-',
+  webmaster varchar(255) NOT NULL default '',
+  mail_webmaster varchar(255) NOT NULL default '',
+  access enum('free','restricted') default 'free',
+  session_id_size tinyint(3) unsigned NOT NULL default '4',
+  session_keyword varchar(255) default NULL,
+  session_time tinyint(3) unsigned NOT NULL default '30',
+  max_user_listbox tinyint(3) unsigned NOT NULL default '10',
+  show_comments enum('true','false') NOT NULL default 'true',
+  nb_comment_page tinyint(4) NOT NULL default '10',
+  upload_available enum('true','false') NOT NULL default 'false',
+  upload_maxfilesize smallint(5) unsigned NOT NULL default '150',
+  upload_maxwidth smallint(5) unsigned NOT NULL default '800',
+  upload_maxheight smallint(5) unsigned NOT NULL default '600',
+  upload_maxwidth_thumbnail smallint(5) unsigned NOT NULL default '150',
+  upload_maxheight_thumbnail smallint(5) unsigned NOT NULL default '100',
+  log enum('true','false') NOT NULL default 'false',
+  comments_validation enum('true','false') NOT NULL default 'false',
+  comments_forall enum('true','false') NOT NULL default 'false',
+  authorize_cookies enum('true','false') NOT NULL default 'false',
+  mail_notification enum('true','false') NOT NULL default 'false'
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_favorites'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_favorites;
+CREATE TABLE phpwebgallery_favorites (
+  user_id smallint(5) unsigned NOT NULL default '0',
+  image_id mediumint(8) unsigned NOT NULL default '0',
+  KEY user_id (user_id,image_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_group_access'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_group_access;
+CREATE TABLE phpwebgallery_group_access (
+  group_id smallint(5) unsigned NOT NULL default '0',
+  cat_id smallint(5) unsigned NOT NULL default '0',
+  PRIMARY KEY  (group_id,cat_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_groups'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_groups;
+CREATE TABLE phpwebgallery_groups (
+  id smallint(5) unsigned NOT NULL auto_increment,
+  name varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_history'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_history;
+CREATE TABLE phpwebgallery_history (
+  date int(11) NOT NULL default '0',
+  login varchar(15) default NULL,
+  IP varchar(50) NOT NULL default '',
+  category varchar(150) default NULL,
+  file varchar(50) default NULL,
+  picture varchar(150) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_image_category'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_image_category;
+CREATE TABLE phpwebgallery_image_category (
+  image_id mediumint(8) unsigned NOT NULL default '0',
+  category_id smallint(5) unsigned NOT NULL default '0',
+  PRIMARY KEY  (image_id,category_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_images'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_images;
+CREATE TABLE phpwebgallery_images (
+  id mediumint(8) unsigned NOT NULL auto_increment,
+  file varchar(255) NOT NULL default '',
+  date_available date NOT NULL default '0000-00-00',
+  date_creation date default NULL,
+  tn_ext char(3) NOT NULL default 'jpg',
+  name varchar(255) default NULL,
+  comment text,
+  author varchar(255) default NULL,
+  hit int(10) unsigned NOT NULL default '0',
+  filesize mediumint(9) unsigned default NULL,
+  width smallint(9) unsigned default NULL,
+  height smallint(9) unsigned default NULL,
+  keywords varchar(255) default NULL,
+  storage_category_id smallint(5) unsigned default NULL,
+  PRIMARY KEY  (id),
+  KEY storage_category_id (storage_category_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_sessions'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_sessions;
+CREATE TABLE phpwebgallery_sessions (
+  id varchar(255) binary NOT NULL default '',
+  user_id smallint(5) unsigned NOT NULL default '0',
+  expiration int(10) unsigned NOT NULL default '0',
+  ip varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_sites'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_sites;
+CREATE TABLE phpwebgallery_sites (
+  id tinyint(4) NOT NULL auto_increment,
+  galleries_url varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id),
+  UNIQUE KEY galleries_url (galleries_url)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_user_access'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_user_access;
+CREATE TABLE phpwebgallery_user_access (
+  user_id smallint(5) unsigned NOT NULL default '0',
+  cat_id smallint(5) unsigned NOT NULL default '0',
+  PRIMARY KEY  (user_id,cat_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_user_group'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_user_group;
+CREATE TABLE phpwebgallery_user_group (
+  user_id smallint(5) unsigned NOT NULL default '0',
+  group_id smallint(5) unsigned NOT NULL default '0',
+  PRIMARY KEY  (group_id,user_id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_users'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_users;
+CREATE TABLE phpwebgallery_users (
+  id smallint(5) unsigned NOT NULL auto_increment,
+  username varchar(20) binary NOT NULL default '',
+  password varchar(255) NOT NULL default '',
+  mail_address varchar(255) default NULL,
+  nb_image_line tinyint(1) unsigned NOT NULL default '5',
+  nb_line_page tinyint(3) unsigned NOT NULL default '3',
+  status enum('admin','guest') NOT NULL default 'guest',
+  language varchar(50) NOT NULL default 'english',
+  maxwidth smallint(6) default NULL,
+  maxheight smallint(6) default NULL,
+  expand enum('true','false') NOT NULL default 'false',
+  show_nb_comments enum('true','false') NOT NULL default 'false',
+  short_period tinyint(3) unsigned NOT NULL default '7',
+  long_period tinyint(3) unsigned NOT NULL default '14',
+  template varchar(255) NOT NULL default 'default',
+  PRIMARY KEY  (id),
+  UNIQUE KEY username (username)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'phpwebgallery_waiting'
+--
+
+DROP TABLE IF EXISTS phpwebgallery_waiting;
+CREATE TABLE phpwebgallery_waiting (
+  id int(10) unsigned NOT NULL auto_increment,
+  storage_category_id smallint(5) unsigned NOT NULL default '0',
+  file varchar(255) NOT NULL default '',
+  username varchar(255) NOT NULL default '',
+  mail_address varchar(255) NOT NULL default '',
+  date int(10) unsigned NOT NULL default '0',
+  tn_ext char(3) default NULL,
+  validated enum('true','false') NOT NULL default 'false',
+  infos text,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
Index: /tags/release-1_3RC1/admin/picture_modify.php
===================================================================
--- /tags/release-1_3RC1/admin/picture_modify.php	(revision 159)
+++ /tags/release-1_3RC1/admin/picture_modify.php	(revision 159)
@@ -0,0 +1,317 @@
+<?php
+/***************************************************************************
+ *                            picture_modify.php                           *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------- categories structure initialization
+$page['plain_structure'] = get_plain_structure();
+//--------------------------------------------------------- update informations
+$errors = array();
+// first, we verify whether there is a mistake on the given creation date
+if ( isset( $_POST['creation_date'] ) and $_POST['creation_date'] != '' )
+{
+  if ( !check_date_format( $_POST['creation_date'] ) )
+    array_push( $errors, $lang['err_date'] );
+}
+if ( isset( $_POST['submit'] ) )
+{
+  $query = 'UPDATE '.PREFIX_TABLE.'images';
+  
+  $query.= ' SET name = ';
+  if ( $_POST['name'] == '' )
+    $query.= 'NULL';
+  else
+    $query.= "'".htmlentities( $_POST['name'], ENT_QUOTES )."'";
+  
+  $query.= ', author = ';
+  if ( $_POST['author'] == '' )
+    $query.= 'NULL';
+  else
+    $query.= "'".htmlentities($_POST['author'],ENT_QUOTES)."'";
+
+  $query.= ', comment = ';
+  if ( $_POST['comment'] == '' )
+    $query.= 'NULL';
+  else
+    $query.= "'".htmlentities($_POST['comment'],ENT_QUOTES)."'";
+
+  $query.= ', date_creation = ';
+  if ( check_date_format( $_POST['creation_date'] ) )
+    $query.= "'".date_convert( $_POST['creation_date'] )."'";
+  else if ( $_POST['creation_date'] == '' )
+    $query.= 'NULL';
+
+  $query.= ', keywords = ';
+  $keywords_array = get_keywords( $_POST['keywords'] );
+  if ( count( $keywords_array ) == 0 )
+    $query.= 'NULL';
+  else
+  {
+    $query.= "'";
+    foreach ( $keywords_array as $i => $keyword ) {
+      if ( $i > 0 ) $query.= ',';
+      $query.= $keyword;
+    }
+    $query.= "'";
+  }
+
+  $query.= ' WHERE id = '.$_GET['image_id'];
+  $query.= ';';
+  mysql_query( $query );
+  // make the picture representative of a category ?
+  $query = 'SELECT DISTINCT(category_id) as category_id';
+  $query.= ',representative_picture_id';
+  $query.= ' FROM '.PREFIX_TABLE.'image_category AS ic';
+  $query.= ', '.PREFIX_TABLE.'categories AS c';
+  $query.= ' WHERE c.id = ic.category_id';
+  $query.= ' AND image_id = '.$_GET['image_id'];
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // if the user ask the picture to be the representative picture of its
+    // category, the category is updated in the database (without wondering
+    // if this picture was already the representative one)
+    if ( $_POST['representative-'.$row['category_id']] == 1 )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'categories';
+      $query.= ' SET representative_picture_id = '.$_GET['image_id'];
+      $query.= ' WHERE id = '.$row['category_id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+    // if the user ask this picture to be not any more the representative,
+    // we have to set the representative_picture_id of this category to NULL
+    else if ( $row['representative_picture_id'] == $_GET['image_id'] )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'categories';
+      $query.= ' SET representative_picture_id = NULL';
+      $query.= ' WHERE id = '.$row['category_id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+  // associate with a new category ?
+  if ( $_POST['associate'] != '-1' )
+  {
+    $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+    $query.= ' (category_id,image_id) VALUES ';
+    $query.= '('.$_POST['associate'].','.$_GET['image_id'].')';
+    $query.= ';';
+    mysql_query( $query);
+    update_category( $_POST['associate'] );
+  }
+  // dissociate any category ?
+  // retrieving all the linked categories
+  $query = 'SELECT DISTINCT(category_id) as category_id';
+  $query.= ' FROM '.PREFIX_TABLE.'image_category';
+  $query.= ' WHERE image_id = '.$_GET['image_id'];
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    if ( $_POST['dissociate-'.$row['category_id']] == 1 )
+    {
+      $query = 'DELETE FROM '.PREFIX_TABLE.'image_category';
+      $query.= ' WHERE image_id = '.$_GET['image_id'];
+      $query.= ' AND category_id = '.$row['category_id'];
+      $query.= ';';
+      mysql_query( $query );
+      update_category( $row['category_id'] );
+    }
+  }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open(
+  '../template/'.$user['template'].'/admin/picture_modify.vtp' );
+
+$tpl = array( 'submit','errors_title','picmod_update','picmod_back',
+              'default','file','size','filesize','registration_date',
+              'author','creation_date','keywords','comment', 'upload_name',
+              'dissociate','categories','infoimage_associate',
+              'cat_image_info','category_representative' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//-------------------------------------------------------------- errors display
+if ( count( $errors ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  foreach ( $errors as $error ) {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.content', $error );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+//-------------------------------------------- displaying informations and form
+$action = './admin.php?'.$_SERVER['QUERY_STRING'];
+$vtp->setVar( $sub, 'form_action', $action );
+// retrieving direct information about picture
+$query = 'SELECT file,date_available,date_creation,tn_ext,name,filesize';
+$query.= ',width,height,author,comment,keywords,storage_category_id';
+$query.= ' FROM '.PREFIX_TABLE.'images';
+$query.= ' WHERE id = '.$_GET['image_id'];
+$query.= ';';
+$row = mysql_fetch_array( mysql_query( $query ) );
+// picture title
+if ( $row['name'] == '' )
+{
+  $title = str_replace( '_',' ',get_filename_wo_extension($row['file']) );
+}
+else
+{
+  $title = $row['name'];
+}
+$vtp->setVar( $sub, 'title', $title );
+$vtp->setVar( $sub, 'f_file', $row['file'] );
+$vtp->setVar( $sub, 'f_size', $row['width'].' * '.$row['height'] );
+$vtp->setVar( $sub, 'f_filesize', $row['filesize'].' KB' );
+$vtp->setVar( $sub, 'f_registration_date',format_date($row['date_available']));
+$default_name = str_replace( '_',' ',get_filename_wo_extension($row['file']) );
+$vtp->setVar( $sub, 'default_name', $default_name );
+// if this form is displayed after an unsucceeded submit, we have to display
+// the values filled by the user (wright or wrong).
+if ( count( $errors ) > 0 )
+{
+  $name            = $_POST['name'];
+  $author          = $_POST['author'];
+  $creation_date   = $_POST['creation_date'];
+  $keywords        = $_POST['keywords'];
+  $comment         = $_POST['comment'];
+}
+else
+{
+  $name            = $row['name'];
+  $author          = $row['author'];
+  $creation_date   = date_convert_back( $row['date_creation'] );
+  $keywords        = $row['keywords'];
+  $comment         = $row['comment'];
+}
+$vtp->setVar( $sub, 'f_name',            $name );
+$vtp->setVar( $sub, 'f_author',          $author );
+$vtp->setVar( $sub, 'f_creation_date',   $creation_date );
+$vtp->setVar( $sub, 'f_keywords',        $keywords );
+$vtp->setVar( $sub, 'f_comment',         $comment );
+// retrieving directory where picture is stored (for displaying the
+// thumbnail)
+$thumbnail_url = get_complete_dir( $row['storage_category_id'] );
+$result = get_cat_info( $row['storage_category_id'] );
+$cat_name = get_cat_display_name( $result['name'], ' &gt; ', '' );
+$vtp->setVar( $sub, 'dir', $cat_name );
+if ( $result['site_id'] == 1 ) $thumbnail_url = '.'.$thumbnail_url;
+$file_wo_ext = get_filename_wo_extension( $row['file'] );
+$thumbnail_url.= '/thumbnail/';
+$thumbnail_url.= $conf['prefix_thumbnail'].$file_wo_ext.'.'.$row['tn_ext'];
+$vtp->setVar( $sub, 'thumbnail_url', $thumbnail_url );
+// storage category is linked by default
+$vtp->addSession( $sub, 'linked_category' );
+$vtp->setVar( $sub, 'linked_category.name', $cat_name );
+$url = '../picture.php?image_id='.$_GET['image_id'];
+$url.= '&amp;cat='.$row['storage_category_id'];
+$vtp->setVar( $sub, 'linked_category.url',add_session_id( $url));
+$url = './admin.php?page=infos_images&amp;cat_id='.$row['storage_category_id'];
+$vtp->setVar( $sub, 'linked_category.infos_images_link',add_session_id( $url));
+if ( $result['status'] == 'private' )
+{
+  $private_string = '<span style="color:red;font-weight:bold;">';
+  $private_string.= $lang['private'].'</span>';
+  $vtp->setVar( $sub, 'linked_category.private', $private_string );
+}
+if ( !$result['visible'] )
+{
+  $invisible_string = '<span style="color:red;">';
+  $invisible_string.= $lang['cat_invisible'].'</span>';
+  $vtp->setVar( $sub, 'linked_category.invisible', $invisible_string );
+}
+$vtp->setVar( $sub, 'linked_category.id', $row['storage_category_id'] );
+if ( $result['representative_picture_id'] == $_GET['image_id'] )
+{
+  $vtp->setVar( $sub, 'linked_category.representative_checked',
+                ' checked="checked"' );
+}
+$vtp->closeSession( $sub, 'linked_category' );
+// retrieving all the linked categories
+$query = 'SELECT DISTINCT(category_id) as category_id,status,visible';
+$query.= ',representative_picture_id';
+$query.= ' FROM '.PREFIX_TABLE.'image_category';
+$query.= ','.PREFIX_TABLE.'categories';
+$query.= ' WHERE image_id = '.$_GET['image_id'];
+$query.= ' AND category_id != '.$row['storage_category_id'];
+$query.= ' AND category_id = id';
+$query.= ';';
+$result = mysql_query( $query );
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'linked_category' );
+  $vtp->setVar( $sub, 'linked_category.id', $row['category_id'] );
+
+  $vtp->addSession( $sub, 'checkbox' );
+  $vtp->setVar( $sub, 'checkbox.id', $row['category_id'] );
+  $vtp->closeSession( $sub, 'checkbox' );
+
+  $cat_infos = get_cat_info( $row['category_id'] );
+  $cat_name = get_cat_display_name( $cat_infos['name'], ' &gt; ', '' );
+  $vtp->setVar( $sub, 'linked_category.name', $cat_name );
+
+  $url = '../picture.php?image_id='.$_GET['image_id'];
+  $url.= '&amp;cat='.$row['category_id'];
+  $vtp->setVar( $sub, 'linked_category.url',add_session_id( $url));
+
+  $url = './admin.php?page=infos_images&amp;cat_id='.$row['category_id'];
+  $vtp->setVar( $sub, 'linked_category.infos_images_link',
+                add_session_id( $url));
+
+  if ( $row['status'] == 'private' )
+  {
+    $private_string = '<span style="color:red;font-weight:bold;">';
+    $private_string.= $lang['private'].'</span>';
+    $vtp->setVar( $sub, 'linked_category.private', $private_string );
+  }
+
+  if ( !get_boolean( $row['visible'] ) )
+  {
+    $invisible_string = '<span style="color:red;">';
+    $invisible_string.= $lang['cat_invisible'].'</span>';
+    $vtp->setVar( $sub, 'linked_category.invisible', $invisible_string );
+  }
+
+  if ( $row['representative_picture_id'] == $_GET['image_id'] )
+  {
+    $vtp->setVar( $sub, 'linked_category.representative_checked',
+                  ' checked="checked"' );
+  }
+  
+  $vtp->closeSession( $sub, 'linked_category' );
+}
+// if there are linked category other than the storage category, we show
+// propose the dissociate text
+if ( mysql_num_rows( $result ) > 0 )
+{
+  $vtp->addSession( $sub, 'dissociate' );
+  $vtp->closeSession( $sub, 'dissociate' );
+}
+// associate to another category ?
+$vtp->addSession( $sub, 'associate_cat' );
+$vtp->setVar( $sub, 'associate_cat.value', '-1' );
+$vtp->setVar( $sub, 'associate_cat.content', '' );
+$vtp->closeSession( $sub, 'associate_cat' );
+$structure = create_structure( '', array() );
+display_categories( $structure, '&nbsp;' );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/stats.php
===================================================================
--- /tags/release-1_3RC1/admin/stats.php	(revision 159)
+++ /tags/release-1_3RC1/admin/stats.php	(revision 159)
@@ -0,0 +1,177 @@
+<?php
+/***************************************************************************
+ *                                 stats.php                               *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+$max_pixels = 500;
+//------------------------------------------------------------ comment deletion
+if ( isset( $_GET['del'] ) and is_numeric( $_GET['del'] ) )
+{
+  $query = 'DELETE FROM '.PREFIX_TABLE.'comments';
+  $query.= ' WHERE id = '.$_GET['del'];
+  $query.= ';';
+  mysql_query( $query );
+}
+//--------------------------------------------------------- history table empty
+if ( isset( $_GET['act'] ) and $_GET['act'] == 'empty' )
+{
+  $query = 'DELETE FROM '.PREFIX_TABLE.'history';
+  $query.= ';';
+  mysql_query( $query );
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/stats.vtp' );
+$tpl = array( 'stats_last_days','date','login',
+              'IP','file','picture','category','stats_pages_seen',
+              'stats_visitors','stats_empty', 'stats_pages_seen_graph_title',
+              'stats_visitors_graph_title');
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//--------------------------------------------------- number of days to display
+if ( isset( $_GET['last_days'] ) ) define( MAX_DAYS, $_GET['last_days'] );
+else                               define( MAX_DAYS, 0 );
+
+foreach ( $conf['last_days'] as $option ) {
+  $vtp->addSession( $sub, 'last_day_option' );
+  $vtp->setVar( $sub, 'last_day_option.option', $option );
+  $url = './admin.php?page=stats&amp;expand='.$_GET['expand'];
+  $url.= '&amp;last_days='.($option - 1);
+  $vtp->setVar( $sub, 'last_day_option.link', add_session_id( $url ) );
+  if ( $option == MAX_DAYS + 1 )
+  {
+    $vtp->setVar( $sub, 'last_day_option.style', 'font-weight:bold;');
+  }
+  $vtp->closeSession( $sub, 'last_day_option' );
+}
+//---------------------------------------------------------------- log  history
+// empty link
+$url = './admin.php?page=stats&amp;last_days='.$_GET['last_days'];
+$url.= '&amp;expand='.$_GET['expand'];
+$url.= '&amp;act=empty';
+$vtp->setVar( $sub, 'emply_url', add_session_id( $url ) );
+// expand array management
+$expand_days = explode( ',', $_GET['expand'] );
+$page['expand_days'] = array();
+foreach ( $expand_days as $expand_day ) {
+  if ( is_numeric( $expand_day ) )
+  {
+    array_push( $page['expand_days'], $expand_day );
+  }
+}
+
+$days = array();
+$max_nb_visitors = 0;
+$max_pages_seen = 0;
+
+$starttime = mktime(  0, 0, 0,date('n'),date('j'),date('Y') );
+$endtime   = mktime( 23,59,59,date('n'),date('j'),date('Y') );
+for ( $i = 0; $i <= MAX_DAYS; $i++ )
+{
+  $day = array();
+  $vtp->addSession( $sub, 'day' );
+  // link to open the day to see details
+  $local_expand = $page['expand_days'];
+  if ( in_array( $i, $page['expand_days'] ) )
+  {
+    $vtp->addSession( $sub, 'expanded' );
+    $vtp->closeSession( $sub, 'expanded' );
+    $local_expand = array_remove( $local_expand, $i );
+  }
+  else
+  {
+    $vtp->addSession( $sub, 'collapsed' );
+    $vtp->closeSession( $sub, 'collapsed' );
+    array_push( $local_expand, $i );
+  }
+  $url = './admin.php?page=stats&amp;last_days='.$_GET['last_days'];
+  $url.= '&amp;expand='.implode( ',', $local_expand );
+  $vtp->setVar( $sub, 'day.url', add_session_id( $url ) );
+  // date displayed like this (in English ) :
+  //                     Sunday 15 June 2003
+  $date = $lang['day'][date( 'w', $starttime )];   // Sunday
+  $date.= date( ' j ', $starttime );               // 15
+  $date.= $lang['month'][date( 'n', $starttime )]; // June
+  $date.= date( ' Y', $starttime );                // 2003
+  $day['date'] = $date;
+  $vtp->setVar( $sub, 'day.name', $date );
+  // number of visitors for this day
+  $query = 'SELECT DISTINCT(IP) as nb_visitors';
+  $query.= ' FROM '.PREFIX_TABLE.'history';
+  $query.= ' WHERE date > '.$starttime;
+  $query.= ' AND date < '.$endtime;
+  $query.= ';';
+  $result = mysql_query( $query );
+  $nb_visitors = mysql_num_rows( $result );
+  $day['nb_visitors'] = $nb_visitors;
+  if ( $nb_visitors > $max_nb_visitors ) $max_nb_visitors = $nb_visitors;
+  $vtp->setVar( $sub, 'day.nb_visitors', $nb_visitors );
+  // log lines for this day
+  $query = 'SELECT date,login,IP,category,file,picture';
+  $query.= ' FROM '.PREFIX_TABLE.'history';
+  $query.= ' WHERE date > '.$starttime;
+  $query.= ' AND date < '.$endtime;
+  $query.= ' ORDER BY date DESC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  $nb_pages_seen = mysql_num_rows( $result );
+  $day['nb_pages_seen'] = $nb_pages_seen;
+  if ( $nb_pages_seen > $max_pages_seen ) $max_pages_seen = $nb_pages_seen;
+  $vtp->setVar( $sub, 'day.nb_pages', $nb_pages_seen );
+  if ( in_array( $i, $page['expand_days'] ) )
+  {
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      $vtp->addSession( $sub, 'line' );
+      $vtp->setVar( $sub, 'line.date', date( 'G:i:s', $row['date'] ) );
+      $vtp->setVar( $sub, 'line.login', $row['login'] );
+      $vtp->setVar( $sub, 'line.IP', $row['IP'] );
+      $vtp->setVar( $sub, 'line.category', $row['category'] );
+      $vtp->setVar( $sub, 'line.file', $row['file'] );
+      $vtp->setVar( $sub, 'line.picture', $row['picture'] );
+      $vtp->closeSession( $sub, 'line' );
+    }
+  }
+  $starttime-= 24*60*60;
+  $endtime  -= 24*60*60;
+  $vtp->closeSession( $sub, 'day' );
+  array_push( $days, $day );
+}
+//------------------------------------------------------------ pages seen graph
+foreach ( $days as $day ) {
+  $vtp->addSession( $sub, 'pages_day' );
+  if ( $max_pages_seen > 0 )
+    $width = floor( ( $day['nb_pages_seen']*$max_pixels ) / $max_pages_seen );
+  else $width = 0;
+  $vtp->setVar( $sub, 'pages_day.date', $day['date'] );
+  $vtp->setVar( $sub, 'pages_day.width', $width );
+  $vtp->setVar( $sub, 'pages_day.nb_pages', $day['nb_pages_seen'] );
+  $vtp->closeSession( $sub, 'pages_day' );
+}
+//-------------------------------------------------------------- visitors grpah
+foreach ( $days as $day ) {
+  $vtp->addSession( $sub, 'visitors_day' );
+  if ( $max_nb_visitors > 0 )
+    $width = floor( ( $day['nb_visitors'] * $max_pixels ) / $max_nb_visitors );
+  else $width = 0;
+  $vtp->setVar( $sub, 'visitors_day.date', $day['date'] );
+  $vtp->setVar( $sub, 'visitors_day.width', $width );
+  $vtp->setVar( $sub, 'visitors_day.nb_visitors', $day['nb_visitors'] );
+  $vtp->closeSession( $sub, 'visitors_day' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/thumbnail.php
===================================================================
--- /tags/release-1_3RC1/admin/thumbnail.php	(revision 159)
+++ /tags/release-1_3RC1/admin/thumbnail.php	(revision 159)
@@ -0,0 +1,429 @@
+<?php
+/***************************************************************************
+ *                              thumbnail.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//------------------------------------------------------------------- functions
+// get_subdirs returns an array containing all sub directory names,
+// excepting : '.', '..' and 'thumbnail'.
+function get_subdirs( $dir )
+{
+  $sub_dirs = array();
+  if ( $opendir = opendir( $dir ) )
+  {
+    while ( $file = readdir( $opendir ) )
+    {
+      if ( $file != 'thumbnail' and $file != '.'
+           and $file != '..' and is_dir( $dir.'/'.$file ) )
+      {
+        array_push( $sub_dirs, $file );
+      }
+    }
+  }
+  return $sub_dirs;
+}
+
+// get_images_without_thumbnail returns an array with all the picture names
+// that don't have associated thumbnail in the directory. Each picture name
+// is associated with the width, heigh and filesize of the picture.
+function get_images_without_thumbnail( $dir )
+{
+  $images = array();
+  if ( $opendir = opendir( $dir ) )
+  {
+    while ( $file = readdir( $opendir ) )
+    {
+      $path = $dir.'/'.$file;
+      if ( is_image( $path, true ) )
+      {
+        if ( !TN_exists( $dir, $file ) )
+        {
+          $image_infos = getimagesize( $path );
+          $size = floor( filesize( $path ) / 1024 ). ' KB';
+          array_push( $images, array( 'name' => $file,
+                                      'width' => $image_infos[0],
+                                      'height' => $image_infos[1],
+                                      'size' => $size ) );
+        }
+      }
+    }
+  }
+  return $images;
+}
+
+// scandir scans a dir to find pictures without thumbnails. Once found,
+// creation of the thumbnails (RatioResizeImg). Only the first $_POST['n']
+// pictures without thumbnails are treated.
+// scandir returns an array with the generation time of each thumbnail (for
+// statistics purpose)
+function scandir( $dir, $width, $height )
+{
+  global $conf;
+  $stats = array();
+  if ( $opendir = opendir( $dir ) )
+  {
+    while ( $file = readdir ( $opendir ) )
+    {
+      $path = $dir.'/'.$file;
+      if ( is_image( $path, true ) )
+      {
+        if ( count( $stats ) < $_POST['n'] and !TN_exists( $dir, $file ) )
+        {
+          $starttime = get_moment();
+          $info = RatioResizeImg( $file, $width, $height, $dir.'/', 'jpg' );
+          $endtime = get_moment();
+          $info['time'] = ( $endtime - $starttime ) * 1000;
+          array_push( $stats, $info );
+        }
+      }
+    }
+  }
+  return $stats;
+}
+
+// RatioResizeImg creates a new picture (a thumbnail since it is supposed to
+// be smaller than original picture !) in the sub directory named
+// "thumbnail".
+function RatioResizeImg( $filename, $newWidth, $newHeight, $path, $tn_ext )
+{
+  global $conf, $lang;
+  // full path to picture
+  $filepath = $path.$filename;
+  // extension of the picture filename
+  $extension = get_extension( $filepath );
+  switch( $extension )
+  {
+  case 'jpg': $srcImage = @imagecreatefromjpeg( $filepath ); break; 
+  case 'JPG': $srcImage = @imagecreatefromjpeg( $filepath ); break; 
+  case 'png': $srcImage = @imagecreatefrompng(  $filepath ); break; 
+  case 'PNG': $srcImage = @imagecreatefrompng(  $filepath ); break; 
+  default : unset( $extension ); break;
+  }
+		
+  if ( isset( $srcImage ) )
+  {
+    // width/height
+    $srcWidth    = imagesx( $srcImage ); 
+    $srcHeight   = imagesy( $srcImage ); 
+    $ratioWidth  = $srcWidth/$newWidth;
+    $ratioHeight = $srcHeight/$newHeight;
+
+    // maximal size exceeded ?
+    if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
+    {
+      if ( $ratioWidth < $ratioHeight)
+      { 
+        $destWidth = $srcWidth/$ratioHeight;
+        $destHeight = $newHeight; 
+      }
+      else
+      { 
+        $destWidth = $newWidth; 
+        $destHeight = $srcHeight/$ratioWidth;
+      }
+    }
+    else
+    {
+      $destWidth = $srcWidth;
+      $destHeight = $srcHeight;
+    }
+    // according to the GD version installed on the server
+    if ( $_POST['gd'] == 2 )
+    {
+      // GD 2.0 or more recent -> good results (but slower)
+      $destImage = imagecreatetruecolor( $destWidth, $destHeight); 
+      imagecopyresampled( $destImage, $srcImage, 0, 0, 0, 0,
+                          $destWidth,$destHeight,$srcWidth,$srcHeight );
+    }
+    else
+    {
+      // GD prior to version  2 -> pretty bad results :-/ (but fast)
+      $destImage = imagecreate( $destWidth, $destHeight);
+      imagecopyresized( $destImage, $srcImage, 0, 0, 0, 0,
+                        $destWidth,$destHeight,$srcWidth,$srcHeight );
+    }
+			
+			
+    if( !is_dir( $path.'thumbnail' ) )
+    {
+      umask( 0000 );
+      mkdir( $path.'thumbnail', 0777 );
+    }
+    $dest_file = $path.'thumbnail/'.$conf['prefix_thumbnail'];
+    $dest_file.= get_filename_wo_extension( $filename );
+    $dest_file.= '.'.$tn_ext;
+			
+    // creation and backup of final picture
+    imagejpeg( $destImage, $dest_file );
+    // freeing memory ressources
+    imagedestroy( $srcImage );
+    imagedestroy( $destImage );
+			
+    list( $width,$height ) = getimagesize( $filepath );
+    $size = floor( filesize( $filepath ) / 1024 ).' KB';
+    list( $tn_width,$tn_height ) = getimagesize( $dest_file );
+    $tn_size = floor( filesize( $dest_file ) / 1024 ).' KB';
+    $info = array( 'file'      => $filename,
+                   'width'     => $width,
+                   'height'    => $height,
+                   'size'      => $size,
+                   'tn_file'   => $dest_file,
+                   'tn_width'  => $tn_width,
+                   'tn_height' => $tn_height,
+                   'tn_size'   => $tn_size );
+    return $info;
+  }
+  // error
+  else
+  {
+    echo $lang['tn_no_support']." ";
+    if ( isset( $extenstion ) )
+    {
+      echo $lang['tn_format'].' '.$extension;
+    }
+    else
+    {
+      echo $lang['tn_thisformat'];
+    }
+    exit();
+  }
+}
+
+// array_max returns the highest value of the given array
+function array_max( $array )
+{
+  sort( $array, SORT_NUMERIC );
+  return array_pop( $array );
+}
+
+// array_min returns the lowest value of the given array
+function array_min( $array )
+{
+  sort( $array, SORT_NUMERIC );
+  return array_shift( $array );
+}
+
+// array_avg returns the average value of the array
+function array_avg( $array )
+{
+  return array_sum( $array ) / sizeof( $array );
+}
+	
+// get_displayed_dirs builds the tree of dirs under "galleries". If a
+// directory contains pictures without thumbnails, the become linked to the
+// page of thumbnails creation.
+function get_displayed_dirs( $dir, $indent )
+{
+  global $conf,$lang,$vtp,$sub;
+		
+  $sub_dirs = get_subdirs( $dir );
+  // write of the dirs
+  foreach ( $sub_dirs as $sub_dir ) {
+    $pictures = get_images_without_thumbnail( $dir.'/'.$sub_dir );
+    $vtp->addSession( $sub, 'dir' );
+    $vtp->setVar( $sub, 'dir.indent', $indent );
+    if ( count( $pictures ) > 0 )
+    {
+      $vtp->addSession( $sub, 'linked' );
+      $url = './admin.php?page=thumbnail&amp;dir='.$dir."/".$sub_dir;
+      $vtp->setVar( $sub, 'linked.url', add_session_id( $url ) );
+      $vtp->setVar( $sub, 'linked.name', $sub_dir );
+      $vtp->setVar( $sub, 'linked.nb_pic', count( $pictures ) );
+      $vtp->closeSession( $sub, 'linked' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'unlinked' );
+      $vtp->setVar( $sub, 'unlinked.name', $sub_dir );
+      $vtp->closeSession( $sub, 'unlinked' );
+    }
+    $vtp->closeSession( $sub, 'dir' );
+    // recursive call
+    $dirs.= get_displayed_dirs( $dir.'/'.$sub_dir,
+                                $indent+30 );
+    
+  }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/thumbnail.vtp' );
+$tpl = array(
+  'tn_dirs_title','tn_dirs_alone','tn_params_title','tn_params_GD',
+  'tn_params_GD_info','tn_width','tn_params_width_info','tn_height',
+  'tn_params_height_info','tn_params_create','tn_params_create_info',
+  'tn_params_format','tn_params_format_info','submit','tn_alone_title',
+  'filesize','tn_picture','tn_results_title','thumbnail',
+  'tn_results_gen_time','tn_stats','tn_stats_nb','tn_stats_total',
+  'tn_stats_max','tn_stats_min','tn_stats_mean' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//----------------------------------------------------- miniaturization results
+if ( isset( $_GET['dir'] ) )
+{
+  $pictures = get_images_without_thumbnail( $_GET['dir'] );
+  if ( count( $pictures ) == 0 )
+  {
+    $vtp->addSession( $sub, 'warning' );
+    $vtp->closeSession( $sub, 'warning' );
+  }
+  elseif ( isset( $_POST['submit'] ) )
+  {
+    // checking criteria
+    $errors = array();
+    if ( !ereg( "^[0-9]{2,3}$", $_POST['width'] ) or $_POST['width'] < 10 )
+    {
+      array_push( $errors, $lang['tn_err_width'].' 10' );
+    }
+    if ( !ereg( "^[0-9]{2,3}$", $_POST['height'] ) or $_POST['height'] < 10 )
+    {
+      array_push( $errors, $lang['tn_err_height'].' 10' );
+    }
+    // picture miniaturization
+    if ( count( $errors ) == 0 )
+    {
+      $vtp->addSession( $sub, 'results' );
+      $stats = scandir( $_GET['dir'], $_POST['width'], $_POST['height'] );
+      $times = array();
+      foreach ( $stats as $stat ) {
+        array_push( $times, $stat['time'] );
+      }
+      $max = array_max( $times );
+      $min = array_min( $times );
+      foreach ( $stats as $i => $stat ) {
+        $vtp->addSession( $sub, 'picture' );
+        if ( $i % 2 == 1 )
+        {
+          $vtp->setVar( $sub, 'picture.class', 'row2' );
+        }
+        $vtp->setVar( $sub, 'picture.num',            ($i+1) );
+        $vtp->setVar( $sub, 'picture.file',           $stat['file'] );
+        $vtp->setVar( $sub, 'picture.filesize',       $stat['size'] );
+        $vtp->setVar( $sub, 'picture.width',          $stat['width'] );
+        $vtp->setVar( $sub, 'picture.height',         $stat['height'] );
+        $vtp->setVar( $sub, 'picture.thumb_file',     $stat['tn_file'] );
+        $vtp->setVar( $sub, 'picture.thumb_filesize', $stat['tn_size'] );
+        $vtp->setVar( $sub, 'picture.thumb_width',    $stat['tn_width'] );
+        $vtp->setVar( $sub, 'picture.thumb_height',   $stat['tn_height'] );
+        $vtp->setVar( $sub, 'picture.time',
+                      number_format( $stat['time'], 2, '.', ' ').' ms' );
+        if ( $stat['time'] == $max )
+        {
+          $vtp->setVar( $sub, 'picture.color', 'red' );
+        }
+        else if ( $stat['time'] == $min )
+        {
+          $vtp->setVar( $sub, 'picture.color', 'green' );
+        }
+        $vtp->closeSession( $sub, 'picture' );
+      }
+      // general statistics
+      $vtp->setVar( $sub, 'results.stats_nb', count( $stats ) );
+      $vtp->setVar( $sub, 'results.stats_total',
+                    number_format( array_sum( $times ), 2, '.', ' ').' ms' );
+      $vtp->setVar( $sub, 'results.stats_max',
+                    number_format( $max, 2, '.', ' ').' ms' );
+      $vtp->setVar( $sub, 'results.stats_min',
+                    number_format( $min, 2, '.', ' ').' ms' );
+      $vtp->setVar( $sub, 'results.stats_mean',
+                    number_format( array_avg( $times ), 2, '.', ' ').' ms' );
+      $vtp->closeSession( $sub, 'results' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'errors' );
+      foreach ( $errors as $error ) {
+        $vtp->addSession( $sub, 'li' );
+        $vtp->setVar( $sub, 'li.li', $error );
+        $vtp->closeSession( $sub, 'li' );
+      }
+      $vtp->closeSession( $sub, 'errors' );
+    }
+  }
+//-------------------------------------------------- miniaturization parameters
+  if ( sizeof( $pictures ) != 0 )
+  {
+    $vtp->addSession( $sub, 'params' );
+    $url = './admin.php?page=thumbnail&amp;dir='.$_GET['dir'];
+    $vtp->setVar( $sub, 'params.action', add_session_id( $url ) );
+    // GD version selected...
+    if ( $_POST['gd'] == 1 )
+    {
+      $vtp->setVar( $sub, 'params.gd1_checked', ' checked="checked"' );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'params.gd2_checked', ' checked="checked"' );
+    }
+    // width values
+    if ( isset( $_POST['width'] ) )
+    {
+      $vtp->setVar( $sub, 'params.width_value', $_POST['width'] );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'params.width_value', '128' );
+    }
+    // height value
+    if ( isset( $_POST['height'] ) )
+    {
+      $vtp->setVar( $sub, 'params.height_value', $_POST['height'] );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'params.height_value', '96' );
+    }
+    // options for the number of picture to miniaturize : "n"
+    $options = array( 5,10,20,40 );
+    foreach ( $options as $option ) {
+      $vtp->addSession( $sub, 'n_option' );
+      $vtp->setVar( $sub, 'n_option.option', $option );
+      if ( $option == $_POST['n'] )
+      {
+        $vtp->setVar( $sub, 'n_option.selected', ' selected="selected"' );
+      }
+      $vtp->closeSession( $sub, 'n_option' );
+    }
+    $vtp->closeSession( $sub, 'params' );
+//---------------------------------------------------------- remaining pictures
+    $vtp->addSession( $sub, 'remainings' );
+    $pictures = get_images_without_thumbnail( $_GET['dir'] );
+    $vtp->setVar( $sub, 'remainings.total', count( $pictures ) );
+    foreach ( $pictures as $i => $picture ) {
+      $vtp->addSession( $sub, 'remaining' );
+      if ( $i % 2 == 1 )
+      {
+        $vtp->setVar( $sub, 'remaining.class', 'row2' );
+      }
+      $vtp->setVar( $sub, 'remaining.num',      ($i+1) );
+      $vtp->setVar( $sub, 'remaining.file',     $picture['name'] );
+      $vtp->setVar( $sub, 'remaining.filesize', $picture['size'] );
+      $vtp->setVar( $sub, 'remaining.width',    $picture['width'] );
+      $vtp->setVar( $sub, 'remaining.height',   $picture['height'] );
+      $vtp->closeSession( $sub, 'remaining' );
+    }
+    $vtp->closeSession( $sub, 'remainings' );
+  }
+}
+//-------------------------------------------------------------- directory list
+else
+{
+  $vtp->addSession( $sub, 'directory_list' );
+  get_displayed_dirs( '../galleries', 60 );
+  $vtp->closeSession( $sub, 'directory_list' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/update.php
===================================================================
--- /tags/release-1_3RC1/admin/update.php	(revision 159)
+++ /tags/release-1_3RC1/admin/update.php	(revision 159)
@@ -0,0 +1,618 @@
+<?php
+/***************************************************************************
+ *                                update.php                               *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include_once( './include/isadmin.inc.php' );
+//------------------------------------------------------------------- functions
+function insert_local_category( $cat_id )
+{
+  global $conf, $page, $user, $lang;
+		
+  $site_id = 1;
+		
+  // 0. retrieving informations on the category to display
+  $cat_directory = '../galleries';
+		
+  if ( is_numeric( $cat_id ) )
+  {
+    $cat_directory.= '/'.get_local_dir( $cat_id );
+    $result = get_cat_info( $cat_id );
+    // 1. display the category name to update
+    $src = '../template/'.$user['template'].'/admin/images/puce.gif';
+    $output = '<img src="'.$src.'" alt="&gt;" />';
+    $output.= '<span style="font-weight:bold;">'.$result['name'][0].'</span>';
+    $output.= ' [ '.$result['dir'].' ]';
+    $output.= '<div class="retrait">';
+
+    // 2. we search pictures of the category only if the update is for all
+    //    or a cat_id is specified
+    if ( isset( $page['cat'] ) or $_GET['update'] == 'all' )
+    {
+      $output.= insert_local_image( $cat_directory, $cat_id );
+    }
+  }
+
+  // 3. we have to remove the categories of the database not present anymore
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE site_id = '.$site_id;
+  if ( !is_numeric( $cat_id ) )
+  {
+    $query.= ' AND id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' AND id_uppercat = '.$cat_id;
+  }
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // retrieving the directory
+    $rep = '../galleries/'.get_local_dir( $row['id'] );
+    // is the directory present ?
+    if ( !is_dir( $rep ) ) delete_category( $row['id'] );
+  }
+  // 4. retrieving the sub-directories
+  $subdirs = array();
+  $dirs = '';
+  if ( $opendir = opendir( $cat_directory ) )
+  {
+    while ( $file = readdir( $opendir ) )
+    {
+      if ( $file != '.'
+           and $file != '..'
+           and is_dir ( $cat_directory.'/'.$file )
+           and $file != 'thumbnail' )
+      {
+        if ( preg_match( '/^[a-zA-Z0-9-_.]+$/', $file ) )
+          array_push( $subdirs, $file );
+        else
+        {
+          $output.= '<span style="color:red;">"'.$file.'" : ';
+          $output.= $lang['update_wrong_dirname'].'</span><br />';
+          // if the category even exists (from a previous release of
+          // PhpWebGallery), we keep it in our $subdirs array
+          $query = 'SELECT id';
+          $query.= ' FROM '.PREFIX_TABLE.'categories';
+          $query.= ' WHERE site_id = '.$site_id;
+          $query.= " AND dir = '".$file."'";
+          $query.= ' AND id_uppercat';
+          if ( !is_numeric( $cat_id ) ) $query.= ' IS NULL';
+          else                          $query.= ' = '.$cat_id;
+          $query.= ';';
+          $result = mysql_query( $query );
+          if ( mysql_num_rows( $result ) != 0 )
+          {
+            array_push( $subdirs, $file );
+          }
+        }
+      }
+    }
+  }
+  foreach ( $subdirs as $subdir ) {
+    // 5. Is the category already existing ? we create a subcat if not
+    //    existing
+    $category_id = '';
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE site_id = '.$site_id;
+    $query.= " AND dir = '".$subdir."'";
+    $query.= ' AND id_uppercat';
+    if ( !is_numeric( $cat_id ) ) $query.= ' IS NULL';
+    else                          $query.= ' = '.$cat_id;
+    $query.= ';';
+    $result = mysql_query( $query );
+    if ( mysql_num_rows( $result ) == 0 )
+    {
+      $name = str_replace( '_', ' ', $subdir );
+      // we have to create the category
+      $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
+      $query.= ' (dir,name,site_id,id_uppercat) VALUES';
+      $query.= " ('".$subdir."','".$name."','".$site_id."'";
+      if ( !is_numeric( $cat_id ) ) $query.= ',NULL';
+      else                          $query.= ",'".$cat_id."'";
+      $query.= ');';
+      mysql_query( $query );
+      $category_id = mysql_insert_id();
+      // regeneration of the plain_structure to integrate the new category
+      $page['plain_structure'] = get_plain_structure();
+    }
+    else
+    {
+      // we get the already registered id
+      $row = mysql_fetch_array( $result );
+      $category_id = $row['id'];
+    }
+    // 6. recursive call
+    $output.= insert_local_category( $category_id );
+  }
+		
+  if ( is_numeric( $cat_id ) )
+  {
+    $output.= '</div>';
+  }
+  return $output;
+}
+	
+function insert_local_image( $rep, $category_id )
+{
+  global $lang,$conf,$count_new;
+
+  $output = '';
+  // we have to delete all the images from the database that :
+  //     - are not in the directory anymore
+  //     - don't have the associated thumbnail available anymore
+  $query = 'SELECT id,file,tn_ext';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' WHERE storage_category_id = '.$category_id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $lien_image = $rep.'/'.$row['file'];
+    $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefix_thumbnail'];
+    $lien_thumbnail.= get_filename_wo_extension( $row['file'] );
+    $lien_thumbnail.= '.'.$row['tn_ext'];
+		
+    if ( !is_file ( $lien_image ) or !is_file ( $lien_thumbnail ) )
+    {
+      if ( !is_file ( $lien_image ) )
+      {
+        $output.= $row['file'];
+        $output.= ' <span style="font-weight:bold;">';
+        $output.= $lang['update_disappeared'].'</span><br />';
+      }
+      if ( !is_file ( $lien_thumbnail ) )
+      {
+        $output.= $row['file'];
+        $output.= ' : <span style="font-weight:bold;">';
+        $output.= $lang['update_disappeared_tn'].'</span><br />';
+      }
+      // suppression de la base :
+      delete_image( $row['id'] );
+    }
+  }
+		
+  // searching the new images in the directory
+  $pictures = array();		
+  $tn_ext = '';
+  if ( $opendir = opendir( $rep ) )
+  {
+    while ( $file = readdir( $opendir ) )
+    {
+      if ( is_file( $rep.'/'.$file ) and is_image( $rep.'/'.$file ) )
+      {
+        // is the picture waiting for validation by an administrator ?
+        $query = 'SELECT id,validated,infos';
+        $query.= ' FROM '.PREFIX_TABLE.'waiting';
+        $query.= ' WHERE storage_category_id = '.$category_id;
+        $query.= " AND file = '".$file."'";
+        $query.= ';';
+        $result = mysql_query( $query );
+        $waiting = mysql_fetch_array( $result );
+        if (mysql_num_rows( $result ) == 0 or $waiting['validated'] == 'true')
+        {
+          if ( $tn_ext = TN_exists( $rep, $file ) )
+          {
+            // is the picture already in the database ?
+            $query = 'SELECT id';
+            $query.= ' FROM '.PREFIX_TABLE.'images';
+            $query.= ' WHERE storage_category_id = '.$category_id;
+            $query.= " AND file = '".$file."'";
+            $query.= ';';
+            $result = mysql_query( $query );
+            if ( mysql_num_rows( $result ) == 0 )
+            {
+              $picture = array();
+              $picture['file']     = $file;
+              $picture['tn_ext']   = $tn_ext;
+              $picture['date'] = date( 'Y-m-d', filemtime ( $rep.'/'.$file ) );
+              $picture['filesize'] = floor( filesize( $rep.'/'.$file ) / 1024);
+              $image_size = @getimagesize( $rep.'/'.$file );
+              $picture['width']    = $image_size[0];
+              $picture['height']   = $image_size[1];
+              if ( $waiting['validated'] == 'true' )
+              {
+                // retrieving infos from the XML description of
+                // $waiting['infos']
+                $infos = nl2br( $waiting['infos'] );
+                $picture['author']        = getAttribute( $infos, 'author' );
+                $picture['comment']       = getAttribute( $infos, 'comment' );
+                $unixtime = getAttribute( $infos, 'date_creation' );
+                $picture['date_creation'] = '';
+                if ( $unixtime != '' )
+                {
+                  $picture['date_creation'] = date( 'Y-m-d', $unixtime );
+                }
+                $picture['name']          = getAttribute( $infos, 'name' );
+                // deleting the waiting element
+                $query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
+                $query.= ' WHERE id = '.$waiting['id'];
+                $query.= ';';
+                mysql_query( $query );
+              }
+              array_push( $pictures, $picture );
+            }
+          }
+          else
+          {
+            $output.= '<span style="color:red;">';
+            $output.= $lang['update_missing_tn'].' : '.$file;
+            $output.= ' (<span style="font-weight:bold;">';
+            $output.= $conf['prefix_thumbnail'];
+            $output.= get_filename_wo_extension( $file ).'.XXX</span>';
+            $output.= ', XXX = ';
+            $output.= implode( ', ', $conf['picture_ext'] );
+            $output.= ')</span><br />';
+          }
+        }
+      }
+    }
+  }
+  // inserting the pictures found in the directory
+  foreach ( $pictures as $picture ) {
+    $query = 'INSERT INTO '.PREFIX_TABLE.'images';
+    $query.= ' (file,storage_category_id,date_available,tn_ext';
+    $query.= ',filesize,width,height';
+    $query.= ',name,author,comment,date_creation)';
+    $query.= ' VALUES ';
+    $query.= "('".$picture['file']."','".$category_id."'";
+    $query.= ",'".$picture['date']."','".$picture['tn_ext']."'";
+    $query.= ",'".$picture['filesize']."','".$picture['width']."'";
+    $query.= ",'".$picture['height']."','".$picture['name']."'";
+    $query.= ",'".$picture['author']."','".$picture['comment']."'";
+    if ( $picture['date_creation'] != '' )
+    {
+      $query.= ",'".$picture['date_creation']."'";
+    }
+    else
+    {
+      $query.= ',NULL';
+    }
+    $query.= ');';
+    mysql_query( $query );
+    $count_new++;
+    // retrieving the id of newly inserted picture
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' WHERE storage_category_id = '.$category_id;
+    $query.= " AND file = '".$picture['file']."'";
+    $query.= ';';
+    list( $image_id ) = mysql_fetch_array( mysql_query( $query ) );
+    // adding the link between this picture and its storage category
+    $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+    $query.= ' (image_id,category_id) VALUES ';
+    $query.= ' ('.$image_id.','.$category_id.')';
+    $query.= ';';
+    mysql_query( $query );
+
+    $output.= $picture['file'];
+    $output.= ' <span style="font-weight:bold;">';
+    $output.= $lang['update_research_added'].'</span>';
+    $output.= ' ('.$lang['update_research_tn_ext'].' '.$picture['tn_ext'].')';
+    $output.= '<br />';
+  }
+  return $output;
+}
+
+// remote_images verifies if a file named "listing.xml" is present is the
+// admin directory. If it is the case, creation of a remote picture storage
+// site if it doesn't already exists. Then, the function calls
+// insert_remote_category for this remote site on the root category.
+function remote_images()
+{
+  global $conf, $lang, $vtp, $sub;
+
+  // 1. is there a file listing.xml ?
+  if ( !( $xml_content = getXmlCode( 'listing.xml' ) ) )
+  {
+    return false;
+  }
+  $url = getContent( getChild( $xml_content, 'url' ) );
+  $vtp->setVar( $sub, 'remote_update.url', $url );
+
+  // 2. is the site already existing ?
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'sites';
+  $query.= " WHERE galleries_url = '".$url."'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  if ( mysql_num_rows($result ) == 0 )
+  {
+    // we have to register this site in the database
+    $query = 'INSERT INTO '.PREFIX_TABLE.'sites';
+    $query.= " (galleries_url) VALUES ('".$url."')";
+    $query.= ';';
+    mysql_query( $query );
+    $site_id = mysql_insert_id();
+  }
+  else
+  {
+    // we get the already registered id
+    $row = mysql_fetch_array( $result );
+    $site_id = $row['id'];
+  }
+
+  // 3. available dirs in the file
+  $categories = insert_remote_category( $xml_content, $site_id, 'NULL', 0 );
+  $vtp->setVar( $sub, 'remote_update.categories', $categories );
+}
+
+// insert_remote_category searchs the "dir" node of the xml_dir given and
+// insert the contained categories if the are not in the database yet. The
+// function also deletes the categories that are in the database and not in
+// the xml_file.
+function insert_remote_category( $xml_dir, $site_id, $id_uppercat, $level )
+{
+  global $conf,$user;
+
+  $output = '';
+  $categories = array();
+  $list_dirs = getChildren( $xml_dir, 'dir'.$level );
+  for ( $i = 0; $i < sizeof( $list_dirs ); $i++ )
+  {
+    // is the category already existing ?
+    $category_id = '';
+    $dir = getAttribute( $list_dirs[$i], 'name' );
+    $categories[$i] = $dir;
+
+    $src = '../template/'.$user['template'].'/admin/images/puce.gif';
+    $output.= '<img src="'.$src.'" alt="&gt;" />';
+    $output.= '<span style="font-weight:bold;">'.$dir.'</span>';
+    $output.= '<div class="retrait">';
+
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE site_id = '.$site_id;
+    $query.= " AND dir = '".$dir."'";
+    if ( $id_uppercat == 'NULL' )
+    {
+      $query.= ' AND id_uppercat IS NULL';
+    }
+    else
+    {
+      $query.= ' AND id_uppercat = '.$id_uppercat;
+    }
+    $query.= ';';
+    $result = mysql_query( $query );
+    if ( mysql_num_rows( $result ) == 0 )
+    {
+      $name = str_replace( '_', ' ', $dir );
+      // we have to create the category
+      $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
+      $query.= ' (name,dir,site_id,id_uppercat) VALUES ';
+      $query.= "('".$name."','".$dir."',".$site_id;
+      if ( !is_numeric( $id_uppercat ) )
+      {
+        $query.= ',NULL';
+      }
+      else
+      {
+        $query.= ','.$id_uppercat;
+      }
+      $query.= ');';
+      mysql_query( $query );
+      $category_id = mysql_insert_id();
+    }
+    else
+    {
+      // we get the already registered id
+      $row = mysql_fetch_array( $result );
+      $category_id = $row['id'];
+    }
+    $output.= insert_remote_image( $list_dirs[$i], $category_id );
+    $output.= insert_remote_category( $list_dirs[$i], $site_id,
+                                      $category_id, $level+1 );
+    $output.= '</div>';
+  }
+  // we have to remove the categories of the database not present in the xml
+  // file (ie deleted from the picture storage server)
+  $query = 'SELECT dir,id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE site_id = '.$site_id;
+  if ( !is_numeric( $id_uppercat ) )
+  {
+    $query.= ' AND id_uppercat IS NULL';
+  }
+  else
+  {
+    $query.= ' AND id_uppercat = '.$id_uppercat;
+  }
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // is the category in the xml file ?
+    if ( !in_array( $row['dir'], $categories ) )
+    {
+      delete_category( $row['id'] );
+    }
+  }
+
+  return $output;
+}
+	
+// insert_remote_image searchs the "root" node of the xml_dir given and
+// insert the contained pictures if the are not in the database yet.
+function insert_remote_image( $xml_dir, $category_id )
+{
+  global $count_new,$lang;
+
+  $output = '';
+  $root = getChild( $xml_dir, 'root' );
+  $pictures = array();
+  $xml_pictures = getChildren( $root, 'picture' );
+  for ( $j = 0; $j < sizeof( $xml_pictures ); $j++ )
+  {
+    //<picture file="albatros.jpg" tn_ext="png" date="2002-04-14"
+    //  filesize="35" width="640" height="480" />
+    $file     = getAttribute( $xml_pictures[$j], 'file' );
+    $tn_ext   = getAttribute( $xml_pictures[$j], 'tn_ext' );
+    $date     = getAttribute( $xml_pictures[$j], 'date' ); 
+    $filesize = getAttribute( $xml_pictures[$j], 'filesize' );
+    $width    = getAttribute( $xml_pictures[$j], 'width' );
+    $height   = getAttribute( $xml_pictures[$j], 'height' );
+			
+    $pictures[$j] = $file;
+			
+    // is the picture already existing in the database ?
+    $query = 'SELECT id,tn_ext';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' WHERE storage_category_id = '.$category_id;
+    $query.= " AND file = '".$file."'";
+    $query.= ';';
+    $result = mysql_query( $query );
+    $query = '';
+    if ( mysql_num_rows( $result ) == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'images';
+      $query.= ' (file,storage_category_id,date_available,tn_ext';
+      $query.= ',filesize,width,height)';
+      $query.= ' VALUES (';
+      $query.= "'".$file."'";
+      $query.= ",'".$category_id."'";
+      $query.= ",'".$date."'";
+      $query.= ",'".$tn_ext."'";
+      $query.= ",'".$filesize."'";
+      $query.= ",'".$width."'";
+      $query.= ",'".$height."'";
+      $query.= ')';
+      $query.= ';';
+      mysql_query( $query );
+      // retrieving the id of newly inserted picture
+      $query = 'SELECT id';
+      $query.= ' FROM '.PREFIX_TABLE.'images';
+      $query.= ' WHERE storage_category_id = '.$category_id;
+      $query.= " AND file = '".$file."'";
+      $query.= ';';
+      list( $image_id ) = mysql_fetch_array( mysql_query( $query ) );
+      // adding the link between this picture and its storage category
+      $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
+      $query.= ' (image_id,category_id) VALUES ';
+      $query.= ' ('.$image_id.','.$category_id.')';
+      $query.= ';';
+      mysql_query( $query );
+
+      $output.= $file;
+      $output.= ' <span style="font-weight:bold;">';
+      $output.= $lang['update_research_added'].'</span>';
+      $output.= ' ('.$lang['update_research_tn_ext'].' '.$tn_ext.')<br />';
+
+      $count_new++;
+    }
+    else
+    {
+      // is the tn_ext the same in the xml file and in the database ?
+      $row = mysql_fetch_array( $result );
+      if ( $row['tn_ext'] != $tn_ext )
+      {
+        $query = 'UPDATE '.PREFIX_TABLE.'images';
+        $query.= ' SET';
+        $query.= " tn_ext = '".$tn_ext."'";
+        $query.= ' WHERE storage_category_id = '.$category_id;
+        $query.= " AND file = '".$file."'";
+        $query.= ';';
+      }
+    }
+    // execution of the query
+    if ( $query != '' )
+    {
+      mysql_query( $query );
+    }
+  }
+  // we have to remove the pictures of the database not present in the xml file
+  // (ie deleted from the picture storage server)
+  $query = 'SELECT id,file';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' WHERE storage_category_id = '.$category_id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // is the file in the xml file ?
+    if ( !in_array( $row['file'], $pictures ) )
+    {
+      delete_image( $row['id'] );
+    }
+  }
+  return $output;
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/update.vtp' );
+$tpl = array( 'update_default_title', 'update_only_cat', 'update_all',
+              'update_research_conclusion', 'update_deletion_conclusion',
+              'remote_site', 'update_part_research' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//-------------------------------------------------------- categories structure
+$page['plain_structure'] = get_plain_structure();
+//-------------------------------------------- introduction : choices of update
+// Display choice if "update" var is not specified
+check_cat_id( $_GET['update'] );
+if ( !isset( $_GET['update'] )
+     and !( isset( $page['cat'] )
+            or $_GET['update'] == 'cats'
+            or $_GET['update'] == 'all' ) )
+{
+  $vtp->addSession( $sub, 'introduction' );
+  // only update the categories, not the pictures.
+  $url = add_session_id( './admin.php?page=update&amp;update=cats' );
+  $vtp->setVar( $sub, 'introduction.only_cat:url', $url );
+  // update the entire tree folder
+  $url = add_session_id( './admin.php?page=update&amp;update=all' );
+  $vtp->setVar( $sub, 'introduction.all:url', $url );
+  $vtp->closeSession( $sub, 'introduction' );
+}
+//------------------------------------------------- local update : ../galleries
+else
+{
+  $count_new = 0;
+  $count_deleted = 0;
+  $vtp->addSession( $sub, 'local_update' );
+  if ( isset( $page['cat'] ) )
+  {
+    $categories = insert_local_category( $page['cat'] );
+  }
+  else
+  {
+    $categories = insert_local_category( 'NULL' );
+  }
+  $vtp->setVar( $sub, 'local_update.categories', $categories );
+  $vtp->setVar( $sub, 'local_update.count_new', $count_new );
+  $vtp->setVar( $sub, 'local_update.count_deleted', $count_deleted );
+  $vtp->closeSession( $sub, 'local_update' );
+}
+//------------------------------------------------- remote update : listing.xml
+if ( @is_file( './listing.xml' ) )
+{
+  $count_new = 0;
+  $count_deleted = 0;
+  $vtp->addSession( $sub, 'remote_update' );
+
+  remote_images();
+  $vtp->setVar( $sub, 'remote_update.count_new', $count_new );
+  $vtp->setVar( $sub, 'remote_update.count_deleted', $count_deleted );
+
+  $vtp->closeSession( $sub, 'remote_update' );
+}
+//---------------------------------------- update informations about categories
+update_category( 'all' );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/user_list.php
===================================================================
--- /tags/release-1_3RC1/admin/user_list.php	(revision 159)
+++ /tags/release-1_3RC1/admin/user_list.php	(revision 159)
@@ -0,0 +1,261 @@
+<?php
+/***************************************************************************
+ *                               user_list.php                             *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_list.vtp' );
+$tpl = array( 'listuser_confirm','listuser_modify_hint','listuser_modify',
+              'listuser_permission','listuser_permission_hint',
+              'listuser_delete_hint','listuser_delete','yes','no',
+              'listuser_button_all','listuser_button_invert',
+              'listuser_button_create_address','title_add','login','password',
+              'add','errors_title' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template',   $user['template'] );
+//------------------------------------------------------------------ add a user
+$errors = array();
+if ( isset( $_POST['submit'] ) )
+{
+  $errors = register_user(
+    $_POST['username'], $_POST['password'], $_POST['password'], '', 'guest' );
+}
+//-------------------------------------------------------------- errors display
+if ( sizeof( $errors ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  foreach ( $errors as $error ) {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.li', $error );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+else
+{
+  $_POST = array();
+}
+//--------------------------------------------------------------- delete a user
+if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
+{
+  $query = 'SELECT username';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= ' WHERE id = '.$_GET['delete'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  // confirm user deletion ?
+  if ( $_GET['confirm'] != 1 )
+  {
+    $vtp->addSession( $sub, 'deletion' );
+    $vtp->setVar( $sub, 'deletion.login', $row['username'] );
+    $yes_url = './admin.php?page=user_list&amp;delete='.$_GET['delete'];
+    $yes_url.= '&amp;confirm=1';
+    $vtp->setVar( $sub, 'deletion.yes_url', add_session_id( $yes_url ) );
+    $no_url = './admin.php?page=user_list';
+    $vtp->setVar( $sub, 'deletion.no_url', add_session_id( $no_url ) );
+    $vtp->closeSession( $sub, 'deletion' );
+  }
+  // user deletion confirmed
+  else
+  {
+    $vtp->addSession( $sub, 'confirmation' );
+    if ( $row['username'] != 'guest'
+         and $row['username'] != $conf['webmaster'] )
+    {
+      $query = 'SELECT COUNT(*) AS nb_result';
+      $query.= ' FROM '.PREFIX_TABLE.'users';
+      $query.= ' WHERE id = '.$_GET['delete'];
+      $query.= ';';
+      $row2 = mysql_fetch_array( mysql_query( $query ) );
+      if ( $row2['nb_result'] > 0 )
+      {
+        delete_user( $_GET['delete'] );
+        $vtp->setVar( $sub, 'confirmation.class', 'info' );
+        $info = '"'.$row['username'].'" '.$lang['listuser_info_deletion'];
+        $vtp->setVar( $sub, 'confirmation.info', $info );
+      }
+      else
+      {
+        $vtp->setVar( $sub, 'confirmation.class', 'erreur' );
+        $vtp->setVar( $sub, 'confirmation.info', $lang['user_err_unknown'] );
+      }
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'confirmation.class', 'erreur' );
+      $vtp->setVar( $sub, 'confirmation.info', $lang['user_err_modify'] );
+    }
+    $vtp->closeSession( $sub, 'confirmation' );
+  }
+}
+//------------------------------------------------------------------ users list
+else
+{
+  // add a user
+  $vtp->addSession( $sub, 'add_user' );
+  $action = './admin.php?'.$_SERVER['QUERY_STRING'];
+  $vtp->setVar( $sub, 'add_user.form_action', $action );
+  $vtp->setVar( $sub, 'add_user.f_username', $_POST['username'] );
+  $vtp->closeSession( $sub, 'add_user' );
+  
+  $vtp->addSession( $sub, 'users' );
+
+  $action = './admin.php?'.$_SERVER['QUERY_STRING'];
+  if ( !isset( $_GET['mail'] ) )
+  {
+    $action.= '&amp;mail=true';
+  }
+  $vtp->setVar( $sub, 'users.form_action', $action );
+
+  $query = 'SELECT id,username,status,mail_address';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= ' ORDER BY status ASC, username ASC';
+  $query.= ';';
+  $result = mysql_query( $query );
+
+  $current_status = '';
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // display the line indicating the status of the next users
+    if ( $row['status'] != $current_status )
+    {
+      if ( $current_status != '' )
+      {
+        $vtp->closeSession( $sub, 'category' );
+      }
+      $vtp->addSession( $sub, 'category' );
+      $title = $lang['listuser_user_group'].' ';
+      switch ( $row['status'] )
+      {
+      case 'admin' : $title.= $lang['adduser_status_admin']; break;
+      case 'guest' : $title.= $lang['adduser_status_guest']; break;
+      }
+      $vtp->setVar( $sub, 'category.title', $title );
+      $current_status = $row['status'];
+    }
+    $vtp->addSession( $sub, 'user' );
+    // checkbox for mail management if the user has a mail address
+    if ( $row['mail_address'] != '' and $row['username'] != 'guest' )
+    {
+      $vtp->addSession( $sub, 'checkbox' );
+      $vtp->setVar( $sub, 'checkbox.name', 'mail-'.$row['id'] );
+      $vtp->closeSession( $sub, 'checkbox' );
+    }
+    // use a special color for the login of the user ?
+    if ( $row['username'] == $conf['webmaster'] )
+    {
+      $vtp->setVar( $sub, 'user.color', 'red' );
+    }
+    if ( $row['username'] == 'guest' )
+    {
+      $vtp->setVar( $sub, 'user.color', 'green' );
+      $vtp->setVar( $sub, 'user.login', $lang['guest'] );
+    }
+    else
+    {
+      $vtp->setVar( $sub, 'user.login', $row['username'] );
+    }
+    // modify or not modify ?
+    if ( $row['username'] == 'guest'
+         or ( $row['username'] == $conf['webmaster']
+              and $user['username'] != $conf['webmaster'] ) )
+    {
+      $vtp->addSession( $sub, 'not_modify' );
+      $vtp->closeSession( $sub, 'not_modify' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'modify' );
+      $url = './admin.php?page=user_modify&amp;user_id=';
+      $url.= $row['id'];
+      $vtp->setVar( $sub, 'modify.url', add_session_id( $url ) );
+      $vtp->setVar( $sub, 'modify.login', $row['username'] );
+      $vtp->closeSession( $sub, 'modify' );
+    }
+    // manage permission or not ?
+    if ( $row['username'] == $conf['webmaster']
+         and $user['username'] != $conf['webmaster'] )
+    {
+      $vtp->addSession( $sub, 'not_permission' );
+      $vtp->closeSession( $sub, 'not_permission' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'permission' );
+      $url = './admin.php?page=user_perm&amp;user_id='.$row['id'];
+      $vtp->setVar( $sub, 'permission.url', add_session_id( $url ) );
+      $vtp->setVar( $sub, 'permission.login', $row['username'] );
+      $vtp->closeSession( $sub, 'permission' );
+    }
+    // is the user deletable or not ?
+    if ( $row['username'] == 'guest'
+         or $row['username'] == $conf['webmaster'] )
+    {
+      $vtp->addSession( $sub, 'not_delete' );
+      $vtp->closeSession( $sub, 'not_delete' );
+    }
+    else
+    {
+      $vtp->addSession( $sub, 'delete' );
+      $url = './admin.php?page=user_list&amp;delete='.$row['id'];
+      $vtp->setVar( $sub, 'delete.url', add_session_id( $url ) );
+      $vtp->setVar( $sub, 'delete.login', $row['username'] );
+      $vtp->closeSession( $sub, 'delete' );
+    }
+    $vtp->closeSession( $sub, 'user' );
+  }
+  $vtp->closeSession( $sub, 'category' );
+  // mail management : creation of the mail address if asked by administrator
+  if ( isset( $_GET['mail'] ) )
+  {
+    $mail_address = array();
+    $i = 0;
+    $query = 'SELECT id,mail_address';
+    $query.= ' FROM '.PREFIX_TABLE.'users';
+    $query.= ';';
+    $result = mysql_query( $query );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      $key = 'mail-'.$row['id'];
+      if ( $_POST[$key] == 1 )
+      {
+        $mail_address[$i++] = $row['mail_address'];
+      }
+    }
+    $mail_destination = '';
+    for ( $i = 0; $i < sizeof( $mail_address ); $i++ )
+    {
+      $mail_destination.= $mail_address[$i];
+      if ( sizeof( $mail_address ) > 1 )
+      {
+        $mail_destination.= ';';
+      }
+    }
+    if ( sizeof( $mail_address ) > 0 )
+    {
+      $vtp->addSession( $sub, 'mail_link' );
+      $vtp->setVar( $sub, 'mail_link.mailto', $mail_destination );
+      $vtp->setVar( $sub, 'mail_link.mail_address_start',
+                    substr( $mail_destination, 0, 50 ) );
+      $vtp->closeSession( $sub, 'mail_link' );
+    }
+  }
+  $vtp->closeSession( $sub, 'users' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/user_modify.php
===================================================================
--- /tags/release-1_3RC1/admin/user_modify.php	(revision 159)
+++ /tags/release-1_3RC1/admin/user_modify.php	(revision 159)
@@ -0,0 +1,206 @@
+<?php
+/***************************************************************************
+ *                              user_modify.php                            *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_modify.vtp' );
+$error = array();
+$tpl = array( 'adduser_info_message', 'adduser_info_back', 'adduser_fill_form',
+              'login', 'new', 'password', 'mail_address', 'adduser_status',
+              'submit', 'adduser_info_password_updated','menu_groups',
+              'dissociate','adduser_associate' );
+templatize_array( $tpl, 'lang', $sub );
+//--------------------------------------------------------- form criteria check
+$error = array();
+$display_form = true;
+
+// retrieving information in the database about the user identified by its
+// id in $_GET['user_id']
+$query = 'select';
+$query.= ' username,status,mail_address';
+$query.= ' from '.PREFIX_TABLE.'users';
+$query.= ' where id = '.$_GET['user_id'];
+$query.= ';';
+$row = mysql_fetch_array( mysql_query( $query ) );
+$page['username'] = $row['username'];
+$page['status'] = $row['status'];
+$page['mail_address'] = $row['mail_address'];
+// user is not modifiable if :
+//   1. the selected user is the user "guest"
+//   2. the selected user is the webmaster and the user making the modification
+//      is not the webmaster
+if ( $row['username'] == 'guest'
+     or ( $row['username'] == $conf['webmaster']
+          and $user['username'] != $conf['webmaster'] ) )
+{
+  array_push( $error, $lang['user_err_modify'] );
+  $display_form = false;
+}
+// if the user was not found in the database, no modification possible
+if ( $row['username'] == '' )
+{
+  array_push( $error, $lang['user_err_unknown'] );
+  $display_form = false;
+}
+
+if ( sizeof( $error ) == 0 and isset( $_POST['submit'] ) )
+{
+  // shall we use a new password and overwrite the old one ?
+  $use_new_password = false;
+  if ( $_POST['use_new_pwd'] == 1)
+  {
+    $use_new_password = true;
+  }
+  $error = array_merge( $error, update_user(
+                          $_GET['user_id'], $_POST['mail_address'],
+                          $_POST['status'], $use_new_password,
+                          $_POST['password'] ) );
+}
+// association with groups management
+if ( isset( $_POST['submit'] ) )
+{
+  // deletion of checked groups
+  $query = 'SELECT id,name';
+  $query.= ' FROM '.PREFIX_TABLE.'groups';
+  $query.= ' ORDER BY id ASC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $dissociate = 'dissociate-'.$row['id'];
+    if ( $_POST[$dissociate] == 1 )
+    {
+      $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
+      $query.= ' WHERE user_id = '.$_GET['user_id'];
+      $query.= ' AND group_id ='.$row['id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+  }
+  // create a new association between the user and a group
+  $query = 'INSERT INTO '.PREFIX_TABLE.'user_group';
+  $query.= ' (user_id,group_id) VALUES';
+  $query.= ' ('.$_GET['user_id'].','.$_POST['associate'].')';
+  $query.= ';';
+  mysql_query( $query );
+}
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+  $vtp->addSession( $sub, 'errors' );
+  for ( $i = 0; $i < sizeof( $error ); $i++ )
+  {
+    $vtp->addSession( $sub, 'li' );
+    $vtp->setVar( $sub, 'li.li', $error[$i] );
+    $vtp->closeSession( $sub, 'li' );
+  }
+  $vtp->closeSession( $sub, 'errors' );
+}
+//---------------------------------------------------------------- confirmation
+if ( sizeof( $error ) == 0 and isset( $_POST['submit'] ) )
+{
+  $vtp->addSession( $sub, 'confirmation' );
+  $vtp->setVar( $sub, 'confirmation.username', $page['username'] );
+  $url = add_session_id( './admin.php?page=user_list' );
+  $vtp->setVar( $sub, 'confirmation.url', $url );
+  $vtp->closeSession( $sub, 'confirmation' );
+  if ( $use_new_pwd )
+  {
+    $vtp->addSession( $sub, 'password_updated' );
+    $vtp->closeSession( $sub, 'password_updated' );
+  }
+}
+//------------------------------------------------------------------------ form
+if ( $display_form )
+{
+  $vtp->addSession( $sub, 'form' );
+  $action = './admin.php?page=user_modify&amp;user_id='.$_GET['user_id'];
+  $vtp->setVar( $sub, 'form.form_action', add_session_id( $action ) );
+  $vtp->setVar( $sub, 'form.user:username',     $page['username'] );
+  if ( isset( $_POST['mail_address'] ) )
+  {
+    $page['mail_address'] = $_POST['mail_address'];
+  }
+  $vtp->setVar( $sub, 'form.user:mail_address', $page['mail_address'] );
+  if ( isset( $_POST['status'] ) )
+  {
+    $page['status'] = $_POST['status'];
+  }
+  $option = get_enums( PREFIX_TABLE.'users', 'status' );
+  for ( $i = 0; $i < sizeof( $option ); $i++ )
+  {
+    $vtp->addSession( $sub, 'status_option' );
+    $vtp->setVar( $sub, 'status_option.value', $option[$i] );
+    $vtp->setVar( $sub, 'status_option.option',
+                  $lang['adduser_status_'.$option[$i]] );
+    if( $option[$i] == $page['status'] )
+    {
+      $vtp->setVar( $sub, 'status_option.selected', ' selected="selected"' );
+    }
+    $vtp->closeSession( $sub, 'status_option' );
+  }
+  // groups linked with this user
+  $query = 'SELECT id,name';
+  $query.= ' FROM '.PREFIX_TABLE.'user_group, '.PREFIX_TABLE.'groups';
+  $query.= ' WHERE group_id = id';
+  $query.= ' AND user_id = '.$_GET['user_id'];
+  $query.= ';';
+  $result = mysql_query( $query );
+  $user_groups = array();
+  if ( mysql_num_rows( $result ) > 0 )
+  {
+    $vtp->addSession( $sub, 'groups' );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      $vtp->addSession( $sub, 'group' );
+      $vtp->setVar( $sub, 'group.name', $row['name'] );
+      $vtp->setVar( $sub, 'group.dissociate_id', $row['id'] );
+      $vtp->closeSession( $sub, 'group' );
+      array_push( $user_groups, $row['id'] );
+    }
+    $vtp->closeSession( $sub, 'groups' );
+  }
+  // empty group not to take into account
+  $vtp->addSession( $sub, 'associate_group' );
+  $vtp->setVar( $sub, 'associate_group.value', 'undef' );
+  $vtp->setVar( $sub, 'associate_group.option', '' );
+  $vtp->closeSession( $sub, 'associate_group' );
+  // groups not linked yet to the user
+  $query = 'SELECT id,name';
+  $query.= ' FROM '.PREFIX_TABLE.'groups';
+  $query.= ' ORDER BY id ASC';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    if ( !in_array( $row['id'], $user_groups ) )
+    {
+      $vtp->addSession( $sub, 'associate_group' );
+      $vtp->setVar( $sub, 'associate_group.value', $row['id'] );
+      $vtp->setVar( $sub, 'associate_group.option', $row['name'] );
+      $vtp->closeSession( $sub, 'associate_group' );
+    }
+  }
+
+  $url = add_session_id( './admin.php?page=user_list' );
+  $vtp->setVar( $sub, 'form.url_back', $url );
+  $vtp->closeSession( $sub, 'form' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/user_perm.php
===================================================================
--- /tags/release-1_3RC1/admin/user_perm.php	(revision 159)
+++ /tags/release-1_3RC1/admin/user_perm.php	(revision 159)
@@ -0,0 +1,179 @@
+<?php
+/***************************************************************************
+ *                               user_perm.php                             *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/user_perm.vtp' );
+$error = array();
+$tpl = array( 'permuser_authorized','permuser_forbidden','submit',
+              'permuser_parent_forbidden','permuser_info_message',
+              'adduser_info_back','permuser_only_private' );
+templatize_array( $tpl, 'lang', $sub );
+$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//--------------------------------------------------------------------- updates
+if ( isset( $_POST['submit'] ) )
+{
+  // cleaning the user_access table for this user
+  $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
+  $query.= ' WHERE user_id = '.$_GET['user_id'];
+  $query.= ';';
+  mysql_query( $query );
+  // selecting all private categories
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= " WHERE status = 'private'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $radioname = 'access-'.$row['id'];
+    if ( $_POST[$radioname] == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
+      $query.= ' (user_id,cat_id) VALUES';
+      $query.= ' ('.$_GET['user_id'].','.$row['id'].')';
+      $query.= ';';
+      mysql_query ( $query );
+    }
+  }
+  check_favorites( $_GET['user_id'] );
+  $vtp->addSession( $sub, 'confirmation' );
+  $url = './admin.php?page=user_list';
+  $vtp->setVar( $sub, 'confirmation.back_url', add_session_id( $url ) );
+  $vtp->closeSession( $sub, 'confirmation' );
+}
+//---------------------------------------------------------------- form display
+$restrictions = get_restrictions( $_GET['user_id'], $page['user_status'],
+                                  false, false );
+$action = './admin.php?page=user_perm&amp;user_id='.$_GET['user_id'];
+$vtp->setVar( $sub, 'action', add_session_id( $action ) );
+// Association of group_ids with group_names -> caching informations
+$query = 'SELECT id,name';
+$query.= ' FROM '.PREFIX_TABLE.'groups';
+$query.= ';';
+$result = mysql_query( $query );
+$groups = array();
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $groups[$row['id']] = $row['name'];
+}
+// Listing of groups the user belongs to
+$query = 'SELECT ug.group_id as groupid';
+$query.= ' FROM '.PREFIX_TABLE.'user_group as ug';
+$query.= ' WHERE user_id = '.$_GET['user_id'];
+$query.= ';';
+$result = mysql_query( $query );
+$usergroups = array();
+while ( $row = mysql_fetch_array( $result ) )
+{
+  array_push( $usergroups, $row['groupid'] );
+}
+// only private categories are listed
+$query = 'SELECT id';
+$query.= ' FROM '.PREFIX_TABLE.'categories';
+$query.= " WHERE status = 'private'";
+$query.= ';';
+$result = mysql_query( $query );
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'category' );
+  $vtp->setVar( $sub, 'category.id', $row['id'] );
+  // we have to know whether the user is authorized to access this
+  // category. The category can be accessible for this user thanks to his
+  // personnal access rights OR thanks to the access rights of a group he
+  // belongs to.
+  // 1. group access :
+  //    retrieving all authorized groups for this category and for this user
+  $query = 'SELECT ga.group_id as groupid';
+  $query.= ' FROM '.PREFIX_TABLE.'group_access as ga';
+  $query.= ', '.PREFIX_TABLE.'user_group as ug';
+  $query.= ' WHERE ga.group_id = ug.group_id';
+  $query.= ' AND ug.user_id = '.$_GET['user_id'];
+  $query.= ' AND cat_id = '.$row['id'];
+  $query.= ';';
+  $subresult = mysql_query( $query );
+  $authorized_groups = array();
+  while ( $subrow = mysql_fetch_array( $subresult ) )
+  {
+    array_push( $authorized_groups, $subrow['groupid'] );
+  }
+  // 2. personnal access
+  $is_user_allowed = is_user_allowed( $row['id'], $restrictions );
+  // link to the category permission management
+  $url = './admin.php?page=cat_perm&amp;cat_id='.$row['id'];
+  $vtp->setVar( $sub, 'category.cat_perm_link', add_session_id( $url ) );
+  // color of the category : green if the user is allowed by himself or
+  // thanks to a group he belongs to
+  if ( $is_user_allowed == 0 or count( $authorized_groups ) > 0 )
+  {
+    $vtp->setVar( $sub, 'category.color', 'green' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'category.color', 'red' );
+  }
+  // category name
+  $cat_infos = get_cat_info( $row['id'] );
+  $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
+                                'font-weight:bold;' );
+  $vtp->setVar( $sub, 'category.name', $name );
+  // usergroups
+  if ( count( $usergroups ) > 0 )
+  {
+    $vtp->addSession( $sub, 'usergroups' );
+    foreach ( $usergroups as $i => $usergroup ) {
+      $vtp->addSession( $sub, 'usergroup' );
+      $vtp->setVar( $sub, 'usergroup.name', $groups[$usergroup] );
+      $url = './admin.php?page=group_perm&amp;group_id='.$usergroup;
+      $vtp->setVar( $sub, 'usergroup.url', add_session_id( $url ) );
+      if ( in_array( $usergroup, $authorized_groups ) )
+      {
+        $vtp->setVar( $sub, 'usergroup.color', 'green' );
+      }
+      else
+      {
+        $vtp->setVar( $sub, 'usergroup.color', 'red' );
+      }
+      if ( $i < count( $usergroups ) - 1 )
+      {
+        $vtp->setVar( $sub, 'usergroup.separation', ',' );
+      }
+      $vtp->closeSession( $sub, 'usergroup' );
+    }
+    $vtp->closeSession( $sub, 'usergroups' );
+  }
+  // any subcat forbidden for this user ?
+  if ( $is_user_allowed == 2 )
+  {
+    $vtp->addSession( $sub, 'parent_forbidden' );
+    $vtp->closeSession( $sub, 'parent_forbidden' );
+  }
+  // personnal forbidden or authorized access ?
+  if ( $is_user_allowed == 0 )
+  {
+    $vtp->setVar( $sub, 'category.authorized_checked', ' checked="checked"' );
+  }
+  else
+  {
+    $vtp->setVar( $sub, 'category.forbidden_checked', ' checked="checked"' );
+  }
+  $vtp->closeSession( $sub, 'category' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/admin/waiting.php
===================================================================
--- /tags/release-1_3RC1/admin/waiting.php	(revision 159)
+++ /tags/release-1_3RC1/admin/waiting.php	(revision 159)
@@ -0,0 +1,138 @@
+<?php
+/***************************************************************************
+ *                                waiting.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include_once( './include/isadmin.inc.php' );
+//--------------------------------------------------------------------- updates
+if ( isset( $_POST['submit'] ) )
+{
+  $query = 'SELECT id,storage_category_id,file,tn_ext';
+  $query.= ' FROM '.PREFIX_TABLE.'waiting';
+  $query.= " WHERE validated = 'false'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $key = 'validate-'.$row['id'];
+    if ( isset( $_POST[$key] ) )
+    {
+      if ( $_POST[$key] == 'true' )
+      {
+        // The uploaded element was validated, we have to set the
+        // "validated" field to "true"
+        $query = 'UPDATE '.PREFIX_TABLE.'waiting';
+        $query.= " SET validated = 'true'";
+        $query.= ' WHERE id = '.$row['id'];
+        $query.= ';';
+        mysql_query( $query );
+        // linking logically the picture to its storage category
+        $query = 'INSERT INTO';
+      }
+      else
+      {
+        // The uploaded element was refused, we have to delete its reference
+        // in the database and to delete the element as well.
+        $query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
+        $query.= ' WHERE id = '.$row['id'];
+        $query.= ';';
+        mysql_query( $query );
+        // deletion of the associated files
+        $dir = get_complete_dir( $row['storage_category_id'] );
+        unlink( '.'.$dir.$row['file'] );
+        if ( $row['tn_ext'] != '' )
+        {
+          $thumbnail = $conf['prefix_thumbnail'];
+          $thumbnail.= get_filename_wo_extension( $row['file'] );
+          $thumbnail.= '.'.$row['tn_ext'];
+          $url = '.'.$dir.'thumbnail/'.$thumbnail;
+          unlink( $url );
+        }
+      }
+    }
+  }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/waiting.vtp' );
+$tpl = array( 'category','date','author','thumbnail','file','delete',
+              'submit' );
+templatize_array( $tpl, 'lang', $sub );
+//---------------------------------------------------------------- form display
+$cat_names = array();
+$query = 'SELECT id,storage_category_id,file,username,mail_address';
+$query.= ',date,tn_ext';
+$query.= ' FROM '.PREFIX_TABLE.'waiting';
+$query.= " WHERE validated = 'false'";
+$query.= ' ORDER BY storage_category_id';
+$query.= ';';
+$result = mysql_query( $query );
+$i = 0;
+while ( $row = mysql_fetch_array( $result ) )
+{
+  $vtp->addSession( $sub, 'picture' );
+  $vtp->setVar( $sub, 'picture.id', $row['id'] );
+  if ( $i++ % 2 == 0 )
+  {
+    $vtp->setVar( $sub, 'picture.class', 'row2' );
+  }
+  if ( !isset( $cat_names[$row['storage_category_id']] ) )
+  {
+    $cat = get_cat_info( $row['storage_category_id'] );
+    $cat_names[$row['storage_category_id']] = array();
+    $cat_names[$row['storage_category_id']]['dir'] =
+      '.'.get_complete_dir( $row['storage_category_id'] );
+    $cat_names[$row['storage_category_id']]['display_name'] =
+      get_cat_display_name( $cat['name'], ' &gt; ', 'font-weight:bold;' );
+  }
+  // category name
+  $vtp->setVar( $sub, 'picture.cat_name',
+                $cat_names[$row['storage_category_id']]['display_name'] );
+  // date displayed like this (in English ) :
+  //                     Sunday 15 June 2003 21:29
+  $date = format_date( $row['date'], 'unix', true );
+  $vtp->setVar( $sub, 'picture.date', $date );
+  // file preview link
+  $url = $cat_names[$row['storage_category_id']]['dir'].$row['file'];
+  $vtp->setVar( $sub, 'picture.preview_url', $url );
+  // file name
+  $vtp->setVar( $sub, 'picture.file', $row['file'] );
+  // is there an existing associated thumnail ?
+  if ( $row['tn_ext'] != '' )
+  {
+    $vtp->addSession( $sub, 'thumbnail' );
+    $thumbnail = $conf['prefix_thumbnail'];
+    $thumbnail.= get_filename_wo_extension( $row['file'] );
+    $thumbnail.= '.'.$row['tn_ext'];
+    $url = $cat_names[$row['storage_category_id']]['dir'];
+    $url.= 'thumbnail/'.$thumbnail;
+    $vtp->setVar( $sub, 'thumbnail.preview_url', $url );
+    $vtp->setVar( $sub, 'thumbnail.file', $thumbnail );
+    $vtp->closeSession( $sub, 'thumbnail' );
+  }
+  else
+  {
+    $vtp->addSession( $sub, 'no_thumbnail' );
+    $vtp->closeSession( $sub, 'no_thumbnail' );
+  }
+  // username and associated mail address
+  $vtp->setVar( $sub, 'picture.mail_address', $row['mail_address'] );
+  $vtp->setVar( $sub, 'picture.username', $row['username'] );
+
+  $vtp->closeSession( $sub, 'picture' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?>
Index: /tags/release-1_3RC1/category.php
===================================================================
--- /tags/release-1_3RC1/category.php	(revision 159)
+++ /tags/release-1_3RC1/category.php	(revision 159)
@@ -0,0 +1,471 @@
+<?php
+/***************************************************************************
+ *                               category.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+// determine the initial instant to indicate the generation time of this page
+$t1 = explode( ' ', microtime() );
+$t2 = explode( '.', $t1[0] );
+$t2 = $t1[1].'.'.$t2[1];
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//---------------------------------------------------------------------- logout
+if ( $_GET['act'] == 'logout' and isset( $_COOKIE['id'] ) )
+{
+  // cookie deletion if exists
+  setcookie( 'id', '', 0, cookie_path() );
+  $url = 'category.php';
+  header( 'Request-URI: '.$url );  
+  header( 'Content-Location: '.$url );  
+  header( 'Location: '.$url );
+  exit();
+}
+//-------------------------------------------------- access authorization check
+// creating the plain structure : array of all the available categories and
+// their relative informations, see the definition of the function
+// get_plain_structure for further details.
+$page['plain_structure'] = get_plain_structure();
+
+check_cat_id( $_GET['cat'] );
+check_login_authorization();
+if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+{
+  check_restrictions( $page['cat'] );
+}
+//-------------------------------------------------------------- initialization
+// creation of the array containing the cat ids to expand in the menu
+// $page['tab_expand'] contains an array with the category ids
+// $page['expand'] contains the string to display in URL with comma
+$page['tab_expand'] = array();
+if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' )
+{
+  $tab_expand = explode( ',', $_GET['expand'] );
+  foreach ( $tab_expand as $id ) {
+    if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id );
+  }
+  $page['expand'] = implode( ',', $page['tab_expand'] );
+}
+// in case of expanding all authorized cats
+// The $page['expand'] equals 'all' and
+// $page['tab_expand'] contains all the authorized cat ids
+if ( $user['expand'] or $_GET['expand'] == 'all' )
+{
+  $page['tab_expand'] = array();
+  $page['expand'] = 'all';
+}
+// detection of the start picture to display
+if ( !isset( $_GET['start'] )
+     or !is_numeric( $_GET['start'] )
+     or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
+{
+  $page['start'] = 0;
+}
+else
+{
+  $page['start'] = $_GET['start'];
+}
+// Sometimes, a "num" is provided in the URL. It is the number
+// of the picture to show. This picture must be in the thumbnails page.
+// We have to find the right $page['start'] that show the num picture
+// in this category
+if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 )
+{
+  $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] );
+  $page['start']*= $user['nb_image_page'];
+}
+// creating the structure of the categories (useful for displaying the menu)
+$page['structure'] = create_structure( '', $user['restrictions'] );
+$page['structure'] = update_structure( $page['structure'] );
+initialize_category();
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/category.vtp' );
+initialize_template();
+$tpl = array(
+  'categories','hint_category','sub-cat','images_available','total',
+  'title_menu','nb_image_category','send_mail','title_send_mail',
+  'generation_time','connected_user','recent_image','days','generation_time',
+  'favorite_cat_hint','favorite_cat','stats','most_visited_cat_hint',
+  'most_visited_cat','recent_cat','recent_cat_hint','upload_picture',
+  'comments' );
+templatize_array( $tpl, 'lang', $handle );
+
+$tpl = array( 'mail_webmaster','webmaster','top_number','version','site_url' );
+templatize_array( $tpl, 'conf', $handle );
+
+$tpl = array( 'short_period','long_period','lien_collapsed', 'username' );
+templatize_array( $tpl, 'user', $handle );
+
+$tpl = array( 'title','navigation_bar','cat_comment','cat_nb_images' );
+templatize_array( $tpl, 'page', $handle );
+
+// special global template vars
+$vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) );
+$icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) );
+$vtp->setGlobalVar( $handle, 'icon_long', $icon_long );
+$nb_total_pictures = count_images( $page['structure'] );
+$vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures );
+//------------------------------------------------------------- categories menu
+// normal categories
+foreach ( $page['structure'] as $category ) {
+  // display category is a function relative to the template
+  display_category( $category, '&nbsp;', $handle );
+}
+// favorites cat
+if ( !$user['is_the_guest'] )
+{
+  $vtp->addSession( $handle, 'favorites' );
+  $url = './category.php?cat=fav&amp;expand='.$page['expand'];
+  $vtp->setVar( $handle, 'favorites.url', add_session_id( $url ) );
+  // searching the number of favorite picture
+  $query = 'SELECT COUNT(*) AS count';
+  $query.= ' FROM '.PREFIX_TABLE.'favorites';
+  $query.= ' WHERE user_id = '.$user['id'].';';
+  $result = mysql_query( $query );
+  $row = mysql_fetch_array( $result );
+  $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] );
+  $vtp->closeSession( $handle, 'favorites' );
+}
+// most visited pictures category
+$url = './category.php?cat=most_visited&amp;expand='.$page['expand'];
+$vtp->setGlobalVar( $handle, 'most_visited_url', add_session_id( $url ) );
+// recent pictures
+$url = './category.php?cat=recent&amp;expand='.$page['expand'];
+$vtp->setGlobalVar( $handle, 'recent_url', add_session_id( $url ) );
+//--------------------------------------------------------------------- summary
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url', './identification.php' );
+if ( !$user['is_the_guest'] )
+{
+  $vtp->setVar( $handle, 'summary.title', '' );
+  $vtp->setVar( $handle, 'summary.name',replace_space($lang['change_login']));
+}
+else
+{
+  $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] );
+  $vtp->setVar( $handle, 'summary.name',  replace_space( $lang['login'] ) );
+}
+$vtp->closeSession( $handle, 'summary' );
+// links for registered users
+if ( !$user['is_the_guest'] )
+{
+  // logout link
+  $vtp->addSession( $handle, 'summary' );
+  $vtp->setVar( $handle, 'summary.url', './category.php?act=logout' );
+  $vtp->setVar( $handle, 'summary.title', '' );
+  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) );
+  $vtp->closeSession( $handle, 'summary' );
+  // customization link
+  $vtp->addSession( $handle, 'summary' );
+  $url = './profile.php?cat='.$page['cat'];
+  $url.= '&amp;expand='.$page['expand'];
+  if ( $page['cat'] == 'search' )
+  {
+    $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+  }
+  $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) );
+  $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] );
+  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) );
+  $vtp->closeSession( $handle, 'summary' );
+}
+// search link
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) );
+$vtp->setVar( $handle, 'summary.title', $lang['hint_search'] );
+$vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) );
+$vtp->closeSession( $handle, 'summary' );
+// about link
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url', './about.php?'.
+              str_replace( '&', '&amp;', $_SERVER['QUERY_STRING'] ) );
+$vtp->setVar( $handle, 'summary.title', $lang['hint_about'] );
+$vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) );
+$vtp->closeSession( $handle, 'summary' );
+// administration link
+if ( $user['status'] == 'admin' )
+{
+  $vtp->addSession( $handle, 'summary' );
+  $vtp->setVar( $handle, 'summary.url',
+                add_session_id( './admin/admin.php' ) );
+  $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] );
+  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) );
+  $vtp->closeSession( $handle, 'summary' );
+}
+//-------------------------------------------------------------- category title
+if ( isset ( $page['cat'] ) )
+{
+  if ( is_numeric( $page['cat'] ) )
+  {
+    $cat_title = get_cat_display_name( $page['cat_name'], '<br />',
+                                    'font-style:italic;' );
+    $vtp->setGlobalVar( $handle, "cat_title", $cat_title );
+  }
+  else
+  {
+    if ( $page['cat'] == 'search' )
+    {
+      $page['title'].= ' : <span style="font-style:italic;">';
+      $page['title'].= $_GET['search']."</span>";
+    }
+    $page['title'] = replace_space( $page['title'] );
+    $vtp->setGlobalVar( $handle, "cat_title", $page['title'] );
+  }
+}
+else
+{
+  $vtp->setGlobalVar( $handle, "cat_title",
+                      replace_space( $lang['no_category'] ) );
+}
+//------------------------------------------------------------------ thumbnails
+if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 )
+{
+  $array_cat_directories = array();
+  
+  $query = 'SELECT distinct(id),file,date_available,tn_ext,name,filesize';
+  $query.= ',storage_category_id';
+  $query.= ' FROM '.PREFIX_TABLE.'images AS i';
+  $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id';
+  $query.= $page['where'];
+  $query.= $conf['order_by'];
+  $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page'];
+  $query.= ';';
+  $result = mysql_query( $query );
+
+  $vtp->addSession( $handle, 'thumbnails' );
+  $vtp->addSession( $handle, 'line' );
+  // iteration counter to use a new <tr> every "$nb_image_line" pictures
+  $cell_number = 1;
+  // iteration counter to be sure not to create too much lines in the table
+  $line_number = 1;
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // retrieving the storage dir of the picture
+    if ( $array_cat_directories[$row['storage_category_id']] == '' )
+    {
+      $array_cat_directories[$row['storage_category_id']] =
+        get_complete_dir( $row['storage_category_id'] );
+    }
+    $cat_directory = $array_cat_directories[$row['storage_category_id']];
+
+    $file = get_filename_wo_extension( $row['file'] );
+    // name of the picture
+    if ( $row['name'] != '' ) $name = $row['name'];
+    else                      $name = str_replace( '_', ' ', $file );
+
+    if ( $page['cat'] == 'search' )
+    {
+      $name = replace_search( $name, $_GET['search'] );
+    }
+    // thumbnail url
+    $thumbnail_url = $cat_directory;
+    $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail'];
+    $thumbnail_url.= $file.'.'.$row['tn_ext'];
+    // message in title for the thumbnail
+    $thumbnail_title = $row['file'];
+    if ( $row['filesize'] == '' )
+      $poids = floor( filesize( $cat_directory.$row['file'] ) / 1024 );
+    else
+      $poids = $row['filesize'];
+    $thumbnail_title .= ' : '.$poids.' KB';
+    // url link on picture.php page
+    $url_link = './picture.php?cat='.$page['cat'];
+    $url_link.= '&amp;image_id='.$row['id'].'&amp;expand='.$page['expand'];
+    if ( $page['cat'] == 'search' )
+    {
+      $url_link.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+    }
+    // date of availability for creation icon
+    list( $year,$month,$day ) = explode( '-', $row['date_available'] );
+    $date = mktime( 0, 0, 0, $month, $day, $year );
+    // sending vars to display
+    $vtp->addSession( $handle, 'thumbnail' );
+    $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
+    $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url );
+    $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] );
+    $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
+    $vtp->setVar( $handle, 'thumbnail.name', $name );
+    $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );
+
+    if ( $conf['show_comments'] and $user['show_nb_comments'] )
+    {
+      $vtp->addSession( $handle, 'nb_comments' );
+      $query = 'SELECT COUNT(*) AS nb_comments';
+      $query.= ' FROM '.PREFIX_TABLE.'comments';
+      $query.= ' WHERE image_id = '.$row['id'];
+      $query.= " AND validated = 'true'";
+      $query.= ';';
+      $row = mysql_fetch_array( mysql_query( $query ) );
+      $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] );
+      $vtp->closeSession( $handle, 'nb_comments' );
+    }
+    
+    $vtp->closeSession( $handle, 'thumbnail' );
+    
+    if ( $cell_number++ == $user['nb_image_line'] )
+    {
+      // creating a new line
+      $vtp->closeSession( $handle, 'line' );
+      // the number of the next cell is 1
+      $cell_number = 1;
+      // we only create a new line if it does not exceed the maximum line
+      // per page for the logged user
+      if ( $line_number++ < $user['nb_line_page'] )
+      {
+        $vtp->addSession( $handle, 'line' );
+      }
+    }
+  }
+  $vtp->closeSession( $handle, 'thumbnails' );
+}
+//-------------------------------------------------------------- empty category
+elseif ( ( isset( $page['cat'] )
+           and is_numeric( $page['cat'] )
+           and $page['cat_nb_images'] == 0 )
+         or $_GET['cat'] == '' )
+{
+  $vtp->addSession( $handle, 'thumbnails' );
+  $vtp->addSession( $handle, 'line' );
+
+  $subcats = get_non_empty_subcat_ids( $page['cat'] );
+  $cell_number = 1;
+  $i = 0;
+  foreach ( $subcats as $subcat_id => $non_empty_id ) {
+    $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"';
+    $name.= ' alt="&gt;"/> ';
+    $name.= '[ <span style="font-weight:bold;">';
+    $name.= $page['plain_structure'][$subcat_id]['name'];
+    $name.= '</span> ]';
+
+    // searching the representative picture of the category
+    $query = 'SELECT representative_picture_id';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE id = '.$non_empty_id;
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    
+    $query = 'SELECT file,tn_ext,storage_category_id';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
+    $query.= ' WHERE category_id = '.$non_empty_id;
+    // if the category has a representative picture, this is its thumbnail
+    // tha will be displayed !
+    if ( $row['representative_picture_id'] != '' )
+      $query.= ' AND id = '.$row['representative_picture_id'];
+    else
+      $query.= ' ORDER BY RAND()';
+    $query.= ' LIMIT 0,1';
+    $query.= ';';
+    $image_result = mysql_query( $query );
+    $image_row    = mysql_fetch_array( $image_result );
+
+    $file = get_filename_wo_extension( $image_row['file'] );
+
+    // creating links for thumbnail and associated category
+    $thumbnail_link = get_complete_dir( $image_row['storage_category_id'] );
+    $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail'];
+    $thumbnail_link.= $file.'.'.$image_row['tn_ext'];
+
+    $thumbnail_title = $lang['hint_category'];
+
+    $url_link = './category.php?cat='.$subcat_id;
+    if ( !in_array( $page['cat'], $page['tab_expand'] ) )
+    {
+      array_push( $page['tab_expand'], $page['cat'] );
+      $page['expand'] = implode( ',', $page['tab_expand'] );
+    }
+    $url_link.= '&amp;expand='.$page['expand'];
+    // we add the category to explore in the expand list
+    if ( $page['expand'] != '' ) $url_link.= ',';
+    $url_link.= $subcat_id;
+
+    $date = $page['plain_structure'][$subcat_id]['date_last'];
+
+    // sending vars to display
+    $vtp->addSession( $handle, 'thumbnail' );
+    $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
+    $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_link );
+    $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] );
+    $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
+    $vtp->setVar( $handle, 'thumbnail.name', $name );
+    $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );
+    $vtp->closeSession( $handle, 'thumbnail' );
+
+    if ( $cell_number++ == $user['nb_image_line'] )
+    {
+      $vtp->closeSession( $handle, 'line' );
+      $cell_number = 1;
+      // we open a new line if the subcat was not the last one
+      if ( $i++ < count( $subcats ) - 1 )
+      {
+        $vtp->addSession( $handle, 'line' );
+      }
+    }
+  }
+  if ( $i < count( $subcats ) - 1 )
+  {
+    $vtp->closeSession( $handle, 'line' );
+  }
+  $vtp->closeSession( $handle, 'thumbnails' );
+}
+//------------------------------------------------------- category informations
+if ( isset ( $page['cat'] ) )
+{
+  $vtp->addSession( $handle, 'cat_infos' );
+  // navigation bar
+  if ( $page['navigation_bar'] != '' )
+  {
+    $vtp->addSession( $handle, 'navigation' );
+    $vtp->closeSession( $handle, 'navigation' );
+  }
+  // category comment
+  if ( isset( $page['comment'] ) and $page['comment'] != '' )
+  {
+    $vtp->addSession( $handle, 'comment' );
+    $vtp->setVar( $handle, 'comment.cat_comment', $page['comment'] );
+    $vtp->closeSession( $handle, 'comment' );
+  }
+  // total number of pictures in the category
+  if ( is_numeric( $page['cat'] ) )
+  {
+    $vtp->setVar( $handle, 'cat_infos.cat_name',
+                  get_cat_display_name( $page['cat_name'], ' - ',
+                                        'font-style:italic;' ) );
+  }
+  else
+  {
+    $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] );
+  }
+  // upload a picture in the category
+  if ( $page['cat_site_id'] == 1
+       and $conf['upload_available']
+       and $page['cat_uploadable'] )
+  {
+    $vtp->addSession( $handle, 'upload' );
+    $url = './upload.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+    $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) );
+    $vtp->closeSession( $handle, 'upload' );
+  }
+  $vtp->closeSession( $handle, 'cat_infos' );
+}
+//------------------------------------------------------------ log informations
+pwg_log( 'category', $page['title'] );
+mysql_close();
+//------------------------------------------------------------- generation time
+$time = get_elapsed_time( $t2, get_moment() );
+$vtp->setGlobalVar( $handle, 'time', $time );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/galleries/index.htm
===================================================================
--- /tags/release-1_3RC1/galleries/index.htm	(revision 159)
+++ /tags/release-1_3RC1/galleries/index.htm	(revision 159)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>PhpWebGallery</title>
+    </head>
+    <body>
+        No access authorized
+    </body>
+</html>
Index: /tags/release-1_3RC1/identification.php
===================================================================
--- /tags/release-1_3RC1/identification.php	(revision 159)
+++ /tags/release-1_3RC1/identification.php	(revision 159)
@@ -0,0 +1,112 @@
+<?php
+/***************************************************************************
+ *                            identification.php                           *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( "./include/init.inc.php" );
+//-------------------------------------------------------------- identification
+$errors = array();
+if ( isset( $_POST['login'] ) )
+{
+  // retrieving the encrypted password of the login submitted
+  $query = 'SELECT password';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= " WHERE username = '".$_POST['login']."';";
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  if( $row['password'] == md5( $_POST['pass'] ) )
+  {
+    $session_id = session_create( $_POST['login'] );
+    $url = 'category.php?id='.$session_id;
+    header( 'Request-URI: '.$url );
+    header( 'Content-Location: '.$url );  
+    header( 'Location: '.$url );
+    exit();
+  }
+  else
+  {
+    array_push( $errors, $lang['invalid_pwd'] );
+  }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/default/identification.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'ident_page_title', $lang['ident_page_title'] );
+$vtp->setGlobalVar( $handle, 'ident_title',      $lang['ident_title'] );
+$vtp->setGlobalVar( $handle, 'login',            $lang['login'] );
+$vtp->setGlobalVar( $handle, 'password',         $lang['password'] );
+$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
+$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
+$vtp->setGlobalVar( $handle, 'ident_register',   $lang['ident_register'] );
+$vtp->setGlobalVar( $handle, 'ident_forgotten_password',
+                    $lang['ident_forgotten_password'] );
+// conf
+$vtp->setGlobalVar( $handle, 'mail_webmaster',   $conf['mail_webmaster'] );
+// user
+$vtp->setGlobalVar( $handle, 'user_template',    $user['template'] );
+initialize_template();
+//-------------------------------------------------------------- errors display
+if ( sizeof( $errors ) != 0 )
+{
+  $vtp->addSession( $handle, 'errors' );
+  foreach ( $errors as $error ) {
+    $vtp->addSession( $handle, 'li' );
+    $vtp->setVar( $handle, 'li.li', $error );
+    $vtp->closeSession( $handle, 'li' );
+  }
+  $vtp->closeSession( $handle, 'errors' );
+}
+//------------------------------------------------------------------ users list
+// retrieving all the users login
+$query = 'select username from '.PREFIX_TABLE.'users;';
+$result = mysql_query( $query );
+if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
+{
+  $vtp->addSession( $handle, 'select_field' );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    if ( $row['username'] != 'guest' )
+    {
+      $vtp->addSession( $handle, 'option' );
+      $vtp->setVar( $handle, 'option.option', $row['username'] );
+      $vtp->closeSession( $handle, 'option' );
+    }
+  }
+  $vtp->closeSession( $handle, 'select_field' );
+}
+else
+{
+  $vtp->addSession( $handle, 'text_field' );
+  $vtp->closeSession( $handle, 'text_field' );
+}
+//-------------------------------------------------------------- visit as guest
+if ( $conf['access'] == 'free' )
+{
+  $vtp->addSession( $handle, 'guest_visit' );
+  $vtp->closeSession( $handle, 'guest_visit' );
+}
+//---------------------------------------------------------------- registration
+if ( $conf['access'] == 'free' )
+{
+  $vtp->addSession( $handle, 'register' );
+  $vtp->closeSession( $handle, 'register' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/include/config.inc.php
===================================================================
--- /tags/release-1_3RC1/include/config.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/config.inc.php	(revision 159)
@@ -0,0 +1,89 @@
+<?php
+/***************************************************************************
+ *                              config.inc.php                             *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+unset( $conf, $page, $user, $lang );
+$conf = array();
+$page = array();
+$user = array();
+$lang = array();
+
+include_once( PREFIX_INCLUDE.'./include/functions.inc.php' );
+include_once( PREFIX_INCLUDE.'./include/vtemplate.class.php' );
+// How to change the order of display for images in a category ?
+//
+// You have to modify $conf['order_by'].
+// There are several fields that can order the display :
+//  - date_available : the date of the adding to the gallery
+//  - file : the name of the file
+// Once you've chosen which field(s) to use for ordering,
+// you must chose the ascending or descending order for each field.
+// examples :
+// 1. $conf['order_by'] = " order by date_available desc, file asc";
+//    will order pictures by date_available descending & by filename ascending
+// 2. $conf['order_by'] = " order by file asc";
+//    will only order pictures by file ascending
+//    without taking into account the date_available
+$conf['order_by'] = ' ORDER BY date_available DESC, file ASC';
+
+$conf['nb_image_row']       = array(4,5,6,7,8);
+$conf['nb_row_page']        = array(2,3,4,5,6,7,10,20,1000);
+$conf['slideshow_period']   = array(2,5,10);
+$conf['last_days']          = array(1,2,3,10,30,365);
+$conf['version']            = '1.3RC1';
+$conf['site_url']           = 'http://www.phpwebgallery.net';
+$conf['forum_url']          = 'http://forum.phpwebgallery.net';
+$conf['picture_ext']        = array('jpg','JPG','gif','GIF','png','PNG');
+$conf['document_ext']       = array('doc','pdf','zip');
+$conf['top_number']         = 5;
+$conf['anti-flood_time']    = 60; // seconds between 2 comments : 0 to disable
+
+database_connection();
+// rertieving the configuration informations for site
+// $infos array is used to know the fields to retrieve in the table "config"
+// Each field becomes an information of the array $conf.
+// Example :
+//            prefix_thumbnail --> $conf['prefix_thumbnail']
+$infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
+                'session_id_size', 'session_keyword', 'session_time',
+                'max_user_listbox', 'show_comments', 'nb_comment_page',
+                'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
+                'upload_maxheight', 'upload_maxwidth_thumbnail',
+                'upload_maxheight_thumbnail','log','comments_validation',
+                'comments_forall','authorize_cookies','mail_notification' );
+
+$query  = 'SELECT ';
+foreach ( $infos as $i => $info ) {
+  if ( $i > 0 ) $query.= ',';
+  $query.= $info;
+}
+$query.= ' FROM '.PREFIX_TABLE.'config;';
+
+$row = mysql_fetch_array( mysql_query( $query ) );
+
+// affectation of each field of the table "config" to an information of the
+// array $conf.
+foreach ( $infos as $info ) {
+  $conf[$info] = $row[$info];
+  // If the field is true or false, the variable is transformed into a boolean
+  // value.
+  if ( $row[$info] == 'true' or $row[$info] == 'false' )
+  {
+    $conf[$info] = get_boolean( $row[$info] );
+  }
+}
+?>
Index: /tags/release-1_3RC1/include/functions.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions.inc.php	(revision 159)
@@ -0,0 +1,426 @@
+<?php
+/***************************************************************************
+ *                             functions.inc.php                           *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+include( PREFIX_INCLUDE.'./include/functions_user.inc.php' );
+include( PREFIX_INCLUDE.'./include/functions_session.inc.php' );
+include( PREFIX_INCLUDE.'./include/functions_category.inc.php' );
+include( PREFIX_INCLUDE.'./include/functions_xml.inc.php' );
+include( PREFIX_INCLUDE.'./include/functions_group.inc.php' );
+
+//----------------------------------------------------------- generic functions
+
+// get_enums returns an array containing the possible values of a enum field
+// in a table of the database.
+function get_enums( $table, $field )
+{
+  // retrieving the properties of the table. Each line represents a field :
+  // columns are 'Field', 'Type'
+  $result=mysql_query("desc $table");
+  while ( $row = mysql_fetch_array( $result ) ) 
+  {
+    // we are only interested in the the field given in parameter for the
+    // function
+    if ( $row['Field']==$field )
+    {
+      // retrieving possible values of the enum field
+      // enum('blue','green','black')
+      $option = explode( ',', substr($row['Type'], 5, -1 ) );
+      for ( $i = 0; $i < sizeof( $option ); $i++ )
+      {
+        // deletion of quotation marks
+        $option[$i] = str_replace( "'", '',$option[$i] );
+      }                 
+    }
+  }
+  mysql_free_result( $result );
+  return $option;
+}
+
+// get_boolean transforms a string to a boolean value. If the string is
+// "false" (case insensitive), then the boolean value false is returned. In
+// any other case, true is returned.
+function get_boolean( $string )
+{
+  $boolean = true;
+  if ( preg_match( '/^false$/i', $string ) )
+  {
+    $boolean = false;
+  }
+  return $boolean;
+}
+
+// array_remove removes a value from the given array if the value existed in
+// this array.
+function array_remove( $array, $value )
+{
+  $output = array();
+  foreach ( $array as $v ) {
+    if ( $v != $value ) array_push( $output, $v );
+  }
+  return $output;
+}
+
+// The function get_moment returns a float value coresponding to the number
+// of seconds since the unix epoch (1st January 1970) and the microseconds
+// are precised : e.g. 1052343429.89276600
+function get_moment()
+{
+  $t1 = explode( ' ', microtime() );
+  $t2 = explode( '.', $t1[0] );
+  $t2 = $t1[1].'.'.$t2[1];
+  return $t2;
+}
+
+// The function get_elapsed_time returns the number of seconds (with 3
+// decimals precision) between the start time and the end time given.
+function get_elapsed_time( $start, $end )
+{
+  return number_format( $end - $start, 3, '.', ' ').' s';
+}
+
+// - The replace_space function replaces space and '-' characters
+//   by their HTML equivalent  &nbsb; and &minus;
+// - The function does not replace characters in HTML tags
+// - This function was created because IE5 does not respect the
+//   CSS "white-space: nowrap;" property unless space and minus
+//   characters are replaced like this function does.
+// - Example :
+//                 <div class="foo">My friend</div>
+//               ( 01234567891111111111222222222233 )
+//               (           0123456789012345678901 )
+// becomes :
+//             <div class="foo">My&nbsp;friend</div>
+function replace_space( $string )
+{
+  //return $string;
+  $return_string = '';
+  // $remaining is the rest of the string where to replace spaces characters
+  $remaining = $string;
+  // $start represents the position of the next '<' character
+  // $end   represents the position of the next '>' character
+  $start = 0;
+  $end = 0;
+  $start = strpos ( $remaining, '<' ); // -> 0
+  $end   = strpos ( $remaining, '>' ); // -> 16
+  // as long as a '<' and his friend '>' are found, we loop
+  while ( is_numeric( $start ) and is_numeric( $end ) )
+  {
+    // $treatment is the part of the string to treat
+    // In the first loop of our example, this variable is empty, but in the
+    // second loop, it equals 'My friend'
+    $treatment = substr ( $remaining, 0, $start );
+    // Replacement of ' ' by his equivalent '&nbsp;'
+    $treatment = str_replace( ' ', '&nbsp;', $treatment );
+    $treatment = str_replace( '-', '&minus;', $treatment );
+    // composing the string to return by adding the treated string and the
+    // following HTML tag -> 'My&nbsp;friend</div>'
+    $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 );
+    // the remaining string is deplaced to the part after the '>' of this
+    // loop
+    $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
+    $start = strpos ( $remaining, '<' );
+    $end   = strpos ( $remaining, '>' );
+  }
+  $treatment = str_replace( ' ', '&nbsp;', $remaining );
+  $treatment = str_replace( '-', '&minus;', $treatment );
+  $return_string.= $treatment;
+
+  return $return_string;
+}
+
+// get_extension returns the part of the string after the last "."
+function get_extension( $filename )
+{
+  return substr( strrchr( $filename, '.' ), 1, strlen ( $filename ) );
+}
+
+// get_filename_wo_extension returns the part of the string before the last
+// ".".
+// get_filename_wo_extension( 'test.tar.gz' ) -> 'test.tar'
+function get_filename_wo_extension( $filename )
+{
+  return substr( $filename, 0, strrpos( $filename, '.' ) );
+}
+
+// get_dirs retourne un tableau contenant tous les sous-répertoires d'un
+// répertoire
+function get_dirs( $rep )
+{
+  $sub_rep = array();
+
+  if ( $opendir = opendir ( $rep ) )
+  {
+    while ( $file = readdir ( $opendir ) )
+    {
+      if ( $file != '.' and $file != '..' and is_dir ( $rep.$file ) )
+      {
+        array_push( $sub_rep, $file );
+      }
+    }
+  }
+  return $sub_rep;
+}
+
+// The get_picture_size function return an array containing :
+//      - $picture_size[0] : final width
+//      - $picture_size[1] : final height
+// The final dimensions are calculated thanks to the original dimensions and
+// the maximum dimensions given in parameters.  get_picture_size respects
+// the width/height ratio
+function get_picture_size( $original_width, $original_height,
+                           $max_width, $max_height )
+{
+  $width = $original_width;
+  $height = $original_height;
+  $is_original_size = true;
+                
+  if ( $max_width != "" )
+  {
+    if ( $original_width > $max_width )
+    {
+      $width = $max_width;
+      $height = floor( ( $width * $original_height ) / $original_width );
+    }
+  }
+  if ( $max_height != "" )
+  {
+    if ( $original_height > $max_height )
+    {
+      $height = $max_height;
+      $width = floor( ( $height * $original_width ) / $original_height );
+      $is_original_size = false;
+    }
+  }
+  if ( is_numeric( $max_width ) and is_numeric( $max_height )
+       and $max_width != 0 and $max_height != 0 )
+  {
+    $ratioWidth = $original_width / $max_width;
+    $ratioHeight = $original_height / $max_height;
+    if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
+    {
+      if ( $ratioWidth < $ratioHeight )
+      { 
+        $width = floor( $original_width / $ratioHeight );
+        $height = $max_height;
+      }
+      else
+      { 
+        $width = $max_width; 
+        $height = floor( $original_height / $ratioWidth );
+      }
+      $is_original_size = false;
+    }
+  }
+  $picture_size = array();
+  $picture_size[0] = $width;
+  $picture_size[1] = $height;
+  return $picture_size;
+}
+//-------------------------------------------- PhpWebGallery specific functions
+
+// get_languages retourne un tableau contenant tous les languages
+// disponibles pour PhpWebGallery
+function get_languages( $rep_language )
+{
+  $languages = array();
+  $i = 0;
+  if ( $opendir = opendir ( $rep_language ) )
+  {
+    while ( $file = readdir ( $opendir ) )
+    {
+      if ( is_file ( $rep_language.$file )
+           and $file != "index.php"
+           and strrchr ( $file, "." ) == ".php" )
+      {
+        $languages[$i++] =
+          substr ( $file, 0, strlen ( $file )
+                   - strlen ( strrchr ( $file, "." ) ) );
+      }
+    }
+  }
+  return $languages;
+}
+
+// get_themes retourne un tableau contenant tous les "template - couleur"
+function get_themes( $theme_dir )
+{
+  $themes = array();
+  $main_themes = get_dirs( $theme_dir );
+  for ( $i = 0; $i < sizeof( $main_themes ); $i++ )
+  {
+    $colors = get_dirs( $theme_dir.$main_themes[$i].'/' );
+    for ( $j = 0; $j < sizeof( $colors ); $j++ )
+    {
+      array_push( $themes, $main_themes[$i].' - '.$colors[$j] );
+    }
+  }
+  return $themes;
+}
+
+// - add_style replaces the 
+//         $search  into <span style="$style">$search</span>
+// in the given $string.
+// - The function does not replace characters in HTML tags
+function add_style( $string, $search, $style )
+{
+  //return $string;
+  $return_string = '';
+  $remaining = $string;
+
+  $start = 0;
+  $end = 0;
+  $start = strpos ( $remaining, '<' );
+  $end   = strpos ( $remaining, '>' );
+  while ( is_numeric( $start ) and is_numeric( $end ) )
+  {
+    $treatment = substr ( $remaining, 0, $start );
+    $treatment = str_replace( $search, '<span style="'.$style.'">'.
+                              $search.'</span>', $treatment );
+    $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 );
+    $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
+    $start = strpos ( $remaining, '<' );
+    $end   = strpos ( $remaining, '>' );
+  }
+  $treatment = str_replace( $search, '<span style="'.$style.'">'.
+                            $search.'</span>', $remaining );
+  $return_string.= $treatment;
+                
+  return $return_string;
+}
+
+// replace_search replaces a searched words array string by the search in
+// another style for the given $string.
+function replace_search( $string, $search )
+{
+  $words = explode( ',', $search );
+  $style = 'background-color:white;color:red;';
+  foreach ( $words as $word ) {
+    $string = add_style( $string, $word, $style );
+  }
+  return $string;
+}
+
+function database_connection()
+{
+  include( PREFIX_INCLUDE.'./include/mysql.inc.php' );
+  define( PREFIX_TABLE, $prefixeTable );
+
+  @mysql_connect( $cfgHote, $cfgUser, $cfgPassword )
+    or die ( "Could not connect to server" );
+  @mysql_select_db( $cfgBase )
+    or die ( "Could not connect to database" );
+}
+
+function pwg_log( $file, $category, $picture = '' )
+{
+  global $conf, $user;
+
+  if ( $conf['log'] )
+  {
+    $query = 'insert into '.PREFIX_TABLE.'history';
+    $query.= ' (date,login,IP,file,category,picture) values';
+    $query.= " (".time().", '".$user['username']."'";
+    $query.= ",'".$_SERVER['REMOTE_ADDR']."'";
+    $query.= ",'".$file."','".$category."','".$picture."');";
+    mysql_query( $query );
+  }
+}
+
+function templatize_array( $array, $global_array_name, $handle )
+{
+  global $vtp, $lang, $page, $user, $conf;
+
+  foreach ( $array as $value ) {
+    $vtp->setGlobalVar( $handle, $value, ${$global_array_name}[$value] );
+  }
+}
+
+// format_date returns a formatted date for display. The date given in
+// argument can be a unixdate (number of seconds since the 01.01.1970) or an
+// american format (2003-09-15). By option, you can show the time. The
+// output is internationalized.
+//
+// format_date( "2003-09-15", 'us', true ) -> "Monday 15 September 2003 21:52"
+function format_date( $date, $type = 'us', $show_time = false )
+{
+  global $lang;
+
+  switch ( $type )
+  {
+  case 'us' :
+    list( $year,$month,$day ) = explode( '-', $date );
+    $unixdate = mktime(0,0,0,$month,$day,$year);
+    break;
+  case 'unix' :
+    $unixdate = $date;
+    break;
+  }
+  $formated_date = $lang['day'][date( "w", $unixdate )];
+  $formated_date.= date( " j ", $unixdate );
+  $formated_date.= $lang['month'][date( "n", $unixdate )];
+  $formated_date.= date( ' Y', $unixdate );
+  if ( $show_time )
+  {
+    $formated_date.= date( ' G:i', $unixdate );
+  }
+
+  return $formated_date;
+}
+
+// notify sends a email to every admin of the gallery
+function notify( $type, $infos = '' )
+{
+  global $conf;
+
+  $headers = 'From: '.$conf['webmaster'].' <'.$conf['mail_webmaster'].'>'."\n";
+  $headers.= 'Reply-To: '.$conf['mail_webmaster']."\n";
+  $headers.= 'X-Mailer: PhpWebGallery, PHP '.phpversion();
+
+  $options = '-f '.$conf['mail_webmaster'];
+  // retrieving all administrators
+  $query = 'SELECT username,mail_address,language';
+  $query.= ' FROM '.PREFIX_TABLE.'users';
+  $query.= " WHERE status = 'admin'";
+  $query.= ' AND mail_address IS NOT NULL';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $to = $row['mail_address'];
+    include( PREFIX_INCLUDE.'./language/'.$row['language'].'.php' );
+    $content = $lang['mail_hello']."\n\n";
+    switch ( $type )
+    {
+    case 'upload' :
+      $subject = $lang['mail_new_upload_subject'];
+      $content.= $lang['mail_new_upload_content'];
+      break;
+    case 'comment' :
+      $subject = $lang['mail_new_comment_subject'];
+      $content.= $lang['mail_new_comment_content'];
+      break;
+    }
+    $infos = str_replace( '&nbsp;',  ' ', $infos );
+    $infos = str_replace( '&minus;', '-', $infos );
+    $content.= "\n\n".$infos;
+    $content.= "\n\n-- \nPhpWebGallery ".$conf['version'];
+    $content = wordwrap( $content, 72 );
+    @mail( $to, $subject, $content, $headers, $options );
+  }
+}
+?>
Index: /tags/release-1_3RC1/include/functions_category.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions_category.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions_category.inc.php	(revision 159)
@@ -0,0 +1,662 @@
+<?php
+/***************************************************************************
+ *                         functions_category.inc.php                      *
+ *                            --------------------                         *
+ *   application          : PhpWebGallery 1.3 <http://phpwebgallery.net>   *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+function get_subcats_id( $cat_id )
+{
+  $restricted_cats = array();
+                
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id_uppercat = '.$cat_id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    array_push( $restricted_cats, $row['id'] );
+    $sub_restricted_cats = get_subcats_id( $row['id'] );
+    foreach ( $sub_restricted_cats as $sub_restricted_cat ) {
+      array_push( $restricted_cats, $sub_restricted_cat );
+    }
+  }
+  return $restricted_cats;
+}
+
+function check_restrictions( $category_id )
+{
+  global $user,$lang;
+
+  if ( is_user_allowed( $category_id, $user['restrictions'] ) > 0 )
+  {
+    echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
+    echo '<a href="'.add_session_id( './category.php' ).'">';
+    echo $lang['thumbnails'].'</a></div>';
+    exit();
+  }
+}
+        
+// the check_cat_id function check whether the $cat is a right parameter :
+//  - $cat is numeric and corresponds to a category in the database
+//  - $cat equals 'fav' (for favorites)
+//  - $cat equals 'search' (when the result of a search is displayed)
+function check_cat_id( $cat )
+{
+  global $page;
+
+  unset( $page['cat'] );
+  if ( isset( $cat ) )
+  {
+    if ( isset( $page['plain_structure'] ) )
+    {
+      if ( isset( $page['plain_structure'][$cat] ) )
+      {
+        $page['cat'] = $cat;
+      }
+    }
+    else if ( is_numeric( $cat ) )
+    {
+      $query = 'SELECT id';
+      $query.= ' FROM '.PREFIX_TABLE.'categories';
+      $query.= ' WHERE id = '.$cat;
+      $query. ';';
+      $result = mysql_query( $query );
+      if ( mysql_num_rows( $result ) != 0 )
+      {
+        $page['cat'] = $cat;
+      }
+    }
+    if ( $cat == 'fav'
+         or $cat == 'search'
+         or $cat == 'most_visited'
+         or $cat == 'best_rated'
+         or $cat == 'recent' )
+    {
+      $page['cat'] = $cat;
+    }
+  }
+}
+
+function get_plain_structure()
+{
+  $infos = array( 'name','id','date_last','nb_images','dir','id_uppercat',
+                  'rank','site_id');
+  
+  $query = 'SELECT ';
+  foreach ( $infos as $i => $info ) {
+    if ( $i > 0 ) $query.= ',';
+    $query.= $info;
+  }
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' ORDER BY id_uppercat ASC, rank ASC';
+  $query.= ';';
+
+  $plain_structure = array();
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $category = array();
+    foreach ( $infos as $info ) {
+      $category[$info] = $row[$info];
+      if ( $info == 'date_last' )
+      {
+        list($year,$month,$day) = explode( '-', $row[$info] );
+        $category[$info] = mktime(0,0,0,$month,$day,$year);
+      }
+    }
+    $plain_structure[$row['id']] = $category;
+  }
+
+  return $plain_structure;
+}
+
+function create_structure( $id_uppercat, $restrictions )
+{
+  global $page;
+
+  if ( !isset( $page['plain_structure'] ) )
+    $page['plain_structure'] = get_plain_structure();
+
+  $structure = array();
+  $ids = get_subcat_ids( $id_uppercat );
+  foreach ( $ids as $id ) {
+    if ( !in_array( $id, $restrictions ) )
+    {
+      $category = $page['plain_structure'][$id];
+      $category['subcats'] = create_structure( $id, $restrictions );
+      array_push( $structure, $category );
+    }
+  }
+  return $structure;
+}
+
+function get_subcat_ids( $id_uppercat )
+{
+  global $page;
+
+  $ids = array();
+  foreach ( $page['plain_structure'] as $id => $category ) {
+    if ( $category['id_uppercat'] == $id_uppercat ) array_push( $ids, $id );
+    else if ( count( $ids ) > 0 )                   return $ids;
+  }
+  return $ids;
+}
+
+// update_structure updates or add informations about each node of the
+// structure : the last date, should the category be expanded in the menu ?,
+// the associated expand string "48,14,54"
+//
+// 1. last date
+// for each category of the structure, we have to find the most recent
+// subcat so that the parent cat has the same last_date info.
+// For example : we have :
+// > pets       (2003.02.15)
+//    > dogs    (2003.06.14)
+//       > rex  (2003.06.18)
+//       > toby (2003.06.13)
+//    > kitten  (2003.07.05)
+// We finally want to have :
+// > pets       (2003.07.05) <- changed to pets > kitten last date
+//    > dogs    (2003.06.18) <- changed to pets > dogs > rex last date
+//       > rex  (2003.06.18)
+//       > toby (2003.06.13)
+//    > kitten  (2003.07.05)
+//
+// 2. should the category be expanded in the menu ?
+// If the category has to be expanded (ie its id is in the
+// $page['tab_expand'] or all the categories must be expanded by default),
+// $category['expanded'] is set to true.
+//
+// 3. associated expand string
+// in the menu, there is a expand string (used in the URL) to tell which
+// categories must be expanded in the menu if this category is chosen
+function update_structure( $categories )
+{
+  global $page, $user;
+
+  $updated_categories = array();
+
+  foreach ( $categories as $category ) {
+    // update the last date of the category
+    $last_date = search_last_date( $category );
+    $category['date_last'] = $last_date;
+    // update the "expanded" key
+    if ( $user['expand']
+         or $page['expand'] == 'all'
+         or in_array( $category['id'], $page['tab_expand'] ) )
+    {
+      $category['expanded'] = true;
+    }
+    else
+    {
+      $category['expanded'] = false;
+    }
+    // update the  "expand_string" key
+    if ( $page['expand'] == 'all' )
+    {
+      $category['expand_string'] = 'all';
+    }
+    else
+    {
+      $tab_expand = $page['tab_expand'];
+      if ( in_array( $category['id'], $page['tab_expand'] ) )
+      {
+        // the expand string corresponds to the $page['tab_expand'] without
+        // the $category['id']
+        $tab_expand = array_diff( $page['tab_expand'],array($category['id']) );
+      }
+      else if ( count( $category['subcats'] ) > 0 )
+      {
+        // we have this time to add the $category['id']...
+        $tab_expand = array_merge($page['tab_expand'],array($category['id']));
+      }
+      $category['expand_string'] = implode( ',', $tab_expand );
+    }
+    // recursive call
+    $category['subcats'] = update_structure( $category['subcats'] );
+    // adding the updated category
+    array_push( $updated_categories, $category );
+  }
+
+  return $updated_categories;
+}
+
+// search_last_date searchs the last date for a given category. If we take
+// back the example given for update_last_dates, we should have :
+// search_last_date( pets )        --> 2003.07.05
+// search_last_date( pets > dogs ) --> 2003.06.18
+// and so on
+function search_last_date( $category )
+{
+  $date_last = $category['date_last'];
+  foreach ( $category['subcats'] as $subcat ) {
+    $subcat_date_last = search_last_date( $subcat );
+    if ( $subcat_date_last > $date_last )
+    {
+      $date_last = $subcat_date_last;
+    }
+  }
+  return $date_last;
+}
+
+// count_images returns the number of pictures contained in the given
+// category represented by an array, in this array, we have (among other
+// things) :
+// $category['nb_images'] -> number of pictures in this category
+// $category['subcats'] -> array of sub-categories
+// count_images goes to the deepest sub-category to find the total number of
+// pictures contained in the given given category
+function count_images( $categories )
+{
+  $total = 0;
+  foreach ( $categories as $category ) {
+    $total+= $category['nb_images'];
+    $total+= count_images( $category['subcats'] );
+  }
+  return $total;
+}
+
+// variables :
+// $cat['comment']
+// $cat['dir']
+// $cat['dir']
+// $cat['name'] is an array :
+//      - $cat['name'][0] is the lowest cat name
+//      and
+//      - $cat['name'][n] is the most uppercat name findable
+// $cat['nb_images']
+// $cat['id_uppercat']
+// $cat['site_id']
+function get_cat_info( $id )
+{
+  global $page;
+
+  $cat = array();
+                
+  $query = 'SELECT nb_images,id_uppercat,comment,site_id,galleries_url,dir';
+  $query.= ',date_last,uploadable,status,visible,representative_picture_id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories AS a';
+  $query.= ', '.PREFIX_TABLE.'sites AS b';
+  $query.= ' WHERE a.id = '.$id;
+  $query.= ' AND a.site_id = b.id;';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $cat['site_id']     = $row['site_id'];
+  $cat['id_uppercat'] = $row['id_uppercat'];
+  $cat['comment']     = nl2br( $row['comment'] );
+  $cat['nb_images']   = $row['nb_images'];
+  $cat['dir']         = $row['dir'];
+  $cat['date_last']   = $row['date_last'];
+  $cat['uploadable']  = get_boolean( $row['uploadable'] );
+  $cat['status']      = $row['status'];
+  $cat['visible']     = get_boolean( $row['visible'] );
+  $cat['representative_picture_id'] = $row['representative_picture_id'];
+
+  $cat['name'] = array();
+
+  if ( !isset( $page['plain_structure'] ) )
+    $page['plain_structure'] = get_plain_structure();
+
+  array_push( $cat['name'], $page['plain_structure'][$id]['name'] );
+  while ( $page['plain_structure'][$id]['id_uppercat'] != '' )
+  {
+    $id = $page['plain_structure'][$id]['id_uppercat'];
+    array_push( $cat['name'], $page['plain_structure'][$id]['name'] );
+  }
+  return $cat;
+}
+
+// get_complete_dir returns the concatenation of get_site_url and
+// get_local_dir
+// Example : "pets > rex > 1_year_old" is on the the same site as the
+// PhpWebGallery files and this category has 22 for identifier
+// get_complete_dir(22) returns "./galleries/pets/rex/1_year_old/"
+function get_complete_dir( $category_id )
+{
+  return get_site_url( $category_id ).get_local_dir( $category_id );
+}
+
+// get_local_dir returns an array with complete path without the site url
+// Example : "pets > rex > 1_year_old" is on the the same site as the
+// PhpWebGallery files and this category has 22 for identifier
+// get_local_dir(22) returns "pets/rex/1_year_old/"
+function get_local_dir( $category_id )
+{
+  global $page;
+
+  if ( !isset( $page['plain_structure'] ) )
+    $page['plain_structure'] = get_plain_structure();
+  
+  // creating the local path : "root_cat/sub_cat/sub_sub_cat/"
+  $dir = $page['plain_structure'][$category_id]['dir'].'/';
+  while ( $page['plain_structure'][$category_id]['id_uppercat'] != '' )
+  {
+    $category_id = $page['plain_structure'][$category_id]['id_uppercat'];
+    $dir = $page['plain_structure'][$category_id]['dir'].'/'.$dir;
+  }
+  return $dir;
+}
+
+// retrieving the site url : "http://domain.com/gallery/" or
+// simply "./galleries/"
+function get_site_url( $category_id )
+{
+  global $page;
+
+  if ( !isset( $page['plain_structure'] ) )
+    $page['plain_structure'] = get_plain_structure();
+
+  $query = 'SELECT galleries_url';
+  $query.= ' FROM '.PREFIX_TABLE.'sites';
+  $query.= ' WHERE id = '.$page['plain_structure'][$category_id]['site_id'];
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  return $row['galleries_url'];
+}
+
+// The function get_cat_display_name returns a string containing the list
+// of upper categories to the root category from the lowest category shown
+// example : "anniversaires - fete mere 2002 - animaux - erika"
+// You can give two parameters :
+//   - $separation : the string between each category name " - " for example
+//   - $style : the style of the span tag for the lowest category,
+//     "font-style:italic;" for example
+function get_cat_display_name( $array_cat_names, $separation, $style )
+{
+  $output = "";
+  for ( $i = sizeof( $array_cat_names ) - 1; $i >= 0; $i-- )
+  {
+    if ( $i != sizeof( $array_cat_names ) - 1 )
+    {
+      $output.= $separation;
+    }
+    if ( $i != 0 )
+    {
+      $output.= $array_cat_names[$i];
+    }
+    else
+    {
+      if ( $style != "" )
+      {
+        $output.= '<span style="'.$style.'">';
+      }
+      $output.= $array_cat_names[$i];
+      if ( $style != "" )
+      {
+        $output.= "</span>";
+      }
+    }
+  }
+  return replace_space( $output );
+}
+
+// initialize_category initializes ;-) the variables in relation
+// with category :
+// 1. calculation of the number of pictures in the category
+// 2. determination of the SQL query part to ask to find the right category
+//    $page['where'] is not the same if we are in
+//       - simple category
+//       - search result
+//       - favorites displaying
+//       - most visited pictures
+//       - best rated pictures
+//       - recent pictures
+// 3. determination of the title of the page
+// 4. creation of the navigation bar
+function initialize_category( $calling_page = 'category' )
+{
+  global $page,$lang,$user,$conf;
+
+  if ( isset( $page['cat'] ) )
+  {
+    // $page['nb_image_page'] is the number of picture to display on this page
+    // By default, it is the same as the $user['nb_image_page']
+    $page['nb_image_page'] = $user['nb_image_page'];
+    // $url is used to create the navigation bar
+    $url = './category.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+    // simple category
+    if ( is_numeric( $page['cat'] ) )
+    {
+      $result = get_cat_info( $page['cat'] );
+      $page['comment']        = $result['comment'];
+      $page['cat_dir']        = $result['dir'];
+      $page['cat_name']       = $result['name'];
+      $page['cat_nb_images']  = $result['nb_images'];
+      $page['cat_site_id']    = $result['site_id'];
+      $page['cat_uploadable'] = $result['uploadable'];
+      $page['title'] = get_cat_display_name( $page['cat_name'], ' - ', '' );
+      $page['where'] = ' WHERE category_id = '.$page['cat'];
+    }
+    else
+    {
+      if ( $page['cat'] == 'search' or $page['cat'] == 'most_visited'
+           or $page['cat'] == 'recent' or $page['cat'] == 'best_rated' )
+      {
+        // we must not show pictures of a forbidden category
+        $restricted_cats = get_all_restrictions( $user['id'],$user['status'] );
+        if ( count( $restricted_cats ) > 0 )
+        {
+          $where_append.= ' AND category_id NOT IN (';
+          foreach ( $restricted_cats as $i => $restricted_cat ) {
+            if ( $i > 0 ) $where_append.= ',';
+            $where_append.= $restricted_cat;
+          }
+          $where_append.= ')';
+        }
+      }
+      // search result
+      if ( $page['cat'] == 'search' )
+      {
+        $page['title'] = $lang['search_result'];
+        if ( $calling_page == 'picture' )
+        {
+          $page['title'].= ' : <span style="font-style:italic;">';
+          $page['title'].= $_GET['search']."</span>";
+        }
+
+        $page['where'] = ' WHERE (';
+        $fields = array( 'file', 'name', 'comment', 'keywords' );
+        $words = explode( ',', $_GET['search'] );
+        $sql_search = array();
+        foreach ( $words as $i => $word ) {
+          // if the user searchs any of the words, the where statement must
+          // be :
+          // field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' ...
+          // OR field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' ...
+          if ( $_GET['mode'] == 'OR' )
+          {
+            if ( $i != 0 ) $page['where'].= ' OR';
+            foreach ( $fields as $j => $field ) {
+              if ( $j != 0 ) $page['where'].= ' OR';
+              $page['where'].= ' '.$field." LIKE '%".$word."%'";
+            }
+          }
+          // if the user searchs all the words :
+          // ( field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' )
+          // AND ( field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' )
+          else if ( $_GET['mode'] == 'AND' )
+          {
+            if ( $i != 0 ) $page['where'].= ' AND';
+            $page['where'].= ' (';
+            foreach ( $fields as $j => $field ) {
+              if ( $j != 0 ) $page['where'].= ' OR';
+              $page['where'].= ' '.$field." LIKE '%".$word."%'";
+            }
+            $page['where'].= ' )';
+          }
+        }
+        $page['where'].= ' )';
+        $page['where'].= $where_append;
+
+        $query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images';
+        $query.= ' FROM '.PREFIX_TABLE.'images';
+        $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic';
+        $query.= ' ON id = ic.image_id';
+        $query.= $page['where'];
+        $query.= ';';
+
+        $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+      }
+      // favorites displaying
+      else if ( $page['cat'] == 'fav' )
+      {
+        $page['title'] = $lang['favorites'];
+
+        $page['where'] = ', '.PREFIX_TABLE.'favorites AS fav';
+        $page['where'].= ' WHERE user_id = '.$user['id'];
+        $page['where'].= ' AND fav.image_id = id';
+      
+        $query = 'SELECT COUNT(*) AS nb_total_images';
+        $query.= ' FROM '.PREFIX_TABLE.'favorites';
+        $query.= ' WHERE user_id = '.$user['id'];
+        $query.= ';';
+      }
+      // pictures within the short period
+      else if ( $page['cat'] == 'recent' )
+      {
+        $page['title'] = $lang['recent_cat_title'];
+        // We must find the date corresponding to :
+        // today - $conf['periode_courte']
+        $date = time() - 60*60*24*$user['short_period'];
+        $page['where'] = " WHERE date_available > '";
+        $page['where'].= date( 'Y-m-d', $date )."'";
+        $page['where'].= $where_append;
+
+        $query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images';
+        $query.= ' FROM '.PREFIX_TABLE.'images';
+        $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic';
+        $query.= ' ON id = ic.image_id';
+        $query.= $page['where'];
+        $query.= ';';
+      }
+      // most visited pictures
+      else if ( $page['cat'] == 'most_visited' )
+      {
+        $page['title'] = $conf['top_number'].' '.$lang['most_visited_cat'];
+        $page['where'] = ' WHERE category_id != -1'.$where_append;
+        $conf['order_by'] = ' ORDER BY hit DESC, file ASC';
+        $page['cat_nb_images'] = $conf['top_number'];
+        if ( $page['start'] + $user['nb_image_page'] >= $conf['top_number'] )
+        {
+          $page['nb_image_page'] = $conf['top_number'] - $page['start'];
+        }
+      }
+
+      if ( $query != '' )
+      {
+        $result = mysql_query( $query );
+        $row = mysql_fetch_array( $result );
+        $page['cat_nb_images'] = $row['nb_total_images'];
+      }
+    }
+    if ( $calling_page == 'category' )
+    {
+      $page['navigation_bar'] =
+        create_navigation_bar( $url, $page['cat_nb_images'], $page['start'],
+                               $user['nb_image_page'], 'back' );
+    }
+  }
+  else
+  {
+    $page['title'] = $lang['diapo_default_page_title'];
+  }
+}
+
+// get_non_empty_subcat_ids returns an array with sub-categories id
+// associated with their first non empty category id.
+//
+//                          example :
+//
+// - catname [cat_id]
+// - cat1 [1] -> given uppercat
+//   - cat1.1 [12] (empty)
+//     - cat1.1.1 [5] (empty)
+//     - cat1.1.2 [6]
+//   - cat1.2 [3]
+//   - cat1.3 [4]
+//
+// get_non_empty_sub_cat_ids will return :
+//   $ids[12] = 6;
+//   $ids[3]  = 3;
+//   $ids[4]  = 4;
+function get_non_empty_subcat_ids( $id_uppercat )
+{
+  global $user;
+
+  $ids = array();
+
+  $query = 'SELECT id,nb_images';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id_uppercat ';
+  if ( !is_numeric( $id_uppercat ) ) $query.= 'is NULL';
+  else                               $query.= '= '.$id_uppercat;
+  // we must not show pictures of a forbidden category
+  foreach ( $user['restrictions'] as $restricted_cat ) {
+    $query.= ' AND id != '.$restricted_cat;
+  }
+  $query.= ' ORDER BY rank';
+  $query.= ';';
+
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // only categories with findable picture in any of its subcats is
+    // represented.
+    if ( ( $row['nb_images'] != 0 and $non_empty_cat = $row['id'] )
+         or $non_empty_cat = get_first_non_empty_cat_id( $row['id'] ) )
+    {
+      $ids[$row['id']] = $non_empty_cat;
+    }
+  }
+  return $ids;
+}
+
+// get_first_non_empty_cat_id returns the id of the first non empty
+// sub-category to the given uppercat. If no picture is found in any
+// subcategory, false is returned.
+function get_first_non_empty_cat_id( $id_uppercat )
+{
+  global $user;
+
+  $query = 'SELECT id,nb_images';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= ' WHERE id_uppercat = '.$id_uppercat;
+  // we must not show pictures of a forbidden category
+  foreach ( $user['restrictions'] as $restricted_cat ) {
+    $query.= ' AND id != '.$restricted_cat;
+  }
+  $query.= ' ORDER BY RAND()';
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    if ( $row['nb_images'] > 0 )
+    {
+      return $row['id'];
+    }
+  }
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    // recursive call
+    if ( $subcat = get_first_non_empty_cat_id( $row['id'] ) )
+    {
+      return $subcat;
+    }
+  }
+  return false;
+}
+?>
Index: /tags/release-1_3RC1/include/functions_group.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions_group.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions_group.inc.php	(revision 159)
@@ -0,0 +1,106 @@
+<?php
+/***************************************************************************
+ *                           functions_group.inc.php                       *
+ *                            --------------------                         *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+// get_group_restrictions returns an array containing all unaccessible
+// category ids.
+function get_group_restrictions( $group_id )
+{
+  // 1. retrieving ids of private categories
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= " WHERE status = 'private'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  $privates = array();
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    array_push( $privates, $row['id'] );
+  }
+  // 2. retrieving all authorized categories for the group
+  $authorized = array();
+  $query = 'SELECT cat_id';
+  $query.= ' FROM '.PREFIX_TABLE.'group_access';
+  $query.= ' WHERE group_id = '.$group_id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    array_push( $authorized, $row['cat_id'] );
+  }
+
+  $forbidden = array();
+  foreach ( $privates as $private ) {
+    if ( !in_array( $private, $authorized ) )
+    {
+      array_push( $forbidden, $private );
+    }
+  }
+
+  return $forbidden;
+}
+
+// get_all_group_restrictions returns an array with ALL unaccessible
+// category ids, including sub-categories
+function get_all_group_restrictions( $group_id )
+{
+  $restricted_cats = get_group_restrictions( $group_id );
+  foreach ( $restricted_cats as $restricted_cat ) {
+    $sub_restricted_cats = get_subcats_id( $restricted_cat );
+    foreach ( $sub_restricted_cats as $sub_restricted_cat ) {
+      array_push( $restricted_cats, $sub_restricted_cat );
+    }
+  }
+  return $restricted_cats;
+}
+
+// The function is_group_allowed returns :
+//      - 0 : if the category is allowed with this $restrictions array
+//      - 1 : if this category is not allowed
+//      - 2 : if an uppercat category is not allowed
+function is_group_allowed( $category_id, $restrictions )
+{
+  $lowest_category_id = $category_id;
+                
+  $is_root = false;
+  while ( !$is_root and !in_array( $category_id, $restrictions ) )
+  {
+    $query = 'SELECT id_uppercat';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE id = '.$category_id;
+    $query.= ';';
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    if ( $row['id_uppercat'] == '' )
+    {
+      $is_root = true;
+    }
+    $category_id = $row['id_uppercat'];
+  }
+                
+  if ( in_array( $lowest_category_id, $restrictions ) )
+  {
+    return 1;
+  }
+  if ( in_array( $category_id, $restrictions ) )
+  {
+    return 2;
+  }
+  // this group is allowed to go in this category
+  return 0;
+}
+?>
Index: /tags/release-1_3RC1/include/functions_session.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions_session.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions_session.inc.php	(revision 159)
@@ -0,0 +1,125 @@
+<?php
+/***************************************************************************
+ *                         functions_session.inc.php                       *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+// The function generate_key creates a string with pseudo random characters.
+// the size of the string depends on the $conf['session_id_size'].
+// Characters used are a-z A-Z and numerical values. Examples :
+//                    "Er4Tgh6", "Rrp08P", "54gj"
+// input  : none (using global variable)
+// output : $key
+function generate_key()
+{
+  global $conf;
+
+  $md5 = md5( substr( microtime(), 2, 6 ).$conf['session_keyword'] );
+  $init = '';
+  for ( $i = 0; $i < strlen( $md5 ); $i++ )
+  {
+    if ( is_numeric( $md5[$i] ) ) $init.= $md5[$i];
+  }
+  $init = substr( $init, 0, 8 );
+  mt_srand( $init );
+  $key = '';
+  for ( $i = 0; $i < $conf['session_id_size']; $i++ )
+  {
+    $c = mt_rand( 0, 2 );
+    if ( $c == 0 )      $key .= chr( mt_rand( 65, 90 ) );
+    else if ( $c == 1 ) $key .= chr( mt_rand( 97, 122 ) );
+    else                $key .= mt_rand( 0, 9 );
+  }
+  return $key;
+}
+
+// The function create_session finds a non-already-used session key and
+// returns it once found for the given user.
+function session_create( $username )
+{
+  global $conf;
+  // 1. searching an unused session key
+  $id_found = false;
+  while ( !$id_found )
+  {
+    $generated_id = generate_key();
+    $query = 'select id';
+    $query.= ' from '.PREFIX_TABLE.'sessions';
+    $query.= " where id = '".$generated_id."';";
+    $result = mysql_query( $query );
+    if ( mysql_num_rows( $result ) == 0 )
+    {
+      $id_found = true;
+    }
+  }
+  // 2. retrieving id of the username given in parameter
+  $query = 'select id';
+  $query.= ' from '.PREFIX_TABLE.'users';
+  $query.= " where username = '".$username."';";
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $user_id = $row['id'];
+  // 3. inserting session in database
+  $expiration = $conf['session_time'] * 60 + time();
+  $query = 'insert into '.PREFIX_TABLE.'sessions';
+  $query.= ' (id,user_id,expiration,ip) values';
+  $query.= "('".$generated_id."','".$user_id;
+  $query.= "','".$expiration."','".$_SERVER['REMOTE_ADDR']."');";
+  mysql_query( $query );
+                
+  return $generated_id;
+}
+
+// add_session_id adds the id of the session to the string given in
+// parameter as $url. If the session id is the first parameter to the url,
+// it is preceded by a '?', else it is preceded by a '&amp;'. If the
+// parameter $redirect is set to true, '&' is used instead of '&'.
+function add_session_id( $url, $redirect = false )
+{
+  global $page, $user;
+
+  if ( $user['has_cookie'] ) return $url;
+
+  $amp = '&amp;';
+  if ( $redirect )
+  {
+    $amp = '&';
+  }
+  if ( !$user['is_the_guest'] )
+  {
+    if ( preg_match( '/\.php\?/',$url ) )
+    {
+      return $url.$amp.'id='.$page['session_id'];
+    }
+    else
+    {
+      return $url.'?id='.$page['session_id'];
+    }
+  }
+  else
+  {
+    return $url;
+  }
+}
+
+// cookie_path returns the path to use for the PhpWebGallery cookie.
+// If PhpWebGallery is installed on :
+// http://domain.org/meeting/gallery/category.php
+// cookie_path will return : "/meeting/gallery"
+function cookie_path()
+{
+  return substr($_SERVER['PHP_SELF'],0,strrpos( $_SERVER['PHP_SELF'],'/'));
+}
+?>
Index: /tags/release-1_3RC1/include/functions_user.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions_user.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions_user.inc.php	(revision 159)
@@ -0,0 +1,336 @@
+<?php
+/***************************************************************************
+ *                           functions_user.inc.php                        *
+ *                            --------------------                         *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+// validate_mail_address verifies whether the given mail address has the
+// right format. ie someone@domain.com "someone" can contain ".", "-" or
+// even "_". Exactly as "domain". The extension doesn't have to be
+// "com". The mail address can also be empty.
+// If the mail address doesn't correspond, an error message is returned.
+function validate_mail_address( $mail_address )
+{
+  global $lang;
+
+  if ( $mail_address == '' )
+  {
+    return '';
+  }
+  $regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/';
+  if ( !preg_match( $regex, $mail_address ) )
+  {
+    return $lang['reg_err_mail_address'];
+  }
+}
+
+function register_user(
+  $login, $password, $password_conf, $mail_address, $status = 'guest' )
+{
+  global $lang;
+
+  $error = array();
+  $i = 0;
+  // login must not
+  //      1. be empty
+  //      2. start ou end with space character
+  //      3. include ' or " characters
+  //      4. be already used
+  if ( $login == '' )
+  {
+    $error[$i++] = $lang['reg_err_login1'];
+  }
+  if ( ereg( "^.* $", $login) )
+  {
+    $error[$i++] = $lang['reg_err_login2'];
+  }
+  if ( ereg( "^ .*$", $login ) )
+  {
+    $error[$i++] = $lang['reg_err_login3'];
+  }
+  if ( ereg( "'", $login ) or ereg( "\"", $login ) )
+  {
+    $error[$i++] = $lang['reg_err_login4'];
+  }
+  else
+  {
+    $query = 'select id';
+    $query.= ' from '.PREFIX_TABLE.'users';
+    $query.= " where username = '".$login."';";
+    $result = mysql_query( $query );
+    if ( mysql_num_rows( $result ) > 0 )
+    {
+      $error[$i++] = $lang['reg_err_login5'];
+    }
+  }
+  // given password must be the same as the confirmation
+  if ( $password != $password_conf )
+  {
+    $error[$i++] = $lang['reg_err_pass'];
+  }
+
+  $error_mail_address = validate_mail_address( $mail_address );
+  if ( $error_mail_address != '' )
+  {
+    $error[$i++] = $error_mail_address;
+  }
+
+  // if no error until here, registration of the user
+  if ( sizeof( $error ) == 0 )
+  {
+    // 1. retrieving default values, the ones of the user "guest"
+    $infos = array( 'nb_image_line', 'nb_line_page', 'language',
+                    'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
+                    'short_period', 'long_period', 'template' );
+    $query = 'select';
+    for ( $i = 0; $i < sizeof( $infos ); $i++ )
+    {
+      if ( $i > 0 )
+      {
+        $query.= ',';
+      }
+      else
+      {
+        $query.= ' ';
+      }
+      $query.= $infos[$i];
+    }
+    $query.= ' from '.PREFIX_TABLE.'users';
+    $query.= " where username = 'guest';";
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    // 2. adding new user
+    $query = 'insert into '.PREFIX_TABLE.'users';
+    $query.= ' (';
+    $query.= ' username,password,mail_address,status';
+    for ( $i = 0; $i < sizeof( $infos ); $i++ )
+    {
+      $query.= ','.$infos[$i];
+    }
+    $query.= ') values (';
+    $query.= " '".$login."'";
+    $query.= ",'".md5( $password )."'";
+    if ( $mail_address != '' )
+    {
+      $query.= ",'".$mail_address."'";
+    }
+    else
+    {
+      $query.= ',NULL';
+    }
+    $query.= ",'".$status."'";
+    for ( $i = 0; $i < sizeof( $infos ); $i++ )
+    {
+      $query.= ',';
+      if ( $row[$infos[$i]] == '' )
+      {
+        $query.= 'NULL';
+      }
+      else
+      {
+        $query.= "'".$row[$infos[$i]]."'";
+      }
+    }
+    $query.= ');';
+    mysql_query( $query );
+    // 3. retrieving the id of the newly created user
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'users';
+    $query.= " WHERE username = '".$login."';";
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    $user_id = $row['id'];
+    // 4. adding access to the new user, the same as the user "guest"
+    $query = 'SELECT cat_id';
+    $query.= ' FROM '.PREFIX_TABLE.'user_access as ua';
+    $query.=      ','.PREFIX_TABLE.'users as u ';
+    $query.= ' where u.id = ua.user_id';
+    $query.= " and u.username = 'guest';";
+    $result = mysql_query( $query );
+    while( $row = mysql_fetch_array( $result ) )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
+      $query.= ' (user_id,cat_id) VALUES';
+      $query.= ' ('.$user_id.','.$row['cat_id'].');';
+      mysql_query ( $query );
+    }
+  }
+  return $error;
+}
+
+function update_user( $user_id, $mail_address, $status,
+                      $use_new_password = false, $password = '' )
+{
+  $error = array();
+  $i = 0;
+  
+  $error_mail_address = validate_mail_address( $mail_address );
+  if ( $error_mail_address != '' )
+  {
+    $error[$i++] = $error_mail_address;
+  }
+
+  if ( sizeof( $error ) == 0 )
+  {
+    $query = 'UPDATE '.PREFIX_TABLE.'users';
+    $query.= " SET status = '".$status."'";
+    if ( $use_new_password )
+    {
+      $query.= ", password = '".md5( $password )."'";
+    }
+    $query.= ', mail_address = ';
+    if ( $mail_address != '' )
+    {
+      $query.= "'".$mail_address."'";
+    }
+    else
+    {
+      $query.= 'NULL';
+    }
+    $query.= ' WHERE id = '.$user_id;
+    $query.= ';';
+    mysql_query( $query );
+  }
+  return $error;
+}
+
+function check_login_authorization()
+{
+  global $user,$lang,$conf,$page;
+
+  if ( $user['is_the_guest']
+       and ( $conf['access'] == 'restricted' or $page['cat'] == 'fav' ) )
+  {
+    echo '<div style="text-align:center;">'.$lang['only_members'].'<br />';
+    echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
+    exit();
+  }
+}
+        
+// The function get_restrictions returns an array with the ids of the
+// restricted categories for the user.
+// If the $check_invisible parameter is set to true, invisible categories
+// are added to the restricted one in the array.
+function get_restrictions( $user_id, $user_status,
+                           $check_invisible, $use_groups = true )
+{
+  // 1. retrieving ids of private categories
+  $query = 'SELECT id';
+  $query.= ' FROM '.PREFIX_TABLE.'categories';
+  $query.= " WHERE status = 'private'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  $privates = array();
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    array_push( $privates, $row['id'] );
+  }
+  // 2. retrieving all authorized categories for the user
+  $authorized = array();
+  // 2.1. retrieving authorized categories thanks to personnal user
+  //      authorization
+  $query = 'SELECT cat_id';
+  $query.= ' FROM '.PREFIX_TABLE.'user_access';
+  $query.= ' WHERE user_id = '.$user_id;
+  $query.= ';';
+  $result = mysql_query( $query );
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    array_push( $authorized, $row['cat_id'] );
+  }
+  // 2.2. retrieving authorized categories thanks to group authorization to
+  //      which the user is a member
+  if ( $use_groups )
+  {
+    $query = 'SELECT ga.cat_id';
+    $query.= ' FROM '.PREFIX_TABLE.'user_group as ug';
+    $query.= ', '.PREFIX_TABLE.'group_access as ga';
+    $query.= ' WHERE ug.group_id = ga.group_id';
+    $query.= ' AND ug.user_id = '.$user_id;
+    $query.= ';';
+    $result = mysql_query( $query );
+    while ( $row = mysql_fetch_array( $result ) )
+    {
+      array_push( $authorized, $row['cat_id'] );
+    }
+    $authorized = array_unique( $authorized );
+  }
+
+  $forbidden = array();
+  foreach ( $privates as $private ) {
+    if ( !in_array( $private, $authorized ) )
+    {
+      array_push( $forbidden, $private );
+    }
+  }
+
+  if ( $check_invisible )
+  {
+    // 3. adding to the restricted categories, the invisible ones
+    if ( $user_status != 'admin' )
+    {
+      $query = 'SELECT id';
+      $query.= ' FROM '.PREFIX_TABLE.'categories';
+      $query.= " WHERE visible = 'false';";
+      $result = mysql_query( $query );
+      while ( $row = mysql_fetch_array( $result ) )
+      {
+        array_push( $forbidden, $row['id'] );
+      }
+    }
+  }
+  return array_unique( $forbidden );
+}
+
+// The get_all_restrictions function returns an array with all the
+// categories id which are restricted for the user. Including the
+// sub-categories and invisible categories
+function get_all_restrictions( $user_id, $user_status )
+{
+  $restricted_cats = get_restrictions( $user_id, $user_status, true );
+  foreach ( $restricted_cats as $restricted_cat ) {
+    $sub_restricted_cats = get_subcats_id( $restricted_cat );
+    foreach ( $sub_restricted_cats as $sub_restricted_cat ) {
+      array_push( $restricted_cats, $sub_restricted_cat );
+    }
+  }
+  return $restricted_cats;
+}
+
+// The function is_user_allowed returns :
+//      - 0 : if the category is allowed with this $restrictions array
+//      - 1 : if this category is not allowed
+//      - 2 : if an uppercat category is not allowed
+function is_user_allowed( $category_id, $restrictions )
+{
+  $lowest_category_id = $category_id;
+
+  $is_root = false;
+  while ( !$is_root and !in_array( $category_id, $restrictions ) )
+  {
+    $query = 'SELECT id_uppercat';
+    $query.= ' FROM '.PREFIX_TABLE.'categories';
+    $query.= ' WHERE id = '.$category_id;
+    $query.= ';';
+    $row = mysql_fetch_array( mysql_query( $query ) );
+    if ( $row['id_uppercat'] == '' ) $is_root = true;
+    $category_id = $row['id_uppercat'];
+  }
+
+  if ( in_array( $lowest_category_id, $restrictions ) ) return 1;
+  if ( in_array( $category_id,        $restrictions ) ) return 2;
+  // this user is allowed to go in this category
+  return 0;
+}
+?>
Index: /tags/release-1_3RC1/include/functions_xml.inc.php
===================================================================
--- /tags/release-1_3RC1/include/functions_xml.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/functions_xml.inc.php	(revision 159)
@@ -0,0 +1,120 @@
+<?php
+/***************************************************************************
+ *                           functions_xml.inc.php                         *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//------------------------------------------------------------------ constantes
+define( ATT_REG, '\w+' );
+define( VAL_REG, '[^"]*' );
+//------------------------------------------------------------------- functions
+// getContent returns the content of a tag
+//
+// example : getContent( "<name>Joe</name>" ) returns "Joe"
+//
+// It also works with strings containing themself sub-tags :
+// <perso><name>Jean</name><firstname>Billie</fisrtname></perso> ->
+// <name>Jean</name><firstname>Billie</firstname>
+function getContent( $element )
+{
+  // deleting start of the tag
+  $content = preg_replace( '/^<[^>]+>/', '', $element );
+  // deleting end of the tag
+  $content = preg_replace( '/<\/[^>]+>$/', '', $content );
+  // replacing multiple instance of space character
+  $content = preg_replace( '/\s+/', ' ', $content );
+
+  return $content;
+}
+
+// The function get Attribute returns the value corresponding to the
+// attribute $attribute for the tag $element.
+function getAttribute( $element, $attribute )
+{
+  $regex = '/^<\w+[^>]*'.$attribute.'\s*=\s*"('.VAL_REG.')"/i';
+  if ( preg_match( $regex, $element, $out ) ) return $out[1];
+  else return '';
+}
+
+function deprecated_getAttribute( $element, $attribute )
+{
+  // Retrieving string with tag name and all attributes
+  $regex = '/^<\w+( '.ATT_REG.'="'.VAL_REG.'")*/';
+  preg_match( $regex, $element, $out );
+
+  // Splitting string for retrieving separately attributes
+  // and corresponding values
+  $regex = '/('.ATT_REG.')="('.VAL_REG.')"/';
+  preg_match_all( $regex, $out[0], $out );
+
+  // Searching and returning the value of the requested attribute
+  for ( $i = 0; $i < sizeof( $out[0] ); $i++ )
+  {
+    if ( $out[1][$i] == $attribute )
+    {
+      return $out[2][$i];
+    }
+  }
+  return '';
+}
+	
+// The function getChild returns the first child
+// exemple : getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )
+//           returns "<tr>XXX</tr>"
+function getChild( $document, $node )
+{
+  $regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
+  $regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
+
+  preg_match( $regex, $document, $out );
+  return $out[0];
+}
+
+// getChildren returns a list of the children identified by the $node
+// example : 
+//     getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )
+//     returns an array with :
+//          $array[0] equals "<tr>XXX</tr>"
+//          $array[1] equals "<tr>YYY</tr>"
+function getChildren( $document, $node )
+{
+  $regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
+  $regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
+
+  preg_match_all( $regex, $document, $out );
+  return $out[0];
+}
+	
+// get_CodeXML places the content of a text file in a PHP variable and
+// return it. If the file can't be opened, returns false.
+function getXmlCode( $filename )
+{
+  $file = fopen( $filename, 'r' );
+  if ( !$file )
+  {
+    return false;
+  }
+  while ( !feof( $file ) )
+  {
+    $xml_content .= fgets( $file, 1024 );
+  }
+  fclose( $file );
+  $xml_content = str_replace( "\n", '', $xml_content );
+  $xml_content = str_replace( "\t", '', $xml_content );
+
+  return $xml_content;
+}
+?>
Index: /tags/release-1_3RC1/include/index.php
===================================================================
--- /tags/release-1_3RC1/include/index.php	(revision 159)
+++ /tags/release-1_3RC1/include/index.php	(revision 159)
@@ -0,0 +1,17 @@
+<?php
+/***************************************************************************
+ *                                  index.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+$url = '../category.php';
+header( 'Request-URI: '.$url );  
+header( 'Content-Location: '.$url );  
+header( 'Location: '.$url );
+exit();
+?>
Index: /tags/release-1_3RC1/include/init.inc.php
===================================================================
--- /tags/release-1_3RC1/include/init.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/init.inc.php	(revision 159)
@@ -0,0 +1,35 @@
+<?php
+/***************************************************************************
+ *                               init.inc.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+define( PREFIX_INCLUDE, '' );
+
+include_once( './include/config.inc.php' );
+include_once( './include/user.inc.php' );
+
+// calculation of the number of picture to display per page
+$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
+// retrieving the restrictions for this user
+$user['restrictions'] = get_restrictions( $user['id'], $user['status'], true );
+        
+$isadmin = false;
+include_once( './language/'.$user['language'].'.php' );
+// displaying the username in the language of the connected user, instead of
+// "guest" as you can find in the database
+if ( $user['is_the_guest'] ) $user['username'] = $lang['guest'];
+include_once( './template/'.$user['template'].'/htmlfunctions.inc.php' );
+?>
Index: /tags/release-1_3RC1/include/user.inc.php
===================================================================
--- /tags/release-1_3RC1/include/user.inc.php	(revision 159)
+++ /tags/release-1_3RC1/include/user.inc.php	(revision 159)
@@ -0,0 +1,113 @@
+<?php
+/***************************************************************************
+ *                               user.inc.php                              *
+ *                            ------------------                           *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+// retrieving user informations
+// $infos array is used to know the fields to retrieve in the table "users"
+// Each field becomes an information of the array $user.
+// Example :
+//            status --> $user['status']
+$infos = array( 'id', 'username', 'mail_address', 'nb_image_line',
+                'nb_line_page', 'status', 'language', 'maxwidth',
+                'maxheight', 'expand', 'show_nb_comments', 'short_period',
+                'long_period', 'template' );
+
+$query_user  = 'SELECT ';
+foreach ( $infos as $i => $info ) {
+  if ( $i > 0 ) $query_user.= ',';
+  $query_user.= $info;
+}
+$query_user.= ' FROM '.PREFIX_TABLE.'users';
+$query_done = false;
+$user['is_the_guest'] = false;
+
+// cookie deletion if administrator don't authorize them anymore
+if ( !$conf['authorize_cookies'] and isset( $_COOKIE['id'] ) )
+{
+  setcookie( 'id', '', 0, cookie_path() );
+  $url = 'category.php';
+  header( 'Request-URI: '.$url );  
+  header( 'Content-Location: '.$url );  
+  header( 'Location: '.$url );
+  exit();
+}
+
+$user['has_cookie'] = false;
+if     ( isset( $_GET['id']    ) ) $session_id = $_GET['id'];
+elseif ( isset( $_COOKIE['id'] ) )
+{
+  $session_id = $_COOKIE['id'];
+  $user['has_cookie'] = true;
+}
+
+if ( isset( $session_id )
+     and ereg( "^[0-9a-zA-Z]{".$conf['session_id_size']."}$", $session_id ) )
+{
+  $page['session_id'] = $session_id;
+  $query = 'SELECT user_id,expiration,ip';
+  $query.= ' FROM '.PREFIX_TABLE.'sessions';
+  $query.= " WHERE id = '".$page['session_id']."'";
+  $query.= ';';
+  $result = mysql_query( $query );
+  if ( mysql_num_rows( $result ) > 0 )
+  {
+    $row = mysql_fetch_array( $result );
+    if ( !$user['has_cookie'] )
+    {
+      if ( $row['expiration'] < time() )
+      {
+        // deletion of the session from the database,
+        // because it is out-of-date
+        $delete_query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
+        $delete_query.= " WHERE id = '".$page['session_id']."'";
+        $delete_query.= ';';
+        mysql_query( $delete_query );
+      }
+      else if ( $_SERVER['REMOTE_ADDR'] == $row['ip'] )
+      {
+        $query_user .= ' WHERE id = '.$row['user_id'];
+        $query_done = true;
+      }
+    }
+    else
+    {
+      $query_user .= ' WHERE id = '.$row['user_id'];
+      $query_done = true;
+    }
+  }
+}
+if ( !$query_done )
+{
+  $query_user .= ' WHERE id = 2';
+  $user['is_the_guest'] = true;
+}
+$query_user .= ';';
+
+$row = mysql_fetch_array( mysql_query( $query_user ) );
+
+// affectation of each value retrieved in the users table into a variable
+// of the array $user.
+foreach ( $infos as $info ) {
+  $user[$info] = $row[$info];
+  // If the field is true or false, the variable is transformed into a
+  // boolean value.
+  if ( $row[$info] == 'true' or $row[$info] == 'false' )
+  {
+    $user[$info] = get_boolean( $row[$info] );
+  }
+}
+?>
Index: /tags/release-1_3RC1/include/vtemplate.class.php
===================================================================
--- /tags/release-1_3RC1/include/vtemplate.class.php	(revision 159)
+++ /tags/release-1_3RC1/include/vtemplate.class.php	(revision 159)
@@ -0,0 +1,593 @@
+<?php
+/*****************************************************************
+ *			VIRTUAL-TEMPLATE
+ *
+ * Version : 1.3.2 Base Edition ( Decembre 2003 ) build 1
+ *
+ * Address : http://vtemplate.sourceforge.net
+ * 
+ * Authors: 
+ *   + THIEBAUT Jean-Baptiste(J.Baptiste@leweby.com)  -  http://www.leweby.com .
+ *   + CAMPANA François (fc@netouaibe.com).
+ * Licence: GPL.
+ * 
+ * 
+ *
+ *			  
+ *****************************************************************/ 
+
+// to make it work on nexen.net
+set_magic_quotes_runtime(0);
+
+if ( !isset( $DEFINE_VTEMPLATE ) )
+{
+  define("ALL",1);
+  // Tag d'ouverture des variables : vous pouvez changer ce paramètre.
+  define("VARTAG","{#");
+  define("VTEMPLATE_VERSION","1.3.1");
+  define("VTEMPLATE_TYPE","BA");
+  define("VTEMPLATE_BUILD","6");
+  
+  class Err {
+    var $msg;
+    var $titre;
+
+    function error( $errno, $arg = "", $code = 0, $disp = 0 ) {
+      // Gestion des erreurs
+      switch ( $errno )
+      {
+      case 1:
+        $this->titre="Erreur de session n° $code";
+        $this->msg = "La zone $arg est déjà ouverte.Avant d'ajouter une session sur cette zone, vous devez la fermer à l'aide de la fonction closeSession().<br>"	;
+        break;
+      case 2:
+        $this->titre="Erreur de session n° $code";
+        $this->msg = "Vous tentez de fermer une session de la zone $arg alors qu'aucune session pour cette zone n'existe.Pour ouvrir une session, utilisez la fonction addSession().<br>";
+        break;
+      case 3:
+        $this->titre="Erreur de session n° $code";
+	$var = $arg[1];
+	$zone = $arg[0];
+        $this->msg = "Vous essayez de valoriser la variable $var sans avoir créer de session de la zone $zone.Utilisez la fonction addSession() pour créer une session, puis setVar pour valoriser une variable.<br>";
+        break;
+      case 4:
+        $this->titre="Erreur de session n° $code";
+	$var = $arg[1];
+	$zone = $arg[0];
+        $this->msg = "La variable $var que vous souhaitez valoriser n'existe pas dans la zone $zone.<br>";
+        break;
+      case 5:
+        $this->titre="Erreur de parsing n° $code";
+        $this->msg = "Vous utilisez des caractère non autorisés pour déclarer vos zones.Vous pouvez utiliser tous les caractères à l'exception de \'{\' , \'#\' \'}\' et \'|\'.<br>";
+        break;
+      case 6:
+        $this->titre="Erreur de parsing n° $code";
+        $this->msg = "Vous ne pouvez pas utiliser le même nom ($arg)de zone plusieurs fois.<br>";
+        break;
+      case 7:
+        $this->titre="Erreur de parsing n° $code";
+        $this->msg = "Vous avez oublié de fermer la zone $arg.<br>";
+        break;
+      case 8:
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "Le fichier template $arg est introuvable.<br>";
+        break;
+      case 9:
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "Impossible d'ouvrir le fichier $arg.Vérifiez les droits de ce fichier.<br>";
+        break;
+      case 10:
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "Impossible de lire le fichier template $arg.<br>";
+        break;
+      case 11:
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "La zone $arg est introuvable.Vérifiez la syntaxe de cette zone.<br>"; 
+        break;
+      case 12:  
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "La variable $arg est introuvable .Vérifiez la syntaxe de la variable.<br>";	
+        break;
+      case 13:
+        $this->titre="Erreur de traitement n° $code";
+        $this->msg = "L'identifiant de fichier spécifié n'existe pas.Vérifiez les fonctions Open() de votre script.<br>";
+        break;  
+      case 14:
+        $this->titre="Erreur de traitement n° $code";
+	$var = $arg[1];
+	$file = $arg[0];
+        $this->msg = "La variable $var dans le fichier $file est introuvable.Vérifiez la syntaxe de la variable.<br>";	
+        break;  
+      case 15:
+        $this->titre="Erreur de traitement n° $code";
+	$var = $arg[2];
+	$zone = $arg[1];
+	$fichier = $arg[0];
+        $this->msg = "La variable $var dans la zone $zone du fichier $fichier est introuvable.Vérifiez la syntaxe de la variable et du nom de la zone.<br>";
+        break; 
+      default:
+        $this->titre = "Erreur inconnue $code";	 
+        $this->msg = "Veuillez le rapporter aux auteurs de la classe.";
+      }
+      $this->titre .= ": <br>";
+      if ( $disp )
+      {
+	$web = "Pour plus d'informations, consultez la <a href=\"http://www.virtual-solution.net/vtemplate/docs/debug-mod.php?version=".VTEMPLATE_VERSION."&build=".VTEMPLATE_BUILD."&type=".VTEMPLATE_TYPE."&error=$code\" target=\"_blank\">doc en ligne</a>";
+	echo "<font face=verdana size=2 color=red><u>$this->titre</u><i>$this->msg</i>$web<br><br></font>";
+      }
+      return -1;
+    }
+  } // Fin classe
+
+  class Session extends err {
+    var $name;		// Name of the session
+    var $globalvar = array();  // List of global variable of the session
+    var $varlist = array();  // List of var in this session
+    var $subzone = array(); // list of sub-zone
+    var $temp; // Generated code for the current session
+    var $generated = NULL; // The final code
+    var $source; // Source code
+    var $used=0; // Indicates if the session contain used variable
+    var $stored; // Give the filename were is stored the session
+
+    function Session( $name, $source, $stored ) {
+      $this->name = $name;
+      $this->source = $source;
+      $this->stored = $stored;
+      $this->parseVar();
+    }
+
+    function parseVar(){
+      // Récupération des noms des variables
+      $regle = "|".VARTAG."(.*)}|sU"; 
+      preg_match_all ($regle,$this->source,$var1);
+      // Création du tableau de variable  à partir de la liste parsée.
+      $this->varlist=@array_merge($var[1],$var1[1]);
+      return 1;
+    }
+
+    function init(){
+      if ( $this->used )
+        return $this->error(1,array($this->stored,$this->name),"SESSION1",1);
+      // Reset generated code
+      $this->temp = $this->source;
+      $this->used = 1;
+    }
+
+    function closeSession(){
+      // Check if the zone has been used.    
+      if ( !$this->used )
+        return $this->error(2,array($this->stored,$this->name),"SESSION2",1);
+      // Set Globals vars.
+      $this->generateCode();
+      $this->used=0;
+      return 1;
+    }
+
+    function reset(){
+      $this->used = 0;
+      $this->generated = NULL;
+      return 1;
+    }
+
+    function addSubZone( &$subzone ) {
+      $this->subzone[$subzone->name] = &$subzone;
+      return 1;
+    }
+
+    function setVar($varname,$value){
+      if ( !$this->used )
+        return $this->error(3,array($this->stored,$this->name,$varname),
+                            "SESSION3",1);
+      if (!in_array($varname,$this->varlist))
+        return $this->error(4,array($this->name,$varname),"SESSION4",1);
+      $regle = "(\\".VARTAG."$varname\})";
+      $this->temp = preg_replace($regle,$value,$this->temp);
+      return 1;
+    }
+
+    function dispVar(){
+      echo "Liste variables de $this->name:<br>";
+      foreach ( $this->varlist as $vars ) echo "$vars <br>";
+    }
+
+    function setGlobalVar($varname,$value){
+      $set = 0;
+      if (in_array($varname,$this->varlist ) )
+      {
+        // Replace the var into this session 
+        $this->globalvar[$varname]=$value;   
+        $set = 1;
+      }
+      // Replace the var into sub zones
+      foreach(array_keys($this->subzone) as $subzone){
+        $set = $this->subzone[$subzone]->setGlobalVar($varname,$value) || $set;
+      }
+      return $set;
+    }
+
+    function replaceGlobalVar(){
+      if ( count($this->globalvar) )
+      {
+        foreach($this->globalvar as $varname => $value) {
+          $regle = "(\\".VARTAG."$varname\})";
+          $this->temp = preg_replace($regle,$value,$this->temp);
+        }
+      }
+    }
+
+
+    function generateCode(){
+      if ($this->used == 0) return $this->generated;
+      // Replace global var.
+      if ( count($this->globalvar) ) $this->replaceGlobalVar();
+      // Replace all unused variable by ""
+      $regle = "|\\".VARTAG."([^}]*)\}|";
+      $this->temp = preg_replace($regle,"",$this->temp);
+      // Generate the subzone(s) code
+      if(count($this->subzone)){
+        foreach(array_keys($this->subzone) as $subzone){
+          $text = ($this->subzone[$subzone]->used) ? $this->subzone[$subzone]->generateCode() : $this->subzone[$subzone]->generated;
+          $this->temp = preg_replace("(\|$subzone\|)",$text,$this->temp); 	
+          $this->subzone[$subzone]->reset();
+        }
+      }
+      $this->generated .= $this->temp;
+      return $this->generated;
+    }
+
+    function inVarList($varname){
+      return in_array($varname,$this->varlist);
+    }
+  } // Fin classe
+
+  class VTemplate_Private extends Err{
+    /**************************************** 
+     *	        Private Class.              *
+     ****************************************/
+
+    var $sources=array(); // Sources des zones issues
+                          // de la premiere partie du parsing.
+    var $sessions=array(); // Tableau de sessions
+    var $v_global=array(); // Globla var array.
+
+/****************************************************************
+	    Parsing Functions for Template files.  ( PF 1.0 )
+ ****************************************************************/
+
+    function getNom($code){
+      // Retourne le premier nom de zone qu'il trouve dans le code
+      preg_match("(<!--VTP_([^()]+)-->)sU",$code,$reg);   
+      // Tester la présence des caratère invalides dans le nom ( | et {});
+      if ( @count( explode("|",$reg[1]))>1
+           || @count(explode("{",$reg[1]))>1
+           || @count(explode("}",$reg[1]))>1 )
+        exit($this->error(5,$reg[1],"PARSE1",1));
+      return @$reg[1];
+    }
+
+    function endTag($code,$nom){
+      // Renvoie TRUE(1) si le tag de fermeture est présent.
+      preg_match("(<!--/VTP_$nom-->)sU",$code,$reg);
+      return ($reg[0]!="<!--/VTP_$nom-->") ? 0 : 1;
+    }
+
+    function getSource($code,$nom,$type=0){
+      // Retourne le source de la zone de nom $nom
+      preg_match_all ("(<!--VTP_$nom-->(.*)<!--/VTP_$nom-->)sU",$code,$reg);
+      return $reg[$type][0];
+    }
+
+    function parseZone($code_source,$nom_zone="|root|"){
+      // Fonction récursive de parsing du fichier template
+      // Vérification que la zone n'existe pas
+      if (isset($this->sources[$nom_zone]))
+        exit($this->error(6,$nom_zone,"PARSE2",1));
+      // Enregistrement du code source
+      $this->sources[$nom_zone]["source"]=$code_source;
+      // Rappel de la fonction pour chaque fils.
+      while ($nom_fils=$this->getNom($this->sources[$nom_zone]["source"]) ) {
+        // Vérification que le tag de fin est présent.
+        if (!$this->endTag($code_source,$nom_fils))
+          exit($this->error(7,$nom_fils,"PARSE3",1));
+        // Parse le fils
+        $this->parseZone($this->getSource($this->sources[$nom_zone]["source"],$nom_fils,1),$nom_fils);
+        // Enregistre le nom du fils dans la liste des fils
+        $this->sources[$nom_zone]["fils"][]=$nom_fils;
+        // Remplace le code du fils dans le source du père
+        $this->sources[$nom_zone]["source"]=str_replace(
+          $this->getSource($this->sources[$nom_zone]["source"],$nom_fils,0),
+          "|$nom_fils|",
+          $this->sources[$nom_zone]["source"]);
+        // Teste si la zone $nom_fils n'existe pas plusieurs fois
+        // dans la zone $nom_zone
+        if (count(explode("|$nom_fils|",$this->sources[$nom_zone]["source"]))>2)
+          exit($this->error(6,$nom_fils,"PARSE4",1));
+      } // fin While
+      return 1;
+    }
+
+/****************************************************************
+	    Session Management functions ( SMF 1.0 )
+ ****************************************************************/
+
+    function createSession($handle,$zone = "|root|"){
+      // Create a new session of the zone
+      $this->sessions[$handle][$zone] = new Session($zone,$this->sources[$zone]["source"],$this->file_name[$handle]);
+      // Create sub-zone
+      if (@count($this->sources[$zone]["fils"])){
+        foreach($this->sources[$zone]["fils"] as $subzone){	  
+          $this->createSession($handle,$subzone);
+          $this->sessions[$handle][$zone]->addSubZone($this->sessions[$handle][$subzone]);
+        }
+      }
+      //end createSession
+    }
+
+
+/****************************************************************
+	    Global Variable Management Functions ( GVMF 1.0 )
+ ****************************************************************/
+
+    function setGZone($handle,$zone,$var,$value){
+      // Define Global var for $zone and its sub-zone.
+      // Set global value to $zone vars.
+      return $this->sessions[$handle][$zone]->setGlobalVar($var,$value);
+    }
+
+    function setGFile($handle,$var,$value) {
+      return $this->sessions[$handle]["|root|"]->setGlobalVar($var,$value);
+    }
+
+    function setGAll($var,$value){
+      $declare = 0;
+      $this->v_global[$var]=$value;
+      if (is_array($this->sessions)){
+        foreach($this->sessions as $handle => $v){
+          $declare = $this->setGFile($handle,$var,$value) || $declare;
+        }	
+      } 
+      return $declare;
+    }
+
+    function setGOpened($handle){
+// Set Global var into the opened file
+      foreach($this->v_global as $name => $val){
+        $this->setGFile($handle,$name,$val);
+      }
+      return 1;
+    }
+ 
+// Fin VTemplate_Private
+  }
+
+
+  class VTemplate extends VTemplate_Private{
+/****************************************
+ *	   Public Class.		*
+ * ***************************************/
+
+
+/****************************************************************
+	    Core Functions 
+*****************************************************************/
+
+
+    function Open($nomfichier){
+// Ouverture d'un fichier source et retourne le handle de ce fichier
+// Création du handle:
+      $handle =  "{".count($this->sessions)."}" ;
+
+
+// Récupération du source à parser
+      if (!@file_exists($nomfichier)) return $this->error(8,$nomfichier,"TTT1",1);
+      if (!$f_id=@fopen($nomfichier,"r")) return $this->error(9,$nomfichier,"TTT2",1);
+      if (!$source=@fread($f_id, filesize($nomfichier))) return $this->error(10,$nomfichier,"TTT3",1);
+      clearstatcache();
+      fclose($f_id);
+
+// Store the filename
+      $this->file_name[$handle]=$nomfichier;
+
+// Parse les zones
+      $this->parseZone($source);
+
+// Création du tableau de session
+      $this->createSession($handle);
+
+//Nettoyage des variables temporaires
+      $this->sources=NULL;
+
+// Set global var.
+      $this->setGOpened($handle);
+
+      $this->addSession($handle);
+      return $handle;
+    }
+
+    function newSession($handle="{0}",$nom_zone = "|root|"){
+      if ( $this->sessions[$handle][$nom_zone]->used ) $this->closeSession($handle,$nom_zone);
+      $this->addSession($handle,$nom_zone,$cache,$time,$num_session);
+      return 1;
+    }
+
+    function addSession($handle="{0}",$nom_zone = "|root|"){
+      // Does the zone exist ?
+      if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT4",1);   
+      $this->sessions[$handle][$nom_zone]->init();
+      return 1;
+    }
+
+    function closeSession($handle="{0}",$nom_zone = "|root|"){ 
+// Close the current session and all his sub-session
+      // Check if the zone exists.
+      if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT5",1);
+      // Closing sub-zone
+      $this->sessions[$handle][$nom_zone]->closeSession();	
+      return 1;
+    }
+
+    function setGlobalVar($arg1,$arg2,$arg3){
+      if ($arg1 == 1){
+        if (!$this->setGAll($arg2,$arg3)) return $this->error(12,$arg2,"TTT6",1);
+        return 1; 
+      }
+      if (!isset($this->sessions[$arg1])) return $this->error(13,$arg1,"TTT7",1);
+      $tab=explode(".",$arg2);
+      if (count($tab)==1){
+        if (!$this->setGFile($arg1,$arg2,$arg3)) return $this->error(14,array($this->file_name[$arg1],$arg2),"TTT8",1);
+      }
+      else if (count($tab==2)){
+        if (!isset($this->sessions[$arg1][$tab[0]])) return $this->error(11,array($tab[0],$this->file_name[$arg1],"TTT9",1));
+        if (!$this->setGZone($arg1,$tab[0],$tab[1],$arg3)) return $this->error(15,array($this->file_name[$arg1],$tab[0],$tab[1]),"TTT10",1);
+      }
+      return 1;
+    }
+
+    function setVar($handle,$zone_var,$val){
+      // Fill the variable
+      $tab=explode(".",$zone_var);
+      if(count($tab)==2){
+        $zone=$tab[0];
+        $var=$tab[1];
+      }
+      else
+      {
+        $zone="|root|";
+        $var=$tab[0];
+      }
+
+      // Teste l'existence de la zone dans la liste
+      if (!isset($this->sessions[$handle][$zone])) return $this->error(11,array($this->file_name[$handle],$zone),"TTT11",1);
+
+      //Enregistre la variable
+      return $this->sessions[$handle][$zone]->setVar($var,$val);
+    }
+
+    function Parse($handle_dest,$zone_var_dest,$handle_source,$zone_source="|root|"){
+      if($this->sessions[$handle_source][$zone_source]->used == 1) $this->closeSession($handle_source,$zone_source);
+      $this->setVar($handle_dest,$zone_var_dest, $this->sessions[$handle_source][$zone_source]->generated);
+    }
+
+    function setVarF($handle,$zone_var,$file){
+// Fonction qui ouvre le fichier file et copie ce qu'il y a dedans dans une variable.
+      $tab=explode(".",$zone_var);
+
+// Récupération nom de la zone et de la variable.
+      if(count($tab)==2){
+        $zone=$tab[0];
+        $var=$tab[1];
+      }
+      else
+      {
+        $zone="|root|";
+        $var=$tab[0];
+      }
+// Teste l'existence de la zone dans la liste
+      if (!is_object($this->sessions[$handle][$zone])) return $this->error(11,array($handle,$zone),"TTT12",1);
+
+      // Récupération du source à lire
+      if (!@file_exists($file)) return $this->error(8,$file,"TTT13",1);
+      if (!$f_id=@fopen($file,"r")) return $this->error(9,$file,"TTT14",1);
+      if (!$val=@fread($f_id, filesize($file))) return $this->error(10,$file,"TTT15",1);
+      clearstatcache();
+      fclose($f_id);
+
+//Enregistre la variable
+      return $this->sessions[$handle][$zone]->setVar($var,$val);
+    }
+
+
+
+
+
+    function isZone($handle, $zone="|root|") 
+      { 
+        return isset($this->sessions[$handle][$zone]) ; 
+      } 
+
+    function Display($handle="{0}",$display=1,$zone="|root|"){
+      $this->closeSession($handle,$zone);
+      $c_genere = $this->sessions[$handle][$zone]->generated; 
+	
+      if ($display) echo $c_genere; else return ($c_genere);
+    }
+//fonction complementaire version BETA
+
+/*
+ * 
+ On peut l'utiliser : 
+- SetVarTab($array): tout les couples clef/valeur sont valorisées 
+- SetVarTab($array,$index) seuls les couples clef/valeur dont la clef est dans le tableau index ou dont la valeur == $index (si pas tableau) 
+Si $index contient ou est une clef de type zone.clef, la clef sera extraite du texte est servira d'index pour $array 
+
+Vincent 
+*/
+
+    function setVarTab($handle,$zones,$index = array()){ 
+      if (is_array($index)) 
+      { 
+        if (count($index)>0) 
+        { 
+          reset($index); 
+          while (list (, $key) = each ($index)) 
+          { 
+            $tab=explode(".",$key); 
+            if(count($tab)==2){ 
+              $var=$tab[1]; 
+            } 
+            else 
+            { 
+              $var=$tab[0]; 
+            } 
+            setVar($handle,$key,$zones[$var]); 
+          } 
+        } 
+        else 
+        { 
+          reset($zones); 
+          while (list ($key, $val) = each ($zones)) 
+          { 
+            setVar($handle,$key,$val); 
+          } 
+        } 
+      } 
+      else 
+      { 
+        setVar($handle,$index,$zones[$index]); 
+      } 
+    } 
+
+    function setGlobalVarTab($handle,$zones,$index = array()){ 
+      if (is_array($index)) 
+      { 
+        if (count($index)>0) 
+        { 
+          reset($index); 
+          while (list (, $key) = each ($index)) 
+          { 
+            $tab=explode(".",$key); 
+            if ( count( $tab ) == 2 ) $var=$tab[1]; 
+            else                      $var=$tab[0]; 
+            setGlobalVar( $handle, $key, $zones[$var] );
+          } 
+        } 
+        else 
+        { 
+          reset($zones); 
+          while (list ($key, $val) = each ($zones)) 
+          {
+            GlobalVar($handle,$key,$val); 
+          } 
+        } 
+      } 
+      else 
+      {
+        setBlobalVar($handle,$index,$zones[$index]); 
+      } 
+    } 
+    // End VTemplate
+  }
+  $DEFINE_VTEMPLATE = 1;
+}
+?>
Index: /tags/release-1_3RC1/index.php
===================================================================
--- /tags/release-1_3RC1/index.php	(revision 159)
+++ /tags/release-1_3RC1/index.php	(revision 159)
@@ -0,0 +1,27 @@
+<?php
+/***************************************************************************
+ *                                  index.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+define( PREFIX_INCLUDE, '' );
+include_once( './include/functions.inc.php' );
+database_connection();
+// retrieving configuration informations
+$query = 'SELECT access';
+$query.= ' FROM '.PREFIX_TABLE.'config;';
+$row = mysql_fetch_array( mysql_query( $query ) );
+if ( $row['access'] == 'restricted' ) $url = 'identification';
+else                                  $url = 'category';
+// redirection
+$url.= '.php';
+header( 'Request-URI: '.$url );  
+header( 'Content-Location: '.$url );  
+header( 'Location: '.$url );
+exit();
+?>
Index: /tags/release-1_3RC1/language/english.php
===================================================================
--- /tags/release-1_3RC1/language/english.php	(revision 159)
+++ /tags/release-1_3RC1/language/english.php	(revision 159)
@@ -0,0 +1,592 @@
+<?php
+$lang['only_members'] = 'Only members can access this page';
+$lang['invalid_pwd'] = 'Invalid password!';
+$lang['access_forbiden'] = 'You are not authorized to access this page';
+$lang['submit'] = 'Submit';
+$lang['login'] = 'login';
+$lang['password'] = 'password';
+$lang['new'] = 'new';
+$lang['delete'] = 'delete';
+$lang['category'] = 'category';
+$lang['thumbnail'] = 'thumbnail';
+$lang['date'] = 'date';
+
+// diapo page
+$lang['diapo_default_page_title'] = 'No category selected';
+$lang['thumbnails'] = 'Thumbnails';
+$lang['categories'] = 'Categories';
+$lang['hint_category'] = 'shows images at the root of this categry';
+$lang['total_images'] = 'total';
+$lang['title_menu'] = 'Menu';
+$lang['change_login'] = 'change login';
+$lang['login'] = 'login';
+$lang['hint_login'] = 'identification enables site\'s appareance customization';
+$lang['logout'] = 'logout';
+$lang['customize'] = 'customize';
+$lang['hint_customize'] = 'customize the appareance of the gallery';
+$lang['hint_search'] = 'search';
+$lang['search'] = 'search';
+$lang['favorite_cat'] = 'favorites';
+$lang['favorite_cat_hint'] = 'display your favorites';
+$lang['about'] = 'about';
+$lang['hint_about'] = 'more informations on PhpWebGallery...';
+$lang['admin'] = 'admin';
+$lang['hint_admin'] = 'available for administrators only';
+$lang['no_category'] = 'No category selected<br />please select it in the menu';
+$lang['page_number'] = 'page number';
+$lang['previous_page'] = 'Previous';
+$lang['next_page'] = 'Next';
+$lang['nb_image_category'] = 'number of images in this category';
+$lang['recent_image'] = 'image within the';
+$lang['days'] = 'days';
+$lang['send_mail'] = 'Any comment? Send me an e-mail';
+$lang['title_send_mail'] = 'A comment on your site';
+$lang['sub-cat'] = 'subcategories';
+$lang['images_available'] = 'images in this category';
+$lang['total'] = 'images';
+$lang['upload_picture'] = 'Upload a picture';
+
+// both diapo and photo pages
+$lang['registration_date'] = 'registered on';
+$lang['creation_date'] = 'created on';
+$lang['comment'] = 'comment';
+$lang['author'] = 'author';
+$lang['size'] = 'size';
+$lang['filesize'] = 'filesize';
+$lang['file'] = 'file';
+$lang['generation_time'] = 'Page generated in';
+$lang['favorites'] = 'Favorites';
+$lang['search_result'] = 'Search results';
+
+// about page
+$lang['about_page_title'] = 'About PhpWebGallery';
+$lang['about_title'] = 'About...';
+$lang['about_message'] = '<div style="text-align:center;font-weigh:bold;">Information about PhpWebGallery</div>
+<ul>
+  <li>This website uses <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a> release '.$conf['version'].'. PhpWebGallery is a web application giving you the possibility to create an online images gallery easily.</li>
+  <li>Technicaly, PhpWebGallery is fully developped with PHP (the elePHPant) with a MySQL database (the SQuirreL).</li>
+  <li>If you have any suggestions or comments, please visit <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a> official site, and its dedicated <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a>.</li>
+</ul>';
+$lang['about_return'] = 'Back';
+
+// identification page
+$lang['ident_page_title'] = 'Identification';
+$lang['ident_title'] = 'Identification';
+$lang['ident_register'] = 'Register';
+$lang['ident_forgotten_password'] = 'Forget your password ?';
+$lang['ident_guest_visit'] = 'Go through the gallery as a visitor';
+
+// profile page
+$lang['customize_page_title'] = 'Customization';
+$lang['customize_title'] = 'Customization';
+$lang['customize_nb_image_per_row'] = 'number of images per row';
+$lang['customize_nb_row_per_page'] = 'number of rows per page';
+$lang['customize_language'] = 'language';
+$lang['maxwidth'] = 'maximum width of the pictures';
+$lang['maxheight'] = 'maximum height of the pictures';
+$lang['err_maxwidth'] = 'maximum width must be a number superior to 50';
+$lang['err_maxheight'] = 'maximum height must be a number superior to 50';
+
+// photo page
+$lang['previous_image'] = 'Previous';
+$lang['next_image'] = 'Next';
+$lang['back'] = 'Click on the image to go back to the thumbnails page';
+$lang['info_image_title'] = 'Image information';
+$lang['link_info_image'] = 'Modify information';
+$lang['true_size'] = 'Real size';
+$lang['comments_title'] = 'Comments from the users of the site';
+$lang['comments_del'] = 'delete this comment';
+$lang['comments_add'] = 'Add a comment';
+$lang['month'][1] = 'January';
+$lang['month'][2] = 'February';
+$lang['month'][3] = 'March';
+$lang['month'][4] = 'April';
+$lang['month'][5] = 'May';
+$lang['month'][6] = 'June';
+$lang['month'][7] = 'July';
+$lang['month'][8] = 'August';
+$lang['month'][9] = 'September';
+$lang['month'][10] = 'October';
+$lang['month'][11] = 'November';
+$lang['month'][12] = 'December';
+$lang['day'][0] = 'Sunday';
+$lang['day'][1] = 'Monday';
+$lang['day'][2] = 'Tuesday';
+$lang['day'][3] = 'Wednesday';
+$lang['day'][4] = 'Thursday';
+$lang['day'][5] = 'Friday';
+$lang['day'][6] = 'Saturday';
+$lang['add_favorites_alt'] = 'Add to favorites';
+$lang['add_favorites_hint'] = 'Add this picture to your favorites';
+$lang['del_favorites_alt'] = 'Delete from favorites';
+$lang['del_favorites_hint'] = 'Delete this picture from your favorites';
+	
+// page register
+$lang['register_page_title'] = 'Registration';
+$lang['register_title'] = 'Registration';
+$lang['reg_err_login1'] = 'Please, enter a login';
+$lang['reg_err_login2'] = 'login mustn\'t end with a space character';
+$lang['reg_err_login3'] = 'login mustn\'t start with a space character';
+$lang['reg_err_login4'] = 'login mustn\'t contain characters " and \'';
+$lang['reg_err_login5'] = 'this login is already used';
+$lang['reg_err_pass'] = 'please enter your password again';
+$lang['reg_confirm'] = 'confirm';
+$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
+	
+// page search
+$lang['search_title'] = 'Search';
+$lang['invalid_search'] = 'search must be done on 3 caracters or more';
+$lang['search_field_search'] = 'Search';
+$lang['search_return_main_page'] = 'Return to thumbnails page';
+	
+// page upload
+$lang['upload_forbidden'] = 'You can\'t upload pictures in this category';
+$lang['upload_file_exists'] = 'A picture\'s name already used';
+$lang['upload_filenotfound'] = 'You must choose a picture fileformat for the image';
+$lang['upload_cannot_upload'] = 'can\'t upload the picture on the server';
+$lang['upload_title'] = 'Upload a picture';
+$lang['upload_advise'] = 'Choose an image to place in the category : ';
+$lang['upload_advise_thumbnail'] = 'Optional, but recommended : choose a thumbnail to associate to ';
+$lang['upload_advise_filesize'] = 'the filesize of the picture must not exceed : ';
+$lang['upload_advise_width'] = 'the width of the picture must not exceed : ';
+$lang['upload_advise_height'] = 'the height of the picture must not exceed : ';
+$lang['upload_advise_filetype'] = 'the picture must be to the fileformat jpg, gif or png';
+$lang['upload_err_username'] = 'the username must be given';
+$lang['upload_username'] = 'Username';
+$lang['upload_successful'] = 'Picture uploaded with success, an administrator will validate it as soon as possible';
+
+// new in release 1.3
+$lang['charset'] = 'ISO_8859-1';
+$lang['no'] = 'no';
+$lang['yes'] = 'yes';
+$lang['guest'] = 'guest';
+$lang['mail_address'] = 'mail address';
+$lang['public'] = 'public';
+$lang['private'] = 'private';
+$lang['add'] = 'add';
+$lang['dissociate'] = 'dissociate';
+$lang['mandatory'] = 'obligatory';
+$lang['err_date'] = 'wrong date';
+$lang['picture'] = 'picture';
+$lang['IP'] = 'IP';
+$lang['close'] = 'close';
+$lang['open'] = 'open';
+$lang['keywords'] = 'keywords';
+$lang['errors_title'] = 'Errors';
+$lang['infos_title'] = 'Informations';
+$lang['default'] = 'default';
+$lang['comments'] = 'comments';
+$lang['category_representative'] = 'representative';
+$lang['stats'] = 'statistics';
+$lang['most_visited_cat_hint'] = 'displays most visited pictures';
+$lang['most_visited_cat'] = 'most visited';
+$lang['best_rated_cat_hint'] = 'displays pictures best rated';
+$lang['best_rated_cat'] = 'best rated';
+$lang['recent_cat_hint'] = 'displays most recent pictures';
+$lang['recent_cat'] = 'most recent';
+$lang['recent_cat_title'] = 'Recent pictures';
+$lang['visited'] = 'visited';
+$lang['times'] = 'times';
+$lang['customize_theme'] = 'interface theme';
+$lang['customize_expand'] = 'expand all categories';
+$lang['customize_show_nb_comments'] = 'show number of comments';
+$lang['customize_short_period'] = 'short period';
+$lang['customize_long_period'] = 'long period';
+$lang['customize_template'] = 'template';
+$lang['err_periods'] = 'periods must be integer values';
+$lang['err_periods_2'] = 'periods must be superior to 0. The long period must be grater than the short period.';
+$lang['create_cookie'] = 'create a cookie';
+$lang['customize_day'] = 'day';
+$lang['customize_week'] = 'week';
+$lang['customize_month'] = 'month';
+$lang['customize_year'] = 'year';
+$lang['slideshow'] = 'slideshow';
+$lang['period_seconds'] = 'seconds per picture';
+$lang['slideshow_stop'] = 'stop the slideshow';
+$lang['comment_added'] = 'Your comment has been registered';
+$lang['comment_to_validate'] = 'An administrator must authorize your comment before it is visible.';
+$lang['comment_anti-flood'] = 'Anti-flood system : please wait for a moment before trying to post another comment';
+$lang['comment_user_exists'] = 'This login is already used by another user';
+$lang['invalid_search'] = 'Searched words must be grater than 3 characters and must not contain punctuation mark';
+$lang['search_mode_or'] = 'at least one word';
+$lang['search_mode_and'] = 'all the words';
+$lang['search_comments'] = 'separate different words with spaces';
+$lang['upload_name'] = 'Name of the picture';
+$lang['upload_author'] = 'Author (eg "Pierrick LE GALL")';
+$lang['upload_creation_date'] = 'Creation date (DD/MM/YYYY)';
+$lang['upload_comment'] = 'Comment';
+$lang['mail_hello'] = 'Hi,';
+$lang['mail_new_upload_subject'] = 'New picture on the website';
+$lang['mail_new_upload_content'] = 'A new picture has been uploaded on the gallery. It is waiting for your validation. Let\'s meet in the administration panel to authorize or refuse this picture.';
+$lang['mail_new_comment_subject'] = 'New comment on website';
+$lang['mail_new_comment_content'] = 'A new comment has been registered on the gallery. If you chose to validate each comment, you first have to validate this comment in the administration panel to make it visible in the gallery.'."\n\n".'You can see last comments in the administration panel';
+$lang['connected_user'] = 'connected user';
+
+//-------------------------------------------------------------- administration
+if ( $isadmin )
+{
+  // page admin
+  $lang['title_liste_users'] = 'Users list';
+  $lang['title_history'] = 'History';
+  $lang['title_update'] = 'Database update';
+  $lang['title_configuration'] = 'PhpWebGallery configuration';
+  $lang['title_instructions'] = 'Instructions';
+  $lang['title_categories'] = 'Categories management';
+  $lang['title_edit_cat'] = 'Edit a category';
+  $lang['title_info_images'] = 'Modify category\'s image information';
+  $lang['title_thumbnails'] = 'Thumbnail creation';
+  $lang['title_thumbnails_2'] = 'for';
+  $lang['title_default'] = 'PhpWebGallery administration';
+
+  $lang['menu_title'] = 'Administration';
+  $lang['menu_config'] = 'Configuration';
+  $lang['menu_users'] = 'Users';
+  $lang['menu_add_user'] = 'add';
+  $lang['menu_list_user'] = 'list';
+  $lang['menu_categories'] = 'Categories';
+  $lang['menu_update'] = 'Database update';
+  $lang['menu_thumbnails'] = 'Thumbnails';
+  $lang['menu_history'] = 'History';
+  $lang['menu_instructions'] = 'Instructions';
+  $lang['menu_back'] = 'Back to galleries';
+		
+  $lang['title_waiting'] = 'Pictures waiting for validation';
+  $lang['menu_waiting'] = 'Waiting';
+
+  $lang['default_message'] = 'PhpWebGallery administration panel';
+
+  // page de configuration  
+  $lang['conf_err_prefixe'] = 'thumbnail\'s prefix mustn\'t contain any accentued character';
+  $lang['conf_err_mail'] = 'e-mail address refused, it must be like name@server.com';
+  $lang['conf_err_sid_size'] = 'the session identifier size must be an integer value between 4 and 50';
+  $lang['conf_err_sid_time'] = 'the session time must be an integer value between 5 and 60';
+  $lang['conf_err_max_user_listbox'] = 'the max user listbox number must be an integer value between 0 and 255';
+  $lang['conf_confirmation'] = 'Information data registered in database';
+		
+  $lang['conf_general_title'] = 'Main configuration';
+  $lang['conf_general_webmaster'] = 'webmaster login';
+  $lang['conf_general_webmaster_info'] = 'It will be shown to the visitors. It is necessary for website administration';
+  $lang['conf_general_mail'] = 'webmaster mail adress';
+  $lang['conf_general_mail_info'] = 'Visitors will be able to contact by this mail';
+  $lang['conf_general_prefix'] = 'thumbnail prefix';
+  $lang['conf_general_prefix_info'] = 'Thumbnails use this prefix. Do not fill if your not sure.';
+  $lang['conf_general_access'] = 'access type';
+  $lang['conf_general_access_1'] = 'free';
+  $lang['conf_general_access_2'] = 'restricted';
+  $lang['conf_general_access_info'] = '- free : anyone can enter the site, any visitor can create an account in order to customize the appareance of the website<br />- restricted : the webmaster create accounts. Only registered users can enter the site';
+  $lang['conf_general_max_user_listbox'] = 'max listbox users number';
+  $lang['conf_general_max_user_listbox_info'] = '- this is the number maximum of users for which PhpWebGallery display a listbox instead of a simple text box on the identification page<br />- enter a number between 0 and 255, 0 means that you want to display the listbox';
+  $lang['conf_comments'] = 'users comments';
+  $lang['conf_comments_title'] = 'Configuration of '.$lang['conf_comments'];
+  $lang['conf_comments_show_comments'] = $lang['conf_comments'];
+  $lang['conf_comments_show_comments_info'] = 'display the users comments under each picture ?';
+  $lang['conf_comments_comments_number'] = 'number of comments per page';
+  $lang['conf_comments_comments_number_info'] = 'number of comments to display on each page. This number is unlimited for a picture. Enter a number between 5 and 50.';
+  $lang['conf_err_comment_number'] = 'The number of comments a page must be between 5 and 50 included.';
+  $lang['conf_remote_site_delete_info'] = 'Deleting a remote server will delete all the image and the categories in relation with this server.';
+  $lang['conf_upload_title'] = 'Configuration of the users upload';
+  $lang['conf_upload_available'] = 'authorized the upload of pictures';
+  $lang['conf_upload_available_info'] = 'Authorizing the upload of pictures by users on the categories of the website (not on a remote server).';
+  $lang['conf_upload_maxfilesize'] = 'maximum filesize';
+  $lang['conf_upload_maxfilesize_info'] = 'Maximum filesize for the uploaded pictures. Must be a number between 10 and 1000 Ko.';
+  $lang['conf_err_upload_maxfilesize'] = 'Maximum filesize for the uploaded pictures must be a number between 10 and 1000 Ko.';
+  $lang['conf_upload_maxwidth'] = 'maximum width';
+  $lang['conf_upload_maxwidth_info'] = 'Maximum width authorized for the uploaded images. Must be a number superior to 10 pixels';
+  $lang['conf_err_upload_maxwidth'] = 'maximum width authorized for the uploaded images must be a number superior to 10 pixels.';
+  $lang['conf_upload_maxheight'] = 'maximum height';
+  $lang['conf_upload_maxheight_info'] = 'Maximum height authorized for the uploaded images. Must be a number superior to 10 pixels';
+  $lang['conf_err_upload_maxwidth'] = 'maximum height authorized for the uploaded images must be a number superior to 10 pixels.';
+  $lang['conf_upload_maxwidth_thumbnail'] = 'thumbnails maximum width';
+  $lang['conf_upload_maxwidth_thumbnail_info'] = 'Maximum width authorized for the uploaded thumbnails. Must be a number superior to 10 pixels';
+  $lang['conf_err_upload_maxwidth_thumbnail'] = 'Maximum width authorized for the uploaded thumbnails must be a number superior to 10 pixels.';
+  $lang['conf_upload_maxheight_thumbnail'] = 'thumbnails maximum height';
+  $lang['conf_upload_maxheight_thumbnail_info'] = 'Maximum height authorized for the uploaded thumbnails. Must be a number superior to 10 pixels';
+  $lang['conf_err_upload_maxheight_thumbnail'] = 'Maximum height authorized for the uploaded thumbnails must be a number superior to 10 pixels.';
+		
+  $lang['conf_default_title'] = 'Default display properties for unregistered visitors and new accounts';
+  $lang['conf_default_language_info'] = 'default language';
+  $lang['conf_default_theme_info'] = 'default theme';
+		
+  $lang['conf_session_title'] = 'Sessions configuration';
+  $lang['conf_session_size'] = 'identifier size';
+  $lang['conf_session_size_info'] = '- the longer your identifier is, the more secure your site is<br />- enter a number between 4 and 50';
+  $lang['conf_session_time'] = 'validity period';
+  $lang['conf_session_time_info'] = '- the shorter the validity period is, the more secure your site is<br />- enter a number between 5 and 60, in minutes';
+  $lang['conf_session_key'] = 'keyword';
+  $lang['conf_session_key_info'] = '- the session keyword improve the encoding of the session identifier<br />- enter any sentence shorter than 255 caracters';
+  $lang['conf_session_delete'] = 'delete out-of-date sessions';
+  $lang['conf_session_delete_info'] = 'it is recommanded to empty the database table of session, because out-of-date sessions remains in the database (but it doesn\'t make any security trouble)';
+		
+  // page user, clés générales
+  $lang['user_err_modify'] = 'This user can\'t be modified or deleted';
+  $lang['user_err_unknown'] = 'This user doesn\'t exist in the database';
+		
+  // page d\'ajout/modification d\'utilisateur
+  $lang['adduser_info_message'] = 'Informations registered in the database for user ';
+  $lang['adduser_info_password_updated'] = '(password updated)';
+  $lang['adduser_info_back'] = 'back to the users list';
+		
+  $lang['adduser_fill_form'] = 'Please fill the following form';
+  $lang['adduser_unmodify'] = 'unmodifiable';
+  $lang['adduser_status'] = 'status';
+  $lang['adduser_status_admin'] = 'admin';
+  $lang['adduser_status_guest'] = 'guest';
+		
+  // page permissions
+  $lang['permuser_info_message'] = 'Permissions registered';
+  $lang['permuser_title'] = 'Restrictions for user';
+  $lang['permuser_warning'] = 'Warning : a "<span style="font-weight:bold;">forbidden access</span>" to the root of a category prevent from accessing the whole category';
+  $lang['permuser_authorized'] = 'authorized';
+  $lang['permuser_forbidden'] = 'forbidden';
+  $lang['permuser_parent_forbidden'] = 'parent category forbidden';
+
+  // page list users
+  $lang['listuser_confirm'] = 'Do you really want to delete this user';
+  $lang['listuser_info_deletion'] = 'was removed from database';
+  $lang['listuser_user_group'] = 'Users group';
+  $lang['listuser_modify'] = 'modify';
+  $lang['listuser_modify_hint'] = 'modify informations of';
+  $lang['listuser_permission'] = 'permissions';
+  $lang['listuser_permission_hint'] = 'modify permissions of';
+  $lang['listuser_delete'] = 'delete';
+  $lang['listuser_delete_hint'] = 'delete user';
+  $lang['listuser_button_all'] = 'all';
+  $lang['listuser_button_invert'] = 'invert';
+  $lang['listuser_button_create_address'] = 'create mail address';
+		
+  // page categories
+  $lang['cat_invisible'] = 'invisible';
+  $lang['cat_edit'] = 'Edit';
+  $lang['cat_up'] = 'Move up';
+  $lang['cat_down'] = 'Move down';
+  $lang['cat_image_info'] = 'Images info';
+  $lang['cat_total'] = 'total';
+		
+  // page édition d\'une catégorie
+  $lang['editcat_confirm'] = 'Information registered in the database';
+  $lang['editcat_back'] = 'categories';
+  $lang['editcat_title1'] = 'Options for the';
+  $lang['editcat_name'] = 'Name';
+  $lang['editcat_comment'] = 'Comment';
+  $lang['editcat_status'] = 'Status';
+		
+  // page info images
+  $lang['infoimage_general'] = 'General options for the category';
+  $lang['infoimage_useforall'] = 'use for all pictures ?';
+  $lang['infoimage_creation_date'] = 'creation date';
+  $lang['infoimage_detailed'] = 'Option for each picture';
+  $lang['infoimage_title'] = 'title';
+  $lang['infoimage_comment'] = 'comment';
+		
+  // page database update
+  $lang['update_missing_tn'] = 'the thumbnail is missing for';
+  $lang['update_disappeared_tn'] = 'the thumbnail disapeared';
+  $lang['update_disappeared'] = 'doesn\'t exist';
+  $lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist';
+  $lang['update_deletion_conclusion'] = 'pictures removed from database';
+  $lang['update_part_research'] = 'Search for new images in the directories';
+  $lang['update_research_added'] = 'added';
+  $lang['update_research_tn_ext'] = 'thumbnail in';
+  $lang['update_research_conclusion'] = 'pictures added to the database';
+  $lang['update_default_title'] = 'Choose an option';
+  $lang['update_only_cat'] = 'update categories, not pictures';
+  $lang['update_all'] = 'update all';
+		
+  // page de génération miniatures
+  $lang['tn_width'] = 'width';
+  $lang['tn_height'] = 'height';
+		
+  $lang['tn_no_support'] = 'Picture unreachable or no support';
+  $lang['tn_format'] = 'for the file format';
+  $lang['tn_thisformat'] = 'for this file format';
+  $lang['tn_err_width'] = 'width must be a number superior to';
+  $lang['tn_err_height'] = 'height must be a number superior to';
+		
+  $lang['tn_results_title'] = 'Results of miniaturization';
+  $lang['tn_picture'] = 'picture';
+  $lang['tn_results_gen_time'] = 'generated in';
+		
+  $lang['tn_stats'] = 'General statistics';
+  $lang['tn_stats_nb'] = 'number of miniaturized pictures';
+  $lang['tn_stats_total'] = 'total time';
+  $lang['tn_stats_max'] = 'max time';
+  $lang['tn_stats_min'] = 'min time';
+  $lang['tn_stats_mean'] = 'average time';
+		
+  $lang['tn_err'] = 'You made mistakes';
+		
+  $lang['tn_params_title'] = 'Miniaturization parameters';
+  $lang['tn_params_GD'] = 'GD version';
+  $lang['tn_params_GD_info'] = '- GD is the picture manipulating library for PHP<br />-choose the version installed on your server. If you choose the wrong, you\'ll just have errors messages, come back with your browser and choose the other version. If no version works, it means your server doesn\'t support GD.';
+  $lang['tn_params_width_info'] = 'maximum width that thumbnails can take';
+  $lang['tn_params_height_info'] = 'maximum height that thumbnails can take';
+  $lang['tn_params_create'] = 'create';
+  $lang['tn_params_create_info'] = 'Do not try to miniaturize too many pictures in the same time.<br />Indeed, miniaturization uses a lot of CPU. If you installed PhpWebGallery on a free provider, a too high CPU load can sometime lead to the deletion of your website.';
+  $lang['tn_params_format'] = 'file format';
+  $lang['tn_params_format_info'] = 'only jpeg file format is supported for thumbnail creation';
+		
+  $lang['tn_alone_title'] = 'pictures without thumbnail (jpeg and png only)';
+		
+  $lang['tn_dirs_title'] = 'Directories list';
+  $lang['tn_dirs_alone'] = 'pictures without thumbnail';
+		
+  // help page
+  $lang['help_images_title'] = 'Adding pictures';
+  $lang['help_images_intro'] = 'How to place pictures in your directories';
+  $lang['help_images'][0] = 'in the directory "galleries", create directories that will represent your categories';
+  $lang['help_images'][1] = 'in each directory, you can create as many sub-level directories as you wish.';
+  $lang['help_images'][2] = 'you can create as many categories and sub-categories for each category as you wish';
+  $lang['help_images'][3] = 'picture files must have jpeg format (extension jpg or JPG), gif format (extension gif or GIF) or png format (extension png or PNG).';
+  $lang['help_images'][4] = 'try not to use blank space " " or hyphen "-" in picture files, I advise you to use underscore "_" character which is managed by PhpWebGallery and will provide better results';
+		
+  $lang['help_thumbnails_title'] = 'Thumbnails';
+  $lang['help_thumbnails'][0] = 'in each directory containing picture to display on your site, there is a sub-directory nammed "thumbnail", if it doesn\'t exist, create it to place your thumbnails into it.';
+  $lang['help_thumbnails'][1] = 'thumbnails don\'t need to have the same extension as their associated picture (a picture with .jpg extension can have a thumbnail in .GIF extention for instance).';
+  $lang['help_thumbnails'][2] = 'the thumbnail associated to a picture must be prefixed with the prefix given on the configuration page(image.jpg -> TN_image.GIF for instance).';
+  $lang['help_thumbnails'][3] = 'I advise you to use the module for windows downloadable on the presentation site of PhpWebGallery for thumbnails management.';
+  $lang['help_thumbnails'][4] = 'you can use the thumbnail creation page integrated in PhpWebGallery, but I don\'t advice you so, because thumbnail quality may be poor and it uses a high CPU load which can be a problem if you use free web hosting.';
+  $lang['help_thumbnails'][5] = 'if you choose to use your hosting provider to create thumbnails, you must give 775 rights on "galleries" folder and all its sub-folders.';
+		
+  $lang['help_database_title'] = 'Updating database';
+  $lang['help_database'][0] = 'once pictures files and thumbnails correctly placed in the directories, clic on "database update" in the menu of the administration panel.';
+		
+  $lang['help_infos_title'] = 'Miscellanous informations';
+  $lang['help_infos'][1] = 'As soon as you created your gallery, go in the user list and modify permissions for user "visiteur". Indeed, every new registered users will have by default the same permissions as "visiteur" user.';
+		
+  $lang['help_remote_title'] = 'Remote site';
+  $lang['help_remote'][0] = 'PhpWebGallery offers the possibility to use several servers to store the images which will compose your gallery. It can be useful if your gallery is installed on one limited space and that you have a big quantity of images to be shown. Please , follow this procedure : ';
+  $lang['help_remote'][1] = '1. edit file "create_listing_file.php" (you will find it in the directory "admin"), by modifying the line "$prefix_thumbnail = "TN-";" if the prefix for your thumbnails is not "TN-".';
+  $lang['help_remote'][2] = '2. place file "create_listing_file.php" modified on your distant website, in the root directory of your directories of images  (as the directory "galleries" of this website) by ftp.';
+  $lang['help_remote'][3] = '3. launch script using the url http://domaineDistant/repGalerie/create_listing_file.php, a file listing.xml has just been created.';
+  $lang['help_remote'][4] = '4. get back file listing.xml from your distant website to place it in directory "admin" of this website.';
+  $lang['help_remote'][5] = '5. please , launch an update of the data of images by the interface of administration, once the listing.xml used file, kill it from the directory "admin".';
+  $lang['help_remote'][6] = 'You can update the contents of a distant website by redoing the described manipulation. You can also kill a distant website by choosing the option in the configuration section of the administration panel.'.
+		
+    $lang['help_upload_title'] = 'Added images by users';
+  $lang['help_upload'][0] = 'PhpWebGallery offers the possibility for users to upload images. in order to do it :';
+  $lang['help_upload'][1] = '1. authorize the option in the configuration zone of the administration panel';
+  $lang['help_upload'][2] = '2. authorize the rights in writing in the images directories';
+	
+  // installation
+  $lang['install_message'] = 'Message';
+		
+  $lang['step1_confirmation'] = 'Parameters are correct';
+  $lang['step1_err_db'] = 'Connection to server succeed, but it was impossible to connect to database';
+  $lang['step1_err_server'] = 'Can\'t connect to server';
+  $lang['step1_err_copy_2'] = 'The next step of the installation is now possible';
+  $lang['step1_err_copy_next'] = 'next step';
+  $lang['step1_title'] = 'Step 1/2';
+  $lang['step1_host'] = 'MySQL host';
+  $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
+  $lang['step1_user'] = 'user';
+  $lang['step1_user_info'] = 'user login given by your host provider';
+  $lang['step1_pass'] = 'Password';
+  $lang['step1_pass_info'] = 'user password given by your host provider';
+  $lang['step1_database'] = 'Database name';
+  $lang['step1_database_info'] = 'also given by your host provider';
+  $lang['step1_prefix'] = 'Database table prefix';
+  $lang['step1_prefix_info'] = 'database tables names will be prefixed with it (enables you to manage better your tables)';
+
+  $lang['step2_err_login1'] = 'enter a login for webmaster';
+  $lang['step2_err_login3'] = 'webmaster login can\'t contain characters \' or "';
+  $lang['step2_err_pass'] = 'please enter your password again';
+  $lang['step2_err_mail'] = $lang['conf_err_mail'];
+		
+  $lang['install_end_title'] = 'Installation finished';
+  $lang['install_end_message'] = 'The configuration of PhpWebGallery is finished, here is the next step<br /><br />
+For security reason, please delete file "install.php" in the directory "admin"<br />
+Once this file deleted , follow this instructions :
+<ul>
+  <li>go to the identification page : [ <a href="../identification.php">identification</a> ] and use the login/password given for webmaster</li>
+  <li>this login will enable you to access to the [ <a href="admin.php">administration panel</a> ] and to the instructions in order to place pictures in your directories</li>
+</ul>';
+  $lang['step2_title'] = 'Step 2/2';
+  $lang['step2_pwd'] = 'webmaster password';
+  $lang['step2_pwd_info'] = 'Keep it confidential, it enables you to access administration panel';
+  $lang['step2_pwd_conf'] = 'confirm password';
+  $lang['step2_pwd_conf_info'] = 'verification';
+
+  // new in release 1.3
+  $lang['remote_site'] = 'Remote site';
+  $lang['title_add'] = 'Add a user';
+  $lang['title_modify'] = 'Modify a user';
+  $lang['title_groups'] = 'Groups management';
+  $lang['title_user_perm'] = 'Modify permission for user';
+  $lang['title_cat_perm'] = 'Modify permissions for category';
+  $lang['title_group_perm'] = 'Modify permissions for group';
+  $lang['title_comments'] = 'Users comments';
+  $lang['title_picmod'] = 'Modify informations about a picture';
+  $lang['menu_groups'] = 'Groups';
+  $lang['menu_comments'] = 'Comments';
+  $lang['conf_general_log'] = 'history';
+  $lang['conf_general_log_info'] = 'Keep an history of visits on your website ? Visits will be shown in the history section of the administration panel';
+  $lang['conf_general_mail_notification'] = 'Mail notification';
+  $lang['conf_general_mail_notification_info'] = 'Automated mail notification for adminsitrators (and only for them) when a user add a comment or upload a picture.';
+  $lang['conf_comments_validation'] = 'validation';
+  $lang['conf_comments_validation_info'] = 'An administrator validate users posted comments before the becom visible on the site';
+  $lang['conf_comments_forall'] = 'for all ?';
+  $lang['conf_comments_forall_info'] = 'Even guest not registered can post comments';
+  $lang['conf_default_nb_image_per_row_info'] = 'number of pictures for each row by default';
+  $lang['conf_default_nb_row_per_page_info'] = 'number of rows by page by default';
+  $lang['conf_default_short_period_info'] = 'By days. Period within a picture is shown with a red mark. The short period must be superior to 1 day.';
+  $lang['conf_default_long_period_info'] = 'By days. Period within a picture is shown with a green mark. The long period must be superior to the short period.';
+  $lang['conf_default_expand_info'] = 'expand all categories by default in the menu ?';
+  $lang['conf_default_show_nb_comments_info'] = 'show the number of comments for each picture on the thumbnails page';
+  $lang['conf_default_maxwidth_info'] = 'Maximum width for display pictures : picture will have a new width only for display, picture files won\'t be changed. Let empty if you don\'t wish to have a limit.';
+  $lang['conf_default_maxheight_info'] = 'Just as the maximum width, but for the height';
+  $lang['conf_session_cookie'] = 'authorize cookies';
+  $lang['conf_session_cookie_info'] = 'users won\'t have to log on each visit any more. Less secure.';
+  $lang['adduser_associate'] = 'Associate to group';
+  $lang['group_add'] = 'Add a group';
+  $lang['group_add_error1'] = 'The name of a group must not contain " or \'';
+  $lang['group_add_error2'] = 'This name is already used by another group';
+  $lang['group_confirm'] = 'Are you sure you want to remove this group ?';
+  $lang['group_list_title'] = 'List of existing groups';
+  $lang['group_err_unknown'] = 'This group doesn\'t exist in the database';
+  $lang['cat_permission'] = 'permissions';
+  $lang['cat_update'] = 'update';
+  $lang['cat_add'] = 'Add a virtual category';
+  $lang['cat_parent'] = 'parent category';
+  $lang['cat_error_name'] = 'The name of a category mustn\'t be empty';
+  $lang['cat_virtual'] = 'virtual';
+  $lang['cat_first'] = 'Move first';
+  $lang['cat_last'] = 'Move last';
+  $lang['editcat_visible_info'] = '(invisible but for administrators)';
+  $lang['editcat_visible'] = 'Visible';
+  $lang['editcat_uploadable'] = 'Upload available';
+  $lang['infoimage_keyword_separation'] = '(separate with coma ",")';
+  $lang['infoimage_addtoall'] = 'add to all';
+  $lang['infoimage_removefromall'] = 'remove from all';
+  $lang['infoimage_associate'] = 'Associate to the category';
+  $lang['update_wrong_dirname'] = 'The name of the directory must be composed of letters, figures, "-", "_" or "."';
+  $lang['stats_last_days'] = 'last days';
+  $lang['stats_pages_seen'] = 'pages seen';
+  $lang['stats_visitors'] = 'guests';
+  $lang['stats_empty'] = 'empty history';
+  $lang['stats_pages_seen_graph_title'] = 'Number of pages seen by day';
+  $lang['stats_visitors_graph_title'] = 'Number of guests by day';
+  $lang['comments_last_title'] = 'Last comments';
+  $lang['comments_non_validated_title'] = 'Comments waiting for validation';
+  $lang['help_database'][1] = 'In order to avoid the update of too many pictures in a single update, I advise to start by updating only categories, then on the categories section of the administration panel, update each category thanks to the link "update"';
+  $lang['help_upload'][3] = 'The category must have upload available itself for upload.';
+  $lang['help_upload'][4] = 'Uploaded images by the users are not directly visible on the website, they must be validated by an administrator.  For that purpose, an administrator must go on the page "en attente" of the administration panel, to validate or to refuse the images proposed, then launch an update of the images data.';
+  $lang['help_virtual_title'] = 'Links between pictures and categories and virtual categories';
+  $lang['help_virtual'][0] = 'PhpWebGallery is able to dissociate categories where pictures are stored and categories where pictures are shown.';
+  $lang['help_virtual'][1] = 'By default, pictures are shown only in their real categories : the ones corresponding to directories on the web server.';
+  $lang['help_virtual'][2] = 'To link a picture to a category, you just have to make the association on the page of picture informations or on the informations of all pictures of a category.';
+  $lang['help_virtual'][3] = 'Using this principle, it is possible to create virtual categories in PhpWebGallery : no real directory coresponds to this category. You just have to create this category on the section "categories" of the admin panel.';
+  $lang['help_groups_title'] = 'Users Groups';
+  $lang['help_groups'][0] = 'PhpWebGallery is able to manage groups of users. It can be very useful to have common permission access for private categories.';
+  $lang['help_groups'][1] = '1. Create the group "family" on the section "Groups" of admin panel.';
+  $lang['help_groups'][2] = '2. On the section "Users", edit on of them and associate him to the group "family".';
+  $lang['help_groups'][3] = '3. By modifying the permissions for a category or for a group, you\'ll see that all categories accessible for a group are accessible for its members.';
+  $lang['help_groups'][4] = 'A user can belong to several groups. The authorization is stronger than prohibition : if a user "jack" belongs to the group "family" and "friends", and that only group "family" can see category "Christmas 2003", "jack" will be able to see "Christmas 2003".';
+  $lang['help_access_title'] = 'Access authorization';
+  $lang['help_access'][0] = 'PhpWebGallery is able to forbid access to categories. Categories can be "public" or "private". In order to forbid access to a category :';
+  $lang['help_access'][1] = '1. Modify category informations (from the "categories" section in tha admin panel) and make it "private".';
+  $lang['help_access'][2] = '2. On the page of permissions (for a group or a user) the private category will be shown and you\'ll be able to authorize access or not.';
+  $lang['help_infos'][2] = 'If you have any question, do not hesitate to take a look at the forum or ask a question there. The <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a> (message board) is available on the presentation site of PhpWebGallery.';
+  $lang['step1_err_copy'] = 'Copy the text between hyphens and paste it into the file "include/mysql.inc.php"(Warning : mysql.inc.php must only contain what is in blue, no line return or space character)';
+  $lang['permuser_only_private'] = 'Only private categories are shown';
+}
+?>
Index: /tags/release-1_3RC1/language/francais.php
===================================================================
--- /tags/release-1_3RC1/language/francais.php	(revision 159)
+++ /tags/release-1_3RC1/language/francais.php	(revision 159)
@@ -0,0 +1,740 @@
+<?php
+// start version 1.3
+$lang['charset'] = 'ISO_8859-1';
+// end version 1.3
+$lang['only_members'] = 'Seuls les membres du site peuvent accéder à cette page';
+$lang['invalid_pwd'] = 'le mot de passe rentré n\'est pas valide';
+$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé à aller dans cette section';
+$lang['submit'] = 'Valider';
+$lang['login'] = 'login';
+$lang['password'] = 'mot de passe';
+$lang['new'] = 'nouveau';
+$lang['delete'] = 'supprimer';
+$lang['category'] = 'catégorie';
+$lang['thumbnail'] = 'miniature';
+$lang['date'] = 'date';
+// start version 1.3
+$lang['no'] = 'non';
+$lang['yes'] = 'oui';
+$lang['guest'] = 'visiteur';
+$lang['mail_address'] = 'adresse mail';
+$lang['public'] = 'publique';
+$lang['private'] = 'privée';
+$lang['add'] = 'ajouter';
+$lang['dissociate'] = 'dissocier';
+$lang['mandatory'] = 'obligatoire';
+$lang['err_date'] = 'date erronée';
+$lang['picture'] = 'image';
+$lang['IP'] = 'IP';
+$lang['close'] = 'fermer';
+$lang['open'] = 'ouvrir';
+$lang['keywords'] = 'mots-clefs';
+$lang['errors_title'] = 'Erreurs';
+$lang['infos_title'] = 'Informations';
+$lang['default'] = 'défaut';
+$lang['comments'] = 'commentaires';
+$lang['category_representative'] = 'représentant';
+// end version 1.3
+
+// page diapo
+$lang['diapo_default_page_title'] = 'Aucune catégorie séléctionnée';
+$lang['thumbnails'] = 'Miniatures';
+$lang['categories'] = 'Rubriques';
+$lang['hint_category'] = 'affiche les images à la racine de cette catégorie';
+$lang['total_images'] = 'total';
+$lang['title_menu'] = 'Sommaire';
+$lang['change_login'] = 'changer de login';
+$lang['hint_login'] = 's&#039;identifier permet de personnaliser l&#039;apparence du site';
+$lang['logout'] = 'logout';
+$lang['customize'] = 'personnalisation';
+$lang['hint_customize'] = 'personnaliser votre affichage';
+$lang['hint_search'] = 'lancer une recherche';
+$lang['search'] = 'rechercher';
+$lang['favorite_cat'] = 'favoris';
+$lang['favorite_cat_hint'] = 'afficher vos favoris';
+$lang['about'] = 'à propos';
+$lang['hint_about'] = 'des infos sur PhpWebGallery...';
+$lang['admin'] = 'admin';
+$lang['hint_admin'] = 'accessible uniquement aux administrateurs';
+$lang['no_category'] = 'Aucune rubrique n\'est selectionnée,<br />veuillez en choisir une dans le menu.';
+$lang['page_number'] = 'numéro de page';
+$lang['previous_page'] = 'Précédente';
+$lang['next_page'] = 'Suivante';
+$lang['nb_image_category'] = 'nombre d\'images dans la catégorie';
+// start version 1.3
+//$lang['connected_user_female'] = 'utilisatrice connectée';
+$lang['connected_user'] = 'utilisateur connecté';
+// end version 1.3
+$lang['recent_image'] = 'image datant de moins de';
+$lang['days'] = 'jours';
+$lang['send_mail'] = 'Une remarque : mailez moi';
+$lang['title_send_mail'] = '[phpwebgallery] une remarque sur ton site';
+$lang['sub-cat'] = 'sous-catégories';
+$lang['images_available'] = 'images dans cette catégorie';
+$lang['total'] = 'images';
+$lang['upload_picture'] = 'Ajouter une image';
+
+// page diapo et photo
+$lang['registration_date'] = 'enregistré le';
+$lang['creation_date'] = 'créé le';
+$lang['comment'] = 'commentaire';
+$lang['author'] = 'auteur';
+$lang['size'] = 'dimensions';
+$lang['filesize'] = 'poids';
+$lang['file'] = 'fichier';
+$lang['generation_time'] = 'Page générée en';
+$lang['favorites'] = 'Favoris';
+$lang['search_result'] = 'Résultats de la recherche';
+// start version 1.3
+$lang['stats'] = 'statistiques';
+$lang['most_visited_cat_hint'] = 'affiche les images les plus visitées';
+$lang['most_visited_cat'] = 'plus vues';
+$lang['best_rated_cat_hint'] = 'affiche les images les mieux notées';
+$lang['best_rated_cat'] = 'mieux notées';
+$lang['recent_cat_hint'] = 'affiche les images les plus récentes';
+$lang['recent_cat'] = 'plus récentes';
+$lang['recent_cat_title'] = 'Images récentes';
+$lang['visited'] = 'visité';
+$lang['times'] = 'fois';
+// end version 1.3
+	
+// page a_propos
+$lang['about_page_title'] = 'A propos de PhpWebGallery';
+$lang['about_title'] = 'A propos...';
+// start version 1.3
+$lang['about_message'] = '<div style="text-align:center;font-weigh:bold;">Informations sur le PhpWebGallery</div>
+<ul>
+  <li>Ce site utilise la version '.$conf['version'].' de <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a>. PhpWebGallery est une application web permettant de créer simplement une galerie d\'images en ligne.</li>
+  <li>D\'un point de vue technique, PhpWebGallery est entièrement développé en PHP (l\'elePHPant) avec une base de données MySQL(le mySQreuiL).</li>
+  <li>Si vous avez des suggestions ou des commentaires, n\'hésitez pas à visiter le site de <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a> et son <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a>.</li>
+</ul>';
+// end version 1.3
+$lang['about_return'] = 'Retour';
+	
+// page identification
+$lang['ident_page_title'] = 'Identification';
+$lang['ident_title'] = 'Identification';
+// start version 1.3
+//$lang['actual_user'] = 'Vous êtes actuellement : ';
+// end version 1.3
+$lang['ident_register'] = 'S\'enregistrer';
+$lang['ident_forgotten_password'] = 'Mot de passe oublié ?';
+$lang['ident_guest_visit'] = 'Parcourir la galerie en tant que visiteur';
+	
+// page profile
+$lang['customize_page_title'] = 'Personnalisation';
+$lang['customize_title'] = 'Personnalisation';
+$lang['customize_nb_image_per_row'] = 'nombre d\'images par ligne';
+$lang['customize_nb_row_per_page'] = 'nombre de lignes par page';
+// start version 1.3
+// $lang['customize_color'] = 'couleur interface';
+$lang['customize_theme'] = 'theme de l\'interface';
+// end version 1.3
+$lang['customize_language'] = 'langue';
+// start version 1.3
+// $lang['sex'] = 'sexe';
+// $lang['male'] = 'masculin';
+// $lang['female'] = 'féminin';
+$lang['customize_expand'] = 'développer toutes les catégories';
+$lang['customize_show_nb_comments'] = 'montrer le nombre de commentaires';
+$lang['customize_short_period'] = 'période courte';
+$lang['customize_long_period'] = 'période longue';
+$lang['customize_template'] = 'template';
+$lang['err_periods'] = 'les périodes doivent être des entiers';
+$lang['err_periods_2'] = 'les périodes doivent être supérieures à 0, la période longue doit être plus grande que la période courte';
+$lang['create_cookie'] = 'créer un cookie';
+$lang['customize_day'] = 'jour';
+$lang['customize_week'] = 'semaine';
+$lang['customize_month'] = 'mois';
+$lang['customize_year'] = 'an';
+// end version 1.3
+$lang['maxwidth'] = 'largeur maximum des images';
+$lang['maxheight'] = 'hauteur maximum des images';
+$lang['err_maxwidth'] = 'la largeur maximum des images doit être un entier supérieur à 50';
+$lang['err_maxheight'] = 'la hauteur maximum des images doit être un entier supérieur à 50';
+
+// picture.php
+$lang['previous_image'] = 'Précédent';
+$lang['next_image'] = 'Suivant';
+$lang['back'] = 'Cliquez sur l\'image pour revenir à la page des miniatures';
+$lang['info_image_title'] = 'Informations';
+$lang['link_info_image'] = 'Modifier les informations de cette image';
+$lang['true_size'] = 'Taille réelle';
+$lang['comments_title'] = 'Commentaires des visiteurs du site';
+$lang['comments_del'] = 'supprimer ce message';
+$lang['comments_add'] = 'Ajouter un commentaire';
+$lang['month'][1] = 'Janvier';
+$lang['month'][2] = 'Février';
+$lang['month'][3] = 'Mars';
+$lang['month'][4] = 'Avril';
+$lang['month'][5] = 'Mai';
+$lang['month'][6] = 'Juin';
+$lang['month'][7] = 'Juillet';
+$lang['month'][8] = 'Août';
+$lang['month'][9] = 'Septembre';
+$lang['month'][10] = 'Octobre';
+$lang['month'][11] = 'Novembre';
+$lang['month'][12] = 'Décembre';
+$lang['day'][0] = 'Dimanche';
+$lang['day'][1] = 'Lundi';
+$lang['day'][2] = 'Mardi';
+$lang['day'][3] = 'Mercredi';
+$lang['day'][4] = 'Jeudi';
+$lang['day'][5] = 'Vendredi';
+$lang['day'][6] = 'Samedi';
+$lang['add_favorites_alt'] = 'Ajouter aux favoris';
+$lang['add_favorites_hint'] = 'ajouter cette image à vos favoris';
+$lang['del_favorites_alt'] = 'Retirer des favoris';
+$lang['del_favorites_hint'] = 'supprimer cette image de vos favoris';
+// start version 1.3
+$lang['slideshow'] = 'diaporama';
+$lang['period_seconds'] = 'secondes par image';
+$lang['slideshow_stop'] = 'stopper le diaporama';
+$lang['comment_added'] = 'Votre commentaire a été enregistré';
+$lang['comment_to_validate'] = 'Un administrateur doit valider votre commentaire pour qu\'il soit visible';
+$lang['comment_anti-flood'] = 'Système anti-flood : attendez un moment avant de déposer un message';
+$lang['comment_user_exists'] = 'Ce pseudo appartient à un autre utilisateur';
+// end version 1.3
+
+// page register
+$lang['register_page_title'] = 'Enregistrement';
+$lang['register_title'] = 'Enregistrement';
+$lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
+$lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
+$lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
+$lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
+$lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
+$lang['reg_err_pass'] = 'veuillez retaper le mot de passe';
+$lang['reg_confirm'] = 'confirmer';
+// start version 1.3
+// $lang['reg_mail_address'] = 'adresse mail';
+// end version 1.3
+$lang['reg_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
+
+// page search
+$lang['search_title'] = 'Recherche';
+// start version 1.3
+$lang['invalid_search'] = 'Les mots recherchés doivent comporter plus de 3 caractères et ne doivent pas inclure de caractères de ponctuation';
+$lang['search_mode_or'] = 'au moins un mot';
+$lang['search_mode_and'] = 'tous les mots';
+$lang['search_comments'] = 'séparer les différents mots avec un espace';
+// end version 1.3
+$lang['search_field_search'] = 'Rechercher';
+$lang['search_return_main_page'] = 'Retour à la page des miniatures';
+	
+// page upload
+$lang['upload_forbidden'] = 'On ne peut pas ajouter d\'image dans cette catégorie';
+$lang['upload_file_exists'] = 'Une image du même nom existe déjà';
+$lang['upload_filenotfound'] = 'vous devez choisir un fichier image pour la photo';
+$lang['upload_cannot_upload'] = 'impossible d\'uploader la photo sur le serveur';
+$lang['upload_title'] = 'Ajouter une image';
+$lang['upload_advise'] = 'Choisissez une image à placer dans la catégorie : ';
+$lang['upload_advise_thumbnail'] = 'Optionnel, mais recommandé : Choisissez la miniature à associer à ';
+$lang['upload_advise_filesize'] = 'le poids de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_width'] = 'la largeur de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_height'] = 'la hauteur de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_filetype'] = 'l\'image doit être au format jpg, gif ou png';
+$lang['upload_err_username'] = 'le nom de l\'utilisateur doit être renseigné';
+$lang['upload_username'] = 'Nom d\'utilisateur';
+$lang['upload_successful'] = 'Image uploadée avec succès, un administrateur validera celle-ci dès que possible.';
+// start version 1.3
+$lang['upload_name'] = 'Nom de l\'image';
+$lang['upload_author'] = 'Auteur (eg "Pierrick LE GALL")';
+$lang['upload_creation_date'] = 'Date de création (JJ/MM/AAAA)';
+$lang['upload_comment'] = 'Commentaire';
+// end version 1.3
+
+// start version 1.3
+// mails
+$lang['mail_hello'] = 'Bonjour,';
+$lang['mail_new_upload_subject'] = 'Nouvelle image sur le site';
+$lang['mail_new_upload_content'] = 'Une nouvelle image a été placée sur la galerie. Elle est en attente de validation. RDV dans la section d\'administration pour valider ou supprimer cette image.';
+$lang['mail_new_comment_subject'] = 'Nouveau commentaire sur le site';
+$lang['mail_new_comment_content'] = 'Un nouveau commentaire a été posté sur la galerie. Si vous avez activé la validation des commentaires, il faut d\'abord valider le commentaire dans la zone d\'administration pour le voir apparaître.'."\n\n".'Vous avez accès aux derniers commentaires dans la zone d\'administration.';
+// end version 1.3
+
+//----------------------------------administration
+if ( $isadmin )
+{
+// start version 1.3
+  // general for admin section
+  $lang['remote_site'] = 'Site distant';
+// end version 1.3
+ 
+  // page admin
+// start version 1.3
+//  $lang['title_add'] = 'Ajouter/Modifier un utilisateur';
+  $lang['title_add'] = 'Ajouter un utilisateur';
+  $lang['title_modify'] = 'Modifier un utilisateur';
+  $lang['title_groups'] = 'Gestion des groupes';
+// end version 1.3
+  $lang['title_liste_users'] = 'Liste des utilisateurs';
+  $lang['title_history'] = 'Historique';
+  $lang['title_update'] = 'Mise à jour de la base de données';
+  $lang['title_configuration'] = 'Configuration de PhpWebGallery';
+  $lang['title_instructions'] = 'Instructions';
+// start version 1.3
+// $lang['title_permissions'] = 'Modifier les permissions pour un utilisateur';
+  $lang['title_user_perm'] = 'Modifier les permissions pour l\'utilisateur';
+  $lang['title_cat_perm'] = 'Modifier les permissions pour la catégorie';
+  $lang['title_group_perm'] = 'Modifier les permissions pour le groupe';
+  $lang['title_comments'] = 'Commentaires des visiteurs';
+  $lang['title_picmod'] = 'Modifier les informations d\'une image';
+// end version 1.3
+  $lang['title_categories'] = 'Gestion des catégories';
+  $lang['title_edit_cat'] = 'Editer une catégorie';
+  $lang['title_info_images'] = 'Modifier les informations sur les images d\'une catégorie';
+  $lang['title_thumbnails'] = 'Création des miniatures';
+  $lang['title_thumbnails_2'] = 'pour';
+  $lang['title_default'] = 'Administration de PhpWebGallery';
+	
+  $lang['menu_title'] = 'Administration';
+  $lang['menu_config'] = 'Configuration';
+  $lang['menu_users'] = 'Utilisateurs';
+  $lang['menu_add_user'] = 'ajout';
+  $lang['menu_list_user'] = 'liste';
+  $lang['menu_categories'] = 'Catégories';
+  $lang['menu_update'] = 'MaJ base d\'images';
+  $lang['menu_thumbnails'] = 'Miniatures';
+  $lang['menu_history'] = 'Historique';
+  $lang['menu_instructions'] = 'Instructions';
+  $lang['menu_back'] = 'Page diapo';
+// start version 1.3
+  $lang['menu_groups'] = 'Groupes';
+  $lang['menu_comments'] = 'Commentaires';
+// end version 1.3
+  
+  $lang['title_waiting'] = 'Images en attente de validation';
+  $lang['menu_waiting'] = 'En attente';
+		
+  $lang['default_message'] = 'Zone d\'administration de PhpWebGallery';
+		
+  // page de configuration
+  $lang['conf_err_prefixe'] = 'le préfixe des thumbnails ne doit pas comporter d\'accent';
+  $lang['conf_err_mail'] = 'mail refusé, il doit être de la forme nom@serveur.com';
+  // start version 1.3
+//   $lang['conf_err_periods'] = 'les périodes doivent être des entiers';
+//   $lang['conf_err_periods_2'] = 'les périodes doivent être supérieures à 0, la période longue doit être plus grande que la période courte';
+  // end version 1.3
+  $lang['conf_err_sid_size'] = 'la taille de l\'identifiant de session doit être un entier supérieur ou égal à 4 et inférieur à 50';
+  $lang['conf_err_sid_time'] = 'la durée de la session doit être comprise entre 5 et 60 minutes';
+  $lang['conf_err_max_user_listbox'] = 'le nombre max utilisateur listbox doit être un entier compris entre 0 et 255';
+  // start version 1.3
+//  $lang['conf_err_message'] = 'Vous avez commis des erreurs au nombre de ';
+  // end version 1.3
+  $lang['conf_confirmation'] = 'Informations enregistrées dans la base de données';
+  // start version 1.3
+//   $lang['no'] = 'non';
+//   $lang['yes'] = 'oui';
+  // end version 1.3
+  $lang['conf_general_title'] = 'Configuration générale';
+  $lang['conf_general_webmaster'] = 'pseudo webmaster';
+  $lang['conf_general_webmaster_info'] = 'Il apparaîtra à tous vos visiteurs. Il vous sert pour administrer le site';
+  $lang['conf_general_mail'] = 'mail webmaster';
+  $lang['conf_general_mail_info'] = 'Les visiteurs pourront vous contacter par ce mail';
+  $lang['conf_general_prefix'] = 'préfixe thumbnail';
+  $lang['conf_general_prefix_info'] = 'Les noms des fichiers miniatures en sont préfixé. Laissez vide en cas de doute.';
+  // start version 1.3
+//  $lang['conf_general_short_period'] = 'période courte';
+//  $lang['conf_general_short_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque rouge. La période courte fait au minimum 1 jour.';
+//  $lang['conf_general_long_period'] = 'période longue';
+//  $lang['conf_general_long_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque verte. La période longue doit être plus grande que la période courte.';
+  // end version 1.3
+  $lang['conf_general_access'] = 'type d\'acces';
+  $lang['conf_general_access_1'] = 'libre';
+  $lang['conf_general_access_2'] = 'restreint';
+  $lang['conf_general_access_info'] = '- libre : n\'importe qui peut accéder à vos photos, tous les visiteurs peuvent se créer un compte pour pouvoir personnaliser l\'affichage<br />- restreint : l\'administrateur s\'occupe de créer des comptes, seuls les personnes membres peuvent accéder au site';
+  $lang['conf_general_max_user_listbox'] = 'nombre max utilisateur listbox';
+  $lang['conf_general_max_user_listbox_info'] = '- c\'est le nombre maximum d\'utilisateurs pour lequel on affiche une liste déroulante sur la page d\'identification<br />- mettez un nombre entier entre 0 et 255, 0 signifiant que vous ne voulez jamais qu\'on affiche de liste déroulante';
+  // start version 1.3
+//  $lang['conf_general_default_page'] = 'page par défaut';
+//  $lang['conf_general_default_page_1'] = 'diapo';
+//  $lang['conf_general_default_page_2'] = 'identification';
+//  $lang['conf_general_default_page_info'] = 'page sur laquelle les utilisateurs sont redirigés s\'ils vont à la racine du site.';
+//  $lang['conf_general_expand'] = 'développer toutes les catégories';
+//  $lang['conf_general_expand_info'] = 'développer toutes les catégories par défaut dans le menu ?';
+  $lang['conf_general_log'] = 'historique';
+  $lang['conf_general_log_info'] = 'historiser les visites sur le site ? Les visites seront visibles dans l\'historique de l\'administration';
+  $lang['conf_general_mail_notification'] = 'Notification par mail';
+  $lang['conf_general_mail_notification_info'] = 'Notification automatique par mail des administrateurs (seuls les administrateurs) lors de l\'ajout d\'un commentaire, ou lors de l\'ajout d\'une image.';
+  // end version 1.3
+  $lang['conf_comments'] = 'commentaires utilisateurs';
+  $lang['conf_comments_title'] = 'Configuration des '.$lang['conf_comments'];
+  $lang['conf_comments_show_comments'] = $lang['conf_comments'];
+  $lang['conf_comments_show_comments_info'] = 'afficher les commentaires utilisateurs sous chaque images ?';
+  $lang['conf_comments_comments_number'] = 'nombre de commentaires par page';
+  $lang['conf_comments_comments_number_info'] = 'nombre de commentaire à afficher sur chaque page. Le nombre de commentaires pour une image reste illimité. Entrer un nombre entre 5 et 50.';
+  $lang['conf_err_comment_number'] = 'le nombre de commentaires par page doit être compris entre 5 et 50 inclus.';
+// start version 1.3
+  $lang['conf_comments_validation'] = 'validation';
+  $lang['conf_comments_validation_info'] = 'L\'administrateur valide les commentaires avant qu\'ils apparaissent sur le site';
+  $lang['conf_comments_forall'] = 'pour tous ?';
+  $lang['conf_comments_forall_info'] = 'Même les invités non enregistrés peuvent déposer les messages';
+  // $lang['conf_remote_site_title'] = 'Site distant';
+// end version 1.3
+  $lang['conf_remote_site_delete_info'] = 'Supprimer un site revient à supprimer toutes les images et les catégories en relation avec ce site.';
+  $lang['conf_upload_title'] = 'Configurer l\'upload des utilisateurs';
+  $lang['conf_upload_available'] = 'autoriser l\'ajout d\'images';
+  $lang['conf_upload_available_info'] = 'Autoriser l\'ajout d\'image par les utilisateurs dans les catégories du site (pas sur un site distant).';
+  $lang['conf_upload_maxfilesize'] = 'poids maximum';
+  $lang['conf_upload_maxfilesize_info'] = 'Poids maximum autorisé pour les images uploadées. Celui-ci doit être un entier compris entre 10 et 1000, en Ko.';
+  $lang['conf_err_upload_maxfilesize'] = 'Le poids maximum pour les images uploadés doit être un entier compris entre 10 et 1000.';
+  $lang['conf_upload_maxwidth'] = 'largeur maximum';
+  $lang['conf_upload_maxwidth_info'] = 'Largeur maximum autorisée pour les images. Celle-ci doit être un entier supérieur à 10, en pixels.';
+  $lang['conf_err_upload_maxwidth'] = 'la largeur maximum des images uploadées doit être un entier supérieur à 10.';
+  $lang['conf_upload_maxheight'] = 'hauteur maximum';
+  $lang['conf_upload_maxheight_info'] = 'Hauteur maximum autorisée pour les images. Celle-ci doit être un entier supérieur à 10, en pixels.';
+  $lang['conf_err_upload_maxwidth'] = 'la hauteur maximum des images uploadées doit être un entier supérieur à 10.';
+  $lang['conf_upload_maxwidth_thumbnail'] = 'largeur maximum miniatures.';
+  $lang['conf_upload_maxwidth_thumbnail_info'] = 'Largeur maximum autorisée pour les miniatures. Celle-ci doit être un entier supérieur à 10, en pixels.';
+  $lang['conf_err_upload_maxwidth_thumbnail'] = 'la largeur maximum des miniatures uploadées doit être un entier supérieur à 10.';
+  $lang['conf_upload_maxheight_thumbnail'] = 'hauteur maximum miniatures';
+  $lang['conf_upload_maxheight_thumbnail_info'] = 'Hauteur maximum autorisée pour les miniatures. Celle-ci doit être un entier supérieur à 10, en pixels.';
+  $lang['conf_err_upload_maxheight_thumbnail'] = 'la hauteur maximum des miniatures uploadées doit être un entier supérieur à 10.';
+
+  $lang['conf_default_title'] = 'Affichage par défaut pour les visiteurs non enregistrés et les nouveaux comptes';
+  // start version 1.3
+//  $lang['conf_default_language'] = 'langue par défaut';
+  // end version 1.3
+  $lang['conf_default_language_info'] = 'langue par défaut';
+  // start version 1.3
+//  $lang['conf_default_image_per_row'] = 'nombre d\'images par ligne';
+//  $lang['conf_default_image_per_row_info'] = 'nombre d\'images par ligne par défaut';
+//  $lang['conf_default_row_per_page'] = 'nombre de lignes par page';
+//  $lang['conf_default_row_per_page_info'] = 'nombre de lignes par page par défaut';
+  $lang['conf_default_nb_image_per_row_info'] = 'nombre d\'images par ligne par défaut';
+  $lang['conf_default_nb_row_per_page_info'] = 'nombre de lignes par page par défaut';
+//  $lang['conf_default_theme'] = 'thème';
+  // end version 1.3
+  $lang['conf_default_theme_info'] = 'thème par défaut';
+  // start version 1.3
+  $lang['conf_default_short_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque rouge. La période courte fait au minimum 1 jour.';
+  $lang['conf_default_long_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque verte. La période longue doit être plus grande que la période courte.';
+  $lang['conf_default_expand_info'] = 'développer toutes les catégories par défaut dans le menu ?';
+  $lang['conf_default_show_nb_comments_info'] = 'montrer le nombre de commentaires pour chaque image sur la page des miniatures';
+  $lang['conf_default_maxwidth_info'] = 'Largeur maximum affichable pour les images : les images ne seront redimensionnées que pour l\'affichage, les fichiers images resteront intacts. Laisser vide si vous ne souhaitez pas mettre de limite.';
+  $lang['conf_default_maxheight_info'] = 'idem mais pour la hauteur des images';
+  // end version 1.3
+  
+  $lang['conf_session_title'] = 'Configuration des sessions';
+  $lang['conf_session_size'] = 'taille de l\'identifiant';
+  $lang['conf_session_size_info'] = '- plus votre identifiant de session est grand, plus la sécurité est bonne<br />- mettez une valeur entre 4 et 50';
+  $lang['conf_session_time'] = 'durée de validité';
+  $lang['conf_session_time_info'] = '- plus votre durée de validité de la session est petite, plus la sécurité est bonne<br />- elle doit supérieur à 5 et inférieur à 60, en minutes';
+  $lang['conf_session_key'] = 'mot-clef';
+  $lang['conf_session_key_info'] = '- le mot-clef de session permet d\'améliorer le cryptage des identifiants de session.<br />- mettez n\'importe quelle chaîne de moins de 255 caractères.';
+  $lang['conf_session_delete'] = 'supprimer les sessions périmées';
+  $lang['conf_session_delete_info'] = 'il est recommandé de vider sa table de sessions car les sessions périmées restent enregistrées (mais ça ne pose pas de problème de sécurité)';
+  // start version 1.3
+  $lang['conf_session_cookie'] = 'autoriser les cookies';
+  $lang['conf_session_cookie_info'] = 'les utilisateurs ne seront plus obligés de s\'identifier à chaque visite. Méthode moins sécurisée';
+  // end version 1.3
+		
+  // page user, clés générales
+  $lang['user_err_modify'] = 'Cet utilisateur ne peut pas être modifé ou supprimé';
+  $lang['user_err_unknown'] = 'Cet utilisateur n\'existe pas dans la base de données';
+		
+  // page d\'ajout/modification d\'utilisateur
+// start version 1.3		
+//   $lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
+//   $lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
+//   $lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
+//   $lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
+//   $lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
+
+//   $lang['adduser_err_message'] = 'Vous avez commis des erreurs au nombre de ';
+// end version 1.3
+  $lang['adduser_info_message'] = 'Informations enregistrées dans la base de données concernant ';
+  $lang['adduser_info_password_updated'] = '(mot de passe modifié)';
+  $lang['adduser_info_back'] = 'retour liste utilisateurs';
+		
+  $lang['adduser_fill_form'] = 'Veuillez remplir les champs suivants';
+// start version 1.3
+//  $lang['adduser_login'] = 'pseudo';
+// end version 1.3
+  $lang['adduser_unmodify'] = 'non modifiable';
+  $lang['adduser_status'] = 'status';
+  $lang['adduser_status_admin'] = 'admin';
+// start version 1.3
+//  $lang['adduser_status_member'] = 'membre';
+  $lang['adduser_associate'] = 'Associer au groupe';
+// end version 1.3
+  $lang['adduser_status_guest'] = 'visiteur';
+
+// start version 1.3
+  $lang['group_add'] = 'Ajouter un groupe';
+  $lang['group_add_error1'] = 'Le nom du groupe ne doit pas comporter de " ou de \'';
+  $lang['group_add_error2'] = 'Ce nom de groupe est déjà utilisé';
+  $lang['group_confirm'] = 'Etes-vous sûr de vouloir supprimer le groupe';
+  $lang['group_list_title'] = 'Liste des groupes existants';
+  $lang['group_err_unknown'] = 'Ce groupe n\'existe pas dans la base de données';
+// end version 1.3
+
+  // page permissions
+  $lang['permuser_info_message'] = 'Permissions enregistrées';
+  $lang['permuser_title'] = 'Restrictions pour l\'utilisateur';
+  $lang['permuser_warning'] = 'Attention : un "<span style="font-weight:bold;">accès interdit</span>" à la racine d\'une catégorie empêche l\'accès à toute la catégorie';
+  $lang['permuser_authorized'] = 'autorisé';
+  $lang['permuser_forbidden'] = 'interdit';
+  $lang['permuser_parent_forbidden'] = 'catégorie parente interdite';
+// start version 1.3
+  $lang['permuser_only_private'] = 'Seules les catégories privées sont représentées';
+// $lang['permuser_cat_title'] = 'Modifier les permissions pour ';
+// end version 1.3
+		
+  // page liste utilisateurs
+  $lang['listuser_confirm'] = 'Etes-vous sûr de vouloir supprimer l\'utilisateur';
+  // start version 1.3
+//   $lang['listuser_yes'] = 'oui';
+//   $lang['listuser_no'] = 'non';
+  // end version 1.3
+  $lang['listuser_info_deletion'] = 'a été supprimé de la base de données';
+  $lang['listuser_user_group'] = 'Utilisateurs';
+  $lang['listuser_modify'] = 'modifier';
+  $lang['listuser_modify_hint'] = 'modifier les infos de';
+  $lang['listuser_permission'] = 'permissions';
+  $lang['listuser_permission_hint'] = 'modifier les permissions de';
+  $lang['listuser_delete'] = 'supprimer';
+  $lang['listuser_delete_hint'] = 'supprimer';
+  $lang['listuser_button_all'] = 'tous';
+  $lang['listuser_button_invert'] = 'inverser';
+  $lang['listuser_button_create_address'] = 'générer adresse mail';
+		
+  // page catégories
+  $lang['cat_invisible'] = 'invisible';
+  $lang['cat_edit'] = 'Editer';
+  $lang['cat_up'] = 'Monter';
+  $lang['cat_down'] = 'Descendre';
+  $lang['cat_image_info'] = 'infos images';
+  $lang['cat_total'] = 'total';
+  // start version 1.3
+  $lang['cat_permission'] = 'permissions';
+  $lang['cat_update'] = 'mis à jour';
+  $lang['cat_add'] = 'Ajouter une catégorie virtuelle';
+  $lang['cat_parent'] = 'catégorie parente';
+  $lang['cat_error_name'] = 'Le nom d\'une catégorie ne doit pas être nul';
+  $lang['cat_virtual'] = 'virtuelle';
+  $lang['cat_first'] = 'Premier';
+  $lang['cat_last'] = 'Dernier';
+  // end version 1.3
+
+  // page édition d\'une catégorie
+  $lang['editcat_confirm'] = 'Informations enregistrées dans la base de données';
+  $lang['editcat_back'] = 'catégories';
+  $lang['editcat_title1'] = 'Options pour la catégorie';
+  $lang['editcat_name'] = 'Nom';
+  $lang['editcat_comment'] = 'Commentaire';
+  $lang['editcat_status'] = 'Status';
+// start version 1.3
+  // $lang['editcat_status_info'] = '(invisible sauf pour les administrateurs)';
+//  $lang['editcat_status_info'] => $lang['editcat_visible_info']
+  $lang['editcat_visible_info'] = '(invisible sauf pour les administrateurs)';
+  $lang['editcat_visible'] = 'Visible';
+  $lang['editcat_uploadable'] = 'Ajout d\'images par les visiteurs';
+// end version 1.3
+  // page info images
+// start version 1.3
+  // $lang['infoimage_err_date'] = 'date erronée';
+  $lang['infoimage_keyword_separation'] = '(séparer avec des ",")';
+  $lang['infoimage_addtoall'] = 'ajouter à tous';
+  $lang['infoimage_removefromall'] = 'retirer à tous';
+  $lang['infoimage_associate'] = 'Associer à la catégorie';
+// end version 1.3
+  $lang['infoimage_general'] = 'Options générale pour la catégorie';
+  $lang['infoimage_useforall'] = 'utiliser pour toutes les images ?';
+  $lang['infoimage_creation_date'] = 'date de création';
+  $lang['infoimage_detailed'] = 'Options pour chaque image / photo';
+  $lang['infoimage_title'] = 'titre';
+  $lang['infoimage_comment'] = 'commentaire';
+		
+  // page de mise à jour de la base de données
+  $lang['update_missing_tn'] = 'il manque la miniature pour';
+  $lang['update_disappeared_tn'] = 'la miniature a disparu';
+  $lang['update_disappeared'] = 'a disparu';
+  $lang['update_part_deletion'] = 'Suppression des images de la base qui n\'ont pas de thumbnail ou qui n\'existent pas';
+  $lang['update_deletion_conclusion'] = 'images supprimées de la base de données';
+  $lang['update_part_research'] = 'Recherche des nouvelles images dans les répertoires';
+  $lang['update_research_added'] = 'ajouté';
+  $lang['update_research_tn_ext'] = 'miniature en';
+  $lang['update_research_conclusion'] = 'images ajoutées à la base de données';
+  $lang['update_default_title'] = 'Choisir une option';
+  $lang['update_only_cat'] = 'mettre à jour les catégories, mais pas les images';
+  $lang['update_all'] = 'mettre tout à jour';
+// start version 1.3
+  $lang['update_wrong_dirname'] = 'le nom du répertoire ne doit être composé que de lettres, de chiffres et "-", "_" ou ".".';
+// end version 1.3
+		
+  // page de génération miniatures
+  $lang['tn_width'] = 'largeur';
+  $lang['tn_height'] = 'hauteur';
+		
+  $lang['tn_no_support'] = 'Image inexistante ou aucun support';
+  $lang['tn_format'] = 'pour le format';
+  $lang['tn_thisformat'] = 'pour ce format de fichier';
+  $lang['tn_err_width'] = 'la largeur doit être un entier supérieur à';
+  $lang['tn_err_height'] = 'la hauteur doit être un entier supérieur à';
+// start version 1.3
+  // $lang['tn_err_GD'] = 'il faut choisir une version de GD';
+// end version 1.3
+		
+  $lang['tn_results_title'] = 'Résultats de la miniaturisation';
+  $lang['tn_picture'] = 'image';
+// start version 1.3
+  // $lang['tn_filesize'] = 'poids';
+// end version 1.3
+  $lang['tn_results_gen_time'] = 'généré en';
+		
+  $lang['tn_stats'] = 'Statistiques générales';
+  $lang['tn_stats_nb'] = 'nombre d\'images miniaturisées';
+  $lang['tn_stats_total'] = 'temps total';
+  $lang['tn_stats_max'] = 'temps max';
+  $lang['tn_stats_min'] = 'temps min';
+  $lang['tn_stats_mean'] = 'temps moyen';
+		
+  $lang['tn_err'] = 'Vous avez commis des erreurs';
+		
+  $lang['tn_params_title'] = 'Paramètres de miniaturisation';
+  $lang['tn_params_GD'] = 'version de GD';
+  $lang['tn_params_GD_info'] = '- GD est la bibliothèque de manipulation graphique pour PHP<br />- cochez la version de GD installée sur le serveur. Si vous choisissez l\'une et que vous obtenez ensuite des messages d\'erreur, choisissez l\'autre version. Si aucune version ne marche, cela signifie que GD n\'est pas installé sur le serveur.';
+  $lang['tn_params_width_info'] = 'largeur maximum que peut prendre les miniatures';
+  $lang['tn_params_height_info'] = 'hauteur maximum que peut prendre les miniatures';
+  $lang['tn_params_create'] = 'en créer';
+  $lang['tn_params_create_info'] = 'N\'essayez pas de lancer directement un grand nombre de miniaturisation.<br />En effet la miniaturisation est coûteuse en ressources processeur pour le serveur. Si vous êtes chez un hébergeur gratuit, une trop forte occupation processeur peut amener l\'hébergeur à supprimer votre compte.';
+  $lang['tn_params_format'] = 'format';
+  $lang['tn_params_format_info'] = 'seul le format jpeg est supporté pour la création des miniatures';
+		
+  $lang['tn_alone_title'] = 'images sans miniatures (format jpg et png uniquement)';
+		
+  $lang['tn_dirs_title'] = 'Liste des répertoires';
+  $lang['tn_dirs_alone'] = 'images sans miniatures';
+
+// start version 1.3
+  $lang['stats_last_days'] = 'derniers jours';
+  $lang['stats_pages_seen'] = 'pages vues';
+  $lang['stats_visitors'] = 'visiteurs';
+  $lang['stats_empty'] = 'vider l\'historique';
+  $lang['stats_pages_seen_graph_title'] = 'Nombre de pages vues par jour';
+  $lang['stats_visitors_graph_title'] = 'Nombre de visiteurs par jour';
+
+  $lang['comments_last_title'] = 'Derniers commentaires';
+  $lang['comments_non_validated_title'] = 'Commentaires non validés';
+// end version 1.3
+  
+  // help page
+  $lang['help_images_title'] = 'Ajout d\'images';
+  $lang['help_images_intro'] = 'Voici comment il faut placer les images dans vos répertoires';
+  $lang['help_images'][0] = 'dans le répertoire "galleries" placer des repertoires qui vont représenter vos futures catégories';
+  $lang['help_images'][1] = 'dans chacun de ces répertoires, vous avez le droit de créer autant de niveau de sous-répertoire que vous le souhaitez';//modifié
+  $lang['help_images'][2] = 'vous avez le droit à un nombre illimité de catégories et de sous catégories pour chaque catégorie';	
+  $lang['help_images'][3] = 'les fichiers images doivent être au format jpg (extension jpg ou JPG), gif (GIF ou gif) ou encore png (PNG ou png)';
+  $lang['help_images'][4] = 'Evitez d\'utiliser des espaces " " ou des tirets "-" dans les noms de fichiers ou de catégorie, je conseille d\'utiliser le caractère underscore "_" qui est géré par l\'application et donnera des résultats plus appréciables';
+		
+  $lang['help_thumbnails_title'] = 'Miniatures';
+  $lang['help_thumbnails'][0] = 'dans chaque répertoire contenant des images à afficher sur le site, il y a un sous-répertoire nommé "thumbnail", s\'il n\'existe pas, créez-le pour placer vos miniatures dedans';
+  $lang['help_thumbnails'][1] = 'les miniatures n\'ont pas besoin d\'avoir la même extension que les images associées (une image en .jpg peut avoir sa miniature en .GIF par exemple)';
+  $lang['help_thumbnails'][2] = 'la miniature associée à une image doit être préfixée par le préfixe donné sur la page de configuration générale (image.jpg -> TN_image.GIF par exemple).';
+  $lang['help_thumbnails'][3] = 'il est conseillé d\'utiliser le module pour windows téléchargeable sur le site de PhpWebGallery pour la création des miniatures.';
+  $lang['help_thumbnails'][4] = 'vous pouvez utilisez la gestion de création de miniatures, intégrée à PhpWebGallery, mais ce n\'est pas conseillé, car la qualité des miniatures sera moindre qu\'avec un véritable outil de manipulation d\'images et que cela consommera des ressources sur le serveur, ce qui peut se révéler gênant pour un hébergement gratuit.';
+  $lang['help_thumbnails'][5] = 'si vous choisissez d\'utiliser votre hébergeur pour créer les miniatures, il faut avant cela passer le répertoire "galleries" en 775 ainsi que tous ses sous-répertoires.';
+		
+  $lang['help_database_title'] = 'Remplissage de la base de données';
+  $lang['help_database'][0] = 'Une fois les fichiers placés correctement et les miniatures placées ou créées, cliquez sur "MaJ base d\'images" dans le menu de la zone d\'administration.';
+// start version 1.3
+  $lang['help_database'][1] = 'Afin d\'éviter la mise à jour d\'un trop grand nombre d\'images, commencez par mettre à jour uniquement les catégories, puis sur la page des catégories, mettre à jour chaque catégorie individuellement grâce au lien "mise à jour"';
+// end version 1.3
+
+  $lang['help_remote_title'] = 'Site distant';
+  $lang['help_remote'][0] = 'PhpWebGallery offre la possibilité d\'utiliser plusieurs serveurs pour stocker les images qui composeront votre galerie. Cela peut être utile si votre galerie est installée sur une espace limité et que vous avez une grande quantité d\'images à montrer. Suivez la procédure suivante :';
+  $lang['help_remote'][1] = '1. éditez le fichier "create_listing_file.php" (vous le trouverez dans le répertoire "admin"), en modifiant la ligne "$prefix_thumbnail = "TN-";" si le préfixe pour vos miniatures n\'est pas "TN-".';
+  $lang['help_remote'][2] = '2. placez le fichier "create_listing_file.php" modifié sur votre site distant, dans le répertoire racine de vos répertoires d\'images (comme le répertoire "galleries" du présent site) par ftp.';
+  $lang['help_remote'][3] = '3. lancez le script en allant à l\'url http://domaineDistant/repGalerie/create_listing_file.php, un fichier listing.xml vient de se créer.';
+  $lang['help_remote'][4] = '4. récupérez le fichier listing.xml de votre site distant pour le placer dans le répertoire "admin" du présent site.';
+  $lang['help_remote'][5] = '5. lancez une mise à jour de la base d\'images par l\'interface d\'administration, une fois le fichier listing.xml utilisé, supprimez le du répertoire "admin".';
+  $lang['help_remote'][6] = 'Vous pouvez mettre à jour le contenu d\'un site distant en refaisant la manipulation décrite. Vous pouvez également supprimer un site distant en choisissant l\'option dans la section configuration du panneau d\'administration.';
+  $lang['help_upload_title'] = 'Ajout d\'images par les utilisateurs';
+  $lang['help_upload'][0] = 'PhpWebGallery offre la possibilité aux visiteurs d\'uploader des images. Pour cela :';
+  $lang['help_upload'][1] = '1. autorisez l\'option dans la zone configuration du panneau d\'administration';
+  $lang['help_upload'][2] = '2. autorisez les droits en écriture sur les répertoires d\'images';
+// start version 1.3
+  $lang['help_upload'][3] = 'La catégorie doit elle-même être autorisée pour l\'upload.';
+  // $lang['help_upload'][3] becomes $lang['help_upload'][4]
+  $lang['help_upload'][4] = 'Les images uploadées par les visiteurs ne sont pas directement visibles sur le site, elles doivent être validées par un administrateur. Pour cela, un administrateur doit se rendre sur la page "en attente" du panneau d\'administration, valider ou refuser les images proposée, puis lancer une mise à jour de la base d\'images.';
+// end version 1.3
+
+// start version 1.3
+  $lang['help_virtual_title'] = 'Liens images vers catégories et catégories virtuelles';
+  $lang['help_virtual'][0] = 'PhpWebGallery permet de dissocier les catégories où sont stockées les images et les catégories où les images apparaissent.';
+  $lang['help_virtual'][1] = 'Par défaut, les images apparaissent uniquement dans leurs catégories réelles : celles qui correspondent à des répertoires sur le serveur web.';
+  $lang['help_virtual'][2] = 'Pour lier une image à une catégorie, il suffit de l\'y associer via la page de modification d\'une image ou par lot sur la page de modification des images d\'une catégorie.';
+  $lang['help_virtual'][3] = 'En partant de ce principe, il est possible de créer des catégories virtuelles dans PhpWebGallery : aucun répertoire "réel" n\'y est rattaché sur le disque du serveur. Il suffit simplement de créer la catégorie sur la page de la liste des catégories existantes dans la zone d\'administration.';
+
+  $lang['help_groups_title'] = 'Groupes d\'utilisateurs';
+  $lang['help_groups'][0] = 'PhpWebGallery permet de gérer des groupes d\'utilisateurs, cela est très utile pour regrouper les autorisations d\'accès aux catégories privées.';
+  $lang['help_groups'][1] = '1. Créez un groupe "famille" sur la page des groupes de la zone d\'administration.';
+  $lang['help_groups'][2] = '2. Sur la page de la liste des utilisateurs, en éditer un, et l\'associer au groupe "famille".';
+  $lang['help_groups'][3] = '3. En modifiant les permissions pour une catégorie, ou pour un groupe, vous verrez que toutes les catégories autorisées à un groupe le sont pour les membres de ce groupe.';
+  $lang['help_groups'][4] = 'Un utilisateurs peut appartenir à plusieurs groupes. L\'autorisation est plus forte que l\'interdiction : si l\'utilisateur "paul" appartient au groupe "famille" et "amis", et que seule le groupe "famille" est autorisée à consulter la catégorie privée "Noël 2003", alors "paul" y aura accès.';
+
+  $lang['help_access_title'] = 'Autorisations d\'accès';
+  $lang['help_access'][0] = 'PhpWebGallery dispose d\'un système de restrictions d\'accès aux catégories souhaitées. Les catégories sont soit publiques, soit privées. Pour interdire l\'accès par défaut à une catégorie :';
+  $lang['help_access'][1] = '1. Editez la catégorie (depuis la page des catégories dans la zone d\'administration) et rendez la "privée".';
+  $lang['help_access'][2] = '2. Sur les pages des permissions (d\'un groupe, d\'utilisateur) la catégorie apparaîtra et vous pourrez autoriser l\'accès ou non.';
+// end version 1.3
+  
+  $lang['help_infos_title'] = 'Informations complémentaires';
+// start version 1.3
+  // $lang['help_infos'][0] = 'Le webmaster a la possiblité d\'interdire certaines rubrique ou sous-rubriques à certains utilisateurs. Pour cela, allez voir la liste des utilisateurs, puis cliquez sur "permissions" pour l\'un d\'entre eux';
+// end version 1.3
+  $lang['help_infos'][1] = 'Dès que vous avez créé votre galerie, allez dans la gestion des utilisateurs et modifiez les permissions pour l\'utilisateur visiteur. En effet, tous les utilisateurs qui s\'enregistrent eux-même auront par défaut les mêmes permissions que l\'utilisateur "visiteur".';
+// start version 1.3
+  $lang['help_infos'][2] = 'Pour n\'importe quelle question, n\'hésitez pas à consulter le forum ou à y poser une question, sur le site';
+  $lang['help_infos'][2] = 'Pour n\'importe quelle question, n\'hésitez pas à consulter le <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a> ou à y poser une question, sur le site';
+// end version 1.3
+
+  // installation
+  $lang['install_message'] = 'Message';
+		
+  $lang['step1_confirmation'] = 'Les paramètres rentrés sont corrects';
+  $lang['step1_err_db'] = 'La connexion au serveur est OK, mais impossible de se connecter à cette base de données';
+  $lang['step1_err_server'] = 'Impossible de se connecter au serveur';
+// start version 1.3
+  // $lang['step1_err_copy'] = 'Copiez le texte entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé PhpWebGallery (le fichier mysql.inc.php ne doit comporter QUE ce qui est en bleu entre les tirets)';
+  $lang['step1_err_copy'] = 'Copiez le texte en bleu entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé PhpWebGallery (le fichier mysql.inc.php ne doit comporter QUE ce qui est en bleu entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)';
+// end version 1.3
+  $lang['step1_err_copy_2'] = 'La configuration du reste de l\'application est maintenant possible';
+  $lang['step1_err_copy_next'] = 'prochaine étape';
+  $lang['step1_title'] = 'Etape 1 sur 2';
+  $lang['step1_host'] = 'Hôte MySQL';
+  $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
+  $lang['step1_user'] = 'Utilisateur';
+  $lang['step1_user_info'] = 'nom d\'utilisateur pour votre hébergeur';
+  $lang['step1_pass'] = 'Password';
+  $lang['step1_pass_info'] = 'celui fourni par votre hébergeur';
+  $lang['step1_database'] = 'Nom de la base';
+  $lang['step1_database_info'] = 'celui fourni par votre hébergeur';
+  $lang['step1_prefix'] = 'Préfixe des noms de table';
+  $lang['step1_prefix_info'] = 'le nom des tables apparaîtra avec ce préfixe (permet de mieux gérer sa base de données)';
+
+  $lang['step2_err_login1'] = 'veuillez rentrer un pseudo pour le webmaster';
+// start version 1.3
+  // $lang['step2_err_login2'] = 'le pseudo du webmaster ne doit pas se terminer ou commencer par un espace';
+//
+  $lang['step2_err_login3'] = 'le pseudo du webmaster ne doit pas comporter les caractère " et \'';
+  $lang['step2_err_pass'] = 'veuillez retaper votre mot de passe';
+  $lang['step2_err_mail'] = $lang['conf_err_mail'];
+		
+  $lang['install_end_title'] = 'Installation terminée';
+  $lang['install_end_message'] = 'La configuration de l\'application s\'est correctement déroulée, place à la prochaine étape<br /><br />
+Par mesure de sécurité, merci de supprimer le fichier "install.php" du repertoire "admin"<br />
+Un fois ce fichier supprimé, veuillez suivre ces indications :
+<ul>
+  <li>allez sur la page d\'identification : [ <a href="../identification.php">identification</a> ] et connectez-vous avec le pseudo donné pour le webmaster</li>
+  <li>celui-ci vous permet d\'accéder à la [ <a href="admin.php">partie administration</a> ] et aux instructions pour placer les images dans les répertoires.</li>
+</ul>';
+  $lang['step2_title'] = 'Etape 2 sur 2';
+  $lang['step2_pwd'] = 'password webmaster';
+  $lang['step2_pwd_info'] = 'Il doit rester confidentiel, il permet d\'accéder au panneau d\'administration.';
+  $lang['step2_pwd_conf'] = 'confirmer password';
+  $lang['step2_pwd_conf_info'] = 'Vérification';
+}
+?>
Index: /tags/release-1_3RC1/language/index.htm
===================================================================
--- /tags/release-1_3RC1/language/index.htm	(revision 159)
+++ /tags/release-1_3RC1/language/index.htm	(revision 159)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>PhpWebGallery</title>
+    </head>
+    <body>
+        No access authorized
+    </body>
+</html>
Index: /tags/release-1_3RC1/picture.php
===================================================================
--- /tags/release-1_3RC1/picture.php	(revision 159)
+++ /tags/release-1_3RC1/picture.php	(revision 159)
@@ -0,0 +1,726 @@
+<?php
+/***************************************************************************
+ *                                picture.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 page shows the image full size
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );       
+//-------------------------------------------------- access authorization check
+check_cat_id( $_GET['cat'] );
+check_login_authorization();
+$page['plain_structure'] = get_plain_structure();
+if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+{
+  check_restrictions( $page['cat'] );
+}
+//---------------------------------------- incrementation of the number of hits
+$query = 'UPDATE '.PREFIX_TABLE.'images';
+$query.= ' SET hit=hit+1';
+$query.= ' WHERE id='.$_GET['image_id'];
+$query.= ';';
+@mysql_query( $query );
+//-------------------------------------------------------------- initialization
+initialize_category( 'picture' );
+//------------------------------------- main picture information initialization
+$query = 'SELECT id,date_available,comment,hit,keywords';
+$query.= ',author,name,file,date_creation,filesize,width,height';
+$query.= ',storage_category_id';
+if ( is_numeric( $page['cat'] ) )
+{
+  $query.= ',category_id';
+}
+$query.= ' FROM '.PREFIX_TABLE.'images';
+$query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id = ic.image_id';
+$query.= $page['where'];
+$query.= ' AND id = '.$_GET['image_id'];
+$query.= $conf['order_by'];
+$query.= ';';
+$result = mysql_query( $query );
+// if this image_id doesn't correspond to this category, an error message is
+// displayed, and execution is stopped
+if ( mysql_num_rows( $result ) == 0 )
+{
+  echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
+  echo '<a href="'.add_session_id( './category.php' ).'">';
+  echo $lang['thumbnails'].'</a></div>';
+  exit();
+}
+$row = mysql_fetch_array( $result );
+$page['id']             = $row['id'];
+$page['file']           = $row['file'];
+$page['name']           = $row['name'];
+$page['date_available'] = $row['date_available'];
+$page['comment']        = $row['comment'];
+$page['hit']            = $row['hit'];
+$page['author']         = $row['author'];
+$page['date_creation']  = $row['date_creation'];
+$page['filesize']       = $row['filesize'];
+$page['width']          = $row['width'];
+$page['height']         = $row['height'];
+$page['category_id']    = $row['category_id'];
+$page['keywords']       = $row['keywords'];
+$page['storage_category_id'] = $row['storage_category_id'];
+// retrieving the number of the picture in its category (in order)
+$query = 'SELECT DISTINCT(id)';
+$query.= ' FROM '.PREFIX_TABLE.'images';
+$query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id = ic.image_id';
+$query.= $page['where'];
+$query.= $conf['order_by'];
+$query.= ';';
+$result = mysql_query( $query );
+$page['num'] = 0;
+$row = mysql_fetch_array( $result );
+while ( $row['id'] != $page['id'] )
+{
+  $page['num']++;
+  $row = mysql_fetch_array( $result );
+}
+//--------------------------------------------------------- favorite management
+if ( isset( $_GET['add_fav'] ) )
+{
+  if ( $_GET['add_fav'] == 1 )
+  {
+    // verify if the picture is already in the favorite of the user
+    $query = 'SELECT COUNT(*) AS nb_fav';
+    $query.= ' FROM '.PREFIX_TABLE.'favorites';
+    $query.= ' WHERE image_id = '.$page['id'];
+    $query.= ' AND user_id = '.$user['id'];
+    $query.= ';';
+    $result = mysql_query( $query );
+    $row = mysql_fetch_array( $result );
+    if ( $row['nb_fav'] == 0 )
+    {
+      $query = 'INSERT INTO '.PREFIX_TABLE.'favorites';
+      $query.= ' (image_id,user_id) VALUES';
+      $query.= ' ('.$page['id'].','.$user['id'].')';
+      $query.= ';';
+      $result = mysql_query( $query );
+    }
+  }
+  if ( $_GET['add_fav'] == 0 )
+  {
+    $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
+    $query.= ' WHERE user_id = '.$user['id'];
+    $query.= ' AND image_id = '.$page['id'];
+    $query.= ';';
+    $result = mysql_query( $query );
+    
+    $page['cat_nb_images'] = $page['cat_nb_images'] - 1;
+    if ( $page['cat_nb_images'] <= 0 )
+    {
+      // there is no favorite picture anymore
+      // we redirect the user to the category page
+      $url = add_session_id( 'category.php' );
+      header( 'Request-URI: '.$url );
+      header( 'Content-Location: '.$url );  
+      header( 'Location: '.$url );
+      exit();
+    }
+    // redirection of the user to the picture.php page
+    // with the right picture
+    $page['num'] = $page['num'] - 1;
+    if ( $page['num'] == -1 )
+    {
+      $page['num'] = 0;
+    }
+    $query = 'SELECT id';
+    $query.= ' FROM '.PREFIX_TABLE.'images';
+    $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic';
+    $query.= ' ON id = ic.image_id';
+    $query.= $page['where'];
+    $query.= $conf['order_by'];
+    $query.= ' LIMIT '.$page['num'].',1';
+    $query.= ';';
+    $result = mysql_query( $query );
+    $row = mysql_fetch_array( $result );
+    $redirect = './picture.php?image_id='.$row['id'].'&cat='.$page['cat'];
+    $redirect.= '&expand='.$_GET['expand'];
+    if ( $page['cat'] == 'search' )
+    {
+      $redirect.= '&search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+    }
+    $url = add_session_id( $redirect, true );
+    header( 'Request-URI: '.$url );
+    header( 'Content-Location: '.$url );  
+    header( 'Location: '.$url );
+    exit();
+  }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/picture.vtp' );
+initialize_template();
+
+$tpl = array( 'back','submit','comments_title','comments_del','delete',
+              'comments_add','author','slideshow','slideshow_stop',
+              'period_seconds' );
+templatize_array( $tpl, 'lang', $handle );
+$vtp->setGlobalVar( $handle, 'user_template', $user['template'] );
+$vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] );
+//-------------------------------------------------------- slideshow management
+if ( isset( $_GET['slideshow'] ) )
+{
+  if ( !is_numeric( $_GET['slideshow'] ) )
+    $_GET['slideshow'] = $conf['slideshow_period'][0];
+  $vtp->addSession( $handle, 'stop_slideshow' );
+  $url = './picture.php';
+  $url.= '?image_id='.$page['id'];
+  $url.= '&amp;cat='.$page['cat'];
+  $url.= '&amp;expand='.$_GET['expand'];
+  if ( $page['cat'] == 'search' )
+  {
+    $url.= '&amp;search='.$_GET['search'];
+    $url.= '&amp;mode='.$_GET['mode'];
+  }
+  $vtp->setVar( $handle, 'stop_slideshow.url', add_session_id( $url ) );
+  $vtp->closeSession( $handle, 'stop_slideshow' );
+}
+else
+{
+  $vtp->addSession( $handle, 'start_slideshow' );
+  foreach ( $conf['slideshow_period'] as $option ) {
+    $vtp->addSession( $handle, 'second' );
+    $vtp->setVar( $handle, 'second.option', $option );
+    $url = './picture.php';
+    $url.= '?image_id='.$page['id'];
+    $url.= '&amp;cat='.$page['cat'];
+    $url.= '&amp;expand='.$_GET['expand'];
+    if ( $page['cat'] == 'search' )
+    {
+      $url.= '&amp;search='.$_GET['search'];
+      $url.= '&amp;mode='.$_GET['mode'];
+    }
+    $url.= '&amp;slideshow='.$option;
+    $vtp->setVar( $handle, 'second.url', add_session_id( $url ) );
+    $vtp->closeSession( $handle, 'second' );
+  }
+  $vtp->closeSession( $handle, 'start_slideshow' );
+}
+//------------------------------------------------------------------ page title
+if ( $page['name'] != '' )
+{
+  $vtp->setGlobalVar( $handle, 'page_title', $page['name'] );
+}
+else
+{
+  $vtp->setGlobalVar( $handle, 'page_title', $page['file'] );
+}
+//-------------------------------------------------- previous picture thumbnail
+if ( $page['num'] >= 1 )
+{
+  $prev = $page['num'] - 1;
+  $query = 'SELECT DISTINCT(id),name,file,tn_ext,storage_category_id';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id';
+  $query.= $page['where'];
+  $query.= $conf['order_by'];
+  $query.= ' LIMIT '.$prev.',1';
+  $query.= ';';
+  $result = mysql_query( $query );
+  $row = mysql_fetch_array( $result );
+
+  if ( $array_cat_directories[$row['storage_category_id']] == '' )
+  {
+    $array_cat_directories[$row['storage_category_id']] =
+      get_complete_dir( $row['storage_category_id'] );
+  }
+  $cat_directory = $array_cat_directories[$row['storage_category_id']];
+
+  $file = substr( $row['file'], 0, strrpos ( $row['file'], '.' ) );
+  $lien_thumbnail = $cat_directory.'/thumbnail/';
+  $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
+
+  $prev_title = $lang['previous_image'].' : ';
+  $alt_thumbnaill = '';
+  if ( $row['name'] != '' ) $alt_thumbnail = $row['name'];
+  else                      $alt_thumbnail = $file;
+  $prev_title.= $alt_thumbnail;
+  
+  $url_link = './picture.php?image_id='.$row['id'].'&amp;cat='.$page['cat'];
+  $url_link.= '&amp;expand='.$_GET['expand'];
+  if ( $page['cat'] == 'search' )
+  {
+    $url_link.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+  }
+  // sending vars for display
+  $vtp->addSession( $handle, 'previous' );
+  $vtp->setGlobalVar( $handle, 'previous.url', add_session_id( $url_link ) );
+  $vtp->setGlobalVar( $handle, 'previous.title', $prev_title );
+  $vtp->setGlobalVar( $handle, 'previous.src', $lien_thumbnail );
+  $vtp->setGlobalVar( $handle, 'previous.alt', $alt_thumbnail );
+  $vtp->closeSession( $handle, 'previous' );
+}
+else
+{
+  $vtp->addSession( $handle, 'previous_empty' );
+  $vtp->closeSession( $handle, 'previous_empty' );
+}
+//-------------------------------------------------------- main picture display
+if ( is_numeric( $page['cat'] ) )
+{
+  $intitule_cat = get_cat_display_name( $page['cat_name'], " - ",
+                                        "font-style:italic;" );
+}
+else
+{
+  $intitule_cat = $page['title'];
+}
+
+if ( $array_cat_directories[$page['storage_category_id']] == '' )
+{
+  $array_cat_directories[$page['storage_category_id']] =
+    get_complete_dir( $page['storage_category_id'] );
+}
+$cat_directory = $array_cat_directories[$page['storage_category_id']];
+
+$n = $page['num'] + 1;
+$intitule_titre = replace_space( $intitule_cat." - " ).$n.'/'.
+$intitule_titre.= $page['cat_nb_images']."<br />";
+if ( $page['name'] != "" )
+{
+  $intitule_file = $page['name'];
+}
+else
+{
+  $intitule_file = str_replace( "_", " ",
+                                substr( $page['file'], 0,
+                                        strrpos ( $page['file'], ".") ) );
+}
+if ( $page['cat'] == 'search' )
+{
+  $intitule_file = replace_search( $intitule_file, $_GET['search'] );
+}
+$vtp->setGlobalVar( $handle, 'title', $intitule_titre.$intitule_file );
+
+$lien_image = $cat_directory.$page['file'];
+
+// calculation of width and height
+if ( $page['width'] == "" )
+{
+  $taille_image = @getimagesize( $lien_image );
+  $original_width = $taille_image[0];
+  $original_height = $taille_image[1];
+}
+else
+{
+  $original_width = $page['width'];
+  $original_height = $page['height'];
+}
+
+$picture_size = get_picture_size( $original_width, $original_height,
+				  $user['maxwidth'], $user['maxheight'] );
+$final_width  = $picture_size[0];
+$final_height = $picture_size[1];
+        
+$url_link = './category.php?cat='.$page['cat'].'&amp;';
+$url_link.= 'num='.$page['num'].'&amp;expand='.$_GET['expand'];
+if ( $page['cat'] == 'search' )
+{
+  $url_link.= "&amp;search=".$_GET['search'].'&amp;mode='.$_GET['mode'];
+}
+$vtp->setGlobalVar( $handle, 'picture_link', add_session_id( $url_link ) );
+$vtp->setGlobalVar( $handle, 'picture_width', $final_width );
+$vtp->setGlobalVar( $handle, 'picture_height', $final_height );
+$vtp->setGlobalVar( $handle, 'picture_border_color', $user['couleur_text'] );
+$vtp->setGlobalVar( $handle, 'picture_src', $lien_image );
+$vtp->setGlobalVar( $handle, 'picture_alt', $page['file'] );
+
+if ( $page['comment'] != '' )
+{
+  if ( $page['cat'] == 'search' )
+  {
+    $picture_comment = replace_search( $page['comment'], $_GET['search'] );
+    $vtp->setGlobalVar( $handle, 'picture_comment', $picture_comment );
+  }
+  else
+  {
+    $vtp->setGlobalVar( $handle, 'picture_comment', $page['comment'] );
+  }
+}
+//--------------------------------------------------------- picture information
+// author
+if ( $page['author'] != "" )
+{
+  $vtp->addSession( $handle, 'info_line' );
+  $vtp->setVar( $handle, 'info_line.name', $lang['author'].' : ' );
+  $vtp->setVar( $handle, 'info_line.content', $page['author'] );
+  $vtp->closeSession( $handle, 'info_line' );
+}
+// creation date
+if ( $page['date_creation'] != "" )
+{
+  $vtp->addSession( $handle, 'info_line' );
+  $vtp->setVar( $handle, 'info_line.name', $lang['creation_date'].' : ' );
+  $vtp->setVar( $handle, 'info_line.content',
+                format_date( $page['date_creation'] ) );
+  $vtp->closeSession( $handle, 'info_line' );
+}
+// date of availability
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['registration_date'].' : ' );
+list( $year,$month,$day ) = explode( '-', $page['date_available'] );
+$vtp->setVar( $handle, 'info_line.content',
+              format_date( $page['date_available'] ) );
+$vtp->closeSession( $handle, 'info_line' );
+// size in pixels
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['size'].' : ' );
+if ( $original_width != $final_width or $original_height != $final_height )
+{
+  $content = '[ <a href="'.$lien_image.'" title="'.$lang['true_size'].'">';
+  $content.= $original_width.'*'.$original_height.'</a> ]';
+  $vtp->setVar( $handle, 'info_line.content', $content );
+}
+else
+{
+  $content = $original_width.'*'.$original_height;
+  $vtp->setVar( $handle, 'info_line.content', $content );
+}
+$vtp->closeSession( $handle, 'info_line' );
+// file
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['file'].' : ' );
+if ( $page['cat'] == 'search' )
+{
+  $content = replace_search( $page['file'], $_GET['search'] );
+  $vtp->setVar( $handle, 'info_line.content', $content );
+}
+else
+{
+  $vtp->setVar( $handle, 'info_line.content', $page['file'] );
+}
+$vtp->closeSession( $handle, 'info_line' );
+// filesize
+if ( $page['filesize'] == "" )
+{
+  $poids = floor ( filesize( $lien_image ) / 1024 );
+}
+else
+{
+  $poids = $page['filesize'];
+}
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['filesize'].' : ' );
+$vtp->setVar( $handle, 'info_line.content', $poids.' KB' );
+$vtp->closeSession( $handle, 'info_line' );
+// keywords
+if ( $page['keywords'] != '' )
+{
+  $vtp->addSession( $handle, 'info_line' );
+  $vtp->setVar( $handle, 'info_line.name', $lang['keywords'].' : ' );
+  $keywords = explode( ',', $page['keywords'] );
+  $content = '';
+  $url = './category.php?cat=search&amp;expand='.$_GET['expand'];
+  $url.= '&amp;mode=OR&amp;search=';
+  foreach ( $keywords as $i => $keyword ) {
+    $local_url = add_session_id( $url.$keyword );
+    if ( $i > 0 ) $content.= ',';
+    $content.= '<a href="'.$local_url.'">'.$keyword.'</a>';
+  }
+  $vtp->setVar( $handle, 'info_line.content', $content );
+  $vtp->closeSession( $handle, 'info_line' );
+}
+// number of visits
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['visited'].' : ' );
+$vtp->setVar( $handle, 'info_line.content', $page['hit'].' '.$lang['times'] );
+$vtp->closeSession( $handle, 'info_line' );
+//------------------------------------------------------- favorite manipulation
+if ( $page['cat'] != 'fav' and !$user['is_the_guest'] )
+{
+  $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+  $url.= '&amp;expand='.$_GET['expand'].'&amp;add_fav=1';
+  if ( $page['cat'] == 'search' )
+  {
+    $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+  }
+  $vtp->addSession( $handle, 'favorite' );
+  $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
+  $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] );
+  $vtp->setVar( $handle, 'favorite.src',
+                './template/'.$user['template'].'/theme/favorite.gif' );
+  $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['add_favorites_alt'].' ]' );
+  $vtp->closeSession( $handle, 'favorite' );
+}
+if ( $page['cat'] == 'fav' )
+{
+  $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+  $url.= '&amp;expand='.$_GET['expand'].'&amp;add_fav=0';
+  $vtp->addSession( $handle, 'favorite' );
+  $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
+  $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] );
+  $vtp->setVar( $handle, 'favorite.src',
+                './template/'.$user['template'].'/theme/del_favorite.gif' );
+  $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['del_favorites_alt'].' ]' );
+  $vtp->closeSession( $handle, 'favorite' );
+}
+//------------------------------------ admin link for information modifications
+if ( $user['status'] == 'admin' )
+{
+  $vtp->addSession( $handle, 'modification' );
+  $url = './admin/admin.php?page=picture_modify&amp;cat_id='.$page['cat'];
+  $url.= '&amp;image_id='.$page['id'];
+  $vtp->setVar( $handle, 'modification.link', add_session_id( $url ) );
+  $vtp->setVar( $handle, 'modification.name', $lang['link_info_image'] );
+}
+//---------------------------------------------- next picture thumbnail display
+if ( $page['num'] < $page['cat_nb_images']-1 )
+{
+  $next = $page['num'] + 1;
+  $query = 'SELECT DISTINCT(id),name,file,tn_ext,storage_category_id';
+  $query.= ' FROM '.PREFIX_TABLE.'images';
+  $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id';
+  $query.= $page['where'];
+  $query.= $conf['order_by'];
+  $query.= ' LIMIT '.$next.',1';
+  $query.= ';';
+  $result = mysql_query( $query );
+  $row = mysql_fetch_array( $result );
+
+  if ( $array_cat_directories[$row['storage_category_id']] == '' )
+  {
+    $array_cat_directories[$row['storage_category_id']] =
+      get_complete_dir( $row['storage_category_id'] );
+  }
+  $cat_directory = $array_cat_directories[$row['storage_category_id']];
+
+  $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+  $lien_thumbnail = $cat_directory.'thumbnail/';
+  $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
+  
+  if ( $row['name'] != "" )
+  {
+    $alt_thumbnail = $row['name'];
+  }
+  else
+  {
+    $alt_thumbnail = $file;
+  }
+  $next_title = $lang['next_image']." : ".$alt_thumbnail;
+
+  $url_link = './picture.php?image_id='.$row['id'].'&amp;cat='.$page['cat'];
+  $url_link.= '&amp;expand='.$_GET['expand'];
+  if ( $page['cat'] == 'search' )
+  {
+    $url_link.= "&amp;search=".$_GET['search'].'&amp;mode='.$_GET['mode'];
+  }
+  // sending vars for display
+  $vtp->addSession( $handle,   'next' );
+  $vtp->setGlobalVar( $handle, 'next.url', add_session_id( $url_link ) );
+  $vtp->setGlobalVar( $handle, 'next.title', $next_title );
+  $vtp->setGlobalVar( $handle, 'next.src', $lien_thumbnail );
+  $vtp->setGlobalVar( $handle, 'next.alt', $alt_thumbnail );
+  $vtp->closeSession( $handle, 'next' );
+  // slideshow
+  if ( isset( $_GET['slideshow'] ) )
+  {
+    $vtp->addSession( $handle, 'refresh' );
+    $vtp->setVar( $handle, 'refresh.time', $_GET['slideshow'] );
+    $url = $url_link.'&amp;slideshow='.$_GET['slideshow'];
+    $vtp->setVar( $handle, 'refresh.url', add_session_id( $url ) );
+    $vtp->closeSession( $handle, 'refresh' );
+  }
+}
+else
+{
+  $vtp->addSession( $handle, 'previous_empty' );
+  $vtp->closeSession( $handle, 'previous_empty' );
+}
+//---------------------------------------------------- users's comments display
+if ( $conf['show_comments'] )
+{
+  $vtp->addSession( $handle, 'comments' );
+  // comment registeration
+  if ( isset( $_POST['content'] ) and $_POST['content'] != '' )
+  {
+    $register_comment = true;
+
+    if ( !$user['is_the_guest'] ) $author = $user['username'];
+    if ( $_POST['author'] != '' ) $author = $_POST['author'];
+    // if a guest try to use the name of an already existing user, he must
+    // be rejected
+    if ( isset( $author ) and $author != $user['username'] )
+    {
+      $query = 'SELECT COUNT(*) AS user_exists';
+      $query.= ' FROM '.PREFIX_TABLE.'users';
+      $query.= " WHERE username = '".$author."'";
+      $query.= ';';
+      $row = mysql_fetch_array( mysql_query( $query ) );
+      if ( $row['user_exists'] == 1 )
+      {
+        $vtp->addSession( $handle, 'information' );
+        $message = $lang['comment_user_exists'];
+        $vtp->setVar( $handle, 'information.content', $message );
+        $vtp->closeSession( $handle, 'information' );
+        $register_comment = false;
+      }
+    }
+
+    if ( $register_comment )
+    {
+      // anti-flood system
+      $reference_date = time() - $conf['anti-flood_time'];
+      $query = 'SELECT id';
+      $query.= ' FROM '.PREFIX_TABLE.'comments';
+      $query.= ' WHERE date > '.$reference_date;
+      $query.= " AND author = '".$author."'";
+      $query.= ';';
+      if ( mysql_num_rows( mysql_query( $query ) ) == 0
+           or $conf['anti-flood_time'] == 0 )
+      {
+        $query = 'INSERT INTO '.PREFIX_TABLE.'comments';
+        $query.= ' (author,date,image_id,content,validated) VALUES';
+        $query.= ' (';
+        if ( !isset( $author ) ) $query.= 'NULL';
+        else                     $query.= "'".$author."'";
+        $query.= ','.time().','.$page['id'];
+        $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'";
+        if ( !$conf['comments_validation'] or $user['status'] == 'admin' )
+          $query.= ",'true'";
+        else
+          $query.= ",'false'";
+        $query.= ');';
+        mysql_query( $query );
+        // information message
+        $vtp->addSession( $handle, 'information' );
+        $message = $lang['comment_added'];
+        if ( $conf['comments_validation'] and $user['status'] != 'admin' )
+        {
+          $message.= '<br />'.$lang['comment_to_validate'];
+        }
+        $vtp->setVar( $handle, 'information.content', $message );
+        $vtp->closeSession( $handle, 'information' );
+        // notification to the administrators
+        if ( $conf['mail_notification'] )
+        {
+          $cat_name = get_cat_display_name( $page['cat_name'], ' > ', '' );
+          $cat_name = strip_tags( $cat_name );
+          if ( $page['name'] == '' ) $picture = $page['file'];
+          else                       $picture = $page['name'];
+          notify( 'comment', $cat_name.' > '.$picture );
+        }
+      }
+      else
+      {
+        // information message
+        $vtp->addSession( $handle, 'information' );
+        $message = $lang['comment_anti-flood'];
+        $vtp->setVar( $handle, 'information.content', $message );
+        $vtp->closeSession( $handle, 'information' );
+      }
+    }
+  }
+  // comment deletion
+  if ( isset( $_GET['del'] )
+       and is_numeric( $_GET['del'] )
+       and $user['status'] == 'admin' )
+  {
+    $query = 'DELETE FROM '.PREFIX_TABLE.'comments';
+    $query.= ' WHERE id = '.$_GET['del'].';';
+    mysql_query( $query );
+  }
+  // number of comment for this picture
+  $query = 'SELECT COUNT(*) AS nb_comments';
+  $query.= ' FROM '.PREFIX_TABLE.'comments';
+  $query.= ' WHERE image_id = '.$page['id'];
+  $query.= " AND validated = 'true'";
+  $query.= ';';
+  $row = mysql_fetch_array( mysql_query( $query ) );
+  $page['nb_comments'] = $row['nb_comments'];
+  // navigation bar creation
+  $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+  $url.= '&amp;expand='.$_GET['expand'];
+  if ( $page['cat'] == 'search' )
+  {
+    $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+  }
+  if( !isset( $_GET['start'] )
+      or !is_numeric( $_GET['start'] )
+      or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
+  {
+    $page['start'] = 0;
+  }
+  else
+  {
+    $page['start'] = $_GET['start'];
+  }
+  $page['navigation_bar'] = create_navigation_bar( $url, $page['nb_comments'],
+                                                   $page['start'],
+                                                   $conf['nb_comment_page'],
+                                                   '' );
+  // sending vars for display
+  $vtp->setGlobalVar( $handle, 'navigation_bar', $page['navigation_bar'] );
+  $vtp->setGlobalVar( $handle, 'nb_comments', $page['nb_comments'] );
+
+  $query = 'SELECT id,author,date,image_id,content';
+  $query.= ' FROM '.PREFIX_TABLE.'comments';
+  $query.= ' WHERE image_id = '.$page['id'];
+  $query.= " AND validated = 'true'";
+  $query.= ' ORDER BY date ASC';
+  $query.= ' LIMIT '.$page['start'].', '.$conf['nb_comment_page'].';';
+  $result = mysql_query( $query );
+                
+  while ( $row = mysql_fetch_array( $result ) )
+  {
+    $vtp->addSession( $handle, 'comment' );
+    $author = $row['author'];
+    if ( $row['author'] == '' ) $author = $lang['guest'];
+    $vtp->setVar( $handle, 'comment.author', $author );
+    $vtp->setVar( $handle, 'comment.date',
+                  format_date( $row['date'], 'unix', true ) );
+    $vtp->setVar( $handle, 'comment.content', nl2br( $row['content'] ) );
+    if ( $user['status'] == 'admin' )
+    {
+      $vtp->addSession( $handle, 'delete' );
+      $vtp->setVar( $handle, 'delete.link',
+                    add_session_id( $url.'&amp;del='.$row['id'] ) );
+      $vtp->closeSession( $handle, 'delete' );
+    }
+    $vtp->closeSession( $handle, 'comment' );
+  }
+
+  if ( !$user['is_the_guest']
+       or ( $user['is_the_guest'] and $conf['comments_forall'] ) )
+  {
+    $vtp->addSession( $handle, 'add_comment' );
+    // form action
+    $action = str_replace( '&', '&amp;', $_SERVER['REQUEST_URI'] );
+    $vtp->setGlobalVar( $handle, 'form_action', $action );
+    // display author field if the user is not logged in
+    if ( !$user['is_the_guest'] )
+    {
+      $vtp->addSession( $handle, 'author_known' );
+      $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] );
+      $vtp->closeSession( $handle, 'author_known' );
+    }
+    else
+    {
+      $vtp->addSession( $handle, 'author_field' );
+      $vtp->closeSession( $handle, 'author_field' );
+    }
+    $vtp->closeSession( $handle, 'add_comment' );
+  }
+  $vtp->closeSession( $handle, 'comments' );
+}
+//------------------------------------------------------------ log informations
+pwg_log( 'picture', $intitule_cat, $page['file'] );
+mysql_close();
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/profile.php
===================================================================
--- /tags/release-1_3RC1/profile.php	(revision 159)
+++ /tags/release-1_3RC1/profile.php	(revision 159)
@@ -0,0 +1,381 @@
+<?php
+/***************************************************************************
+ *                                profile.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+// customize appearance of the site for a user
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+if ( $user['is_the_guest'] )
+{
+  echo '<div style="text-align:center;">'.$lang['only_members'].'<br />';
+  echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
+  exit();
+}
+//-------------------------------------------------------------- initialization
+check_cat_id( $_GET['cat'] );
+//------------------------------------------------------ update & customization
+$infos = array( 'nb_image_line', 'nb_line_page', 'language',
+                'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
+                'short_period', 'long_period', 'template', 'mail_address' );
+// mise à jour dans la base de données des valeurs
+// des paramètres pour l'utilisateur courant
+//    - on teste si chacune des variables est passée en argument à la page
+//    - ce qui signifie que l'on doit venir de la page de personnalisation
+$errors = array();
+if ( isset( $_POST['submit'] ) )
+{
+  $int_pattern = '/^\d+$/';
+  if ( $_POST['maxwidth'] != ''
+       and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
+             or $_POST['maxwidth'] < 50 ) )
+  {
+    array_push( $errors, $lang['err_maxwidth'] );
+  }
+  if ( $_POST['maxheight']
+       and ( !preg_match( $int_pattern, $_POST['maxheight'] )
+             or $_POST['maxheight'] < 50 ) )
+  {
+    array_push( $errors, $lang['err_maxheight'] );
+  }
+  // periods must be integer values, they represents number of days
+  if ( !preg_match( $int_pattern, $_POST['short_period'] )
+       or !preg_match( $int_pattern, $_POST['long_period'] ) )
+  {
+    array_push( $errors, $lang['err_periods'] );
+  }
+  else
+  {
+    // long period must be longer than short period
+    if ( $_POST['long_period'] <= $_POST['short_period']
+         or $_POST['short_period'] <= 0 )
+    {
+      array_push( $errors, $lang['err_periods_2'] );
+    }
+  }
+  $mail_error = validate_mail_address( $_POST['mail_address'] );
+  if ( $mail_error != '' )
+  {
+    array_push( $errors, $mail_error );
+  }
+  if ( $_POST['use_new_pwd'] == 1 )
+  {
+    // password must be the same as its confirmation
+    if ( $_POST['password'] != $_POST['passwordConf'] )
+    {
+      array_push( $errors, $lang['reg_err_pass'] );
+    }
+  }
+
+  if ( count( $errors ) == 0 )
+  {
+    $query = 'UPDATE '.PREFIX_TABLE.'users';
+    $query.= ' SET ';
+    foreach ( $infos as $i => $info ) {
+      if ( $i > 0 ) $query.= ',';
+      $query.= $info;
+      $query.= ' = ';
+      if ( $_POST[$info] == '' ) $query.= 'NULL';
+      else                       $query.= "'".$_POST[$info]."'";
+    }
+    $query.= ' WHERE id = '.$user['id'];
+    $query.= ';';
+    mysql_query( $query );
+
+    if ( $_POST['use_new_pwd'] == 1 )
+    {
+      $query = 'UPDATE '.PREFIX_TABLE.'users';
+      $query.= " SET password = '".md5( $_POST['password'] )."'";
+      $query.= ' WHERE id = '.$user['id'];
+      $query.= ';';
+      mysql_query( $query );
+    }
+    if ( $_POST['create_cookie'] == 1 )
+    {
+      setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
+                 cookie_path() );
+      // update the expiration date of the session
+      $query = 'UPDATE '.PREFIX_TABLE.'sessions';
+      $query.= ' SET expiration = '.$_POST['cookie_expiration'];
+      $query.= " WHERE id = '".$page['session_id']."'";
+      $query.= ';';
+      mysql_query( $query );
+    }
+    // redirection
+    $url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
+    if ( $page['cat'] == 'search' )
+    {
+      $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
+    }
+    if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true );
+    header( 'Request-URI: '.$url );  
+    header( 'Content-Location: '.$url );  
+    header( 'Location: '.$url );
+    exit();
+  }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp' );
+initialize_template();
+$tpl = array( 'customize_page_title','customize_title','password','new',
+              'reg_confirm','submit','create_cookie' );
+templatize_array( $tpl, 'lang', $handle );
+//----------------------------------------------------------------- form action
+$url = './profile.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+if ( $page['cat'] == 'search' )
+{
+  $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+}
+$vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
+//-------------------------------------------------------------- errors display
+if ( count( $errors ) != 0 )
+{
+  $vtp->addSession( $handle, 'errors' );
+  foreach ( $errors as $error ) {
+    $vtp->addSession( $handle, 'li' );
+    $vtp->setVar( $handle, 'li.li', $error );
+    $vtp->closeSession( $handle, 'li' );
+  }
+  $vtp->closeSession( $handle, 'errors' );
+}
+//---------------------------------------------------- number of images per row
+if ( in_array( 'nb_image_line', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_nb_image_per_row'] );
+  $vtp->addSession( $handle, 'select' );
+  $vtp->setVar( $handle, 'select.name', 'nb_image_line' );
+  for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
+  {
+    $vtp->addSession( $handle, 'option' );
+    $vtp->setVar( $handle, 'option.option', $conf['nb_image_row'][$i] );
+    if ( $conf['nb_image_row'][$i] == $user['nb_image_line'] )
+    {
+      $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+    }
+    $vtp->closeSession( $handle, 'option' );
+  }
+  $vtp->closeSession( $handle, 'select' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//------------------------------------------------------ number of row per page
+if ( in_array( 'nb_line_page', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_nb_row_per_page'] );
+  $vtp->addSession( $handle, 'select' );
+  $vtp->setVar( $handle, 'select.name', 'nb_line_page' );
+  for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
+  {
+    $vtp->addSession( $handle, 'option' );
+    $vtp->setVar( $handle, 'option.option', $conf['nb_row_page'][$i] );
+    if ( $conf['nb_row_page'][$i] == $user['nb_line_page'] )
+    {
+      $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+    }
+    $vtp->closeSession( $handle, 'option' );
+  }
+  $vtp->closeSession( $handle, 'select' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------------------- template
+if ( in_array( 'template', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_template'] );
+  $vtp->addSession( $handle, 'select' );
+  $vtp->setVar( $handle, 'select.name', 'template' );
+  $option = get_dirs( './template/' );
+  for ( $i = 0; $i < sizeof( $option ); $i++ )
+  {
+    $vtp->addSession( $handle, 'option' );
+    $vtp->setVar( $handle, 'option.option', $option[$i] );
+    if ( $option[$i] == $user['template'] )
+    {
+      $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+    }
+    $vtp->closeSession( $handle, 'option' );
+  }
+  $vtp->closeSession( $handle, 'select' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------------------- language
+if ( in_array( 'language', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_language'] );
+  $vtp->addSession( $handle, 'select' );
+  $vtp->setVar( $handle, 'select.name', 'language' );
+  $option = get_languages( './language/' );
+  for ( $i = 0; $i < sizeof( $option ); $i++ )
+  {
+    $vtp->addSession( $handle, 'option' );
+    $vtp->setVar( $handle, 'option.option', $option[$i] );
+    if( $option[$i] == $user['language'] )
+    {
+      $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+    }
+    $vtp->closeSession( $handle, 'option' );
+  }
+  $vtp->closeSession( $handle, 'select' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------------------------------------- short period
+if ( in_array( 'short_period', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_short_period'] );
+  $vtp->addSession( $handle, 'text' );
+  $vtp->setVar( $handle, 'text.name', 'short_period' );
+  $vtp->setVar( $handle, 'text.value', $user['short_period'] );
+  $vtp->closeSession( $handle, 'text' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------------------- long period
+if ( in_array( 'long_period', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_long_period'] );
+  $vtp->addSession( $handle, 'text' );
+  $vtp->setVar( $handle, 'text.name', 'long_period' );
+  $vtp->setVar( $handle, 'text.value', $user['long_period'] );
+  $vtp->closeSession( $handle, 'text' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//--------------------------------------------------------- max displayed width
+if ( in_array( 'maxwidth', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['maxwidth'] );
+  $vtp->addSession( $handle, 'text' );
+  $vtp->setVar( $handle, 'text.name', 'maxwidth' );
+  $vtp->setVar( $handle, 'text.value', $user['maxwidth'] );
+  $vtp->closeSession( $handle, 'text' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------- max displayed height
+if ( in_array( 'maxheight', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['maxheight'] );
+  $vtp->addSession( $handle, 'text' );
+  $vtp->setVar( $handle, 'text.name', 'maxheight' );
+  $vtp->setVar( $handle, 'text.value', $user['maxheight'] );
+  $vtp->closeSession( $handle, 'text' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------------------------------------- mail address
+if ( in_array( 'mail_address', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['mail_address'] );
+  $vtp->addSession( $handle, 'text' );
+  $vtp->setVar( $handle, 'text.name', 'mail_address' );
+  $vtp->setVar( $handle, 'text.value', $user['mail_address'] );
+  $vtp->closeSession( $handle, 'text' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------- expand all categories ?
+if ( in_array( 'expand', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_expand'] );
+  $vtp->addSession( $handle, 'group' );
+  $vtp->addSession( $handle, 'radio' );
+  $vtp->setVar( $handle, 'radio.name', 'expand' );
+  $vtp->setVar( $handle, 'radio.value', 'true' );
+  $checked = '';
+  if ( $user['expand'] )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $handle, 'radio.checked', $checked );
+  $vtp->setVar( $handle, 'radio.option', $lang['yes'] );
+  $vtp->closeSession( $handle, 'radio' );
+  $vtp->addSession( $handle, 'radio' );
+  $vtp->setVar( $handle, 'radio.name', 'expand' );
+  $vtp->setVar( $handle, 'radio.value', 'false' );
+  $checked = '';
+  if ( !$user['expand'] )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $handle, 'radio.checked', $checked );
+  $vtp->setVar( $handle, 'radio.option', $lang['no'] );
+  $vtp->closeSession( $handle, 'radio' );
+  $vtp->closeSession( $handle, 'group' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------- show number of comments on thumbnails page
+if ( in_array( 'show_nb_comments', $infos ) )
+{
+  $vtp->addSession( $handle, 'line' );
+  $vtp->setVar( $handle, 'line.name', $lang['customize_show_nb_comments'] );
+  $vtp->addSession( $handle, 'group' );
+  $vtp->addSession( $handle, 'radio' );
+  $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' );
+  $vtp->setVar( $handle, 'radio.value', 'true' );
+  $checked = '';
+  if ( $user['show_nb_comments'] )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $handle, 'radio.checked', $checked );
+  $vtp->setVar( $handle, 'radio.option', $lang['yes'] );
+  $vtp->closeSession( $handle, 'radio' );
+  $vtp->addSession( $handle, 'radio' );
+  $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' );
+  $vtp->setVar( $handle, 'radio.value', 'false' );
+  $checked = '';
+  if ( !$user['show_nb_comments'] )
+  {
+    $checked = ' checked="checked"';
+  }
+  $vtp->setVar( $handle, 'radio.checked', $checked );
+  $vtp->setVar( $handle, 'radio.option', $lang['no'] );
+  $vtp->closeSession( $handle, 'radio' );
+  $vtp->closeSession( $handle, 'group' );
+  $vtp->closeSession( $handle, 'line' );
+}
+//--------------------------------------------------------------- create cookie
+if ( $conf['authorize_cookies'] )
+{
+  $vtp->addSession( $handle, 'cookie' );
+  $options = array(
+    array( 'message' => '1 '.$lang['customize_day'],
+           'value' => time() + 24*60*60 ),
+    array( 'message' => '1 '.$lang['customize_week'],
+           'value' => time() + 7*24*60*60 ),
+    array( 'message' => '1 '.$lang['customize_month'],
+           'value' => time() + 30*24*60*60 ),
+    array( 'message' => '1 '.$lang['customize_year'],
+           'value' => time() + 365*24*60*60 )
+    );
+  foreach ( $options as $option ) {
+    $vtp->addSession( $handle, 'expiration_option' );
+    $vtp->setVar( $handle, 'expiration_option.option', $option['message'] );
+    $vtp->setVar( $handle, 'expiration_option.value', $option['value'] );
+    $vtp->closeSession( $handle, 'expiration_option' );
+  }
+  $vtp->closeSession( $handle, 'cookie' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/readme.txt
===================================================================
--- /tags/release-1_3RC1/readme.txt	(revision 159)
+++ /tags/release-1_3RC1/readme.txt	(revision 159)
@@ -0,0 +1,31 @@
+                  PhpWebGallery version 1.3 beta (14/09/2003)
+                          http://phpwebgallery.net
+                       http://forum.phpwebgallery.net
+
+English -----------------------------------------------------------------------
+                  Installation instructions for PhpWebGallery
+
+1. extract files from the downloaded file (using tar or unzip command, or
+   softwares like powerarchiver or winzip)
+
+2. place de source files on your website in the directory of your choice
+   ("gallery" for example), it is useless to place "readme.txt" file on your
+   website
+
+3. go to the URL http://your.domain/gallery/admin/install.php
+
+4. follow the instructions of installation
+
+Francais ----------------------------------------------------------------------
+                 Instructions d'installation de PhpWebGallery
+
+1. décompresser à l'aide de winzip par exemple (winrar, winace et beaucoup
+   d'autres le permettent également) le fichier téléchargé.
+
+2. placer les fichiers décompressés sur votre serveur web dans le répertoire
+   de votre choix ("galerie" par exemple), il est inutile de placer le
+   fichier "readme.txt" sur votre serveur web
+
+3. aller à l'URL http://votre.domaine/galerie/admin/install.php
+
+4. suivre les instructions d'installation
Index: /tags/release-1_3RC1/register.php
===================================================================
--- /tags/release-1_3RC1/register.php	(revision 159)
+++ /tags/release-1_3RC1/register.php	(revision 159)
@@ -0,0 +1,103 @@
+<?php
+/***************************************************************************
+ *                                register.php                             *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+if ( $conf['access'] == "restricted" )
+{
+  echo $lang['only_members'];
+  exit();
+}
+//----------------------------------------------------------- user registration
+$error = array();
+if ( isset( $_POST['submit'] ) )
+{
+  $error = register_user( $_POST['login'], $_POST['password'],
+                          $_POST['password_conf'], $_POST['mail_address'] );
+  if ( sizeof( $error ) == 0 )
+  {
+    $session_id = session_create( $_POST['login'] );
+    $url = 'category.php?id='.$session_id;
+    header( 'Request-URI: '.$url );
+    header( 'Content-Location: '.$url );  
+    header( 'Location: '.$url );
+    exit();
+  }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'register_page_title',
+                    $lang['register_page_title'] );
+$vtp->setGlobalVar( $handle, 'register_title',   $lang['register_title'] );
+$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
+$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
+initialize_template();
+//----------------------------------------------------------------- form action
+$vtp->setGlobalVar( $handle, 'form_action', './register.php' );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+  $vtp->addSession( $handle, 'errors' );
+  for ( $i = 0; $i < sizeof( $error ); $i++ )
+  {
+    $vtp->addSession( $handle, 'li' );
+    $vtp->setVar( $handle, 'li.li', $error[$i] );
+    $vtp->closeSession( $handle, 'li' );
+  }
+  $vtp->closeSession( $handle, 'errors' );
+}
+//----------------------------------------------------------------------- login
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['login'] );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.name', 'login' );
+$vtp->setVar( $handle, 'text.value', $_POST['login'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+//-------------------------------------------------------------------- password
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['password'] );
+$vtp->addSession( $handle, 'password' );
+$vtp->setVar( $handle, 'password.name', 'password' );
+$vtp->setVar( $handle, 'password.value', '' );
+$vtp->closeSession( $handle, 'password' );
+$vtp->closeSession( $handle, 'line' );
+//------------------------------------------------------- password confirmation
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] );
+$vtp->addSession( $handle, 'password' );
+$vtp->setVar( $handle, 'password.name', 'password_conf' );
+$vtp->setVar( $handle, 'password.value', '' );
+$vtp->closeSession( $handle, 'password' );
+$vtp->closeSession( $handle, 'line' );
+//---------------------------------------------------------------- mail address
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['mail_address'] );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.name', 'mail_address' );
+$vtp->setVar( $handle, 'text.value', $_POST['mail_address'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
Index: /tags/release-1_3RC1/search.php
===================================================================
--- /tags/release-1_3RC1/search.php	(revision 159)
+++ /tags/release-1_3RC1/search.php	(revision 159)
@@ -0,0 +1,121 @@
+<?php
+/***************************************************************************
+ *                                 search.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+//----------------------------------------------------------------- redirection
+$error = array();
+if ( isset( $_POST['search'] ) )
+{
+  $redirect = true;
+  $search = array();
+  $words = preg_split( '/\s+/', $_POST['search'] );
+  foreach ( $words as $i => $word ) {
+    if ( strlen( $word ) > 2 and !preg_match( '/[,;:\']/', $word ) )
+    {
+      array_push( $search, $word );
+    }
+    else
+    {
+      $redirect = false;
+      array_push( $error, $lang['invalid_search'] );
+      break;
+    }
+  }
+  $search = array_unique( $search );
+  $search = implode( ',', $search );
+  if ( $redirect )
+  {
+    $url = 'category.php?cat=search&search='.$search.'&mode='.$_POST['mode'];
+    $url = add_session_id( $url, true );
+    header( 'Request-URI: '.$url );
+    header( 'Content-Location: '.$url );  
+    header( 'Location: '.$url );
+    exit();
+  }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/search.vtp' );
+initialize_template();
+
+$tpl = array( 'search_title','search_return_main_page','submit',
+              'search_comments' );
+templatize_array( $tpl, 'lang', $handle );
+//----------------------------------------------------------------- form action
+$vtp->setGlobalVar( $handle, 'form_action', add_session_id( './search.php' ) );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+  $vtp->addSession( $handle, 'errors' );
+  for ( $i = 0; $i < sizeof( $error ); $i++ )
+  {
+    $vtp->addSession( $handle, 'li' );
+    $vtp->setVar( $handle, 'li.li', $error[$i] );
+    $vtp->closeSession( $handle, 'li' );
+  }
+  $vtp->closeSession( $handle, 'errors' );
+}
+//------------------------------------------------------------------------ form
+// search field
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['search_field_search'].' *' );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.size', '40' );
+$vtp->setVar( $handle, 'text.name', 'search' );
+$vtp->setVar( $handle, 'text.value', $_POST['search'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+// mode of search : match all words or at least one of this words
+$vtp->addSession( $handle, 'line' );
+$vtp->addSession( $handle, 'group' );
+
+$vtp->addSession( $handle, 'radio' );
+$vtp->setVar( $handle, 'radio.name', 'mode' );
+$vtp->setVar( $handle, 'radio.value', 'OR' );
+$vtp->setVar( $handle, 'radio.option', $lang['search_mode_or'] );
+if ( $_POST['mode'] == 'OR' or $_POST['mode'] == '' )
+{
+  $vtp->setVar( $handle, 'radio.checked', ' checked="checked"' );
+}
+$vtp->closeSession( $handle, 'radio' );
+
+$vtp->addSession( $handle, 'radio' );
+$vtp->setVar( $handle, 'radio.name', 'mode' );
+$vtp->setVar( $handle, 'radio.value', 'AND' );
+$vtp->setVar( $handle, 'radio.option', $lang['search_mode_and'] );
+if ( $_POST['mode'] == 'AND' )
+{
+  $vtp->setVar( $handle, 'radio.checked', ' checked="checked"' );
+}
+$vtp->closeSession( $handle, 'radio' );
+
+$vtp->closeSession( $handle, 'group' );
+$vtp->closeSession( $handle, 'line' );
+//---------------------------------------------------- return to main page link
+$vtp->setGlobalVar( $handle, 'back_url', add_session_id( './category.php' ) );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+//------------------------------------------------------------ log informations
+pwg_log( 'search', $page['title'] );
+mysql_close();
+?>
Index: /tags/release-1_3RC1/template/default/about.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/about.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/about.vtp	(revision 159)
@@ -0,0 +1,32 @@
+<html>
+  <head>
+    {#style}
+    <title>{#about_page_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}" />
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#about_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:5px;">&nbsp;</div>
+          {#frame_start}50%{#frame_begin}
+            <div class="menu" style="white-space:normal;margin:10px;">
+              {#about_message}
+            </div>
+          {#frame_end}
+          <div style="text-align:center;margin:5px;">
+            <a href="{#back_url}">{#about_return}</a>
+          </div>
+          <div style="text-align:center;margin:5px;">
+            <img src="./template/{#user_template}/images/php_sqreuil_artistes.gif" alt="php logo" />
+          </div>
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/admin/admin.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/admin.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/admin.vtp	(revision 159)
@@ -0,0 +1,222 @@
+<html>
+  <head>
+    <title>{#title_default}</title>
+    <style>
+      a {
+        text-decoration:none;
+        color:#006699;
+      }
+      a:hover {
+        text-decoration:underline;
+      }
+      body,table,input,form,select,textarea {
+        font-family:arial,verdana,sans-serif;
+        font-size:12px;
+      }
+      .miniature {
+        border:solid 1px black;
+      }
+      body {
+        background-color:#E5E5E5;
+      }
+      .titretable1 {
+        color:black;
+        background-color:#D3DCE3;
+        text-align:center;
+        border:2px solid #006699;
+        font-weight:bold;
+        border-bottom:0px;
+      }
+      .grostitre {
+        text-align:center;
+        margin:10px 50px 10px 50px;
+        font-size:20px;
+        width:300px;
+      }
+      .plan {
+        margin:10px 10px 10px 2px;
+        white-space:nowrap;
+      }
+      .table1 {
+        border-collapse:collapse;
+        background-color:#FFFFFF;
+      }
+      .contenucellule {
+        background-color:#EEEEEE;
+        border:2px solid #006699;
+      }
+      .style1 {
+        margin-top:20px;
+      }
+      th {
+        font-weight:bold;
+        background-color:#D3DCE3;
+      }
+      td.row1 {
+        background-color:#E6E4E4;
+      }
+      td.row2,td.throw2 {
+        background-color:#E8E8E8;
+      }
+      td.throw2 {
+        text-align:center;
+        font-weight:bold;
+      }
+      td.row3 {
+        background-color:#eeeeee;
+      }
+      td.row4 {
+        background-color:#cccccc;
+      }
+      .cat_plan {
+        font-weight:bold;
+      }
+      .retrait {
+        margin:10px;
+        margin-left:30px;
+        margin-top:2px;
+      }
+      input,textarea {
+        border-width:1;
+        border-color:#000000;
+        background:#ffffff;
+        color: #000000;
+      }
+      .erreur {
+        color:red;
+        text-align:center;
+      }
+      .errors {
+        text-align:left;
+        margin:25px;
+        background-color:#ffe1e1;
+        border:1px solid red;
+        color:black;
+      }
+      .errors_title {
+        margin:5px;
+        font-weight:bold;
+        font-size:120%;
+        text-align:center;
+        color:red;
+      }
+      .info {
+        color:darkblue;
+        text-align:center;
+      }
+      div.key {
+        margin-left : 10px;
+      }
+      td.choice {
+        text-align : center;
+      }
+<!-- comments CSS style -->
+      .commentsAuthor,.commentsTitle,.commentsInfos,.commentsContent,.commentsNavigationBar {
+        color:black;
+        font-family:arial,sans-Serif;
+        font-size:12px;
+      }
+      .commentsTitle,.commentsAuthor {
+        text-align:center;
+        font-weight:bold;
+      }
+      .commentsInfos {
+        text-align:right;
+        margin:3px 3px 3px 10px;
+        font-size:11px;
+      }
+      .commentsContent {
+        margin:10px;
+      }
+      .commentsTitle {
+        margin-top:15px;
+      }
+      .commentsAuthor {
+        margin:5px;
+      }
+      .commentsNavigationBar {
+        margin:10px;
+      }
+      .tableComment {
+        width:100%;
+        border:2px solid #006699;
+        margin:10px;
+      }
+      .cellAuthor {
+        border-right:1px solid #006699;
+        width:100px;
+      }
+      .cellInfo {
+        border-bottom:1px solid #006699;
+      }
+      .imgLink {
+        border:1px solid black;
+      }
+    </style>
+    <script language="javascript">
+      function SelectAll( formulaire )
+      {
+        len = formulaire.elements.length;
+        var i=0;
+        for( i = 0; i < len; i++)
+        {
+          if ( formulaire.elements[i].type=='checkbox'
+               && formulaire.elements[i].name != 'copie')
+          {
+            formulaire.elements[i].checked = true;
+          }
+        }
+      }
+
+      function Inverser( formulaire )
+      {
+        len = formulaire.elements.length;
+        var i=0;
+        for( i=0; i<len; i++)
+        {
+          if ( formulaire.elements[i].type=='checkbox'
+               && formulaire.elements[i].name != 'copie')
+          {
+            formulaire.elements[i].checked = !formulaire.elements[i].checked;
+          }
+        }
+      }
+    </script>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}">
+  </head>
+  <body>
+    <table>
+      <tr>
+        <td width="1%" valign="top">
+          <table class="table1">
+            <tr>
+              <td class="titretable1">{#menu_title}</td>
+            </tr>
+            <tr>
+              <td class="contenucellule">
+                <div class="plan">
+                  <!--VTP_summary-->
+                  {#indent}<img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt; "><a href="{#link}" class="cat_plan">{#name}</a><br />
+                  <!--/VTP_summary-->
+                </div>
+              </td>
+            </tr>
+          </table>
+        </td>
+        <td align="center" valign="top">
+          <div class="grostitre">{#title}</div>
+          <br />
+          <center>
+            <table width="95%" class="table1">
+              <tr>
+                <td class="contenucellule">
+                  {#sub}
+                </td>
+              </tr>
+            </table>
+          </center>
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/admin/cat_list.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/cat_list.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/cat_list.vtp	(revision 159)
@@ -0,0 +1,103 @@
+<!--VTP_errors-->
+<div class="errors">
+  <div class="errors_title">{#errors_title}</div>
+  <ul>
+    <!--VTP_li-->
+    <li>{#content}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+<table style="width:100%;">
+<tr>
+  <td colspan="8" style="text-align:center;padding-top:10px;padding-bottom:10px;">
+  <form action="" method="post">
+    {#cat_add} <input type="text" name="virtual_name" />
+    {#cat_parent}
+    <select name="associate">
+      <!--VTP_associate_cat-->
+      <option value="{#value}">{#content}</option>
+      <!--/VTP_associate_cat-->
+    </select>
+   <input type="submit" value="{#submit}" name="submit" />
+  </form>
+  </td>
+</tr>
+<!--VTP_cat-->
+<tr>
+  <{#td} style="width:50%;text-align:left;">
+    {#indent}<img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" />
+    &nbsp;{#name} [
+    <!--VTP_storage-->
+    dir : {#dir}
+    <!--/VTP_storage-->
+    <!--VTP_virtual-->
+    <span style="color:blue;">{#cat_virtual}</span>
+    <!--/VTP_virtual-->
+    ]
+    <span style="color:red;font-weight:normal;"> {#invisible} <span style="font-weight:bold;">{#private}</span></span>
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:1px;white-space:nowrap;text-align:center;">
+    <!--VTP_up-->
+    <a href="{#up_url}"><img src="../template/{#user_template}/admin/images/arrow_up.gif" alt="{#cat_up}" title="{#cat_up}" style="border:none;" /></a>
+    <!--/VTP_up-->
+    <!--VTP_no_up-->
+    <a href="{#last_url}"><img src="../template/{#user_template}/admin/images/arrow_last.gif" alt="{#cat_last}" title="{#cat_last}" style="border:none;" /></a>
+    <!--/VTP_no_up-->
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:1px;white-space:nowrap;text-align:center;">
+    <!--VTP_down-->
+    <a href="{#down_url}"><img src="../template/{#user_template}/admin/images/arrow_down.gif" alt="{#cat_down}" title="{#cat_down}" style="border:none;" /></a>
+    <!--/VTP_down-->
+    <!--VTP_no_down-->
+    <a href="{#first_url}"><img src="../template/{#user_template}/admin/images/arrow_first.gif" alt="{#cat_first}" title="{#cat_first}" style="border:none;" /></a>
+    <!--/VTP_no_down-->
+  </{#td}>
+  <{#td} class="{#class}" style="width:1px;text-align:center;">
+    <div style="margin-left:3px;margin-right:3px;">{#nb_picture}</div>
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:10%;white-space:nowrap;text-align:center;">
+    <a href="{#edit_url}">{#cat_edit}</a>
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:10%;white-space:nowrap;text-align:center;">
+    <!--VTP_image_info-->
+    <a href="{#image_info_url}">{#cat_image_info}</a>
+    <!--/VTP_image_info-->
+    <!--VTP_no_image_info-->
+    <span style="color:darkgray;">{#cat_image_info}</span>
+    <!--/VTP_no_image_info-->
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:10%;white-space:nowrap;text-align:center;">
+    <!--VTP_permission-->
+    <a href="{#url}">{#cat_permission}</a>
+    <!--/VTP_permission-->
+    <!--VTP_no_permission-->
+    <span style="color:darkgray;">{#cat_permission}</span>
+    <!--/VTP_no_permission-->
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:10%;white-space:nowrap;text-align:center;">
+    <!--VTP_update-->
+    <a href="{#update_url}">{#cat_update}</a>
+    <!--/VTP_update-->
+    <!--VTP_no_update-->
+    <span style="color:darkgray;">{#cat_update}</span>
+    <!--/VTP_no_update-->
+  </{#td}>
+  <{#td} class="{#class}"
+         style="width:10%;white-space:nowrap;text-align:center;">
+    <!--VTP_delete-->
+    <a href="{#delete_url}">{#delete}</a>
+    <!--/VTP_delete-->
+    <!--VTP_no_delete-->
+    <span style="color:darkgray;">{#delete}</span>
+    <!--/VTP_no_delete-->
+  </{#td}>
+<tr>
+<!--/VTP_cat-->
+</table>
Index: /tags/release-1_3RC1/template/default/admin/cat_modify.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/cat_modify.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/cat_modify.vtp	(revision 159)
@@ -0,0 +1,84 @@
+<!--VTP_confirmation-->
+<div style="color:red;text-align:center;">
+  {#editcat_confirm} [ <a href="{#back_url}">{#editcat_back}</a> ]</div>
+<!--/VTP_confirmation-->
+<form action="{#form_action}" method="post">
+  <table style="width:100%;">
+    <tr>
+      <th colspan="2">{#editcat_title1} "{#cat:name}" [
+        <!--VTP_storage-->
+        dir : {#dir}
+        <!--/VTP_storage-->
+        <!--VTP_virtual-->
+        <span style="color:blue;">{#cat_virtual}</span>
+        <!--/VTP_virtual-->
+        ]
+      </th>
+    </tr>
+    <!--VTP_server-->
+    <tr>
+      <td style="width:20%;">{#remote_site}</td>
+      <td class="row2">{#url}</td>
+    </tr>
+    <!--/VTP_server-->
+    <tr>
+      <td style="width:20%;">{#editcat_name}</td>
+      <td class="row2">
+        <input type="text" name="name" value="{#name}" maxlength="255"/>
+      </td>
+    </tr>
+    <tr>
+      <td>{#editcat_comment}</td>
+      <td class="row2">
+        <textarea name="comment" rows="5" cols="50" style="overflow:auto">{#comment}</textarea>
+      </td>
+    </tr>
+    <tr>
+      <td>{#editcat_status}</td>
+      <td class="row2">
+        <!--VTP_status_option-->
+        <input type="radio" name="status" value="{#value}"{#checked} />{#option}
+        <!--/VTP_status_option-->
+      </td>
+    </tr>
+    <tr>
+      <td>{#editcat_visible}</td>
+      <td class="row2">
+        <!--VTP_visible_option-->
+        <input type="radio" name="visible" value="{#value}"{#checked} />{#option}
+        <!--/VTP_visible_option-->
+	{#editcat_visible_info}
+      </td>
+    </tr>
+    <!--VTP_uploadable-->
+    <tr>
+      <td>{#editcat_uploadable}</td>
+      <td class="row2">
+        <!--VTP_uploadable_option-->
+        <input type="radio" name="uploadable" value="{#value}"{#checked} />{#option}
+        <!--/VTP_uploadable_option-->
+      </td>
+    </tr>
+    <!--/VTP_uploadable-->
+    <!--VTP_parent-->
+    <tr>
+      <td>{#cat_parent}</td>
+      <td class="row2">
+        <select name="associate">
+          <!--VTP_associate_cat-->
+          <option value="{#value}"{#selected}>{#content}</option>
+          <!--/VTP_associate_cat-->
+        </select>
+      </td>
+    </tr>
+    <!--/VTP_parent-->
+    <tr>
+      <td colspan="2">&nbsp;</td>
+    </tr>
+    <tr>
+      <td colspan="2" align="center">
+        <input type="submit" name="submit" value="{#submit}" />
+      </td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/cat_perm.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/cat_perm.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/cat_perm.vtp	(revision 159)
@@ -0,0 +1,48 @@
+<form action="{#action}" method="post">
+  <!--VTP_groups-->
+  <table style="width:100%;">
+    <tr>
+      <th colspan="2">{#menu_groups}</th>
+    </tr>
+    <!--VTP_group-->
+    <tr>
+      <td><img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" /><a href="{#group_perm_link}"><span style="color:{#color}">{#groupname}</span></a></td>
+      <td style="text-align:right;">
+        <input type="radio" name="groupaccess-{#id}" value="0"{#authorized_checked}/>{#permuser_authorized}
+        <input type="radio" name="groupaccess-{#id}" value="1"{#forbidden_checked}/>{#permuser_forbidden}
+      </td>
+    </tr>
+    <!--/VTP_group-->
+  </table>
+  <!--/VTP_groups-->
+  <table style="width:100%;">
+    <tr>
+      <th colspan="2">{#menu_users}</th>
+    </tr>
+    <!--VTP_user-->
+    <tr>
+      <td>
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" />
+        <a href="{#user_perm_link}"><span style="color:{#color}">{#username}</span></a>
+        <!--VTP_usergroups-->
+        [
+        <!--VTP_usergroup-->
+        <span style="color:{#color};">{#name}</span>{#separation}
+        <!--/VTP_usergroup-->
+        ]
+        <!--/VTP_usergroups-->
+      </td>
+      <td style="text-align:right;">
+        <!--VTP_parent_forbidden-->
+        <a href="{#url}">{#permuser_parent_forbidden}</a>
+        <!--/VTP_parent_forbidden-->
+        <input type="radio" name="useraccess-{#id}" value="0"{#authorized_checked}/>{#permuser_authorized}
+        <input type="radio" name="useraccess-{#id}" value="1"{#forbidden_checked}/>{#permuser_forbidden}
+      </td>
+    </tr>
+    <!--/VTP_user-->
+    <tr>
+      <td colspan="2" align="center"><input type="submit" name="submit" value="{#submit}"/></td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/comments.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/comments.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/comments.vtp	(revision 159)
@@ -0,0 +1,81 @@
+<!--VTP_section-->
+<table style="width:100%;">
+  <tr>
+    <th>
+      {#title}
+      <!--VTP_last_days-->
+      [
+      <!--VTP_last_day_option-->
+      <a href="{#link}" style="{#style}">{#option}</a>{#separation}
+      <!--/VTP_last_day_option-->
+      {#stats_last_days}
+      ]
+      <!--/VTP_last_days-->
+      <!--VTP_open-->
+      [ <a href="{#url}">{#open}</a> ]
+      <!--/VTP_open-->
+      <!--VTP_close-->
+      [ <a href="{#url}">{#close}</a> ]
+      <!--/VTP_close-->
+    </th>
+  </tr>
+</table>
+<!--VTP_start_form-->
+<form action="{#action}" method="post">
+<!--/VTP_start_form-->
+<!--VTP_picture-->
+<div style="border:2px solid #D3DCE3;margin:2px;">
+  <table style="width:100%;">
+    <tr>
+     <td valign="top" width="1px">
+       <!-- the thumbnail of the picture, linked to the full size page -->
+       <a href="{#thumb_url}" title="{#thumb_title}">
+         <img src="{#thumb_src}" class="imgLink" alt="{#thumb_alt}"/>
+       </a>
+     </td>
+     <td>
+       <div style="font-weight:bold;">{#title}</div>
+       <!--VTP_comment-->
+       <table style="width:100%;">
+         <tr>
+           <td>
+             <table class="tableComment">
+               <tr>
+                 <td rowspan="2" valign="top" class="cellAuthor">
+                   <div class="commentsAuthor">{#author}</div>
+                 </td>
+                 <td class="cellInfo">
+                   <div class="commentsInfos">
+                     {#date}<!--VTP_delete--><a href="{#link}" title="{#comments_del}"><img src="../template/{#user_template}/admin/images/delete.gif" style="border:none;margin-left:5px;" alt="[{#delete}]"/></a><!--/VTP_delete-->
+                   </div>
+                 </td>
+               </tr>
+               <tr>
+                 <td>
+                   <div class="commentsContent">{#content}</div>
+                 </td>
+               </tr>
+             </table>
+           </td>
+           <!--VTP_validation-->
+           <td style="width:1px;">
+             <input type="checkbox" name="validate-{#id}" value="true" />
+           </td>
+           <!--/VTP_validation-->
+         </tr>
+       </table>
+       <!--/VTP_comment-->
+     </td>
+    </tr>
+  </table>
+</div>
+<!--/VTP_picture-->
+<!--VTP_submit-->
+<div style="text-align:center;margin:10px;">
+  <input type="submit" name="submit" value="{#submit}" />
+</div>
+<!--/VTP_submit-->
+<!--VTP_end_form-->
+</form>
+<!--/VTP_end_form-->
+<!--/VTP_section-->
Index: /tags/release-1_3RC1/template/default/admin/configuration.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/configuration.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/configuration.vtp	(revision 159)
@@ -0,0 +1,88 @@
+<!--VTP_errors-->
+<div class="errors">
+  <div class="errors_title">{#errors_title}</div>
+  <ul>
+    <!--VTP_li-->
+    <li>{#li}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+<!--VTP_confirmation-->
+  <div class="info">{#conf_confirmation}</div>
+<!--/VTP_confirmation-->
+<form method="post" action="{#form_action}">
+  <table width="100%">
+    <!--VTP_line-->
+    <!--VTP_param_line-->
+    <tr>
+      <td>{#name}</td>
+      <td align="center">
+        <!--VTP_select-->
+        <select name="{#name}">
+          <!--VTP_option-->
+          <option{#selected}>{#option}</option>
+          <!--/VTP_option-->
+        </select>
+        <!--/VTP_select-->
+        <!--VTP_hidden-->
+        {#text}<input type="hidden" name="{#name}" value="{#value}" />
+        <!--/VTP_hidden-->
+        <!--VTP_text-->
+        <input type="text" name="{#name}" value="{#value}" />
+        <!--/VTP_text-->
+        <!--VTP_group-->
+          <!--VTP_radio-->
+          <input type="radio" name="{#name}" value="{#value}"{#checked}/>{#option}
+          <!--/VTP_radio-->
+        <!--/VTP_group-->
+        <!--VTP_check-->
+          <!--VTP_box-->
+          <input type="checkbox" name="{#name}" value="{#value}"{#checked}/>{#option}
+          <!--/VTP_box-->
+        <!--/VTP_check-->
+      </td>
+      <td width="50%" class="row2">{#def}</td>
+    </tr>
+    <!--/VTP_param_line-->
+    <!--VTP_title_line-->
+    <tr>
+      <th colspan="3" align="center">{#title}</th>
+    </tr>
+    <!--/VTP_title_line-->
+    <!--VTP_space_line-->
+    <tr>
+      <td colspan="3"><div style="margin-bottom:0px">&nbsp;</div></td>
+    </tr>
+    <!--/VTP_space_line-->
+    <!--/VTP_line-->
+    <!--VTP_remote_sites-->
+    <tr>
+      <th colspan="3" align="center">{#remote_site}</th>
+    </tr>
+    <tr>
+      <td colspan=3><div style='margin-bottom:0px'>&nbsp;</div></td>
+    </tr>
+    <tr>
+      <td>&nbsp;</td>
+      <td align="center">{#delete}</td>
+      <td>&nbsp;</td>
+    </tr>
+    <!--VTP_site-->
+    <tr>
+      <td>{#url}</td>
+      <td align="center"><input type="checkbox" name="delete_site_{#id}" value="1" /></td>
+      <!--VTP_rowspan--><td class="row2" rowspan="{#nb_sites}">{#conf_remote_site_delete_info}</td><!--/VTP_rowspan-->
+    </tr>
+    <!--/VTP_site-->
+    <tr>
+      <td colspan=3><div style='margin-bottom:0px'>&nbsp;</div></td>
+    </tr>
+    <!--/VTP_remote_sites-->
+    <tr>
+      <td colspan="3" align="center">
+        <input type="submit" name="submit" value="{#submit}">
+      </td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/group_list.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/group_list.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/group_list.vtp	(revision 159)
@@ -0,0 +1,53 @@
+<!--VTP_errors-->
+<div class="errors">
+  <ul>
+    <!--VTP_li-->
+    <li>{#li}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+
+<!--VTP_deletion-->
+<table style="width:100%;">
+  <tr>
+    <th colspan="2">{#group_confirm} "{#name}"</th>
+  </tr>
+  <tr>
+    <td align="center"><a href="{#yes_url}">{#yes}</a></td>
+    <td align="center" class="row2"><a href="{#no_url}">{#no}</a></td>
+  </tr>
+</table>
+<!--/VTP_deletion-->
+
+<!--VTP_confirmation-->
+<div class="{#class}">{#info}</div>
+<!--/VTP_confirmation-->
+
+<form method="post" action="{#form_action}">
+  <div style="text-align:center;margin:10px;">
+    {#group_add} <input type="text" name="name" />
+    <input type="submit" value="{#add}" name="submit" />
+  </div>
+</form>
+
+<!--VTP_groups-->
+<table width="100%">
+  <tr>
+    <th colspan="3">{#group_list_title}</th>
+  </tr>
+  <!--VTP_group-->
+  <tr>
+    <td style="width:25%;">
+      <div style="margin-left:10px;color:{#color}"><img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" /> {#name}</div>
+    </td>
+    <td class="row2" style="text-align:center;width:25%;">
+      <a href="{#permission_url}">{#listuser_permission}</a>
+    </td>
+    <td class="row2" style="text-align:center;width:25%;">
+      <a href="{#deletion_url}">{#delete}</a>
+    </td>
+  </tr>
+  <!--/VTP_group-->
+</table>
+<!--/VTP_groups-->
Index: /tags/release-1_3RC1/template/default/admin/group_perm.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/group_perm.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/group_perm.vtp	(revision 159)
@@ -0,0 +1,27 @@
+<!--VTP_confirmation-->
+<div class="info">{#permuser_info_message} [ <a href="{#back_url}">{#adduser_info_back}</a> ]</div>
+<!--/VTP_confirmation-->
+
+<div class="info">{#permuser_only_private}</div>
+
+<form action="{#action}" method="post">
+  <table style="width:100%;">
+    <!--VTP_category-->
+    <tr>
+      <td>
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" /> <a href="{#cat_perm_link}"><span style="color:{#color}">{#name}</span></a>
+      </td>
+      <td style="text-align:right;">
+        <!--VTP_parent_forbidden-->
+        {#permuser_parent_forbidden}
+        <!--/VTP_parent_forbidden-->
+        <input type="radio" name="access-{#id}" value="0"{#authorized_checked}/>{#permuser_authorized}
+        <input type="radio" name="access-{#id}" value="1"{#forbidden_checked}/>{#permuser_forbidden}
+      </td>
+    </tr>
+    <!--/VTP_category-->
+    <tr>
+      <td colspan="2" align="center"><input type="submit" name="submit" value="{#submit}"/></td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/help.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/help.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/help.vtp	(revision 159)
@@ -0,0 +1,26 @@
+<table style="width:100%;">
+  <!--VTP_cat-->
+  <tr>
+    <th>{#name}</th>
+  </tr>
+  <tr>
+    <td>&nbsp;</td>
+  </tr>
+  <tr>
+    <td>
+      <!--VTP_illustration-->
+      <div style="text-align:center;margin:auto;margin-bottom:10px;"><img src="{#pic_src}" style="border:1px solid black;" alt="{#pic_alt}"/></div>
+      {#caption}
+      <!--/VTP_illustration-->
+      <ul style="margin-right:10px;">
+        <!--VTP_item-->
+        <li>{#content}</li>
+        <!--/VTP_item-->
+      </ul>
+    </td>
+  </tr>
+  <tr>
+    <td>&nbsp;</td>
+  </tr>
+  <!--/VTP_cat-->
+</table>
Index: /tags/release-1_3RC1/template/default/admin/infos_image.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/infos_image.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/infos_image.vtp	(revision 159)
@@ -0,0 +1,91 @@
+<form method="post" action="{#form_action}">
+  <table width="100%">
+    <tr>
+      <th colspan="3">{#infoimage_general} &quot;{#cat_name}&quot;</th>
+    </tr>
+    <tr>
+      <td><div style="margin-left:50px;">{#author}</div></td>
+      <td style="text-align:center;">
+        <input type="text" name="author_cat" value="" maxlength="255" />
+      </td>
+      <td style="text-align:left;">
+        <input type="checkbox" name="use_common_author" value="1" />
+        {#infoimage_useforall}
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <div style="margin-left:50px;">{#infoimage_creation_date} [DD/MM/YYYY]</div>
+      </td>
+      <td style="text-align:center;">
+        <input type="text" name="date_creation_cat" value="" size="12" maxlength="10"/>
+      </td>
+      <td style="text-align:left;">
+        <input type="checkbox" name="use_common_date_creation" value="1" />
+        {#infoimage_useforall}
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <div style="margin-left:50px;">{#keywords} {#infoimage_keyword_separation}</div>
+      </td>
+      <td style="text-align:center;">
+        <input type="text" name="keywords_cat" value="" maxlength="255" />
+      </td>
+      <td style="text-align:left;">
+        <input type="radio" name="common_keywords" value="add" />
+        {#infoimage_addtoall}
+        <input type="radio" name="common_keywords" value="remove" />
+        {#infoimage_removefromall}
+      </td>
+    </tr>
+  </table>
+  <table width="100%">
+    <tr>
+      <th colspan="7">{#infoimage_detailed}</th>
+    </tr>
+    <tr>
+      <td colspan="7" align="center">{#navigation_bar}</td>
+    </tr>
+    <tr>
+      <td style="width:0px;">&nbsp;</td>
+      <td class="row2" style="text-align:center;">{#thumbnail}</td>
+      <td class="row2" style="text-align:center;">{#infoimage_title}</td>
+      <td class="row2" style="text-align:center;">{#author}</td>
+      <td class="row2" style="text-align:center;">{#infoimage_comment}</td>
+      <td class="row2" style="text-align:center;">{#infoimage_creation_date}</td>
+      <td class="row2" style="text-align:center;">{#keywords}</td>
+    </tr>
+    <!--VTP_picture-->
+    <tr>
+      <td style="width:0px;">
+        <div style="margin-left:2px;margin-right:2px;">
+          <input type="checkbox" name="check-{#id}" value="1" />
+        </div>
+      </td>
+      <td style="text-align:center;"><a name="{#link}" href="{#url}"><img src="{#thumbnail_url}" alt="" class="miniature" title="{#filename}" /></td>
+      <td style="text-align:center;">{#default_name}<br /><input type="text" name="name-{#id}" value="{#name}" maxlength="255"/></td>
+      <td style="text-align:center;"><input type="text" name="author-{#id}" value="{#author}" maxlength="255" size="12" /></td>
+      <td style="text-align:center;"><textarea name="comment-{#id}" rows="5" cols="30" style="overflow:auto">{#comment}</textarea></td>
+      <td style="text-align:center;"><input type="text" name="date_creation-{#id}" value="{#date_creation}" maxlength="10" size="10" /></td>
+      <td style="text-align:center;"><input type="text" name="keywords-{#id}" value="{#keywords}" length="255" /></td>
+    </tr>
+    <!--/VTP_picture-->
+    <tr>
+      <td colspan="6">
+        <img src="../template/{#user_template}/admin/images/arrow_select.gif" alt="&lt;" />
+        {#infoimage_associate}
+        <select name="associate">
+          <!--VTP_associate_cat-->
+          <option value="{#value}">{#content}</option>
+          <!--/VTP_associate_cat-->
+        </select>
+    </td>
+  </tr>
+    <tr>
+      <td colspan="6" style="text-align:center;">
+        <input type="submit" value="{#submit}" name="submit" />
+      </td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/install.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/install.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/install.vtp	(revision 159)
@@ -0,0 +1,253 @@
+<html>
+  <head>
+    <title>PhpWebGallery {#release}</title>
+    <style>
+      a {
+        text-decoration : none;
+        color : #006699;
+      }
+      a:hover {
+        text-decoration : underline;
+      }
+      body,table,input,form,select,textarea {
+        font-family : Arial, Verdana, Sans-Serif;
+        font-size : 12px;
+      }
+      .miniature {
+        border : solid 1px black;
+      }
+      body {
+        background-color :  #E5E5E5;
+      }
+      .titretable1 {
+        color : black;
+        background-color : #D3DCE3;
+        text-align : center;
+        border : 2px solid #006699;
+      }
+      .grostitre {
+        text-align : center;
+        font-size : 20px;
+        margin-bottom : 20px;
+      }
+      .plan {
+        margin : 10px 10px 10px 2px;
+        white-space : nowrap;
+      }
+      .table1 {
+        border-collapse:collapse;
+        background-color:#FFFFFF;
+        width:700px;
+        margin:auto;
+      }
+      .contenucellule {
+        background-color : #EEEEEE;
+        border : 2px solid #006699;
+      }
+      .style1 {
+        margin-top : 20px;
+      }
+      th {
+        font-weight : bold;
+        background-color : #D3DCE3;
+      }
+      td.row1 {
+        background-color : #DDDDDD;
+      }
+      td.row2 {
+        background-color : #E8E8E8;
+      }
+      .cat_plan {
+        font-weight : bold;
+      }
+      .retrait {
+        margin : 10px;
+        margin-left : 30px;
+        margin-top : 2px;
+      }
+      input,textarea {
+        border-width : 1;
+        border-color : #000000;
+        background : #ffffff;
+        color: #000000;
+      }
+      .errors,.infos {
+        margin:10px;
+      }
+      .errors {
+        border:1px solid red;
+        background-color:#ffe1e1;
+      }
+      .infos {
+        background-color:#eff4fa;
+        border:1px solid #9cb4ce;
+      }
+      .errors_title,.infos_title {
+        margin:5px;
+        font-weight:bold;
+        font-size:120%;
+        text-align:center;
+      }
+      .errors_title {
+        color:red;
+      }
+      .infos_title {
+        color:#9cb4ce;
+      }
+    </style>
+  </head>
+  <body>
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+	  <div class="grostitre">PhpWebGallery {#release}</div>
+          <table class="table1">
+            <tr>
+              <td class="contenucellule">
+<!--VTP_errors-->
+<div class="errors">
+  <div class="errors_title">{#errors_title}</div>
+  <ul>
+    <!--VTP_error-->
+    <li>{#content}</li>
+    <!--/VTP_error-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+
+<!--VTP_infos-->
+<div class="infos">
+  <div class="infos_title">{#infos_title}</div>
+  <ul>
+    <!--VTP_info-->
+    <li>{#content}</li>
+    <!--/VTP_info-->
+  </ul>
+</div>
+<!--/VTP_infos-->
+
+<!--VTP_error_copy-->
+{#step1_err_copy} :
+<br />-----------------------------------------------------<br />
+<div style="color:blue;">{#file_content}</div>
+-----------------------------------------------------<br />
+<div style="text-align:center;">{#step1_err_copy_2}<br />
+<a href="./install.php?step=2&amp;language={#language}">{#step1_err_copy_next}</a></div>
+<!--/VTP_error_copy-->
+
+<!--VTP_step0-->
+<form method="get" action="install.php">
+  <input type="hidden" name="step" value="1" />
+  <table width="100%">
+    <tr>
+      <td align="center">
+        <select name="language">
+          <!--VTP_language-->
+          <option>{#name}</option>
+          <!--/VTP_language-->
+        </select>
+        <input name="submit" type="submit" value="Submit" />
+      </td>
+    </tr>
+  </table>
+</form>
+<!--/VTP_step0-->
+
+<!--VTP_step1-->
+<form method="post" action="install.php?step=1&amp;language={#language}">
+  <table width="100%">
+    <tr>
+      <th colspan="3">{#step1_title}</th>
+    </tr>
+    <tr>
+      <td colspan="3">&nbsp;</td>
+    </tr>
+    <tr>
+      <td>{#step1_host}</td>
+      <td align=center><input type="text" name="cfgHote" value="{#f_host}" /></td>
+      <td class="row2">{#step1_host_info}</td>
+    </tr>
+    <tr>
+      <td>{#step1_user}</td>
+      <td align=center><input type="text" name="cfgUser" value="{#f_user}" /></td>
+      <td class="row2">{#step1_user_info}</td>
+    </tr>
+    <tr>
+      <td>{#step1_pass}</td>
+      <td align=center><input type="password" name="cfgPassword" value="" /></td>
+      <td class="row2">{#step1_pass_info}</td>
+    </tr>
+    <tr>
+      <td>{#step1_database}</td>
+      <td align=center><input type="text" name="cfgBase" value="{#f_base}" /></td>
+      <td class="row2">{#step1_database_info}</td>
+    </tr>
+    <tr>
+      <td>{#step1_prefix}</td>
+      <td align=center><input type="text" name="prefixeTable" value="{#f_prefixeTable}" /></td>
+      <td class="row2">{#step1_prefix_info}</td>
+    </tr>
+    <tr>
+     <td colspan="3">&nbsp;</td>
+    </tr>
+    <tr>
+      <td colspan="3" align="center"><input type="submit" name="submit" value="{#submit}" /></td>
+    </tr>
+  </table>
+</form>
+<!--/VTP_step1-->
+
+<!--VTP_step2-->
+<form method="post" action="install.php?step=2&amp;language={#language}">
+  <table width=100%>
+    <tr>
+      <th colspan="3">{#step2_title}</th>
+    </tr>
+    <tr>
+      <td colspan="3">&nbsp;</td>
+    </tr>
+    <tr>
+      <td>{#conf_general_webmaster}</td>
+      <td align="center"><input type="text" name="webmaster" value="{#f_webmaster}" /></td>
+      <td class="row2">{#conf_general_webmaster_info}</td>
+    </tr>
+    <tr>
+      <td>{#step2_pwd}</td>
+      <td align="center"><input type="password" name="pwdWebmaster" value="" /></td>
+      <td class="row2">{#step2_pwd_info}</td>
+    </tr>
+    <tr>
+      <td>{#step2_pwd_conf}</td>
+      <td align="center"><input type="password" name="pwdWebmasterConf" value="" /></td>
+      <td class="row2">{#step2_pwd_conf_info}</td>
+    </tr>
+    <tr>
+      <td>{#conf_general_mail}</td>
+      <td align="center"><input type="text" name="mail_webmaster" value="{#f_mail_webmaster}" /></td>
+      <td class="row2">{#conf_general_mail_info}</td>
+    </tr>
+    <tr>
+      <td colspan="3">&nbsp;</th>
+    </tr>
+    <tr>
+      <td colspan="3" align="center">
+        <input type="submit" name="submit" value="{#submit}" />
+      </td>
+    </tr>
+  </table>
+</form>
+<!--/VTP_step2-->
+
+<!--VTP_install_end-->
+<div class="infos_title">{#install_end_title}</div>
+<div style="padding:5px;">{#install_end_message}</div>
+<!--/VTP_install_end-->
+
+              </td>
+            </tr>
+          </table>
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/admin/picture_modify.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/picture_modify.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/picture_modify.vtp	(revision 159)
@@ -0,0 +1,101 @@
+<!--VTP_errors-->
+<div class="errors">
+  <div class="errors_title">{#errors_title}</div>
+  <ul>
+    <!--VTP_li-->
+    <li>{#content}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+<!--VTP_confirmation-->
+<div class="info">
+  {#picmod_update} [ <a href="{#url}">{#picmod_back}</a> ]
+</div>
+<!--/VTP_confirmation-->
+<form method="post" action="{#form_action}">
+  <table style="width:100%;">
+    <tr><th colspan="2">{#title} [ {#dir} &gt; {#f_file} ]</th></tr>
+    <tr>
+      <td colspan="2"><div style="margin-bottom:0px">&nbsp;</div></td>
+    </tr>
+    <tr valign="top">
+      <td style="width:1px;"><img src="{#thumbnail_url}" alt="" class="miniature" /></td>
+      <td>
+        <table>
+          <tr>
+            <td>{#upload_name} :</td>
+            <td><input type="text" name="name" value="{#f_name}" /> [ {#default} : {#default_name} ]</td>
+          </tr>
+          <tr>
+            <td>{#file} :</td>
+            <td>{#f_file}</td>
+          </tr>
+          <tr>
+            <td>{#size} :</td>
+            <td>{#f_size}</td>
+          </tr>
+          <tr>
+            <td>{#filesize} :</td>
+            <td>{#f_filesize}</td>
+          </tr>
+          <tr>
+            <td>{#registration_date} :</td>
+            <td>{#f_registration_date}</td>
+          </tr>
+          <tr>
+            <td>{#author} :</td>
+            <td><input type="text" name="author" value="{#f_author}" /></td>
+          </tr>
+          <tr>
+            <td>{#creation_date} :</td>
+            <td><input type="text" name="creation_date" value="{#f_creation_date}" /></td>
+          </tr>
+          <tr>
+            <td>{#keywords} :</td>
+            <td><input type="text" name="keywords" value="{#f_keywords}" size="50" /></td>
+          </tr>
+          <tr>
+            <td>{#comment} :</td>
+            <td><textarea name="comment" rows="5" cols="50" style="overflow:auto">{#f_comment}</textarea></td>
+          </tr>
+          <tr>
+            <td valign="top">{#categories} :</td>
+            <td>
+              <table>
+                <!--VTP_linked_category-->
+                <tr>
+                  <td><!--VTP_checkbox--><input type="checkbox" name="dissociate-{#id}" value="1" /><!--/VTP_checkbox--><a href="{#url}">{#name}</a> [ <a href="{#infos_images_link}">{#cat_image_info}</a> ] {#private} {#invisible} [ <input type="checkbox" name="representative-{#id}" value="1"{#representative_checked} /> {#category_representative} ]
+                </tr>
+                <!--/VTP_linked_category-->
+                <!--VTP_dissociate-->
+                <tr>
+                  <td colspan="2"><img src="../template/{#user_template}/admin/images/arrow_select.gif" alt="&lt;" /> {#dissociate}</td>
+                </tr>
+                <!--/VTP_dissociate-->
+                <tr><td colspan="2">&nbsp;</td></tr>
+                <tr>
+                  <td>{#infoimage_associate}
+                    <select name="associate">
+                      <!--VTP_associate_cat-->
+                      <option value="{#value}">{#content}</option>
+                      <!--/VTP_associate_cat-->
+                    </select>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2"><div style="margin-bottom:0px">&nbsp;</div></td>
+    </tr>
+    <tr>
+      <td colspan="2" align="center">
+        <input type="submit" name="submit" value="{#submit}">
+      </td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/stats.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/stats.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/stats.vtp	(revision 159)
@@ -0,0 +1,125 @@
+<style>
+      .commentsAuthor,.commentsTitle,.commentsInfos,.commentsContent,.commentsNavigationBar {
+        color:{#text_color};
+        font-family:arial,sans-Serif;
+        font-size:12px;
+      }
+      .commentsTitle,.commentsAuthor {
+        text-align:center;
+        font-weight:bold;
+      }
+      .commentsInfos {
+        text-align:right;
+        margin:3px 3px 3px 10px;
+        font-size:11px;
+      }
+      .commentsContent {
+        margin:10px;
+      }
+      .commentsTitle {
+        margin-top:15px;
+      }
+      .commentsAuthor {
+        margin:5px;
+      }
+      .commentsNavigationBar {
+        margin:10px;
+      }
+      .tableComment {
+        width:100%;
+        border:2px solid #006699;
+        margin:10px;
+      }
+      .cellAuthor {
+        border-right:1px solid #006699;
+        width:100px;
+      }
+      .cellInfo {
+        border-bottom:1px solid #006699;
+      }
+      .imgLink {
+        border:1px solid black;
+      }
+</style>
+<div style="text-align:center;margin-top:5px;">
+  <!--VTP_last_day_option-->
+  <a href="{#link}" style="{#style}">{#option}</a>{#separation}
+  <!--/VTP_last_day_option-->
+  {#stats_last_days}
+</div>
+
+<table width="100%">
+  <tr>
+    <th width="1%">{#date}</th>
+    <th>{#login}</th>
+    <th>{#IP}</th>
+    <th>{#file}</th>
+    <th>{#category}</th>
+    <th>{#picture}</th>
+  </tr>
+  <tr>
+    <td colspan="6" style="text-align:center;"><a href="{#emply_url}">{#stats_empty}</a></td>
+  </tr>
+  <!--VTP_day-->
+  <tr>
+    <td colspan="6">
+      <a href="{#url}"><!--VTP_collapsed--><img src="../template/{#user_template}/admin/images/collapsed.gif" style="border:none;" /><!--/VTP_collapsed--><!--VTP_expanded--><img src="../template/{#user_template}/admin/images/expanded.gif" style="border:none;" /><!--/VTP_expanded--></a>
+      <span style="font-weight:bold;">{#name}</span> [ {#nb_pages} {#stats_pages_seen} - {#nb_visitors} {#stats_visitors} ]
+    </td>
+  </tr>
+  <!--VTP_line-->
+  <tr>
+    <td>{#date}</td>
+    <td style="text-align:center;">{#login}</td>
+    <td>{#IP}</td>
+    <td>{#file}</td>
+    <td>{#category}</td>
+    <td>{#picture}</td>
+  </tr>
+  <!--/VTP_line-->
+  <!--/VTP_day-->
+</table>
+
+<!-- Graph with the number of pages seen per day -->
+<table style="margin:auto;margin-top:10px;margin-bottom:10px;border:1px solid black;">
+<tr>
+  <td colspan="3" style="text-align:center;font-weight:bold">{#stats_pages_seen_graph_title}</td>
+</tr>
+<!--VTP_pages_day-->
+<tr>
+  <td>{#date}</td>
+  <td>
+    <table style="border-collapse:collapse;">
+      <tr>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_left.gif" width="4" height="12" /></td>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_middle.gif" width="{#width}" height="12" /></td>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_right.gif" width="4" height="12" /></td>
+      </tr>
+    </table>
+  </td>
+  <td align="center">[ {#nb_pages} ]</td>
+</tr>
+<!--/VTP_pages_day-->
+</table>
+
+<!-- Graph with the number of visitors per day -->
+<table style="margin:auto;margin-top:10px;margin-bottom:10px;border:1px solid black;">
+<tr>
+  <td colspan="3" style="text-align:center;font-weight:bold">{#stats_visitors_graph_title}</td>
+</tr>
+<!--VTP_visitors_day-->
+<tr>
+  <td>{#date}</td>
+  <td>
+    <table style="border-collapse:collapse;">
+      <tr>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_left.gif" width="4" height="12" /></td>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_middle.gif" width="{#width}" height="12" /></td>
+        <td style="padding:0;"><img src="../template/{#user_template}/admin/images/stat_right.gif" width="4" height="12" /></td>
+      </tr>
+    </table>
+  </td>
+  <td align="center">[ {#nb_visitors} ]</td>
+</tr>
+<!--/VTP_visitors_day-->
+</table>
Index: /tags/release-1_3RC1/template/default/admin/thumbnail.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/thumbnail.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/thumbnail.vtp	(revision 159)
@@ -0,0 +1,188 @@
+<!--VTP_directory_list-->
+<table style="width:100%;">
+  <tr>
+    <th>{#tn_dirs_title}</th>
+  </tr>
+  <tr>
+    <td>
+      <div style="text-indent:30px;">
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" style="border:none;" />
+        galleries
+      </div>
+      <!--VTP_dir-->
+      <div style="text-indent:{#indent}px;">
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" style="border:none;" />
+        <!--VTP_linked-->
+        <a href="{#url}">{#name}</a> [ {#nb_pic} {#tn_dirs_alone} ]
+        <!--/VTP_linked-->
+        <!--VTP_unlinked-->
+        {#name}
+        <!--/VTP_unlinked-->
+      </div>
+      <!--/VTP_dir-->
+    </td>
+  </tr>
+</table>
+<!--/VTP_directory_list-->
+
+<!--VTP_warning-->
+<div style="text-align:center;font-weight:bold;margin:10px;"> [ 0 {#tn_dirs_alone} ]</div>
+<!--/VTP_warning-->
+
+<!--VTP_errors-->
+<div class="errors">
+  <ul>
+    <!--VTP_li-->
+    <li>{#li}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+
+<!--VTP_results-->
+<table style="width:100%;">
+  <tr>
+    <th colspan="10">{#tn_results_title}</th>
+  </tr>
+  <tr>
+    <td class="throw2">&nbsp;</td>
+    <td class="throw2">{#tn_picture}</td>
+    <td class="throw2">{#filesize}</td>
+    <td class="throw2">{#tn_width}</td>
+    <td class="throw2">{#tn_height}</td>
+    <th>{#tn_results_gen_time}</th>
+    <td class="throw2">{#thumbnail}</td>
+    <td class="throw2">{#filesize}</td>
+    <td class="throw2">{#tn_width}</td>
+    <td class="throw2">{#tn_height}</td>
+  </tr>
+  <!--VTP_picture-->
+  <tr>
+    <td class="row2">{#num}</td>
+    <td class="{#class}">{#file}</td>
+    <td class="{#class}" style="text-align:right;">{#filesize}</td>
+    <td class="{#class}" style="text-align:right;">{#width}</td>
+    <td class="{#class}" style="text-align:right;">{#height}</td>
+    <th>
+      <div style="text-align:right;margin-right:5px;color:{#color};">{#time}</div>
+    </th>
+    <td class="{#class}">{#thumb_file}</td>
+    <td class="{#class}" style="text-align:right;">{#thumb_filesize}</td>
+    <td class="{#class}" style="text-align:right;">{#thumb_width}</td>
+    <td class="{#class}" style="text-align:right;">{#thumb_height}</td>
+  </tr>
+  <!--/VTP_picture-->
+  <tr>
+    <td colspan="10">&nbsp;</td>
+  </tr>
+</table>
+<table style="margin:auto;border:1px solid black;">
+  <tr>
+    <td colspan="2" style="text-align:center;font-weight:bold;" class="row2">{#tn_stats}</td>
+  </tr>
+  <tr>
+    <td>{#tn_stats_nb}</td>
+    <td style="text-align:center;">{#stats_nb}</td>
+  </tr>
+  <tr>
+    <td>{#tn_stats_total}</td>
+    <td style="text-align:right;">{#stats_total}</td>
+  </tr>
+  <tr>
+    <td>{#tn_stats_max}</td>
+    <td style="text-align:right;color:red;">{#stats_max}</td>
+  </tr>
+  <tr>
+    <td>{#tn_stats_min}</td>
+    <td style="text-align:right;color:green;">{#stats_min}</td>
+  </tr>
+  <tr>
+    <td>{#tn_stats_mean}</td>
+    <td style="text-align:right;">{#stats_mean}</td>
+  </tr>
+</table>
+<table>
+  <tr>
+    <td>&nbsp;</td>
+  </tr>
+</table>
+<!--/VTP_results-->
+
+<!--VTP_params-->
+<form method="post" action="{#action}">
+  <table style="width:100%;">
+    <tr>
+      <th colspan="3">{#tn_params_title}</th>
+    </tr>
+    <tr><td colspan="3">&nbsp;</td></tr>
+    <tr>
+      <td><div class="key">{#tn_params_GD}</div></td>
+      <td class="choice">
+        <input type="radio" name="gd" value="2"{#gd2_checked} />2.x
+        <input type="radio" name="gd" value="1"{#gd1_checked} />1.x
+      </td>
+      <td style="width:50%;" class="row2">{#tn_params_GD_info}</td>
+    </tr>
+    <tr>
+      <td><div class="key">{#tn_width}</div></td>
+      <td class="choice">
+        <input type="text" name="width" value="{#width_value}"/>
+      </td>
+      <td class="row2">{#tn_params_width_info}</td>
+    </tr>
+    <tr>
+      <td><div class="key">{#tn_height}</div></td>
+      <td class="choice">
+        <input type="text" name="height" value="{#height_value}"/>
+      </td>
+      <td class="row2">{#tn_params_height_info}</td>
+    </tr>
+    <tr>
+      <td><div class="key">{#tn_params_create}</div></td>
+      <td class="choice">
+        <select name="n">
+          <!--VTP_n_option-->
+          <option{#selected}>{#option}</option>
+          <!--/VTP_n_option-->
+        </select>
+      </td>
+      <td class="row2">{#tn_params_create_info}</td>
+    </tr>
+    <tr>
+      <td><div class="key">{#tn_params_format}</div></td>
+      <td class="choice"><span style="font-weight:bold;">jpeg</span></td>
+      <td class="row2">{#tn_params_format_info}</td>
+    </tr>
+    <tr><td colspan="3">&nbsp;</td></tr>
+    <tr>
+      <td colspan="3" style="text-align:center;">
+        <input type="submit" name="submit" value="{#submit}"/>
+      </td>
+    </tr>
+  </table>
+</form>
+<!--/VTP_params-->
+
+<!--VTP_remainings-->
+<table style="width:100%;">
+  <tr>
+    <th colspan="5"><span style="color:#006699;">{#total}</span> {#tn_alone_title}</th>
+  </tr>
+  <tr>
+    <td class="throw2">&nbsp;</td>
+    <td class="throw2" style="width:50%;">{#tn_picture}</td>
+    <td class="throw2" style="width:17%;">{#filesize}</td>
+    <td class="throw2" style="width:17%;">{#tn_width}</td>
+    <td class="throw2" style="width:16%;">{#tn_height}</td>
+  </tr>
+  <!--VTP_remaining-->
+  <tr>
+    <td class="row2">{#num}</td>
+    <td class="{#class}"><div style="margin-left:10px;">{#file}</div></td>
+    <td class="{#class}"><div style="margin-left:10px;">{#filesize}</div></td>
+    <td class="{#class}"><div style="margin-left:10px;">{#width}</div></td>
+    <td class="{#class}"><div style="margin-left:10px;">{#height}</div></td>
+  </tr>
+  <!--/VTP_remaining-->
+</table>
+<!--/VTP_remainings-->
Index: /tags/release-1_3RC1/template/default/admin/update.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/update.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/update.vtp	(revision 159)
@@ -0,0 +1,49 @@
+<table style="width:100%;">
+  <!--VTP_introduction-->
+  <tr>
+    <th>{#update_default_title}</th>
+  </tr>
+  <tr>
+    <td>
+      <div class="retrait">
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" />
+        <a href="{#only_cat:url}">{#update_only_cat}</a>
+        <br /><img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" />
+        <a href="{#all:url}">{#update_all}</a>
+      </div>
+    </td>
+  </tr>
+  <!--/VTP_introduction-->
+  <!--VTP_local_update-->
+  <tr>
+    <th>{#update_part_research}</th>
+  </tr>
+  <tr>
+    <td>
+      <div class="retrait">
+        <span style="font-weight:bold;color:navy;">{#url}</span><br /><br />
+        <!-- update.php generates itself HTML code for categories -->
+        {#categories}
+        <br /><span style="color:blue;">{#count_new} {#update_research_conclusion}</span>
+        <br /><span style="color:red;">{#count_deleted} {#update_deletion_conclusion}</span>
+      </div>
+    </td>
+  </tr>
+  <!--/VTP_local_update-->
+  <!--VTP_remote_update-->
+  <tr>
+    <th>{#remote_site}</th>
+  </tr>
+  <tr>
+    <td>
+      <div class="retrait">
+        <span style="font-weight:bold;color:navy;">{#url}</span><br /><br />
+        <!-- update.php generates itself HTML code for categories -->
+        {#categories}
+        <br /><span style="color:blue;">{#count_new} {#update_research_conclusion}</span>
+        <br /><span style="color:red;">{#count_deleted} {#update_deletion_conclusion}</span>
+      </div>
+    </td>
+  </tr>
+  <!--/VTP_remote_update-->
+</table>
Index: /tags/release-1_3RC1/template/default/admin/user_list.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/user_list.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/user_list.vtp	(revision 159)
@@ -0,0 +1,101 @@
+<!--VTP_deletion-->
+<table style="width:100%;">
+  <tr>
+    <th colspan="2">{#listuser_confirm} "{#login}" ?</th>
+  </tr>
+  <tr>
+    <td align="center"><a href="{#yes_url}">{#yes}</a></td>
+    <td align="center" class="row2"><a href="{#no_url}">{#no}</a></td>
+  </tr>
+</table>
+<!--/VTP_deletion-->
+
+<!--VTP_confirmation-->
+<div class="{#class}">{#info}</div>
+<!--/VTP_confirmation-->
+
+<!--VTP_errors-->
+<div class="errors">
+  <div class="errors_title">{#errors_title}</div>
+  <ul>
+    <!--VTP_li-->
+    <li>{#li}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+
+<!--VTP_add_user-->
+<form method="post" action="{#form_action}">
+  <div style="text-align:center;margin:10px;">
+    <span style="font-weight:bold;">{#title_add}</span> -&gt;
+    {#login} : <input type="text" name="username" value="{#f_username}" />
+    {#password} : <input type="text" name="password" value="{#f_password}" />
+    <input type="submit" value="{#add}" name="submit" />
+  </div>
+</form>
+<!--/VTP_add_user-->
+
+<!--VTP_users-->
+<form method="post" action="{#form_action}" name="{#form_name}">
+<table width="100%">
+  <!--VTP_category-->
+  <tr>
+    <th colspan="5">{#title}</th>
+  </tr>
+  <!--VTP_user-->
+  <tr>
+    <td style="width:0px;">
+      <div style="margin-left:2px;margin-right:2px;">
+      <!--VTP_checkbox-->
+        <input type="checkbox" name="{#name}" value="1" />
+      <!--/VTP_checkbox-->
+      </div>
+    </td>
+    <td style="width:25%;">
+      <div style="margin-left:10px;color:{#color}">{#login}</div>
+    </td>
+    <td class="row2" style="text-align:center;width:25%;">
+      <!--VTP_modify-->
+      <a href="{#url}" title="{#listuser_modify_hint} {#login}">{#listuser_modify}</a>
+      <!--/VTP_modify-->
+      <!--VTP_not_modify-->
+      <span style="color:darkgray;">{#listuser_modify}</span>
+      <!--/VTP_not_modify-->
+    </td>
+    <td class="row2" style="text-align:center;width:25%;">
+      <!--VTP_permission-->
+      <a href="{#url}" title="{#listuser_permission_hint} {#login}">{#listuser_permission}</a>
+      <!--/VTP_permission-->
+      <!--VTP_not_permission-->
+      <span style="color:darkgray;">{#listuser_permission}</span>
+      <!--/VTP_not_permission-->
+    </td>
+    <td class="row2" style="text-align:center;width:25%;">
+      <!--VTP_delete-->
+      <a href="{#url}" title="{#listuser_delete_hint} {#login}">{#listuser_delete}</a>
+      <!--/VTP_delete-->
+      <!--VTP_not_delete-->
+      <span style="color:darkgray;">{#listuser_delete}</span>
+      <!--/VTP_not_delete-->
+    </td>
+  </tr>
+  <!--/VTP_user-->
+  <!--/VTP_category-->
+  <tr>
+    <td colspan="5">&nbsp;</td>
+  </tr>
+  <tr>
+    <td colspan="5">
+      <img src="../template/{#user_template}/admin/images/arrow_select.gif" alt="&lt;" />
+      <input type="button" value="{#listuser_button_all}" onClick="SelectAll(this.form)" style="margin-left:5px;margin-right:5px;" />
+      <input type="button" value="{#listuser_button_invert}" onClick="Inverser(this.form)" style="margin-left:5px;margin-right:5px;" />
+      <input type="submit" value="{#listuser_button_create_address}" style="margin-left:5px;margin-right:5px;" />
+      <!--VTP_mail_link-->
+      <a href="mailto:{#mailto}">mailto:{#mail_address_start}...</a>
+      <!--/VTP_mail_link-->
+    </td>
+  </tr>
+</table>
+</form>
+<!--/VTP_users-->
Index: /tags/release-1_3RC1/template/default/admin/user_modify.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/user_modify.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/user_modify.vtp	(revision 159)
@@ -0,0 +1,91 @@
+<!--VTP_errors-->
+<div class="errors">
+  <ul>
+    <!--VTP_li-->
+    <li>{#li}</li>
+    <!--/VTP_li-->
+  </ul>
+</div>
+<!--/VTP_errors-->
+<!--VTP_confirmation-->
+<div class="info">
+  {#adduser_info_message} "{#username}"
+  <!--VTP_password_updated-->
+  {#adduser_info_password_updated}
+  <!--/VTP_password_updated-->
+  [ <a href="{#url}">{#adduser_info_back}</a> ]
+</div>
+<!--/VTP_confirmation-->
+<!--VTP_form-->
+<form method="post" action="{#form_action}">
+  <table style="width:100%;">
+    <tr align="center" valign="middle">
+      <td>
+        <table style="margin-left:auto;margin-right:auto;">
+          <tr>
+            <th colspan="2">{#adduser_fill_form}</th>
+          </tr>
+          <tr>
+            <td colspan="2"><div style="margin-bottom:0px;">&nbsp;</div></td>
+          </tr>
+          <tr>
+            <td>{#login}</td>
+            <td style="color:red;text-align:center;">{#user:username}</td>
+          </tr>
+          <tr>
+            <td>{#new} {#password}<input type="checkbox" name="use_new_pwd" value="1" /></td>
+            <td><input type="text" name="password" value="" /></td>
+          </tr>
+          <tr>
+            <td>{#mail_address}</td>
+            <td><input type="text" name="mail_address" value="{#user:mail_address}" /></td>
+          </tr>
+          <tr>
+            <td>{#adduser_status}</td>
+            <td>
+              <select name="status">
+                <!--VTP_status_option-->
+                <option value="{#value}"{#selected}>{#option}</option>
+                <!--/VTP_status_option-->
+              </select>
+            </td>
+          </tr>
+          <!--VTP_groups-->
+          <tr>
+            <td valign="top">{#menu_groups}</td>
+            <td>
+              <table>
+                <!--VTP_group-->
+                <tr>
+                  <td>{#name}</td>
+                  <td><input type="checkbox" name="dissociate-{#dissociate_id}" value="1" /> {#dissociate}</td>
+                </tr>
+                <!--/VTP_group-->
+              </table>
+            </td>
+          </tr>
+          <!--/VTP_groups-->
+          <tr>
+            <td>{#adduser_associate}</td>
+            <td>
+              <select name="associate">
+                <!--VTP_associate_group-->
+                <option value="{#value}">{#option}</option>
+                <!--/VTP_associate_group-->
+              </select>
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2" align="center">
+              <input type="submit" name="submit" value="{#submit}" />
+            </td>
+          </tr>
+        </table>
+      </td>
+    </tr>
+  </table>
+</form>
+<div class="info">
+  [ <a href="{#url_back}">{#adduser_info_back}</a> ]
+</div>
+<!--/VTP_form-->
Index: /tags/release-1_3RC1/template/default/admin/user_perm.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/user_perm.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/user_perm.vtp	(revision 159)
@@ -0,0 +1,34 @@
+<!--VTP_confirmation-->
+<div class="info">{#permuser_info_message} [ <a href="{#back_url}">{#adduser_info_back}</a> ]</div>
+<!--/VTP_confirmation-->
+
+<div class="info">{#permuser_only_private}</div>
+
+<form action="{#action}" method="post">
+  <table style="width:100%;">
+    <!--VTP_category-->
+    <tr>
+      <td>
+        <img src="../template/{#user_template}/admin/images/puce.gif" alt="&gt;" /> <a href="{#cat_perm_link}"><span style="color:{#color}">{#name}</span></a>
+        <!--VTP_usergroups-->
+        [
+        <!--VTP_usergroup-->
+        <a href="{#url}" style="color:{#color};">{#name}</a>{#separation}
+        <!--/VTP_usergroup-->
+        ]
+        <!--/VTP_usergroups-->
+      </td>
+      <td style="text-align:right;">
+        <!--VTP_parent_forbidden-->
+        {#permuser_parent_forbidden}
+        <!--/VTP_parent_forbidden-->
+        <input type="radio" name="access-{#id}" value="0"{#authorized_checked}/>{#permuser_authorized}
+        <input type="radio" name="access-{#id}" value="1"{#forbidden_checked}/>{#permuser_forbidden}
+      </td>
+    </tr>
+    <!--/VTP_category-->
+    <tr>
+      <td colspan="2" align="center"><input type="submit" name="submit" value="{#submit}"/></td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/admin/waiting.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/admin/waiting.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/admin/waiting.vtp	(revision 159)
@@ -0,0 +1,39 @@
+<form action="{#action}" method="post">
+  <table style="width:100%;">
+    <tr>
+      <th style="width:20%;">{#category}</th>
+      <th style="width:20%;">{#date}</th>
+      <th style="width:20%;">{#file}</th>
+      <th style="width:20%;">{#thumbnail}</th>
+      <th style="width:20%;">{#author}</th>
+      <th style="width:1px;">&nbsp;</th>
+    </tr>
+    <!--VTP_picture-->
+    <tr>
+      <td class="{#class}" style="white-space:nowrap;">{#cat_name}</td>
+      <td class="{#class}" style="white-space:nowrap;">{#date}</td>
+      <td class="{#class}" style="white-space:nowrap;">
+        <a target="_blank" href="{#preview_url}">{#file}</a>
+      </td>
+      <td class="{#class}" style="white-space:nowrap;">
+        <!--VTP_thumbnail-->
+        <a target="_blank" href="{#preview_url}">{#file}</a>
+        <!--/VTP_thumbnail-->
+        <!--VTP_no_thumbnail-->
+        &nbsp;
+        <!--/VTP_no_thumbnail-->
+      </td>
+      <td class="{#class}" style="white-space:nowrap;">
+        <a href="mailto:{#mail_address}">{#username}</a>
+      </td>
+      <td class="{#class}" style="white-space:nowrap;">
+        <input type="radio" name="validate-{#id}" value="true" />{#submit}
+        <input type="radio" name="validate-{#id}" value="false" />{#delete}
+      </td>
+    </tr>
+    <!--/VTP_picture-->
+    <tr>
+      <td colspan="5" align="center"><input type="submit" name="submit" value="{#submit}" style="margin:5px;" /></td>
+    </tr>
+  </table>
+</form>
Index: /tags/release-1_3RC1/template/default/category.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/category.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/category.vtp	(revision 159)
@@ -0,0 +1,112 @@
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}" />
+    {#style}
+    <title>{#title}</title>
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;">
+      <tr>
+        <td valign="top" style="width:1%;padding:10px;">
+          {#frame_start}100%{#frame_begin}
+            <div class="titreMenu">{#categories}</div>
+            <div class="menu">
+              <!--VTP_category-->{#indent}<!--VTP_bullet_w_link--><a href="{#bullet_link}"><img src="{#bullet_url}" style="border:none;" alt="&gt;" /></a><!--/VTP_bullet_w_link--><!--VTP_bullet_wo_link--><img src="{#bullet_url}" style="border:none;" alt="&gt;" /><!--/VTP_bullet_wo_link-->&nbsp;<a href="{#link_url}"><span title="{#hint_category}" style="{#name_style}">{#link_name}</span>&nbsp;<span class="menuInfoCat">[&nbsp;<!--VTP_subcat--><span title="{#nb_subcats} {#sub-cat}">{#nb_subcats}</span>&nbsp;-&nbsp;<!--/VTP_subcat--><span title="{#total_cat} {#images_available}">{#total_cat}</span>&nbsp;]</span></a>{#cat_icon}<br />
+              <!--/VTP_category-->
+              <div class="totalImages">[&nbsp;{#nb_total_pictures}&nbsp;{#total}&nbsp;]</div>
+              <!--VTP_favorites-->
+              <br />&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#url}"><span title="{#favorite_cat_hint}" style="font-weight:bold;">{#favorite_cat}</span></a>&nbsp;<span class="menuInfoCat">[&nbsp;{#nb_favorites}&nbsp;]</span>
+              <!--/VTP_favorites-->
+              <br />&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<span style="font-weight:bold;">{#stats}</span></a>
+              <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#most_visited_url}"><span title="{#most_visited_cat_hint}" style="font-weight:bold;">{#top_number}&nbsp;{#most_visited_cat}</span></a>
+              <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#recent_url}"><span title="{#recent_cat_hint}" style="font-weight:bold;">{#recent_cat}</span></a> {#icon_short}
+            </div>
+          {#frame_end}
+          <div style="margin-bottom:5px;">&nbsp;</div>
+          {#frame_start}100%{#frame_begin}
+            <div class="titreMenu">{#title_menu}</div>
+            <div class="menu">
+              <!--VTP_summary-->
+              &nbsp;<img src="{#lien_collapsed}" alt="&gt;"/>&nbsp;<a href="{#url}" title="{#title}">{#name}</a><br />
+              <!--/VTP_summary-->
+              <!--VTP_upload-->
+              <br />&nbsp;<img src="{#lien_collapsed}" alt="&gt;"/>&nbsp;<a href="{#url}" class="back">{#upload_picture}</a>
+              <!--/VTP_upload-->
+            </div>
+          {#frame_end}
+        </td>
+        <td style="padding:5px;width:99%;" valign="top">
+          <table style="width:100%;">
+            <tr>
+              <td align="center">
+                {#frame_start}1%{#frame_begin}
+                  <div class="titrePage">{#cat_title}</div>
+                {#frame_end}
+                <div style="margin-bottom:5px;">&nbsp;</div>
+                <!--VTP_thumbnails-->
+                <table class="thumbnail">
+                  <!--VTP_line-->
+                  <tr>
+                    <!--VTP_thumbnail-->
+                    <td valign="bottom" class="thumbnail">
+                      <a href="{#url}" class="back">
+                      <img src="{#src}"
+                           alt="{#alt}"
+                           title="{#title}"
+                           class="imgLink"/><br />
+                      {#name}
+                      </a>
+                      {#icon}
+                      <!--VTP_nb_comments-->
+                      <br />{#nb} {#comments}
+                      <!--/VTP_nb_comments-->
+                    </td>
+                    <!--/VTP_thumbnail-->
+                  </tr>
+                  <!--/VTP_line-->
+                </table>
+                <!--/VTP_thumbnails-->
+              </td>
+            </tr>
+            <tr>
+              <td align="left">
+                <!--VTP_cat_infos-->
+                  <!--VTP_navigation-->
+                  <div class="navigationBar">{#navigation_bar}</div>
+                  <!--/VTP_navigation-->
+                  <!--VTP_comment-->
+                  <div class="comments">{#cat_comment}</div>
+                  <!--/VTP_comment-->
+                  <div class="infoCat">
+                  {#nb_image_category} "{#cat_name}" : {#cat_nb_images}
+                  </div>
+                <!--/VTP_cat_infos-->
+              </td>
+            </tr>
+            <tr>
+              <td align="right">
+                {#frame_start}1%{#frame_begin}
+                  <div class="info">
+                    {#connected_user}&nbsp;{#username}<br />
+                    {#recent_image}&nbsp;{#short_period}&nbsp;{#days}
+                      {#icon_short}<br />
+                    {#recent_image}&nbsp;{#long_period}&nbsp;{#days}
+                      {#icon_long}<br />
+                    {#send_mail}&nbsp;<a href="mailto:{#mail_webmaster}?subject={#title_send_mail}"><span style="font-weight:bold;">{#webmaster}</span></a>
+                  </div>
+                {#frame_end}
+              </td>
+            </tr>
+          </table>
+        </td>
+      </tr>
+    </table>
+    <div class="copyright">{#generation_time} {#time}</div>
+    <!-- Please, do not remove this copyright. If you really want to,
+         contact me pierrick@z0rglub.com to find a solution on how
+         to show the origin of the script...-->
+    <div class="copyright">Powered by <a href="{#site_url}" class="back">PhpWebGallery</a> {#version}</div>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/footer.htm
===================================================================
--- /tags/release-1_3RC1/template/default/footer.htm	(revision 159)
+++ /tags/release-1_3RC1/template/default/footer.htm	(revision 159)
@@ -0,0 +1,1 @@
+<!-- footer -->
Index: /tags/release-1_3RC1/template/default/header.htm
===================================================================
--- /tags/release-1_3RC1/template/default/header.htm	(revision 159)
+++ /tags/release-1_3RC1/template/default/header.htm	(revision 159)
@@ -0,0 +1,1 @@
+<!-- header -->
Index: /tags/release-1_3RC1/template/default/htmlfunctions.inc.php
===================================================================
--- /tags/release-1_3RC1/template/default/htmlfunctions.inc.php	(revision 159)
+++ /tags/release-1_3RC1/template/default/htmlfunctions.inc.php	(revision 159)
@@ -0,0 +1,241 @@
+<?php
+/***************************************************************************
+ *                           htmlfunctions.inc.php                         *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************
+
+ ***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+include( PREFIX_INCLUDE.'./template/'.$user['template'].'/theme/conf.php' );
+$user['lien_expanded']='./template/'.$user['template'].'/theme/expanded.gif';
+$user['lien_collapsed']='./template/'.$user['template'].'/theme/collapsed.gif';
+include_once( PREFIX_INCLUDE.'./template/'.$user['template'].'/style.inc.php');
+
+function get_icon( $date_comparaison )
+{
+  global $user, $conf;
+  $difference = time() - $date_comparaison;
+  $jours = 24*60*60;
+  $output = '';
+  if ( $difference < $user['long_period'] * $jours )
+  {
+    $icon_url = './template/'.$user['template'].'/theme/';
+    if ( $difference < $user['short_period'] * $jours )
+    {
+      $icon_url.= 'new_short.gif';
+    }
+    else
+    {
+      $icon_url.= 'new_long.gif';
+    }
+    $size = getimagesize( $icon_url );
+    $output = '<img src="'.$icon_url.'" style="border:0;';
+    $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
+  }
+  return $output;
+}
+
+function create_navigation_bar( $url, $nb_element, $start,
+                                $nb_element_page, $link_class )
+{
+  global $lang;
+  $navigation_bar = "";
+  // 0. détection de la page en cours
+  if( !isset( $start )
+      || !is_numeric( $start )
+      || ( is_numeric( $start ) && $start < 0 ) )
+  {
+    $start = 0;
+  }
+  // on n'affiche la bare de navigation que si on plus de 1 page
+  if ( $nb_element > $nb_element_page )
+  {
+    // 1.une page précédente ?
+    if ( $start != 0 )
+    {
+      $previous = $start - $nb_element_page;
+      $navigation_bar.= '<a href="';
+      $navigation_bar.= add_session_id( $url.'&amp;start='.$previous );
+      $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page'];
+      $navigation_bar.= '</a>';
+      $navigation_bar.= ' | ';
+    }
+    // 2.liste des numéros de page
+    $maximum = ceil ( $nb_element / $nb_element_page );
+    for ( $i = 1; $i <= $maximum; $i++ )
+    {
+      $temp_start = ( $i - 1 ) * $nb_element_page;
+      if ( $temp_start == $start )
+      {
+        $navigation_bar.= ' <span style="font-weight:bold;">'.$i.'</span> ';
+      }
+      else
+      {
+        $navigation_bar.= ' <a href="';
+        $navigation_bar.= add_session_id( $url.'&amp;start='.$temp_start );
+        $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> ';
+      }
+    }
+    // 3.une page suivante ?
+    if ( $nb_element > $nb_element_page
+         && $start + $nb_element_page < $nb_element )
+    {
+      $next = $start + $nb_element_page;
+      $navigation_bar.= ' | <a href="';
+      $navigation_bar.= add_session_id( $url.'&amp;start='.$next );
+      $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
+    }
+  }
+  return $navigation_bar;
+}
+
+function get_frame_start()
+{
+  return '<table style="width:';
+}
+/*
+function get_frame_begin()
+{
+  return ';">
+            <tr>
+              <td style="border:1px dashed gray;width:100%;padding:5px;background-color:white;">';
+}
+
+function get_frame_end()
+{
+  return '
+              </td>
+            </tr>   
+          </table>';
+}
+*/
+
+function get_frame_begin()
+{
+  global $user;
+  $path = './template/'.$user['template'].'/theme/';
+  $size_01 = getimagesize( $path.'01.gif' );
+  $size_02 = getimagesize( $path.'02.gif' );
+  $size_03 = getimagesize( $path.'03.gif' );
+  return ';">
+            <tr>
+              <td><img src="'.$path.'01.gif" style="width:'.$size_01[0].'px;display:box;" alt="" /></td>
+              <td><img src="'.$path.'02.gif" style="display:box;width:100%;height:'.$size_02[1].'px;" alt="" /></td>
+              <td><img src="'.$path.'03.gif" style="display:box;width:'.$size_03[0].'px;" alt="" /></td>
+            </tr>
+            <tr>
+              <td style="background:url('.$path.'04.gif);"></td>
+              <td style="background:url('.$path.'05.gif);width:100%;">';
+}
+        
+function get_frame_end()
+{
+  global $user;
+  $path = './template/'.$user['template'].'/theme/';
+  $size_08 = getimagesize( $path.'08.gif' );
+  return '
+              </td>
+              <td style="background:url('.$path.'06.gif);"></td>
+            </tr>
+            <tr>
+              <td><img src="'.$path.'07.gif" alt="" /></td>
+              <td><img src="'.$path.'08.gif" style="width:100%;height:'.$size_08[1].'px;" alt="" /></td>
+              <td><img src="'.$path.'09.gif" alt="" /></td>
+            </tr>   
+          </table>';
+}
+
+function initialize_template()
+{
+  global $vtp, $handle, $user, $lang;
+
+  $vtp->setGlobalVar( $handle, 'charset', $lang['charset'] );
+  $vtp->setGlobalVar( $handle, 'style', $user['style'] );
+  $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+  $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+  $vtp->setGlobalVar( $handle, 'frame_end',   get_frame_end() );
+  $vtp->setVarF( $handle, 'header',
+                 './template/'.$user['template'].'/header.htm' );
+  $vtp->setVarF( $handle, 'footer',
+                 './template/'.$user['template'].'/footer.htm' );
+}
+
+function display_category( $category, $indent, $handle )
+{
+  global $user,$lang,$vtp;
+
+  $vtp->addSession( $handle, 'category' );
+  $vtp->setVar( $handle, 'category.indent', $indent );
+
+  if ( $user['expand'] or count( $category['subcats'] ) == 0 )
+  {
+    $vtp->addSession( $handle, 'bullet_wo_link' );
+    $vtp->setVar( $handle, 'bullet_wo_link.bullet_url',
+                  $user['lien_collapsed'] );
+    $vtp->closeSession( $handle, 'bullet_wo_link' );
+  }
+  else
+  {
+    $vtp->addSession( $handle, 'bullet_w_link' );
+    $url = './category.php?cat='.$page['cat'];
+    $url.= '&amp;expand='.$category['expand_string'];
+    if ( $page['cat'] == 'search' )
+    {
+      $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+    }
+    $vtp->setVar( $handle, 'bullet_w_link.bullet_link', add_session_id($url) );
+    if ( $category['expanded'] )
+    {
+      $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
+                    $user['lien_expanded'] );
+    }
+    else
+    {
+      $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
+                    $user['lien_collapsed'] );
+    }
+    $vtp->closeSession( $handle, 'bullet_w_link' );
+  }
+
+  $url = './category.php?cat='.$category['id'];
+  $url.= '&amp;expand='.$category['expand_string'];
+  $vtp->setVar( $handle, 'category.link_url', add_session_id( $url ) );
+
+  $name = $category['name'];
+  if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] );
+  $vtp->setVar( $handle, 'category.link_name', $name );
+
+  if ( $category['id_uppercat'] == '' )
+  {
+    $vtp->setVar( $handle, 'category.name_style', 'font-weight:bold;' );
+  }
+  if ( count( $category['subcats'] ) > 0 )
+  {
+    $vtp->addSession( $handle, 'subcat' );
+    $vtp->setVar( $handle, 'subcat.nb_subcats', count($category['subcats']) );
+    $vtp->closeSession( $handle, 'subcat' );
+  }
+  $vtp->setVar( $handle, 'category.total_cat', $category['nb_images'] );
+  $vtp->setVar( $handle, 'category.cat_icon',get_icon($category['date_last']));
+  $vtp->closeSession( $handle, 'category' );
+
+  // recursive call
+  if ( $category['expanded'] )
+  {
+    foreach ( $category['subcats'] as $subcat ) {
+      display_category( $subcat, $indent.str_repeat( '&nbsp', 2 ), $handle );
+    }
+  }
+}
+?>
Index: /tags/release-1_3RC1/template/default/identification.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/identification.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/identification.vtp	(revision 159)
@@ -0,0 +1,78 @@
+<html>
+  <head>
+    {#style}
+    <title>{#ident_page_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}" />
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#ident_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:5px;">&nbsp;</div>
+          {#frame_start}50%{#frame_begin}
+            <div style="margin-left:auto;margin-right:auto;text-align:center;">
+              <form method="post" action="./identification.php">
+                <table style="width:80%;margin-left:auto;margin-right:auto;">
+                  <!--VTP_errors-->
+                  <tr>
+                    <td colspan="3">
+                      <div class="errors">
+                        <ul>
+                          <!--VTP_li-->
+                          <li>{#li}</li>
+                          <!--/VTP_li-->
+                        </ul>
+                      </div>
+                    </td>
+                  </tr>
+                  <!--/VTP_errors-->
+                  <tr>
+                    <td class="menu" align="center">{#login}</td>
+                    <td class="menu" align="center">{#password}</td>
+                    <td>&nbsp;</td>
+                  </tr>
+                  <tr>
+                    <td align="center">
+                      <!--VTP_select_field-->
+                      <select name="login">
+                        <!--VTP_option-->
+                        <option>{#option}</option>
+                        <!--/VTP_option-->
+                      </select>
+                      <!--/VTP_select_field-->
+                      <!--VTP_text_field-->
+                      <input type="text" name="login" value="" />
+                      <!--/VTP_text_field-->
+                    </td>
+                    <td align="center"><input type="password" name="pass"/></td>
+                    <td align="center"><input type="submit" name="submit" value="{#submit}" class="bouton"/></td>
+                  </tr>
+                </table>
+              </form>
+              <table style="width:80%;margin-left:auto;margin-right:auto;">
+                <tr>
+                  <td colspan="3" align="center">
+                    <!--VTP_guest_visit-->
+                      <a href="./category.php">[ {#ident_guest_visit} ]</a>
+                    <!--/VTP_guest_visit-->
+                    <div  style="margin-top:10px;text-align:left;">
+                      <!--VTP_register-->
+                        <a href="register.php"><img src="./template/{#user_template}/theme/register.gif" style="border:0;" alt="{#ident_register}"/>&nbsp;{#ident_register}</a><br />
+                      <!--/VTP_register-->
+                      <a href="mailto:{#mail_webmaster}?subject=[PhpWebGallery] {#ident_forgotten_password}"><img src="./template/{#user_template}/theme/lost.gif" style="border:0;" alt=""/>&nbsp;{#ident_forgotten_password}</a>
+                    </div>
+                  </td>
+                </tr>
+              </table>
+            </div>
+          {#frame_end}
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/picture.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/picture.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/picture.vtp	(revision 159)
@@ -0,0 +1,190 @@
+<html>
+  <head>
+    <!--VTP_refresh-->
+    <meta http-equiv="refresh" content="{#time};url={#url}">
+    <!--/VTP_refresh-->
+    <meta http-equiv="Content-Type" content="text/html;charset={#charset}">
+    {#style}
+    <!-- Specific style to picture.php-->
+    <style type="text/css">
+      .commentsAuthor,.commentsTitle,.commentsInfos,.commentsContent,.commentsNavigationBar {
+        color:{#text_color};
+        font-family:arial,sans-Serif;
+        font-size:12px;
+      }
+      .commentsTitle,.commentsAuthor {
+        text-align:center;
+        font-weight:bold;
+      }
+      .commentsInfos {
+        margin:3px 3px 3px 10px;
+        font-size:11px;
+      }
+      .commentsContent {
+        margin:10px;
+      }
+      .commentsTitle {
+        margin-top:15px;
+      }
+      .commentsAuthor {
+        margin:5px;
+      }
+      .commentsNavigationBar {
+        margin:10px;
+      }
+      .tableComment {
+        width:90%;
+        border:2px solid {#text_color};
+        margin:10px;
+      }
+      .cellAuthor {
+        border-right:1px solid {#text_color};
+        width:100px;
+      }
+      .cellInfo {
+        border-bottom:1px solid {#text_color};
+      }
+    </style>
+    <title>{#page_title}</title>
+  </head>
+  <body>
+    {#header}
+    <!--VTP_information-->
+    <div class="information">{#content}</div>
+    <!--/VTP_information-->
+    <!--VTP_start_slideshow-->
+    <div style="text-align:center;margin-bottom:5px;">
+      [ {#slideshow} :
+      <!--VTP_second-->
+      <a href="{#url}" class="back" style="font-weight:bold;">{#option}</a>
+      <!--/VTP_second-->
+      {#period_seconds} ]
+    </div>
+    <!--/VTP_start_slideshow-->
+    <!--VTP_stop_slideshow-->
+    <div style="text-align:center;margin-bottom:5px;">
+      [ <a href="{#url}" class="back" style="font-weight:bold;">{#slideshow_stop}</a> ]
+    </div>
+    <!--/VTP_stop_slideshow-->
+    <table style="width:100%;height:100%;">
+      <tr align="center" valign="middle">
+        <td>
+          <!--VTP_previous-->
+          <a href="{#url}" title="{#title}">
+            <img src="{#src}" class="imgLink" style="margin-right:10px;margin-left:5px;" alt="{#alt}"/>
+          </a>
+          <!--/VTP_previous-->
+          <!--VTP_previous_empty-->
+          &nbsp;
+          <!--/VTP_previous_empty-->
+        </td>
+        <td style="width:100%;">
+          {#frame_start}1%{#frame_begin}
+          <div class="titrePage">{#title}</div>
+          {#frame_end}
+          <div style="margin-bottom:5px">&nbsp;</div>
+          {#frame_start}1%{#frame_begin}
+          <a href="{#picture_link}">
+            <img style="margin:10px;width:{#picture_width}px;height:{#picture_height}px;border:1px solid {#picture_border_color}" src="{#picture_src}" alt="{#picture_alt}"/>
+          </a>
+          <div class="commentImage">{#picture_comment}</div>
+          <table style="width:100%;">   
+            <tr>
+              <td align="center">
+                <table style="margin:auto;margin-top:5px;margin-bottom:5px;">
+                  <!--VTP_info_line-->
+                  <tr>
+                     <td class="menu" style="font-weight:bold;">{#name}</td>
+                     <td class="menu" style="text-align:right;">{#content}</td>
+                  </tr>
+                  <!--/VTP_info_line-->
+                </table>
+              </td>
+            </tr>
+          </table>
+          <!--VTP_favorite-->
+          <div class="menu" style="text-align:center;margin:5px;">
+            <a href="{#link}" title="{#title}"><img src="{#src}" style="border:none;margin-left:5px;" alt=""/></a>
+            <a href="{#link}">{#alt}</a>
+          </div>
+          <!--/VTP_favorite-->
+          <!--VTP_modification-->
+          <div class="menu" style="text-align:center;margin:5px;">
+            [ <a href="{#link}">{#name}</a> ]
+          </div>
+          <!--/VTP_modification-->
+          {#frame_end}
+          <div style="text-align:center;">{#back}</div>
+        </td>
+        <td>
+          <!--VTP_next-->
+          <a href="{#url}" title="{#title}">
+            <img src="{#src}" class="imgLink" style="margin-right:10px;margin-left:5px;" alt="{#alt}"/>
+          </a>
+          <!--/VTP_next-->
+          <!--VTP_next_empty-->
+          &nbsp;
+          <!--/VTP_next_empty-->
+        </td>
+      </tr>
+      <!--VTP_comments-->
+      <tr align="center" valign="middle">
+        <td colspan="3">
+          {#frame_start}90%{#frame_begin}
+            <table style="width:100%;">
+              <tr align="center">
+                <td>
+                  <div class="commentsTitle">
+                    [{#nb_comments}] {#comments_title}
+                  </div>
+                  <div class="commentsNavigationBar">{#navigation_bar}</div>
+                  <!--VTP_comment-->
+                  <table class="tableComment">
+                    <tr>
+                      <td rowspan="2" valign="top" class="cellAuthor">
+                        <div class="commentsAuthor">{#author}</div>
+                      </td>
+                      <td align="right" class="cellInfo">
+                        <div class="commentsInfos">
+                          {#date}<!--VTP_delete--><a href="{#link}" title="{#comments_del}"><img src="./template/{#user_template}/theme/delete.gif" style="border:none;margin-left:5px;" alt="[{#delete}]"/></a><!--/VTP_delete-->
+                        </div>
+                      </td>
+                    </tr>
+                    <tr>
+                      <td>
+                        <div class="commentsContent">{#content}</div>
+                      </td>
+                    </tr>
+                  </table>
+                  <!--/VTP_comment-->
+                  <div class="commentsNavigationBar">{#navigation_bar}</div>
+                </td>
+              </tr>
+            </table>
+            <!--VTP_add_comment-->
+            <form method="post" action="{#form_action}">
+              <table style="width:100%;">
+                <tr align="center">
+                  <td>
+                    <div class="commentsTitle">{#comments_add}</div>
+                    <!--VTP_author_field-->
+                    <div class="menu">{#author} : <input type="text" name="author" style="margin-top:5px;"/></div>
+                    <!--/VTP_author_field-->
+                    <!--VTP_author_known-->
+                    <input type="hidden" name="author" value="{#value}" />
+                    <!--/VTP_author_known-->
+                    <textarea name="content" rows="10" cols="50" style="overflow:auto;width:450px;margin:10px;"></textarea><br />
+                    <input type="submit" value="{#submit}" style="margin:10px;"/>
+                  </td>
+                </tr>
+              </table>
+            </form>
+            <!--/VTP_add_comment-->
+          {#frame_end}
+        </td>
+      </tr>
+      <!--/VTP_comments-->
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/profile.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/profile.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/profile.vtp	(revision 159)
@@ -0,0 +1,102 @@
+<html>
+  <head>
+    {#style}
+    <title>{#customize_page_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; {#charset}">
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#customize_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:20px"></div>
+          {#frame_start}50%{#frame_begin}
+            <form method="post" action="{#form_action}">
+              <table style="width:100%;margin-top:10px;margin-bottom:10px;">
+                <tr align="center" valign="middle">
+                  <td>
+                    <table width="80%">
+                      <!--VTP_errors-->
+                      <tr>
+                        <td colspan="2">
+                          <div class="errors">
+                            <ul>
+                              <!--VTP_li-->
+                              <li>{#li}</li>
+                              <!--/VTP_li-->
+                            </ul>
+                          </div>
+                        </td>
+                      </tr>
+                      <!--/VTP_errors-->
+                      <!--VTP_line-->
+                      <tr>
+                        <td class="menu">{#name}</td>
+                        <td class="menu">
+                          <!--VTP_select-->
+                          <select name="{#name}">
+                            <!--VTP_option-->
+                            <option{#selected}>{#option}</option>
+                            <!--/VTP_option-->
+                          </select>
+                          <!--/VTP_select-->
+                          <!--VTP_text-->
+                          <input type="text" name="{#name}" value="{#value}" />
+                          <!--/VTP_text-->
+                          <!--VTP_group-->
+                            <!--VTP_radio-->
+                            <input type="radio" name="{#name}" value="{#value}"{#checked}/>{#option}
+                            <!--/VTP_radio-->
+                          <!--/VTP_group-->
+                        </td>
+                      </tr>
+                      <!--/VTP_line-->
+                      <tr>
+                        <td colspan="2">&nbsp;</td>
+                      </tr>
+                      <tr>
+                        <td class="menu">{#new} {#password} <input type="checkbox" name="use_new_pwd" value="1" /></td>
+                        <td class="menu"><input type="password" name="password" value="" /></td>
+                      </tr>
+                      <tr>
+                        <td class="menu">{#reg_confirm}</td>
+                        <td class="menu"><input type="password" name="passwordConf" value="" /></td>
+                      </tr>
+                      <!--VTP_cookie-->
+                      <tr>
+                        <td colspan="2">&nbsp;</td>
+                      </tr>
+                      <tr>
+                        <td class="menu">{#create_cookie} <input type="checkbox" name="create_cookie" value="1" /></td>
+                        <td class="menu">
+                          <select name="cookie_expiration">
+                          <!--VTP_expiration_option-->
+                            <option value="{#value}">{#option}</option>
+                          <!--/VTP_expiration_option-->
+                          </select>
+                        </td>
+                      </tr>
+                      <!--/VTP_cookie-->
+                      <tr>
+                        <td colspan="2">&nbsp;</td>
+                      </tr>
+                      <tr>
+                        <td colspan="2" align="center">
+                          <input type="submit" name="submit" value="{#submit}" style="margin:5px;"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </form>
+          {#frame_end}
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/register.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/register.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/register.vtp	(revision 159)
@@ -0,0 +1,74 @@
+<html>
+  <head>
+    {#style}
+    <title>{#register_page_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}">
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#register_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:20px"></div>
+          {#frame_start}50%{#frame_begin}
+            <form method="post" action="{#form_action}">
+              <table style="width:80%;margin-top:10px;margin-bottom:10px;margin-left:auto;margin-right:auto;">
+                <!--VTP_errors-->
+                <tr>
+                  <td colspan="2">
+                    <div class="errors">
+                      <ul>
+                        <!--VTP_li-->
+                        <li>{#li}</li>
+                        <!--/VTP_li-->
+                      </ul>
+                    </div>
+                  </td>
+                </tr>
+                <!--/VTP_errors-->
+                <!--VTP_line-->
+                <tr>
+                  <td class="menu">{#name}</td>
+                  <td class="menu">
+                    <!--VTP_select-->
+                    <select name="{#name}">
+                      <!--VTP_option-->
+                      <option{#selected}>{#option}</option>
+                      <!--/VTP_option-->
+                    </select>
+                    <!--/VTP_select-->
+                    <!--VTP_text-->
+                    <input type="text" name="{#name}" value="{#value}" />
+                    <!--/VTP_text-->
+                    <!--VTP_password-->
+                    <input type="password" name="{#name}" value="{#value}" />
+                    <!--/VTP_password-->
+                  </td>
+                </tr>
+                <!--/VTP_line-->
+                <tr>
+                  <td colspan="2">&nbsp;</td>
+                </tr>
+                <tr>
+                <tr>
+                  <td colspan="2" align="center">
+                    <input type="submit" name="submit" value="{#submit}" style="margin:5px;"/>
+                  </td>
+                </tr>
+                <tr>
+                  <td colspan="2" align="center">
+                    <a href="./category.php">[ {#ident_guest_visit} ]</a>
+                  </td>
+                </tr>
+              </table>
+            </form>
+          {#frame_end}
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/search.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/search.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/search.vtp	(revision 159)
@@ -0,0 +1,84 @@
+<html>
+  <head>
+    {#style}
+    <title>{#search_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}">
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#search_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:5px;">&nbsp;</div>
+          {#frame_start}50%{#frame_begin}
+            <div style="margin-left:auto;margin-right:auto;text-align:center;">
+              <form method="post" action="{#form_action}">
+                <table style="width:80%;margin-left:auto;margin-right:auto;">
+                  <!--VTP_errors-->
+                  <tr>
+                    <td colspan="2">
+                      <div class="errors">
+                        <ul>
+                          <!--VTP_li-->
+                          <li>{#li}</li>
+                          <!--/VTP_li-->
+                        </ul>
+                      </div>
+                    </td>
+                  </tr>
+                  <!--/VTP_errors-->
+                  <tr>
+                    <td colspan="2">
+                      <div style="margin-bottom:10px;">&nbsp;</div>
+                    </td>
+                  </tr>
+                  <!--VTP_line-->
+                  <tr>
+                    <td class="menu">{#name}</td>
+                    <td class="menu">
+                      <!--VTP_select-->
+                      <select name="{#name}">
+                        <!--VTP_option-->
+                        <option{#selected}>{#option}</option>
+                        <!--/VTP_option-->
+                      </select>
+                      <!--/VTP_select-->
+                      <!--VTP_text-->
+                      <input type="text" name="{#name}" size="{#size}" value="{#value}" />
+                      <!--/VTP_text-->
+                      <!--VTP_group-->
+                        <!--VTP_radio-->
+                        <input type="radio" name="{#name}" value="{#value}"{#checked}/>{#option}
+                        <!--/VTP_radio-->
+                      <!--/VTP_group-->
+                    </td>
+                  </tr>
+                  <!--/VTP_line-->
+                  <tr>
+                    <td align="center" colspan="2">
+                      <input type="submit" name="submit" value="{#submit}" class="bouton" style="margin:10px;" />
+                    </td>
+                  </tr>
+                  <tr>
+                    <td align="center" colspan="2">
+                      <a href="{#back_url}">[ {#search_return_main_page} ]</a>
+                    </td>
+                  </tr>
+                  <tr>
+                    <td colspan="2">
+                      <div style="margin-top:10px;">* : {#search_comments}</div>
+                    </td>
+                  </tr>
+                </table>
+              </form>
+            </div>
+          {#frame_end}
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/template/default/style.inc.php
===================================================================
--- /tags/release-1_3RC1/template/default/style.inc.php	(revision 159)
+++ /tags/release-1_3RC1/template/default/style.inc.php	(revision 159)
@@ -0,0 +1,147 @@
+<?php
+/***************************************************************************
+ *                               style.inc.php                             *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+$user['style'] = '<style type="text/css">
+      a {
+        text-decoration:none;
+      }
+      a:hover {
+        text-decoration:underline;
+      }
+      a.back, body {
+        color:'.$user['couleur_text_fond'].';
+      }
+      body,table,input {
+        font-family:arial,sans-serif;
+        font-size:12px;
+      }
+      .imgLink {
+        border:1px solid '.$user['couleur_text_fond'].';
+      }
+      .titrePage,.titreMenu,.menu,.info, a {
+        color:'.$user['couleur_text'].';
+      }
+      .titreMenu,.menu,.info {
+        margin-bottom:5px;
+        white-space:nowrap;
+      }
+      .menu,.titrePage,.info {
+        margin-left:2px;
+        margin-right:2px;
+      }
+      .menuInfoCat {
+        font-family:sans-serif;
+        font-size:11px;
+      }
+      .totalImages {
+        text-align:center;
+        margin-top:5px;
+        font-family:sans-serif;
+        font-size:11px;
+      }
+      .titreMenu {
+        font-weight:600;
+        text-align:center;
+      }
+      .info {
+        text-align:right;
+      }
+      .titrePage {
+        white-space:nowrap;
+        font-weight:500;
+        font-size:18px;
+        text-align:center;
+      }
+      .comments,.infoCat,.navigationBar {
+        margin-top:10px;
+        margin-bottom:10px;
+      }
+      .comments {
+        text-align:justify;
+        font-style:italic;
+      }
+      .navigationBar {
+        text-align:center;
+      }
+      .infoCat {
+        text-align:left;
+      }
+      .thumbnail {
+        font-size:11px;
+        text-align:center;
+      }
+      .copyright {
+        font-size:11px;
+        text-align:center;
+        font-family:sans-serif;
+        letter-spacing:0.3mm;
+      }
+      .commentImage {
+        font-weight:bold;
+        text-align:center;
+        font-size:17px;
+      }
+      .bouton {
+        background:#EEEEEE;
+      }
+      input {
+        border-width:1;
+        border-color:#000000;
+        background:#ffffff;
+        color: #000000;
+      }
+      body {';
+$image = './theme/'.$user['theme'].'/background.gif';
+if ( @is_file( $image ) )
+{
+  $user['style'].= '
+        background-image:url('.$image.');';
+}
+else
+{
+  $user['style'].= '
+        background-color:'.$user['couleur_fond'].';';
+}
+$user['style'].= '
+        margin:5px;
+      }
+      table {
+        border-collapse:collapse;
+      }
+      table.thumbnail {
+        border-collapse:separate;
+      }
+      td {
+        font-family:sans-serif;
+        padding:0;
+      }
+      .errors {
+        text-align:left;
+        margin-top:5px;
+        margin-bottom:5px;
+        background-color:red;
+        font-weight:bold;
+        border:1px solid black;
+        color:white;
+      }
+      div.information {
+        text-align:center;
+        border:2px solid '.$user['couleur_text_fond'].';
+        margin:10px;padding:5px;
+      }
+    </style>';
Index: /tags/release-1_3RC1/template/default/theme/conf.php
===================================================================
--- /tags/release-1_3RC1/template/default/theme/conf.php	(revision 159)
+++ /tags/release-1_3RC1/template/default/theme/conf.php	(revision 159)
@@ -0,0 +1,7 @@
+<?php
+	/*---------------couleur de fond pour le template agjimmy - lightred------------------*/
+	/* ce template a été "adapté" par thierry                                         */
+	$user['couleur_fond'] = "#FFFFFF";
+	$user['couleur_text_fond'] = "black";
+	$user['couleur_text'] = "black";
+?>
Index: /tags/release-1_3RC1/template/default/upload.vtp
===================================================================
--- /tags/release-1_3RC1/template/default/upload.vtp	(revision 159)
+++ /tags/release-1_3RC1/template/default/upload.vtp	(revision 159)
@@ -0,0 +1,115 @@
+<html>
+  <head>
+    {#style}
+    <title>{#upload_title}</title>
+    <meta http-equiv="Content-Type" content="text/html; charset={#charset}">
+  </head>
+  <body>
+    {#header}
+    <table style="width:100%;height:100%">
+      <tr align="center" valign="middle">
+        <td>
+          {#frame_start}1px{#frame_begin}
+            <div class="titrePage">{#upload_title}</div>
+          {#frame_end}
+          <div style="margin-bottom:5px;">&nbsp;</div>
+          {#frame_start}50%{#frame_begin}
+            <!--VTP_upload_not_successful-->
+            <form enctype="multipart/form-data" method="post" action="{#form_action}">
+              <table style="width:80%;margin-left:auto;margin-right:auto;">
+                <!--VTP_errors-->
+                <tr>
+                  <td colspan="3">
+                    <div class="errors">
+                      <ul>
+                        <!--VTP_li-->
+                        <li>{#li}</li>
+                        <!--/VTP_li-->
+                      </ul>
+                    </div>
+                  </td>
+                </tr>
+                <!--/VTP_errors-->
+                <tr>
+                  <td colspan="2" class="menu">
+                    <div style="text-align:center;">{#advise_title}</div>
+                    <ul>
+                      <!--VTP_advise-->
+                      <li>{#content}</li>
+                      <!--/VTP_advise-->
+                    </ul>
+                  </td>
+                </tr>
+                <tr>
+                  <td colspan="2" align="center" style="padding:10px;">
+                    <input name="picture" type="file" value="" />
+                  </td>
+                </tr>
+                <!--VTP_fields-->
+                <!-- username -->
+                <tr>
+                  <td class="menu">{#upload_username} <span style="color:red;">*</span></td>
+                  <td align="center" style="padding:10px;">
+                    <input name="username" type="text" value="{#username}" />
+                  </td>
+                </tr>
+                <!-- mail address -->
+                <tr>
+                  <td class="menu">{#mail_address} <span style="color:red;">*</span></td>
+                  <td align="center" style="padding:10px;">
+                    <input name="mail_address" type="text" value="{#user_mail_address}" />
+                  </td>
+                </tr>
+                <!-- name of the picture -->
+                <tr>
+                  <td class="menu">{#upload_name}</td>
+                  <td align="center" style="padding:10px;">
+                    <input name="name" type="text" value="{#name}" />
+                  </td>
+                </tr>
+                <!-- author -->
+                <tr>
+                  <td class="menu">{#upload_author}</td>
+                  <td align="center" style="padding:10px;">
+                    <input name="author" type="text" value="{#author}" />
+                  </td>
+                </tr>
+                <!-- date of creation -->
+                <tr>
+                  <td class="menu">{#upload_creation_date}</td>
+                  <td align="center" style="padding:10px;">
+                    <input name="date_creation" type="text" value="{#date_creation}" />
+                  </td>
+                </tr>
+                <!-- comment -->
+                <tr>
+                  <td class="menu">{#upload_comment}</td>
+                  <td align="center" style="padding:10px;">
+                   <textarea name="comment" rows="3" cols="40" style="overflow:auto">{#comment}</textarea>
+                  </td>
+                </tr>
+                <!--/VTP_fields-->
+                <tr>
+                  <td colspan="2" align="center">
+                    <input name="submit" type="submit" value="{#submit}" />
+                  </td>
+                </tr>
+              </table>
+            </form>
+            <!--/VTP_upload_not_successful-->
+            <!--VTP_upload_successful-->
+            {#upload_successful}<br />
+            <!--/VTP_upload_successful-->
+            <div style="text-align:center;">
+              <a href="{#return_url}">[ {#search_return_main_page} ]</a>
+            </div>
+            <!--VTP_note-->
+            <div style="text-align:left;"><span style="color:red;">*</span> : {#mandatory}</div>
+            <!--/VTP_note-->
+          {#frame_end}
+        </td>
+      </tr>
+    </table>
+    {#footer}
+  </body>
+</html>
Index: /tags/release-1_3RC1/upload.php
===================================================================
--- /tags/release-1_3RC1/upload.php	(revision 159)
+++ /tags/release-1_3RC1/upload.php	(revision 159)
@@ -0,0 +1,376 @@
+<?php
+/***************************************************************************
+ *                                 upload.php                              *
+ *                            -------------------                          *
+ *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
+ *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
+ *                                                                         *
+ *   $Id$
+ *                                                                         *
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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;                                         *
+ *                                                                         *
+ ***************************************************************************/
+
+//------------------------------------------------------------------- functions
+// The validate_upload function checks if the image of the given path is valid.
+// A picture is valid when :
+//     - width, height and filesize are not higher than the maximum
+//       filesize authorized by the administrator
+//     - the type of the picture is among jpg, gif and png
+// The function returns an array containing :
+//     - $result['type'] contains the type of the image ('jpg', 'gif' or 'png')
+//     - $result['error'] contains an array with the different errors
+//       found with the picture
+function validate_upload( $temp_name, $my_max_file_size,
+                          $image_max_width, $image_max_height )
+{
+  global $lang;
+		
+  $result = array();
+  $result['error'] = array();
+  //echo $_FILES['picture']['name']."<br />".$temp_name;
+  $extension = get_extension( $_FILES['picture']['name'] );
+  if ( $extension != 'gif' and $extension != 'jpg' and $extension != 'png' )
+  {
+    array_push( $result['error'], $lang['upload_advise_filetype'] );
+    return $result;
+  }
+  if ( !isset( $_FILES['picture'] ) )
+  {
+    // do we even have a file?
+    array_push( $result['error'], "You did not upload anything!" );
+  }
+  else if ( $_FILES['picture']['size'] > $my_max_file_size * 1024 )
+  {
+    array_push( $result['error'],
+                $lang['upload_advise_width'].$my_max_file_size.' KB' );
+  }
+  else
+  {
+    // check if we are allowed to upload this file_type
+    // upload de la photo sous un nom temporaire
+    if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) )
+    {
+      array_push( $result['error'], $lang['upload_cannot_upload'] );
+    }
+    else
+    {
+      $size = getimagesize( $temp_name );
+      if ( isset( $image_max_width )
+           and $image_max_width != ""
+           and $size[0] > $image_max_width )
+      {
+        array_push( $result['error'],
+                    $lang['upload_advise_width'].$image_max_width.' px' );
+      }
+      if ( isset( $image_max_height )
+           and $image_max_height != ""
+           and $size[1] > $image_max_height )
+      {
+        array_push( $result['error'],
+                    $lang['upload_advise_height'].$image_max_height.' px' );
+      }
+      // $size[2] == 1 means GIF
+      // $size[2] == 2 means JPG
+      // $size[2] == 3 means PNG
+      switch ( $size[2] )
+      {
+      case 1 : $result['type'] = 'gif'; break;
+      case 2 : $result['type'] = 'jpg'; break;
+      case 3 : $result['type'] = 'png'; break;
+      default :
+        array_push( $result['error'], $lang['upload_advise_filetype'] );  
+      }
+    }
+  }
+  if ( sizeof( $result['error'] ) > 0 )
+  {
+    // destruction de l'image avec le nom temporaire
+    @unlink( $temp_name );
+  }
+  return $result;
+}	
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+check_cat_id( $_GET['cat'] );
+if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+{
+  check_restrictions( $page['cat'] );
+  $result = get_cat_info( $page['cat'] );
+  $page['cat_dir']        = get_complete_dir( $page['cat'] );
+  $page['cat_site_id']    = $result['site_id'];
+  $page['cat_name']       = $result['name'];
+  $page['cat_uploadable'] = $result['uploadable'];
+}
+else
+{
+  $access_forbidden = true;
+}
+if ( $access_forbidden == true
+     or $page['cat_site_id'] != 1
+     or !$conf['upload_available']
+     or !$page['cat_uploadable'] )
+{
+  echo '<div style="text-align:center;">'.$lang['upload_forbidden'].'<br />';
+  echo '<a href="'.add_session_id( './category.php' ).'">';
+  echo $lang['thumbnails'].'</a></div>';
+  exit();
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/upload.vtp' );
+initialize_template();
+
+$tpl = array( 'upload_title', 'upload_username', 'mail_address', 'submit',
+              'upload_successful', 'search_return_main_page','upload_author',
+              'upload_name','upload_creation_date','upload_comment',
+              'mandatory' );
+templatize_array( $tpl, 'lang', $handle );
+
+$error = array();
+$page['upload_successful'] = false;
+if ( isset( $_GET['waiting_id'] ) )
+{
+  $page['waiting_id'] = $_GET['waiting_id'];
+}
+//-------------------------------------------------------------- picture upload
+// verfying fields
+if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
+{
+  $path = $page['cat_dir'].$_FILES['picture']['name'];
+  if ( @is_file( $path ) )
+  {
+    array_push( $error, $lang['upload_file_exists'] );
+  }
+  // test de la présence des champs obligatoires
+  if ( $_FILES['picture']['name'] == '' )
+  {
+    array_push( $error, $lang['upload_filenotfound'] );
+  }
+  if ( !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
+             $_POST['mail_address'] ) )
+  {
+    array_push( $error, $lang['reg_err_mail_address'] );
+  }
+  if ( $_POST['username'] == '' )
+  {
+    array_push( $error, $lang['upload_err_username'] );
+  }
+
+  if ( $_POST['date_creation'] != '' )
+  {
+    list( $day,$month,$year ) = explode( '/', $_POST['date_creation'] );
+    // int checkdate ( int month, int day, int year)
+    if ( checkdate( $month, $day, $year ) )
+    {
+      // int mktime ( int hour, int minute, int second,
+      //              int month, int day, int year [, int is_dst])
+      $date_creation = mktime( 0, 0, 0, $month, $day, $year );
+    }
+    else
+    {
+      array_push( $error, $lang['err_date'] );
+    }
+  }
+  // creation of the "infos" field :
+  // <infos author="Pierrick LE GALL" comment="my comment"
+  //        date_creation="1056891767" name="" />
+  $xml_infos = '<infos';
+  $xml_infos.= ' author="'.htmlspecialchars($_POST['author'],ENT_QUOTES).'"';
+  $xml_infos.= ' comment="'.htmlspecialchars($_POST['comment'],ENT_QUOTES).'"';
+  $xml_infos.= ' date_creation="'.$date_creation.'"';
+  $xml_infos.= ' name="'.htmlspecialchars( $_POST['name'], ENT_QUOTES).'"';
+  $xml_infos.= ' />';
+  
+  if ( sizeof( $error ) == 0 )
+  {
+    $result = validate_upload( $path, $conf['upload_maxfilesize'],
+                               $conf['upload_maxwidth'],
+                               $conf['upload_maxheight']  );
+    $upload_type = $result['type'];
+    for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
+    {
+      array_push( $error, $result['error'][$j] );
+    }
+  }
+
+  if ( sizeof( $error ) == 0 )
+  {
+    $query = 'insert into '.PREFIX_TABLE.'waiting';
+    $query.= ' (storage_category_id,file,username,mail_address,date,infos)';
+    $query.= ' values ';
+    $query.= '('.$page['cat'].",'".$_FILES['picture']['name']."'";
+    $query.= ",'".htmlspecialchars( $_POST['username'], ENT_QUOTES)."'";
+    $query.= ",'".$_POST['mail_address']."',".time().",'".$xml_infos."')";
+    $query.= ';';
+    mysql_query( $query );
+    $page['waiting_id'] = mysql_insert_id();
+    // mail notification for administrators
+    if ( $conf['mail_notification'] )
+    {
+      notify( 'upload' );
+    }
+  }
+}
+//------------------------------------------------------------ thumbnail upload
+if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
+{
+  // upload of the thumbnail
+  $query = 'select file';
+  $query.= ' from '.PREFIX_TABLE.'waiting';
+  $query.= ' where id = '.$_GET['waiting_id'];
+  $query.= ';';
+  $result= mysql_query( $query );
+  $row = mysql_fetch_array( $result );
+  $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+  $extension = get_extension( $_FILES['picture']['name'] );
+  $path = $page['cat_dir'].'thumbnail/';
+  $path.= $conf['prefix_thumbnail'].$file.'.'.$extension;
+  $result = validate_upload( $path, $conf['upload_maxfilesize'],
+                             $conf['upload_maxwidth_thumbnail'],
+                             $conf['upload_maxheight_thumbnail']  );
+  $upload_type = $result['type'];
+  for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
+  {
+    array_push( $error, $result['error'][$j] );
+  }
+  if ( sizeof( $error ) == 0 )
+  {
+    $query = 'update '.PREFIX_TABLE.'waiting';
+    $query.= " set tn_ext = '".$extension."'";
+    $query.= ' where id = '.$_GET['waiting_id'];
+    $query.= ';';
+    mysql_query( $query );
+    $page['upload_successful'] = true;
+  }
+}
+
+if ( !$page['upload_successful'] )
+{
+  $vtp->addSession( $handle, 'upload_not_successful' );
+//-------------------------------------------------------------- errors display
+  if ( sizeof( $error ) != 0 )
+  {
+    $vtp->addSession( $handle, 'errors' );
+    for ( $i = 0; $i < sizeof( $error ); $i++ )
+    {
+      $vtp->addSession( $handle, 'li' );
+      $vtp->setVar( $handle, 'li.li', $error[$i] );
+      $vtp->closeSession( $handle, 'li' );
+    }
+    $vtp->closeSession( $handle, 'errors' );
+  }
+//----------------------------------------------------------------- form action
+  $url = './upload.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
+  if ( isset( $page['waiting_id'] ) )
+  {
+    $url.= '&amp;waiting_id='.$page['waiting_id'];
+  }
+  $vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
+//--------------------------------------------------------------------- advises
+  if ( $conf['upload_maxfilesize'] != '' )
+  {
+    $vtp->addSession( $handle, 'advise' );
+    $content = $lang['upload_advise_filesize'];
+    $content.= $conf['upload_maxfilesize'].' KB';
+    $vtp->setVar( $handle, 'advise.content', $content );
+    $vtp->closeSession( $handle, 'advise' );
+  }
+  if ( isset( $page['waiting_id'] ) )
+  {
+    $advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
+    $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
+
+    if ( $conf['upload_maxwidth_thumbnail'] != '' )
+    {
+      $vtp->addSession( $handle, 'advise' );
+      $content = $lang['upload_advise_width'];
+      $content.= $conf['upload_maxwidth_thumbnail'].' px';
+      $vtp->setVar( $handle, 'advise.content', $content );
+      $vtp->closeSession( $handle, 'advise' );
+    }
+    if ( $conf['upload_maxheight_thumbnail'] != '' )
+    {
+      $vtp->addSession( $handle, 'advise' );
+      $content = $lang['upload_advise_height'];
+      $content.= $conf['upload_maxheight_thumbnail'].' px';
+      $vtp->setVar( $handle, 'advise.content', $content );
+      $vtp->closeSession( $handle, 'advise' );
+    }
+  }
+  else
+  {
+    $advise_title = $lang['upload_advise'];
+    $advise_title.= get_cat_display_name( $page['cat_name'], ' - ',
+                                          'font-style:italic;' );
+    $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
+
+    if ( $conf['upload_maxwidth'] != '' )
+    {
+      $vtp->addSession( $handle, 'advise' );
+      $content = $lang['upload_advise_width'];
+      $content.= $conf['upload_maxwidth'].' px';
+      $vtp->setVar( $handle, 'advise.content', $content );
+      $vtp->closeSession( $handle, 'advise' );
+    }
+    if ( $conf['upload_maxheight'] != '' )
+    {
+      $vtp->addSession( $handle, 'advise' );
+      $content = $lang['upload_advise_height'];
+      $content.= $conf['upload_maxheight'].' px';
+      $vtp->setVar( $handle, 'advise.content', $content );
+      $vtp->closeSession( $handle, 'advise' );
+    }
+  }
+  $vtp->addSession( $handle, 'advise' );
+  $content = $lang['upload_advise_filetype'];
+  $vtp->setVar( $handle, 'advise.content', $content );
+  $vtp->closeSession( $handle, 'advise' );
+//----------------------------------------- optionnal username and mail address
+  if ( !isset( $page['waiting_id'] ) )
+  {
+    $vtp->addSession( $handle, 'fields' );
+    // username
+    if ( isset( $_POST['username'] ) ) $username = $_POST['username'];
+    else                               $username = $user['username'];
+    $vtp->setVar( $handle, 'fields.username',  $username );
+    // mail address
+    if ( isset( $_POST['mail_address'] ) )$mail_address=$_POST['mail_address'];
+    else                                  $mail_address=$user['mail_address'];
+    $vtp->setGlobalVar( $handle, 'user_mail_address',$user['mail_address'] );
+    // name of the picture
+    $vtp->setVar( $handle, 'fields.name', $_POST['name'] );
+    // author
+    $vtp->setVar( $handle, 'fields.author', $_POST['author'] );
+    // date of creation
+    $vtp->setVar( $handle, 'fields.date_creation', $_POST['date_creation'] );
+    // comment
+    $vtp->setVar( $handle, 'fields.comment', $_POST['comment'] );
+
+    $vtp->closeSession( $handle, 'fields' );
+
+    $vtp->addSession( $handle, 'note' );
+    $vtp->closeSession( $handle, 'note' );
+  }
+  $vtp->closeSession( $handle, 'upload_not_successful' );
+}
+else
+{
+  $vtp->addSession( $handle, 'upload_successful' );
+  $vtp->closeSession( $handle, 'upload_successful' );
+}
+//----------------------------------------------------- return to main page url
+$url = './category.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
+$vtp->setGlobalVar( $handle, 'return_url', add_session_id( $url ) );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?>
