Index: tags/bug-1_3beta-012/admin/admin.php
===================================================================
--- trunk/admin/admin.php	(revision 143)
+++ 	(revision )
@@ -1,252 +1,0 @@
-<?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/bug-1_3beta-012/admin/cat_list.php
===================================================================
--- trunk/admin/cat_list.php	(revision 143)
+++ 	(revision )
@@ -1,384 +1,0 @@
-<?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/bug-1_3beta-012/admin/cat_modify.php
===================================================================
--- trunk/admin/cat_modify.php	(revision 143)
+++ 	(revision )
@@ -1,215 +1,0 @@
-<?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/bug-1_3beta-012/admin/cat_perm.php
===================================================================
--- trunk/admin/cat_perm.php	(revision 143)
+++ 	(revision )
@@ -1,215 +1,0 @@
-<?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/bug-1_3beta-012/admin/comments.php
===================================================================
--- trunk/admin/comments.php	(revision 143)
+++ 	(revision )
@@ -1,251 +1,0 @@
-<?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/bug-1_3beta-012/admin/configuration.php
===================================================================
--- trunk/admin/configuration.php	(revision 143)
+++ 	(revision )
@@ -1,1005 +1,0 @@
-<?
-/***************************************************************************
- *                             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/bug-1_3beta-012/admin/create_listing_file.php
===================================================================
--- trunk/admin/create_listing_file.php	(revision 143)
+++ 	(revision )
@@ -1,172 +1,0 @@
-<?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;
-      }
-    }
-  }
-  // 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/bug-1_3beta-012/admin/group_perm.php
===================================================================
--- trunk/admin/group_perm.php	(revision 143)
+++ 	(revision )
@@ -1,109 +1,0 @@
-<?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' );
-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/bug-1_3beta-012/admin/help.php
===================================================================
--- trunk/admin/help.php	(revision 143)
+++ 	(revision )
@@ -1,48 +1,0 @@
-<?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/bug-1_3beta-012/admin/index.htm
===================================================================
--- trunk/admin/index.htm	(revision 143)
+++ 	(revision )
@@ -1,8 +1,0 @@
-<html>
-    <head>
-        <title>PhpWebGallery</title>
-    </head>
-    <body>
-        No access authorized
-    </body>
-</html>
Index: tags/bug-1_3beta-012/admin/infos_images.php
===================================================================
--- trunk/admin/infos_images.php	(revision 143)
+++ 	(revision )
@@ -1,291 +1,0 @@
-<?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/bug-1_3beta-012/admin/install.php
===================================================================
--- trunk/admin/install.php	(revision 143)
+++ 	(revision )
@@ -1,297 +1,0 @@
-<?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['prefix_table']."';";
-      $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'] );
-    // prefix_table
-    if ( !isset( $_POST['prefix_table'] ) )
-      $vtp->setVar( $handle, 'step1.f_prefix_table', 'phpwebgallery_' );
-    else
-      $vtp->setVar( $handle, 'step1.f_prefix_table', $_POST['prefix_table'] );
-
-    $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_', $prefix_table, $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 '.$prefix_table.'config';
-      mysql_query( $query );
-
-      $query = 'INSERT INTO '.$prefix_table.'config';
-      $query.= ' (webmaster,mail_webmaster) VALUES ';
-      $query.= " ('".$webmaster."','".$_POST['mail_webmaster']."')";
-      $query.= ';';
-      mysql_query( $query );
-
-      $query = 'INSERT INTO '.$prefix_table.'sites';
-      $query.= " (id,galleries_url) VALUES (1, './galleries/')";
-      $query.= ';';
-      mysql_query( $query );
-
-      // webmaster admin user
-      $query = 'INSERT INTO '.$prefix_table.'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 '.$prefix_table.'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/bug-1_3beta-012/admin/phpwebgallery_structure.sql
===================================================================
--- trunk/admin/phpwebgallery_structure.sql	(revision 143)
+++ 	(revision )
@@ -1,243 +1,0 @@
--- 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)
-) 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 pseudo (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/bug-1_3beta-012/admin/picture_modify.php
===================================================================
--- trunk/admin/picture_modify.php	(revision 143)
+++ 	(revision )
@@ -1,317 +1,0 @@
-<?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/bug-1_3beta-012/admin/stats.php
===================================================================
--- trunk/admin/stats.php	(revision 143)
+++ 	(revision )
@@ -1,177 +1,0 @@
-<?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 ASC';
-  $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', $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/bug-1_3beta-012/admin/thumbnail.php
===================================================================
--- trunk/admin/thumbnail.php	(revision 143)
+++ 	(revision )
@@ -1,429 +1,0 @@
-<?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/bug-1_3beta-012/admin/update.php
===================================================================
--- trunk/admin/update.php	(revision 143)
+++ 	(revision )
@@ -1,603 +1,0 @@
-<?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 />';
-        }
-      }
-    }
-  }
-  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/bug-1_3beta-012/admin/user_list.php
===================================================================
--- trunk/admin/user_list.php	(revision 143)
+++ 	(revision )
@@ -1,261 +1,0 @@
-<?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/bug-1_3beta-012/admin/user_modify.php
===================================================================
--- trunk/admin/user_modify.php	(revision 143)
+++ 	(revision )
@@ -1,206 +1,0 @@
-<?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/bug-1_3beta-012/admin/user_perm.php
===================================================================
--- trunk/admin/user_perm.php	(revision 143)
+++ 	(revision )
@@ -1,179 +1,0 @@
-<?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' );
-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/bug-1_3beta-012/admin/waiting.php
===================================================================
--- trunk/admin/waiting.php	(revision 143)
+++ 	(revision )
@@ -1,138 +1,0 @@
-<?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 );
-?>
