aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-05-09 12:42:42 +0000
committerz0rglub <z0rglub@piwigo.org>2003-05-09 12:42:42 +0000
commit867c2379ff66ce0f2c4f872a13027fd649aa076d (patch)
treefd182bca99fc6cfe09a7821fab35ce2629fdab44
parentfe51c10474152f319d08229147adbc95fcd6c219 (diff)
Initial revision
git-svn-id: http://piwigo.org/svn/trunk@2 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/admin.php222
-rw-r--r--admin/ajout.php326
-rw-r--r--admin/cat.php282
-rw-r--r--admin/configuration.php912
-rw-r--r--admin/create_listing_file.php128
-rw-r--r--admin/edit_cat.php116
-rw-r--r--admin/historique.php102
-rw-r--r--admin/images/admin.pngbin0 -> 5844 bytes
-rw-r--r--admin/images/arrow_up.gifbin0 -> 88 bytes
-rw-r--r--admin/images/index.htm8
-rw-r--r--admin/images/moins.gifbin0 -> 867 bytes
-rw-r--r--admin/images/plus.gifbin0 -> 870 bytes
-rw-r--r--admin/images/puce.gifbin0 -> 839 bytes
-rw-r--r--admin/include/functions.php194
-rw-r--r--admin/include/index.htm8
-rw-r--r--admin/include/isadmin.inc.php34
-rw-r--r--admin/index.htm8
-rw-r--r--admin/infos_images.php248
-rw-r--r--admin/install.php599
-rw-r--r--admin/manuel.php151
-rw-r--r--admin/miseajour.php531
-rw-r--r--admin/perm.php270
-rw-r--r--admin/thumbnail.php568
-rw-r--r--admin/user_add.php255
-rw-r--r--admin/user_list.php244
-rw-r--r--admin/waiting.php117
-rw-r--r--category.php499
-rw-r--r--identification.php122
-rw-r--r--include/config.inc.php94
-rw-r--r--include/functions.inc.php286
-rw-r--r--include/functions_category.inc.php481
-rw-r--r--include/functions_session.inc.php135
-rw-r--r--include/functions_user.inc.php302
-rw-r--r--include/index.php7
-rw-r--r--include/init.inc.php38
-rw-r--r--include/user.inc.php93
-rw-r--r--include/vtemplate.class.php519
-rw-r--r--index.php20
-rw-r--r--language/english.php492
-rw-r--r--language/francais.php556
-rw-r--r--language/index.htm8
-rw-r--r--picture.php589
-rw-r--r--profile.php403
-rw-r--r--register.php106
-rw-r--r--search.php90
-rw-r--r--template/default/about.vtp29
-rw-r--r--template/default/admin/admin.vtp163
-rw-r--r--template/default/admin/cat.vtp58
-rw-r--r--template/default/admin/configuration.vtp87
-rw-r--r--template/default/admin/user_list.vtp77
-rw-r--r--template/default/category.vtp111
-rw-r--r--template/default/footer.htm1
-rw-r--r--template/default/header.htm1
-rw-r--r--template/default/htmlfunctions.inc.php187
-rw-r--r--template/default/identification.vtp75
-rw-r--r--template/default/picture.vtp166
-rw-r--r--template/default/profile.vtp84
-rw-r--r--template/default/register.vtp71
-rw-r--r--template/default/search.vtp71
-rw-r--r--template/default/style.inc.php140
-rw-r--r--template/default/upload.vtp79
-rw-r--r--upload.php348
62 files changed, 11911 insertions, 0 deletions
diff --git a/admin/admin.php b/admin/admin.php
new file mode 100644
index 000000000..ce0f601e7
--- /dev/null
+++ b/admin/admin.php
@@ -0,0 +1,222 @@
+<?php
+/***************************************************************************
+ * admin.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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
+$vtp->setGlobalVar( $handle, 'page_title', $lang['title_default'] );
+$vtp->setGlobalVar( $handle, 'menu_title', $lang['menu_title'] );
+//--------------------------------------- validating page and creation of title
+$page_valide = false;
+switch ( $_GET['page'] )
+{
+ case 'ajout':
+ {
+ $titre = $lang['title_add'];
+ $page_valide = true;
+ break;
+ }
+ case 'user_list':
+ {
+ $titre = $lang['title_liste_users'];
+ $page_valide = true;
+ break;
+ }
+ case 'historique':
+ {
+ $titre = $lang['title_history'];
+ $page_valide = true;
+ break;
+ }
+ case 'miseajour':
+ {
+ $titre = $lang['title_update'];
+ $page_valide = true;
+ break;
+ }
+ case 'configuration':
+ {
+ $titre = $lang['title_configuration'];
+ $page_valide = true;
+ break;
+ }
+ case 'manuel':
+ {
+ $titre = $lang['title_instructions'];
+ $page_valide = true;
+ break;
+ }
+ case 'perm':
+ {
+ $titre = $lang['title_permissions'];
+ $page_valide = true;
+ break;
+ }
+ case 'cat':
+ {
+ $titre = $lang['title_categories'];
+ $page_valide = true;
+ break;
+ }
+ case 'edit_cat':
+ {
+ $titre = $lang['title_edit_cat'];
+ $page_valide = true;
+ break;
+ }
+ case 'infos_images':
+ {
+ $titre = $lang['title_info_images'];
+ $page_valide = true;
+ break;
+ }
+ case 'thumbnail':
+ {
+ $titre = $lang['title_thumbnails'];
+ if ( isset( $_GET['dir'] ) )
+ {
+ $titre.= ' '.$lang['title_thumbnails_2'].' <span style="color:#006699;">';
+ // $_GET['dir'] contient :
+ // ../galleries/vieux_lyon ou
+ // ../galleries/vieux_lyon/visite ou
+ // ../galleries/vieux_lyon/visite/truc ...
+ $dir = explode( "/", $_GET['dir'] );
+ $titre.= $dir[2];
+ for ( $i = 3; $i < sizeof( $dir ) - 1; $i++ )
+ {
+ $titre.= ' &gt; '.$dir[$i];
+ }
+ $titre.= "</span>";
+ }
+ $page_valide = true;
+ break;
+ }
+ case 'waiting':
+ {
+ $titre = $lang['title_waiting'];
+ $page_valide = true;
+ break;
+ }
+ default:
+ {
+ $titre = $lang['title_default'];
+ break;
+ }
+}
+$vtp->setGlobalVar( $handle, 'title', $titre );
+//--------------------------------------------------------------------- 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.'liste_users' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_users'] );
+$vtp->closeSession( $handle, 'summary' );
+// user list
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
+$vtp->setVar( $handle, 'summary.link',
+ add_session_id( $link_start.'user_list' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_list_user'] );
+$vtp->closeSession( $handle, 'summary' );
+// user add
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '&nbsp;&nbsp;' );
+$vtp->setVar( $handle, 'summary.link', add_session_id( $link_start.'ajout' ) );
+$vtp->setVar( $handle, 'summary.name', $lang['menu_add_user'] );
+$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' ) );
+$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 from '.$prefixeTable.'waiting;';
+$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' );
+// update
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.indent', '' );
+$vtp->setVar( $handle, 'summary.link',
+ add_session_id( $link_start.'miseajour' ) );
+$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.'historique' ) );
+$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.'manuel' ) );
+$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;
+?> \ No newline at end of file
diff --git a/admin/ajout.php b/admin/ajout.php
new file mode 100644
index 000000000..3ae1fa2f8
--- /dev/null
+++ b/admin/ajout.php
@@ -0,0 +1,326 @@
+<?php
+/***************************************************************************
+ * ajout.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+ $error = array();
+ $absent = false;
+
+ $row = mysql_fetch_array( mysql_query( "select pseudo,status,mail_address from $prefixeTable"."users where id = '".$HTTP_GET_VARS['user_id']."';" ) );
+ $pseudo = $row['pseudo'];
+ $status = $row['status'];
+ $mail_address = $row['mail_address'];
+ if ( $pseudo == "visiteur" || ( $pseudo == $conf['webmaster'] && $user['pseudo'] != $conf['webmaster'] ) )
+ {
+ echo "<div class=\"erreur\">".$lang['user_err_modify']."</div>";
+ $absent = true;
+ }
+ if ( $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ if ( $pseudo == "" )
+ {
+ echo"<div class=\"info\">".$lang['user_err_unknown']."</div>";
+ $absent = true;
+ }
+ }
+ if ( !$absent )
+ {
+ if ( $HTTP_GET_VARS['valider'] == 1 )
+ {
+ $i = 0;
+ // le pseudo ne doit pas
+ // 1. être vide
+ // 2. commencer ou se terminer par un espace
+ // 3. comporter les caractères ' ou "
+ // 4. être déjà utilisé
+ // Notes sur le pseudo du webmaster :
+ // - lorsque l'on trouve plusieurs occurences consécutives du caractère espace, on réduit à une seule occurence
+ if ( $HTTP_GET_VARS['mode'] != "modif" )
+ {
+ if ( $HTTP_POST_VARS['pseudo'] == "" )
+ {
+ $error[$i++] = $lang['reg_err_login1'];
+ }
+ $pseudo = ereg_replace( "[ ]{2,}", " ", $HTTP_POST_VARS['pseudo'] );
+ if ( ereg( "^.* $", $pseudo) )
+ {
+ $error[$i++] = $lang['reg_err_login2'];
+ }
+ if ( ereg( "^ .*$", $pseudo) )
+ {
+ $error[$i++] = $lang['reg_err_login3'];
+ }
+ if ( ereg( "'",$pseudo ) || ereg( "\"",$pseudo ) )
+ {
+ $error[$i++] = $lang['reg_err_login4'];
+ }
+ else
+ {
+ $query = "select id from $prefixeTable"."users where pseudo = '$pseudo';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) > 0 )
+ {
+ $error[$i++] = "<li>".$lang['reg_err_login5']."</li>";
+ }
+ }
+ }
+ // le mail doit être conforme à qqch du type : nom@serveur.com
+ if( $HTTP_POST_VARS['mail_address'] != "" && !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)", $HTTP_POST_VARS['mail_address'] ) )
+ {
+ $error[$i++] = $lang['reg_err_mail_address'];
+ }
+ // mis à jour des variables pour ne pas afficher celles issue de la BD
+ $pseudo = $HTTP_POST_VARS['pseudo'];
+ $password = $HTTP_POST_VARS['password'];
+ $status = $HTTP_POST_VARS['status'];
+ $mail_address = $HTTP_POST_VARS['mail_address'];
+ // on met à jour les paramètres de l'applicaiton dans le cas où il n'y aucune erreur
+ if ( sizeof( $error ) == 0 && $HTTP_GET_VARS['mode'] != "modif" )
+ {
+ // 1.récupération des valeurs par défaut de l'application pour nombre_image_ligne,nombre_ligne_page,couleur,language
+ $row = mysql_fetch_array( mysql_query( "select nombre_image_ligne,nombre_ligne_page,theme,language from $prefixeTable"."users where pseudo = 'visiteur';" ) );
+ // 2.ajout du nouvel utilisateur
+ $query = "insert into $prefixeTable"."users (pseudo,password,mail_address,nombre_image_ligne,nombre_ligne_page,theme,language,status) values ('$pseudo','".md5( $HTTP_POST_VARS['password'] )."',";
+ if ( $HTTP_POST_VARS['mail_address'] != "" )
+ {
+ $query.= "'".$HTTP_POST_VARS['mail_address']."'";
+ }
+ else
+ {
+ $query.= "NULL";
+ }
+ $query.= ",'".$row['nombre_image_ligne']."','".$row['nombre_ligne_page']."','".$row['theme']."','".$row['language']."','".$HTTP_POST_VARS['status']."');";
+ mysql_query( $query );
+ // 3. récupérer l'identifiant de l'utilisateur nouvellement créé
+ $row = mysql_fetch_array( mysql_query( "select id from $prefixeTable"."users where pseudo = '$pseudo';" ) );
+ $user_id = $row['id'];
+ // 4.ajouter les restrictions au nouvel utilisateur, les mêmes que celles de l'utilisateur par défaut
+ $query = "select cat_id ";
+ $query.= "from $prefixeTable"."restrictions as r,$prefixeTable"."users as u ";
+ $query.= "where u.id = r.user_id ";
+ $query.= "and u.pseudo = 'visiteur';";
+ $result = mysql_query( $query );
+ while( $row = mysql_fetch_array( $result ) )
+ {
+ mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('$user_id','".$row['cat_id']."');" );
+ }
+ }
+ if ( sizeof( $error ) == 0 && $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ $query = "update $prefixeTable"."users";
+ $query.= " set status = '".$HTTP_POST_VARS['status']."'";
+ if ( $HTTP_POST_VARS['use_new_pwd'] == 1 )
+ {
+ $query.= ", password = '".md5( $HTTP_POST_VARS['password'] )."'";
+ }
+ $query.= ", mail_address = ";
+ if ( $HTTP_POST_VARS['mail_address'] != "" )
+ {
+ $query.= "'".$HTTP_POST_VARS['mail_address']."'";
+ }
+ else
+ {
+ $query.= "NULL";
+ }
+ $query.= " where id = '".$HTTP_GET_VARS['user_id']."';";
+ mysql_query( $query );
+ }
+ }
+ if ( sizeof( $error ) > 0 )
+ {
+ echo "<div class=\"erreur\">".$lang['adduser_err_message'].sizeof( $error )." :";
+ echo "<ul>";
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ echo "<li>".$error[$i]."</li>";
+ }
+ echo "</ul>";
+ echo "</div>";
+ }
+ if ( sizeof( $error ) == 0 && $HTTP_GET_VARS['valider'] == 1 )
+ {
+ echo"<div class=\"info\">".$lang['adduser_info_message']."\"$pseudo\" ";
+ if ( $HTTP_POST_VARS['use_new_pwd'] == 1 )
+ {
+ echo $lang['adduser_info_password_updated']." ";
+ }
+ echo"[ <a href=\"".add_session_id_to_url( "./admin.php?page=liste_users" )."\">".$lang['adduser_info_back']."</a> ]</div>";
+ }
+ if ( $HTTP_GET_VARS['valider'] != 1 || $HTTP_GET_VARS['mode'] != "modif" || sizeof( $error ) > 0 )
+ {
+ if ( $HTTP_GET_VARS['mode'] != "modif" && sizeof( $error ) == 0 )
+ {
+ unset( $pseudo, $password, $status, $mail_address );
+ }
+ if ( !isset( $HTTP_POST_VARS['use_new_pwd'] ) || $HTTP_POST_VARS['use_new_pwd'] != 1 )
+ {
+ unset( $password );
+ }
+ $action = "./admin.php?page=ajout&amp;valider=1";
+ if ( $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ $action.= "&amp;mode=modif&amp;user_id=".$HTTP_GET_VARS['user_id'];
+ }
+ echo"<form method=\"post\" action=\"".add_session_id_to_url( $action )."\">
+ <table style=\"width:100%;\">
+ <tr align=\"center\" valign=\"middle\">
+ <td>
+ <table style=\"margin-left:auto;margin-right:auto;\">
+ <tr>
+ <th colspan=\"2\">".$lang['adduser_fill_form']."</th>
+ </tr>
+ <tr>
+ <td colspan=\"2\"><div style=\"margin-bottom:0px;\">&nbsp;</div></td>
+ </tr>
+ <tr>
+ <td>".$lang['adduser_login']."</td>
+ <td>";
+ if ( $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ echo"<span style=\"color:red;\">$pseudo [".$lang['adduser_unmodify']."]</span>";
+ echo"<input type=\"hidden\" name=\"pseudo\" value=\"$pseudo\"/>";
+ }
+ else
+ {
+ echo"<input type=\"text\" name=\"pseudo\" value=\"$pseudo\"/>";
+ }
+ echo"
+ </td>
+ </tr>";
+ echo"
+ <tr>
+ <td>";
+ if ( $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ echo $lang['new']." ".$lang['password']."<input type=\"checkbox\" name=\"use_new_pwd\" value=\"1\"";
+ if ( isset( $HTTP_POST_VARS['use_new_pwd'] ) && $HTTP_POST_VARS['use_new_pwd'] == 1 )
+ {
+ echo " checked=\"checked\"";
+ }
+ echo " />";
+ }
+ else
+ {
+ echo $lang['password'];
+ }
+ echo"</td>
+ <td>";
+ echo"<input type=\"text\" name=\"password\" value=\"$password\"/></td>
+ </tr>";
+ echo"
+ <tr>
+ <td>".$lang['reg_mail_address']."</td>";
+ echo "
+ <td><input type=\"text\" name=\"mail_address\" value=\"$mail_address\"/></td>
+ </tr>";
+ echo"
+ <tr>
+ <td>".$lang['adduser_status']."</td>
+ <td>";
+ if ( $pseudo == $conf['webmaster'] )
+ {
+ echo "<span style=\"color:red;\">$status [".$lang['adduser_unmodify']."]</span>
+ <input type=\"hidden\" name=\"status\" value=\"$status\"/>";
+ }
+ else
+ {
+ echo"
+ <select name=\"status\">";
+ // on récupère toutes les status possibles dans la base
+ // par l'intermédiaire de la fonction get_enums
+ $option = get_enums( $prefixeTable."users", "status" );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ if ( isset( $status ) )
+ {
+ echo"
+ <option value=\"$option[$i]\"";
+ if ( $option[$i] == $status )
+ {
+ echo" selected=\"selected\"";
+ }
+ echo">";
+ switch ( $option[$i] )
+ {
+ case "admin" :
+ {
+ echo $lang['adduser_status_admin'];
+ break;
+ }
+ case "membre" :
+ {
+ echo $lang['adduser_status_member'];
+ break;
+ }
+ case "visiteur" :
+ {
+ echo $lang['adduser_status_guest'];
+ break;
+ }
+ }
+ echo"</option>";
+ }
+ else
+ {
+ echo"
+ <option value=\"$option[$i]\"";
+ if ( $option[$i] == "visiteur" )
+ {
+ echo" selected=\"selected\"";
+ }
+ echo">";
+ switch ( $option[$i] )
+ {
+ case "admin" :
+ {
+ echo $lang['adduser_status_admin'];
+ break;
+ }
+ case "membre" :
+ {
+ echo $lang['adduser_status_member'];
+ break;
+ }
+ case "visiteur" :
+ {
+ echo $lang['adduser_status_guest'];
+ break;
+ }
+ }
+ echo"</option>";
+ }
+ }
+ echo"
+ </select>";
+ }
+ echo"
+ </td>
+ </tr>
+ <tr>
+ <td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </form>";
+ if ( $HTTP_GET_VARS['mode'] == "modif" )
+ {
+ echo "<div style=\"text-align:center;margin-bottom:10px;\">[ <a href=\"".add_session_id_to_url( "./admin.php?page=liste_users" )."\">".$lang['adduser_info_back']."</a> ]</div>";
+ }
+ }
+ }
+?> \ No newline at end of file
diff --git a/admin/cat.php b/admin/cat.php
new file mode 100644
index 000000000..2033d667d
--- /dev/null
+++ b/admin/cat.php
@@ -0,0 +1,282 @@
+<?php
+/***************************************************************************
+ * this file is a part of PhpWebGallery *
+ * ------------------- *
+ * version : 1.3 *
+ * url : http://phpwebgallery.net *
+ * help : http://forum.phpwebgallery.net *
+ * author : Pierrick LE GALL *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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.vtp' );
+// language
+$vtp->setGlobalVar( $sub, 'cat_edit', $lang['cat_edit'] );
+$vtp->setGlobalVar( $sub, 'cat_up', $lang['cat_up'] );
+$vtp->setGlobalVar( $sub, 'cat_down', $lang['cat_down'] );
+$vtp->setGlobalVar( $sub, 'cat_image_info', $lang['cat_image_info'] );
+$vtp->setGlobalVar( $sub, 'cat_permission', $lang['cat_permission'] );
+$vtp->setGlobalVar( $sub, 'cat_update', $lang['cat_update'] );
+//--------------------------------------------------------------- rank updates
+if ( isset( $_GET['up'] ) && is_numeric( $_GET['up'] ) )
+{
+ // 1. searching level (id_uppercat)
+ // and rank of the category to move
+ $query = 'select id_uppercat,rank';
+ $query.= ' from '.$prefixeTable.'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 '.$prefixeTable.'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 '.$prefixeTable.'categories';
+ $query.= ' set rank = '.$new_rank;
+ $query.= ' where id = '.$_GET['up'];
+ $query.= ';';
+ mysql_query( $query );
+ $query = 'update '.$prefixeTable.'categories';
+ $query.= ' set rank = '.$rank;
+ $query.= ' where id = '.$replaced_cat;
+ $query.= ';';
+ mysql_query( $query );
+}
+if ( isset( $_GET['down'] ) && is_numeric( $_GET['down'] ) )
+{
+ // 1. searching level (id_uppercat)
+ // and rank of the category to move
+ $query = 'select id_uppercat,rank';
+ $query.= ' from '.$prefixeTable.'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 '.$prefixeTable.'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 '.$prefixeTable.'categories';
+ $query.= ' set rank = '.$new_rank;
+ $query.= ' where id = '.$_GET['down'];
+ $query.= ';';
+ mysql_query( $query );
+ $query = 'update '.$prefixeTable.'categories';
+ $query.= ' set rank = '.$rank;
+ $query.= ' where id = '.$replaced_cat;
+ $query.= ';';
+ mysql_query( $query );
+}
+//------------------------------------------------------------------ reordering
+function ordering( $id_uppercat )
+{
+ global $prefixeTable;
+
+ $rank = 1;
+
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'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 '.$prefixeTable.'categories';
+ $query.= ' set rank = '.$rank;
+ $query.= ' where id = '.$row['id'];
+ $query.= ';';
+ mysql_query( $query );
+ $rank++;
+ ordering( $row['id'] );
+ }
+}
+
+ordering( 'NULL' );
+//----------------------------------------------------affichage de la page
+function display_cat_manager( $id_uppercat, $indent,
+ $uppercat_visible, $level )
+{
+ global $prefixeTable,$lang,$conf,$sub,$vtp;
+
+ // searching the min_rank and the max_rank of the category
+ $query = 'select min(rank) as min, max(rank) as max';
+ $query.= ' from '.$prefixeTable.'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';
+ $query.= ' from '.$prefixeTable.'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 );
+ if ( $row['name'] == '' )
+ {
+ $name = str_replace( '_', ' ', $row['dir'] );
+ }
+ else
+ {
+ $name = $row['name'];
+ }
+ $vtp->setVar( $sub, 'cat.name', $name );
+ $vtp->setVar( $sub, 'cat.dir', $row['dir'] );
+ if ( $row['status'] == 'invisible' || !$uppercat_visible )
+ {
+ $subcat_visible = false;
+ $vtp->setVar( $sub, 'cat.invisible', $lang['cat_invisible'] );
+ }
+ $vtp->setVar( $sub, 'cat.nb_picture', $row['nb_images'] );
+ $url = add_session_id( './admin.php?page=edit_cat&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&amp;up='.$row['id'] );
+ $vtp->setVar( $sub, 'up.up_url', $url );
+ $vtp->closeSession( $sub, 'up' );
+ }
+ else
+ {
+ $vtp->addSession( $sub, 'no_up' );
+ $vtp->closeSession( $sub, 'no_up' );
+ }
+ if ( $row['rank'] != $max_rank )
+ {
+ $vtp->addSession( $sub, 'down' );
+ $url = add_session_id( './admin.php?page=cat&amp;down='.$row['id'] );
+ $vtp->setVar( $sub, 'down.down_url', $url );
+ $vtp->closeSession( $sub, 'down' );
+ }
+ else
+ {
+ $vtp->addSession( $sub, 'no_down' );
+ $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' );
+ }
+ $url = add_session_id( './admin.php?page=perm&amp;cat_id='.$row['id'] );
+ $vtp->setVar( $sub, 'cat.permission_url', $url );
+ if ( $row['site_id'] == 1 )
+ {
+ $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 );
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
+?> \ No newline at end of file
diff --git a/admin/configuration.php b/admin/configuration.php
new file mode 100644
index 000000000..6f1726f06
--- /dev/null
+++ b/admin/configuration.php
@@ -0,0 +1,912 @@
+<?
+/***************************************************************************
+ * configuration.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster',
+ 'acces', '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' );
+$default_user_infos = array( 'nb_image_line', 'nb_line_page', 'theme',
+ 'language', 'maxwidth', 'maxheight', 'expand',
+ 'show_nb_comments', 'short_period', 'long_period',
+ 'template' );
+$error = array();
+$i = 0;
+if ( $_GET['valider'] == 1 )
+{
+ //purge de la table des session si demandé
+ if ( $_POST['empty_session_table'] == 1 )
+ {
+ $query = 'delete from '.$prefixeTable.'sessions';
+ $query.= ' where expiration < '.time().';';
+ mysql_query( $query );
+ }
+ // deletion of site as asked
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'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'] );
+ }
+ }
+ // le préfixe des thumbnails ne doit pas comporter d'accent
+ $ancien_prefixe = $_POST['prefixe_thumbnail'];
+ $prefixe = strtr( $_POST['prefixe_thumbnail'], $Caracs );
+ if ( $ancien_prefixe != $prefixe )
+ {
+ $error[$i++] = $lang['conf_err_prefixe'];
+ }
+ // le mail doit être conforme à qqch du type : nom@serveur.com
+ if ( !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
+ $_POST['mail_webmaster'] ) )
+ {
+ $error[$i++] = $lang['conf_err_mail'];
+ }
+ // les période doivent être des entiers, il représentent des nombres de jours
+ if ( !ereg( "^[0-9]*$", $_POST['short_period'] )
+ || !ereg("^[0-9]*$", $_POST['long_period'] ) )
+ {
+ $error[$i++] = $lang['err_periods'];
+ }
+ else
+ {
+ // la période longue doit être supérieure à la période courte
+ if ( $_POST['long_period'] <= $_POST['short_period']
+ || $_POST['short_period'] <= 0 )
+ {
+ $error[$i++] = $lang['err_periods_2'];
+ }
+ }
+ //la taille de l'id de session doit être un entier entre 4 et 50
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['session_id_size'] )
+ || $_POST['session_id_size'] < 4
+ || $_POST['session_id_size'] > 50 )
+ {
+ $error[$i++] = $lang['conf_err_sid_size'];
+ }
+ // la durée de la session doit être un entier
+ // supérieur à 5 et inférieur à 60 minutes
+ if ( !ereg( "^[1-9][0-9]?$", $_POST['session_time'] )
+ || $_POST['session_time'] < 5
+ || $_POST['session_time'] > 60 )
+ {
+ $error[$i++] = $lang['conf_err_sid_time'];
+ }
+ // max_user_listbox doit être un entier compris entre 0 et 255 inclus
+ if ( !ereg( "^[0-9]{0,3}$", $_POST['max_user_listbox'] )
+ || $_POST['max_user_listbox'] < 0
+ || $_POST['max_user_listbox'] > 255 )
+ {
+ $error[$i++] = $lang['conf_err_max_user_listbox'];
+ }
+ // le nombre de commentaires par page doit être compris entre 5 en 50 inclus
+ if ( !ereg( "^[1-9][0-9]?$", $_POST['nb_comment_page'] )
+ || $_POST['nb_comment_page'] < 5
+ || $_POST['nb_comment_page'] > 50 )
+ {
+ $error[$i++] = $lang['conf_err_comment_number'];
+ }
+ // le poids maximum des fichiers uploadé doit être un entier,
+ // compris entre 10 et 1000
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxfilesize'] )
+ || $_POST['upload_maxfilesize'] < 10
+ || $_POST['upload_maxfilesize'] > 1000 )
+ {
+ $error[$i++] = $lang['conf_err_upload_maxfilesize'];
+ }
+ // la largeur maximum des images uploadées doit être un entier,
+ // supérieur à 10
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxwidth'] )
+ || $_POST['upload_maxwidth'] < 10 )
+ {
+ $error[$i++] = $lang['conf_err_upload_maxwidth'];
+ }
+ // la hauteur maximum des images uploadées doit être un entier,
+ // supérieur à 10
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxheight'] )
+ || $_POST['upload_maxheight'] < 10 )
+ {
+ $error[$i++] = $lang['conf_err_upload_maxheight'];
+ }
+ // la largeur maximum des miniatures uploadées doit être un entier,
+ // supérieur à 10
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxwidth_thumbnail'] )
+ || $_POST['upload_maxwidth_thumbnail'] < 10 )
+ {
+ $error[$i++] = $lang['conf_err_upload_maxwidth_thumbnail'];
+ }
+ // la hauteur maximum des miniatures uploadées doit être un entier,
+ // supérieur à 10
+ if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxheight_thumbnail'] )
+ || $_POST['upload_maxheight_thumbnail'] < 10 )
+ {
+ $error[$i++] = $lang['conf_err_upload_maxheight_thumbnail'];
+ }
+ if ( $_POST['maxwidth'] != '' )
+ {
+ if ( !ereg( "^[0-9]{2,}$", $_POST['maxwidth'] )
+ || $_POST['maxwidth'] < 50 )
+ {
+ $error[$i++] = $lang['err_maxwidth'];
+ }
+ }
+ if ( $_POST['maxheight'] != '' )
+ {
+ if ( !ereg( "^[0-9]{2,}$", $_POST['maxheight'] )
+ || $_POST['maxheight'] < 50 )
+ {
+ $error[$i++] = $lang['err_maxheight'];
+ }
+ }
+ // on met à jour les paramètres de l'application
+ // dans le cas où il n'y aucune erreurs
+ if ( sizeof( $error ) == 0 )
+ {
+ mysql_query( 'delete from '.$prefixeTable.'config;' );
+ $query = 'insert into '.$prefixeTable.'config';
+ $query.= ' (';
+ for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ $query.= $conf_infos[$i];
+ }
+ $query.= ')';
+ $query.= ' values';
+ $query.= ' (';
+ for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ if ( $_POST[$conf_infos[$i]] == '' )
+ {
+ $query.= 'NULL';
+ }
+ else
+ {
+ $query.= "'".$_POST[$conf_infos[$i]]."'";
+ }
+ }
+ $query.= ')';
+ $query.= ';';
+ echo $query;
+ mysql_query( $query );
+
+ $tab_theme = explode( ' - ', $_POST['theme'] );
+ $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
+
+ $query = 'update '.$prefixeTable.'users';
+ $query.= ' set';
+ for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $default_user_infos[$i];
+ $query.= ' = ';
+ if ( $_POST[$default_user_infos[$i]] == '' )
+ {
+ $query.= 'NULL';
+ }
+ else
+ {
+ $query.= "'".$_POST[$default_user_infos[$i]]."'";
+ }
+ }
+ $query.= " where pseudo = 'visiteur';";
+ mysql_query( $query );
+ }
+//--------------------------------------------------------- data initialization
+ for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
+ {
+ $$conf_infos[$i] = $_POST[$conf_infos[$i]];
+ }
+ for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
+ {
+ $$default_user_infos[$i] = $_POST[$default_user_infos[$i]];
+ }
+}
+else
+{
+//--------------------------------------------------------- data initialization
+ $query = 'select';
+ for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $conf_infos[$i];
+ }
+ $query .= ' from '.$prefixeTable.'config;';
+
+ $row = mysql_fetch_array( mysql_query( $query ) );
+
+ for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
+ {
+ $$conf_infos[$i] = $row[$conf_infos[$i]];
+ }
+ $query = 'select';
+ for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $default_user_infos[$i];
+ }
+ $query .= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo ='visiteur';";
+
+ $row = mysql_fetch_array( mysql_query( $query ) );
+
+ for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
+ {
+ $$default_user_infos[$i] = $row[$default_user_infos[$i]];
+ }
+}
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].
+ '/admin/configuration.vtp' );
+// language
+$vtp->setGlobalVar( $sub, 'conf_confirmation', $lang['conf_confirmation'] );
+$vtp->setGlobalVar( $sub, 'conf_remote_site_title',
+ $lang['conf_remote_site_title'] );
+$vtp->setGlobalVar( $sub, 'delete', $lang['delete'] );
+$vtp->setGlobalVar( $sub, 'conf_remote_site_delete_info',
+ $lang['conf_remote_site_delete_info'] );
+$vtp->setGlobalVar( $sub, 'submit', $lang['submit'] );
+//-------------------------------------------------------------- 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 ( sizeof( $error ) == 0 && $_GET['valider'] == 1 )
+{
+ $vtp->addSession( $sub, 'confirmation' );
+ $vtp->closeSession( $sub, 'confirmation' );
+}
+//----------------------------------------------------------------- form action
+$form_action = add_session_id( './admin.php?page=configuration&valider=1' );
+$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', 'prefixe_thumbnail' );
+$vtp->setVar( $sub, 'text.value', $prefixe_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', 'acces' );
+$vtp->setVar( $sub, 'radio.value', 'libre' );
+$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
+$checked = '';
+if ( $acces == 'libre' )
+{
+ $checked = ' checked="checked"';
+}
+$vtp->setVar( $sub, 'radio.checked', $checked );
+$vtp->closeSession( $sub, 'radio' );
+$vtp->addSession( $sub, 'radio' );
+$vtp->setVar( $sub, 'radio.name', 'acces' );
+$vtp->setVar( $sub, 'radio.value', 'restreint' );
+$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
+$checked = '';
+if ( $acces == 'restreint' )
+{
+ $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' );
+
+$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' );
+// 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' );
+
+$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_template'] );
+$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_template_info'] );
+$vtp->closeSession( $sub, 'param_line' );
+$vtp->closeSession( $sub, 'line' );
+// theme
+$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', 'theme' );
+$option = get_themes( '../theme/' );
+for ( $i = 0; $i < sizeof( $option ); $i++ )
+{
+ $vtp->addSession( $sub, 'option' );
+ $vtp->setVar( $sub, 'option.option', $option[$i] );
+ if ( $option[$i] == str_replace( "/", " - ", $theme ) )
+ {
+ $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' );
+// 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 '.$prefixeTable.'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 );
+?> \ No newline at end of file
diff --git a/admin/create_listing_file.php b/admin/create_listing_file.php
new file mode 100644
index 000000000..9b94486ef
--- /dev/null
+++ b/admin/create_listing_file.php
@@ -0,0 +1,128 @@
+<?php
+ $prefixe_thumbnail = "TN-";
+
+
+ $tab_ext = array ( 'jpg', 'JPG','gif','GIF','png','PNG' );
+
+ $listing = "";
+
+ $local_folder = substr( $PHP_SELF, 0, strrpos( $PHP_SELF, "/" ) + 1 );
+ $url = "http://".$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 != "." && $file != ".." && is_dir ( $rep."/".$file ) && $file != "thumbnail" )
+ {
+ $sub_rep[$i++] = $file;
+ }
+ }
+ }
+ // write of the dirs
+ for ( $i = 0; $i < sizeof( $sub_rep ); $i++ )
+ {
+ $dirs.= "\n".$indent."<dir".$level.">";
+ $dirs.= "\n".$indent."\t<name>".$sub_rep[$i]."</name>";
+ $dirs.= get_pictures( $rep."/".$sub_rep[$i], $indent."\t" );
+ $dirs.= get_dirs( $rep."/".$sub_rep[$i], $indent."\t", $level + 1 );
+ $dirs.= "\n".$indent."</dir".$level.">";
+ }
+ return $dirs;
+ }
+
+ function is_image ( $filename )
+ {
+ global $tab_ext;
+ if ( in_array ( substr ( strrchr($filename,"."), 1, strlen ( $filename ) ), $tab_ext ) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ function TN_exist ( $dir, $file )
+ {
+ global $tab_ext, $prefixe_thumbnail;
+
+ $titre = substr ( $file, 0, -4 );
+ for ( $i = 0; $i < sizeof ( $tab_ext ); $i++ )
+ {
+ $test = $dir."/thumbnail/".$prefixe_thumbnail.$titre.".".$tab_ext[$i];
+ if ( is_file ( $test ) )
+ {
+ return $tab_ext[$i];
+ }
+ }
+ return false;
+ }
+
+ function get_pictures( $rep, $indent )
+ {
+ $pictures = array();
+ $i = 0;
+ $tn_ext = "";
+ $root = "";
+ if ( $opendir = opendir ( $rep ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( is_image( $file ) && $tn_ext = TN_exist( $rep, $file ) )
+ {
+ $pictures[$i] = array();
+ $pictures[$i]['file'] = $file;
+ $pictures[$i]['tn_ext'] = $tn_ext;
+ $pictures[$i]['date'] = date( "Y-m-d", filemtime ( $rep."/".$file ) );
+ $pictures[$i]['filesize'] = floor ( filesize( $rep."/".$file ) / 1024 );
+ $image_size = @getimagesize( $rep."/".$file );
+ $pictures[$i]['width'] = $image_size[0];
+ $pictures[$i]['height'] = $image_size[1];
+ $i++;
+ }
+ }
+ }
+ // 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."\t<picture>";
+ $root.= "\n".$indent."\t\t<file>".$pictures[$i]['file']."</file>";
+ $root.= "\n".$indent."\t\t<tn_ext>".$pictures[$i]['tn_ext']."</tn_ext>";
+ $root.= "\n".$indent."\t\t<date>".$pictures[$i]['date']."</date>";
+ $root.= "\n".$indent."\t\t<filesize>".$pictures[$i]['filesize']."</filesize>";
+ $root.= "\n".$indent."\t\t<width>".$pictures[$i]['width']."</width>";
+ $root.= "\n".$indent."\t\t<height>".$pictures[$i]['height']."</height>";
+ $root.= "\n".$indent."\t</picture>";
+ }
+ }
+ $root.= "\n".$indent."</root>";
+ return $root;
+ }
+
+ $listing.= get_dirs( ".", "", 0 );
+
+ if ( $fp = @fopen("./listing.xml","w") )
+ {
+ fwrite( $fp, $listing );
+ fclose( $fp );
+ }
+ else
+ {
+ echo "impossible de créer ou d'écrire dans le fichier listing.xml";
+ }
+
+ //echo str_replace( "\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", nl2br( htmlspecialchars( $listing, ENT_QUOTES ) ) );
+ echo "listing.xml created";
+?> \ No newline at end of file
diff --git a/admin/edit_cat.php b/admin/edit_cat.php
new file mode 100644
index 000000000..ae93521c0
--- /dev/null
+++ b/admin/edit_cat.php
@@ -0,0 +1,116 @@
+<?php
+/***************************************************************************
+ * edit_cat.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+
+ if ( $HTTP_GET_VARS['valider'] == 1 )
+ {
+ $query = "update $prefixeTable"."categories ";
+ if ( $HTTP_POST_VARS['name'] == "" )
+ {
+ $query.= "set name = NULL, ";
+ }
+ else
+ {
+ $query.= "set name = '".htmlspecialchars( $HTTP_POST_VARS['name'], ENT_QUOTES)."', ";
+ }
+ if ( $HTTP_POST_VARS['comment'] == "" )
+ {
+ $query.= "comment = NULL, ";
+ }
+ else
+ {
+ $query.= "comment = '".htmlspecialchars( $HTTP_POST_VARS['comment'], ENT_QUOTES )."', ";
+ }
+ $query.= "status = '".$HTTP_POST_VARS['status']."' ";
+ $query.= "where id = '".$HTTP_GET_VARS['cat']."';";
+ mysql_query( $query );
+
+ $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );
+ while ( $row = mysql_fetch_array ( $result ) )
+ {
+ check_favorites( $row['id'] );
+ }
+
+ echo"<div style=\"color:red;text-align:center;\">".$lang['editcat_confirm']." [ <a href=\"".add_session_id_to_url( "./admin.php?page=cat" )."\">".$lang['editcat_back']."</a> ]</div>";
+ }
+
+ echo "
+ <form action=\"".add_session_id_to_url( "./admin.php?page=edit_cat&amp;cat=".$HTTP_GET_VARS['cat']."&amp;valider=1" )."\" method=\"post\">
+ <table style=\"width:100%;\">";
+ $query = "select a.id,name,dir,status,comment,id_uppercat,site_id,galleries_url";
+ $query.= " from $prefixeTable"."categories as a, $prefixeTable"."sites as b";
+ $query.= " where a.id = ".$HTTP_GET_VARS['cat'];
+ $query.= " and a.site_id = b.id;";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $result = get_cat_info( $row['id'] );
+ $array_cat_names = $result['name'];
+ echo "
+ <tr>
+ <th colspan=\"2\">".$lang['editcat_title1']." ".$lang['category']." \"".get_cat_display_name( $array_cat_names, " - ", "font-style:italic;" )."\" [ dir : ".$row['dir']." ]</th>
+ </tr>";
+ if ( $row['site_id'] != 1 )
+ {
+ echo "
+ <tr>
+ <td style=\"width:20%;\">Server</td>
+ <td class=\"row2\">".$row['galleries_url']."</td>
+ </tr>";
+ }
+ echo "
+ <tr>
+ <td style=\"width:20%;\">".$lang['editcat_name']."</td>
+ <td class=\"row2\"><input type=\"text\" name=\"name\" value=\"".$row['name']."\" maxlength=\"255\"/></td>
+ </tr>
+ <tr>
+ <td style=\"width:20%;\">".$lang['editcat_comment']."</td>
+ <td class=\"row2\"><textarea name=\"comment\" rows=\"5\" cols=\"50\" style=\"overflow:auto\">".$row['comment']."</textarea></td>
+ </tr>
+ <tr>
+ <td style=\"width:20%;\">".$lang['editcat_status']."</td>
+ <td class=\"row2\">
+ <select name=\"status\">";
+ // on récupère toutes les status possibles dans la base
+ // par l'intermédiaire de la fonction get_enums trouvable
+ // dans le fichier config.php
+ $option = get_enums( $prefixeTable."categories", "status" );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ if ( $option[$i] == $row['status'] )
+ {
+ echo"
+ <option selected>$option[$i]</option>";
+ }
+ else
+ {
+ echo"
+ <option>$option[$i]</option>";
+ }
+ }
+ echo"
+ </select>
+ ".$lang['editcat_status_info']."
+ </td>
+ </tr>
+ <tr>
+ <td colspan=\"2\">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ </table>
+ </form>";
+?> \ No newline at end of file
diff --git a/admin/historique.php b/admin/historique.php
new file mode 100644
index 000000000..2aca5bfc1
--- /dev/null
+++ b/admin/historique.php
@@ -0,0 +1,102 @@
+<?php
+/***************************************************************************
+ * historique.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Monday, July 15, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+
+ if ( $HTTP_GET_VARS['empty'] == 1 )
+ {
+ mysql_query( "delete from $prefixeTable"."history;" );
+ }
+ define (NB_JOUR_HISTO,"7");
+ $tMois = array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
+ $tJours = array("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi");
+
+ // on affiche les visites pour les 48 dernières heures
+ // il faut trouver le unix date de la veille à 00h00 :
+ // time (); nous donne le nombre de secondes actuelle
+ $date_ref = time() - (7*24*60*60);
+ $result = mysql_query( "select date,login,IP,categorie,page,titre,commentaire from $prefixeTable"."history where date > '$date_ref' order by date desc;");
+ echo"<div style=\"text-align:center;\"><a href=\"".add_session_id_to_url( "./admin.php?page=historique&amp;empty=1" )."\">empty / vider</a></div>";
+ echo"<div style=\"color:green;text-align:center;margin:10px\">";
+ // affichage de la date du jour
+ echo $tJours[date("w")] ." ";
+ echo date("j").(date("j") == 1 ? "er " : " ");
+ echo $tMois[date("n")-1]." ".date("Y")." ";
+ echo " à ".date("G")."h".date("i");
+ echo"</div>";
+?>
+ <table width='100%'>
+ <tr>
+ <th width='1%'>date</th>
+ <th>login</th>
+ <th>IP</th>
+ <th>page</th>
+ <th>categorie</th>
+ <th>image</th>
+ </tr>
+ <tr>
+ <td colspan=7 height=5><div class='style1'></div></td>
+ </tr>
+ <?
+ $fin = time();
+ $debut = mktime ( 23,59,59,date("n"),date("j")-1,date("Y") );
+ for ( $i = 0; $i < NB_JOUR_HISTO; $i++ )
+ {
+ // 1. affichage du nom du jour
+ echo" <tr>
+ <td><nobr>";
+ echo"<img src=\"".$conf['repertoire_image']."moins.gif\">&nbsp;&nbsp;<b>";
+ echo $tJours[date("w",$fin)] ." ";
+ echo date("j",$fin).(date("j",$fin) == 1 ? "er " : " ");
+ echo $tMois[date("n",$fin)-1]." ".date("Y",$fin)."</b>";
+ echo" </nobr></td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>";
+ // 2. affichage de tous les évènements pour le jour donné
+ // entre la veille à 23h59m59s et le jour même 23h59m59s
+ $result = mysql_query("select date,login,IP,categorie,page,titre,commentaire from $prefixeTable"."history where date > '$debut' and date < '$fin' order by date desc;");
+ $fin = $debut;
+ // on recule le début d'une journée complète
+ $debut = $debut - 24*60*60;
+ while($row=mysql_fetch_array($result))
+ {
+ $date = date("G\hi s", $row[date]);
+ $date = str_replace ( " ","min ", $date );
+ $date .= " sec";
+ // on réduit la taille du commentaire à ses premiers caractères
+ $affichage_commentaire = "";
+ if($row[commentaire] != '')
+ {
+ $affichage_commentaire = substr($row[commentaire],0,10);
+ $affichage_commentaire .= "...";
+ }
+ echo" <tr>
+ <td>&nbsp;|-&nbsp;&nbsp;$date</td>
+ <td>$row[login]</td>
+ <td>$row[IP]</td>
+ <td>$row[page]</td>
+ <td>$row[categorie]</td>
+ <td>$row[titre]</td>
+ </tr>";
+ }
+ }
+ echo" </table>
+ </center>";
+?> \ No newline at end of file
diff --git a/admin/images/admin.png b/admin/images/admin.png
new file mode 100644
index 000000000..ff8dc0160
--- /dev/null
+++ b/admin/images/admin.png
Binary files differ
diff --git a/admin/images/arrow_up.gif b/admin/images/arrow_up.gif
new file mode 100644
index 000000000..90da978cd
--- /dev/null
+++ b/admin/images/arrow_up.gif
Binary files differ
diff --git a/admin/images/index.htm b/admin/images/index.htm
new file mode 100644
index 000000000..960cd928d
--- /dev/null
+++ b/admin/images/index.htm
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>PhpWebGallery</title>
+ </head>
+ <body>
+ No access authorized
+ </body>
+</html> \ No newline at end of file
diff --git a/admin/images/moins.gif b/admin/images/moins.gif
new file mode 100644
index 000000000..74fa8736f
--- /dev/null
+++ b/admin/images/moins.gif
Binary files differ
diff --git a/admin/images/plus.gif b/admin/images/plus.gif
new file mode 100644
index 000000000..2fa7116c1
--- /dev/null
+++ b/admin/images/plus.gif
Binary files differ
diff --git a/admin/images/puce.gif b/admin/images/puce.gif
new file mode 100644
index 000000000..b8494bb77
--- /dev/null
+++ b/admin/images/puce.gif
Binary files differ
diff --git a/admin/include/functions.php b/admin/include/functions.php
new file mode 100644
index 000000000..1aee2d94d
--- /dev/null
+++ b/admin/include/functions.php
@@ -0,0 +1,194 @@
+<?php
+/***************************************************************************
+ * functions.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, September 26, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+ $tab_ext = array ( 'jpg', 'gif', 'JPG','GIF','png','PNG' );
+ $tab_ext_create_TN = array ( 'jpg', 'JPG','png','PNG' );
+
+ function get_extension( $filename )
+ {
+ return substr ( strrchr($filename,"."), 1, strlen ( $filename ) );
+ }
+
+ function is_image( $filename, $create_thumbnail = false )
+ {
+ global $tab_ext, $tab_ext_create_TN;
+ $is_image = false;
+ if ( is_file ( $filename ) )
+ {
+ $size = getimagesize( $filename );
+ // $size[2] == 1 means GIF
+ // $size[2] == 2 means JPG
+ // $size[2] == 3 means PNG
+ if ( !$create_thumbnail )
+ {
+ if ( in_array ( get_extension( $filename ), $tab_ext ) && ( $size[2] == 1 || $size[2] == 2 || $size[2] == 3 ) )
+ {
+ $is_image = true;
+ }
+ }
+ else
+ {
+ if ( in_array ( get_extension( $filename ), $tab_ext_create_TN ) && ( $size[2] == 2 || $size[2] == 3 ) )
+ {
+ $is_image = true;
+ }
+ }
+ }
+ return $is_image;
+ }
+
+ function TN_exist ( $dir, $file )
+ {
+ global $tab_ext, $conf;
+ $titre = substr ( $file, 0, strrpos ( $file, ".") );
+ for ( $i = 0; $i < sizeof ( $tab_ext ); $i++ )
+ {
+ $test = $dir."/thumbnail/".$conf['prefixe_thumbnail'].$titre.".".$tab_ext[$i];
+ if ( is_file ( $test ) )
+ {
+ return $tab_ext[$i];
+ }
+ }
+ return false;
+ }
+
+ // The function delete_site deletes a site
+ // and call the function delete_category for each primary category of the site
+ function delete_site( $id )
+ {
+ global $prefixeTable;
+
+ // destruction of the categories of the site
+ $query = "select id from $prefixeTable"."categories where site_id = $id;";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ delete_category( $row['id'] );
+ }
+
+ // destruction of the site
+ $query = "delete from $prefixeTable"."sites where id = $id;";
+ mysql_query( $query );
+ }
+
+ // The function delete_category deletes the category identified by the $id
+ // It also deletes (in the database) :
+ // - all the images of the images (thanks to delete_image, see further)
+ // - all the restrictions linked to the category
+ // The function works recursively.
+ function delete_category( $id )
+ {
+ global $prefixeTable;
+
+ // destruction of all the related images
+ $query = "select id from $prefixeTable"."images where cat_id = '".$id."';";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ delete_image( $row['id'] );
+ }
+
+ // destruction of the restrictions linked to the category
+ $query = "delete from $prefixeTable"."restrictions where cat_id = '".$id."';";
+ mysql_query( $query );
+
+ // destruction of the sub-categories
+ $query = "select id from $prefixeTable"."categories where id_uppercat = '$id';";
+ $result = mysql_query( $query );
+ while( $row = mysql_fetch_array( $result ) )
+ {
+ delete_category( $row['id'] );
+ }
+
+ // destruction of the category
+ $query = "delete from $prefixeTable"."categories where id = '$id';";
+ mysql_query( $query );
+ }
+
+ // The function delete_image deletes the image identified by the $id
+ // It also deletes (in the database) :
+ // - all the comments related to the image
+ // - all the favorites associated to the image
+ function delete_image( $id )
+ {
+ global $prefixeTable,$count_deleted;
+
+ // destruction of the comments on the image
+ $query = "delete from $prefixeTable"."comments where image_id = $id;";
+ mysql_query( $query );
+
+ // destruction of the favorites associated with the picture
+ $query = "delete from $prefixeTable"."favorites where image_id = $id;";
+ mysql_query( $query );
+
+ // destruction of the image
+ $query = "delete from $prefixeTable"."images where id = $id;";
+ mysql_query( $query );
+ $count_deleted++;
+ }
+
+ // The delete_user function delete a user identified by the $user_id
+ // It also deletes :
+ // - all the restrictions linked to this user
+ // - all the favorites linked to this user
+ function delete_user( $user_id )
+ {
+ global $prefixeTable;
+
+ // destruction of the restrictions linked to the user
+ $query = "delete from $prefixeTable"."restrictions where user_id = $user_id;";
+ mysql_query( $query );
+
+ // destruction of the favorites associated with the user
+ $query = "delete from $prefixeTable"."favorites where user_id = $user_id;";
+ mysql_query( $query );
+
+ // destruction of the user
+ $query = "delete from $prefixeTable"."users where id = $user_id;";
+ mysql_query( $query );
+ }
+
+ // The check_favorites function deletes all the favorites of a user if he is not allowed to see them
+ // (the category or an upper category is restricted or invisible)
+ function check_favorites( $user_id )
+ {
+ global $prefixeTable;
+
+ $row = mysql_fetch_array( mysql_query( "select status from $prefixeTable"."users where id = $user_id;" ) );
+ $status = $row['status'];
+ // retrieving all the restricted categories for this user
+ $restricted_cat = get_all_restrictions( $user_id, $status );
+ // retrieving all the favorites for this user and comparing their categories to the restricted categories
+ $query = "select image_id, cat_id";
+ $query.= " from $prefixeTable"."favorites, $prefixeTable"."images";
+ $query.= " where user_id = $user_id";
+ $query.= " and id = image_id";
+ $query.= ";";
+ $result = mysql_query ( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ if ( in_array( $row['cat_id'], $restricted_cat ) )
+ {
+ $query = "delete from $prefixeTable"."favorites";
+ $query.= " where image_id = ".$row['image_id'];
+ $query.= " and user_id = $user_id";
+ $query.= ";";
+ mysql_query( $query );
+ }
+ }
+ }
+?> \ No newline at end of file
diff --git a/admin/include/index.htm b/admin/include/index.htm
new file mode 100644
index 000000000..960cd928d
--- /dev/null
+++ b/admin/include/index.htm
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>PhpWebGallery</title>
+ </head>
+ <body>
+ No access authorized
+ </body>
+</html> \ No newline at end of file
diff --git a/admin/include/isadmin.inc.php b/admin/include/isadmin.inc.php
new file mode 100644
index 000000000..64a77e9f3
--- /dev/null
+++ b/admin/include/isadmin.inc.php
@@ -0,0 +1,34 @@
+<?php
+/***************************************************************************
+ * isadmin.inc.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+define( PREFIXE_INCLUDE, '.' );
+
+include_once( '../include/config.inc.php' );
+include_once( '../include/user.inc.php' );
+include( './include/functions.php' );
+
+$conf['lien_puce'] = $conf['repertoire_image'].'puce.gif';
+
+$isadmin = true;
+include_once( '../language/'.$user['language'].'.php' );
+
+if ( $user['status'] != 'admin' )
+{
+ echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
+ echo '<a href="../identification.php">'.$lang['ident_title'].'</a></div>';
+ exit();
+}
+?> \ No newline at end of file
diff --git a/admin/index.htm b/admin/index.htm
new file mode 100644
index 000000000..960cd928d
--- /dev/null
+++ b/admin/index.htm
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>PhpWebGallery</title>
+ </head>
+ <body>
+ No access authorized
+ </body>
+</html> \ No newline at end of file
diff --git a/admin/infos_images.php b/admin/infos_images.php
new file mode 100644
index 000000000..a5c1b75a4
--- /dev/null
+++ b/admin/infos_images.php
@@ -0,0 +1,248 @@
+<?php
+/***************************************************************************
+ * infos_images.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Wednesday, July 25, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+ function check_date_format ( $date )
+ {
+ // la date arrive à ce format : JJ/MM/AAAA
+ // checkdate ( int month, int day, int year)
+ $tab_date = explode( "/", $date );
+ return checkdate ( $tab_date[1], $tab_date[0], $tab_date[2]);
+ }
+
+ function date_convert( $date )
+ {
+ // la date arrive à ce format : JJ/MM/AAAA
+ // il faut la transformer en AAAA-MM-JJ
+ $tab_date = explode( "/", $date );
+ return $tab_date[2]."-".$tab_date[1]."-".$tab_date[0];
+ }
+
+ function date_convert_back( $date )
+ {
+ // la date arrive à ce format : AAAA-MM-JJ
+ // il faut la transformer en JJ/MM/AAAA
+ if ( $date != "" )
+ {
+ $tab_date = explode( "-", $date );
+ return $tab_date[2]."/".$tab_date[1]."/".$tab_date[0];
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ include_once( "./include/isadmin.inc.php" );
+ $page['nb_image_page'] = 5;
+ check_cat_id( $HTTP_GET_VARS['cat_id'] );
+ if ( isset( $page['cat'] ) )
+ {
+ //------------------------------------------------------------mises à jour
+ // 1. options individuelles
+ $query = "select id,file ";
+ $query.= "from $prefixeTable"."images ";
+ $query.= "where cat_id = ".$page['cat']." ";
+ $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'];
+ if ( isset( $HTTP_POST_VARS[$name] ) )
+ {
+ $query = "update $prefixeTable"."images ";
+ if ( $HTTP_POST_VARS[$name] == "" )
+ {
+ $query.= "set name = NULL ";
+ }
+ else
+ {
+ $query.= "set name = '".htmlspecialchars( $HTTP_POST_VARS[$name], ENT_QUOTES )."' ";
+ }
+ if ( $HTTP_POST_VARS[$author] == "" )
+ {
+ $query.= ", author = NULL ";
+ }
+ else
+ {
+ $query.= ", author = '".htmlspecialchars( $HTTP_POST_VARS[$author], ENT_QUOTES )."' ";
+ }
+ if ( $HTTP_POST_VARS[$comment] == "" )
+ {
+ $query.= ", comment = NULL ";
+ }
+ else
+ {
+ $query.= ", comment = '".htmlspecialchars( $HTTP_POST_VARS[$comment], ENT_QUOTES )."' ";
+ }
+ if ( check_date_format( $HTTP_POST_VARS[$date_creation] ) )
+ {
+ $date = date_convert( $HTTP_POST_VARS[$date_creation] );
+ $query.= ", date_creation = '$date' ";
+ }
+ else if ( $HTTP_POST_VARS[$date_creation] == "" )
+ {
+ $query.= ", date_creation = NULL ";
+ }
+ $query.= "where id = '".$row['id']."';";
+ mysql_query( $query );
+ }
+ }
+ // 2. options générales
+ if ( $HTTP_POST_VARS['use_common_author'] == 1 )
+ {
+ $query = "update $prefixeTable"."images ";
+ if ( $HTTP_POST_VARS['author_cat'] == "" )
+ {
+ $query.= "set author = NULL ";
+ }
+ else
+ {
+ $query.= "set author = '".$HTTP_POST_VARS['author_cat']."' ";
+ }
+ $query.= "where cat_id = ".$page['cat'].";";
+ mysql_query( $query );
+ }
+ if ( $HTTP_POST_VARS['use_common_date_creation'] == 1 )
+ {
+ // la date arrive à ce format : JJ/MM/AAAA
+ // il faut la transformer en AAAA-MM-JJ
+ if ( check_date_format( $HTTP_POST_VARS['date_creation_cat'] ) )
+ {
+ $date = date_convert( $HTTP_POST_VARS['date_creation_cat'] );
+ $query = "update $prefixeTable"."images ";
+ if ( $HTTP_POST_VARS['date_creation_cat'] == "" )
+ {
+ $query.= "set date_creation = NULL ";
+ }
+ else
+ {
+ $query.= "set date_creation = '$date' ";
+ }
+ $query.= "where cat_id = ".$page['cat'].";";
+ mysql_query( $query );
+ }
+ else
+ {
+ echo $lang['infoimage_err_date'];
+ }
+ }
+ //----------------------------------------------------affichage de la page
+ // détection de la page en cours
+ if( !isset( $HTTP_GET_VARS['start'] ) || !is_numeric( $HTTP_GET_VARS['start'] ) || ( is_numeric( $HTTP_GET_VARS['start'] ) && $HTTP_GET_VARS['start'] < 0 ) )
+ {
+ $page['start'] = 0;
+ }
+ else
+ {
+ $page['start'] = $HTTP_GET_VARS['start'];
+ }
+
+ if ( is_numeric( $HTTP_GET_VARS['num'] ) && $HTTP_GET_VARS['num'] >= 0 )
+ {
+ $page['start'] = floor( $HTTP_GET_VARS['num'] / $page['nb_image_page'] ) * $page['nb_image_page'];
+ }
+ // retrieving category information
+ $result = get_cat_info( $page['cat'] );
+ $cat['local_dir'] = $result['local_dir'];
+ $cat['dir'] = $result['dir'];
+ $cat['name'] = $result['name'];
+ $cat['site_id'] = $result['site_id'];
+ $cat['nb_images'] = $result['nb_images'];
+
+ $url = "./admin.php?page=infos_images&amp;cat_id=".$page['cat'];
+ $page['navigation_bar'] = create_navigation_bar( $url, $cat['nb_images'], $page['start'], $page['nb_image_page'], "" );
+ echo"
+ <form method=\"post\" action=\"".add_session_id_to_url( "./admin.php?page=infos_images&amp;cat_id=".$page['cat']."&amp;start=".$page['start'] )."\">
+ <table width=\"100%\">
+ <tr>
+ <th colspan=\"3\">".$lang['infoimage_general']." \"".get_cat_display_name( $cat['name'], " - ", "font-style:italic;" )."\"</th>
+ </tr>
+ <tr>
+ <td><div style=\"margin-left:50px;\">".$lang['author']."</div></td>
+ <td style=\"text-align:center;\"><input type=\"text\" name=\"author_cat\" value=\"\" maxlength=\"255\"/></td>
+ <td style=\"text-align:left;\"><input type=\"checkbox\" name=\"use_common_author\" value=\"1\"/>".$lang['infoimage_useforall']."</td>
+ </tr>
+ <tr>
+ <td><div style=\"margin-left:50px;\">".$lang['infoimage_creation_date']." [DD/MM/YYYY]</div></td>
+ <td style=\"text-align:center;\"><input type=\"text\" name=\"date_creation_cat\" value=\"\" size=\"12\" maxlength=\"10\"/></td>
+ <td style=\"text-align:left;\"><input type=\"checkbox\" name=\"use_common_date_creation\" value=\"1\"/>".$lang['infoimage_useforall']."</td>
+ </tr>
+ </table>";
+ echo"
+ <table width=\"100%\">
+ <tr>
+ <th colspan=\"5\">".$lang['infoimage_detailed']."</th>
+ </tr>
+ <tr>
+ <td colspan=\"5\" align=\"center\">".$page['navigation_bar']."</td>
+ </tr>
+ <tr>
+ <td class=\"row2\" style=\"text-align:center;\">".$lang['thumbnail']."</td>
+ <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_title']."</td>
+ <td class=\"row2\" style=\"text-align:center;\">".$lang['author']."</td>
+ <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_comment']."</td>
+ <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_creation_date']."</td>
+ </tr>";
+ $query = "select id,file,comment,author,tn_ext,name,date_creation";
+ $query.= " from $prefixeTable"."images";
+ $query.= " where cat_id = ".$page['cat'];
+ $query.= $conf['order_by'];
+ $query.= " limit ".$page['start'].",".$page['nb_image_page'];
+ $query.= ";";
+ $result = mysql_query( $query );
+ $i = 1;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ echo"
+ <tr>";
+ // création des liens vers la miniature
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+ if ( $cat['site_id'] == 1 )
+ {
+ $lien_thumbnail = "../galleries/".$cat['local_dir']."/";
+ }
+ else
+ {
+ $lien_thumbnail = $cat['dir'];
+ }
+ $lien_thumbnail.= "thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ // création du "style" de la ligne
+ $style = "style=\"text-align:center;\"";
+ if ( $i%2 == 0 )
+ {
+ $style.= " class=\"row2\"";
+ }
+ echo"
+ <td $style><a name=\"".$row['id']."\"><img src=\"$lien_thumbnail\" alt=\"\" class=\"miniature\" title=\"".$row['file']."\"/></td>
+ <td $style>$file<br /><input type=\"text\" name=\"name-".$row['id']."\" value=\"".$row['name']."\" maxlength=\"255\"/></td>
+ <td $style><input type=\"text\" name=\"author-".$row['id']."\" value=\"".$row['author']."\" maxlength=\"255\"/></td>
+ <td $style><textarea name=\"comment-".$row['id']."\" rows=\"3\" cols=\"40\" style=\"overflow:auto\">".$row['comment']."</textarea></td>
+ <td $style><input type=\"text\" name=\"date_creation-".$row['id']."\" value=\"".date_convert_back( $row['date_creation'] )."\" maxlength=\"10\" size=\"12\"/></td>";
+ echo"
+ </tr>";
+ $i++;
+ }
+ echo"
+ <tr>
+ <td colspan=\"5\" style=\"text-align:center;\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ </table>
+ </form>";
+ }
+?> \ No newline at end of file
diff --git a/admin/install.php b/admin/install.php
new file mode 100644
index 000000000..c87a63bbd
--- /dev/null
+++ b/admin/install.php
@@ -0,0 +1,599 @@
+<?php
+/***************************************************************************
+ * install_step1.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+ function header_install()
+ {
+ $output = "
+<html>
+ <head>
+ <title>PhpWebGallery 1.2</title>
+ <style>
+ a
+ {
+ text-decoration : none;
+ color : #006699;
+ }
+ a:hover
+ {
+ text-decoration : underline;
+ }
+ body,table,input,form,select,textarea
+ {
+ font-family : Arial, Verdana, Sans-Serif;
+ font-size : 12px;
+ }
+ .miniature
+ {
+ border : solid 1px black;
+ }
+ body
+ {
+ background-color : #E5E5E5;
+ }
+ .titretable1
+ {
+ color : black;
+ background-color : #D3DCE3;
+ text-align : center;
+ border : 2px solid #006699;
+ }
+ .grostitre
+ {
+ text-align : center;
+ font-size : 20px;
+ margin-bottom : 20px;
+ }
+ .plan
+ {
+ margin : 10px 10px 10px 2px;
+ white-space : nowrap;
+ }
+ .table1
+ {
+ border-collapse : collapse;
+ background-color : #FFFFFF;
+ }
+ .contenucellule
+ {
+ background-color : #EEEEEE;
+ border : 2px solid #006699;
+ }
+ .style1
+ {
+ margin-top : 20px;
+ }
+ th
+ {
+ font-weight : bold;
+ background-color : #D3DCE3;
+ }
+ td.row1
+ {
+ background-color : #DDDDDD;
+ }
+ td.row2
+ {
+ background-color : #E8E8E8;
+ }
+ .cat_plan
+ {
+ font-weight : bold;
+ }
+ .retrait
+ {
+ margin : 10px;
+ margin-left : 30px;
+ margin-top : 2px;
+ }
+ input,textarea
+ {
+ border-width : 1;
+ border-color : #000000;
+ background : #ffffff;
+ color: #000000;
+ }
+ .erreur
+ {
+ color : red;
+ text-align : center;
+ }
+ .info
+ {
+ color : darkblue;
+ text-align : center;
+ }
+ </style>
+ </head>
+ <body>
+ <table style=\"width:100%;height:100%\">
+ <tr align=\"center\" valign=\"middle\">
+ <td>
+ <div class=\"grostitre\">PhpWebGallery 1.2</div>
+ <table width=\"700\" class=\"table1\" style=\"margin:auto;\">
+ <tr>
+ <td class=\"contenucellule\">";
+ return $output;
+ }
+
+ function footer_install()
+ {
+ $output = "
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>";
+ return $output;
+ }
+
+ if ( isset( $HTTP_GET_VARS['language'] ) )
+ {
+ $isadmin = true;
+ $lang = array();
+ include( "../language/".$HTTP_GET_VARS['language'].".php" );
+ }
+
+ /*---------------------------------------Step 1------------------------------------*/
+ if ( $HTTP_GET_VARS['step'] == 1 )
+ {
+ $erreur1 = true;
+ $message = "";
+ // création du fichier de configuration de connexion à la BD mysql
+ if( isset( $HTTP_POST_VARS['cfgBase'] ) && isset( $HTTP_POST_VARS['cfgUser'] ) && isset( $HTTP_POST_VARS['cfgPassword'] ) && isset( $HTTP_POST_VARS['cfgHote'] ) )
+ {
+ if ( @mysql_connect( $HTTP_POST_VARS['cfgHote'], $HTTP_POST_VARS['cfgUser'], $HTTP_POST_VARS['cfgPassword'] ) )
+ {
+ if ( @mysql_select_db($HTTP_POST_VARS['cfgBase'] ) )
+ {
+ $message.= "<div class=\"info\">".$lang['step1_confirmation']."</div>";
+ $erreur1 = false;
+ }
+ else
+ {
+ $message.= "<div class=\"erreur\">".$lang['step1_err_db']."</div>";
+ }
+ }
+ else
+ {
+ $message.= "<div class=\"erreur\">".$lang['step1_err_server']."</div>";
+ }
+
+ if ( !$erreur1 )
+ {
+ // écriture du fichier de configuration
+ if ( $fp = @fopen("../include/mysql.inc.php","a+") )
+ {
+ fwrite( $fp, "<?php\n\t\$cfgBase='".$HTTP_POST_VARS['cfgBase']."';\n\t\$cfgUser='".$HTTP_POST_VARS['cfgUser']."';\n\t\$cfgPassword='".$HTTP_POST_VARS['cfgPassword']."';\n\t\$cfgHote='".$HTTP_POST_VARS['cfgHote']."';\n\t\$prefixeTable='".$HTTP_POST_VARS['prefixe']."';\n?>" );
+ fclose( $fp );
+ }
+ $cfgHote = "";
+ $cfgUser = "";
+ $cfgPassword = "";
+ $cfgBase = "";
+ include ( "../include/mysql.inc.php" );
+ $erreur2 = true;
+ if ( @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) )
+ {
+ if ( @mysql_select_db ( $cfgBase ) )
+ {
+ $erreur2 = false;
+ }
+ }
+ if ( $erreur2 )
+ {
+ $message.="<br /><br />".$lang['step1_err_copy']." :<br />
+ -----------------------------------------------------<br />
+ <div style=\"color:blue;\">&lt;?php<br />
+ \$cfgBase = '".$HTTP_POST_VARS['cfgBase']."';<br />
+ \$cfgUser = '".$HTTP_POST_VARS['cfgUser']."';<br />
+ \$cfgPassword = '".$HTTP_POST_VARS['cfgPassword']."';<br />
+ \$cfgHote = '".$HTTP_POST_VARS['cfgHote']."';<br />
+ \$prefixeTable = '".$HTTP_POST_VARS['prefixe']."';<br />
+ ?&gt;</div>
+ -----------------------------------------------------<br />";
+ $message.= "<div style=\"text-align:center;\">".$lang['step1_err_copy_2']."<br />";
+ $message.= "<a href=\"install.php?step=2&amp;language=".$HTTP_GET_VARS['language']."\">".$lang['step1_err_copy_next']."</a></div>";
+ }
+ else
+ {
+ $url = "install.php?step=2&language=".$HTTP_GET_VARS['language'];
+ header("Request-URI: $url");
+ header("Content-Location: $url");
+ header("Location: $url");
+ exit();
+ }
+ }
+ }
+
+ echo header_install();
+ if ( isset( $message ) && $message != "" )
+ {
+ echo"
+ <table width=\"100%\">
+ <tr>
+ <th>".$lang['install_message']."</th>
+ </tr>
+ <tr>
+ <td>$message</td>
+ </tr>
+ </table>";
+ }
+ if ( $erreur1 )
+ {
+ echo"
+ <form method=\"post\" action=\"install.php?step=1&amp;language=".$HTTP_GET_VARS['language']."\">
+ <table width=\"100%\">
+ <tr>
+ <th colspan=\"3\">".$lang['step1_title']."</th>
+ </tr>
+ <tr>
+ <td colspan=\"3\">&nbsp;</th>
+ </tr>
+ <tr>
+ <td>".$lang['step1_host']."</td>
+ <td align=center><input type='text' name='cfgHote' value='";
+ if ( !isset( $HTTP_POST_VARS['cfgHote'] ) )
+ {
+ echo"localhost";
+ }
+ else
+ {
+ echo $HTTP_POST_VARS['cfgHote'];
+ }
+ echo"'></td>
+ <td class=\"row2\">".$lang['step1_host_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step1_user']."</td>
+ <td align=center><input type='text' name='cfgUser' value='".$HTTP_POST_VARS['cfgUser']."'></td>
+ <td class=\"row2\">".$lang['step1_user_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step1_pass']."</td>
+ <td align=center><input type='password' name='cfgPassword' value=''></td>
+ <td class=\"row2\">".$lang['step1_pass_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step1_database']."</td>
+ <td align=center><input type='text' name='cfgBase' value='".$HTTP_POST_VARS['cfgBase']."'></td>
+ <td class=\"row2\">".$lang['step1_database_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step1_prefix']."</td>
+ <td align=center><input type='text' name='prefixe' value='";
+ if ( !isset( $HTTP_POST_VARS['prefixe'] ) )
+ {
+ echo"phpwebgallery_";
+ }
+ else
+ {
+ echo $HTTP_POST_VARS['prefixe'];
+ }
+ echo"'></td>
+ <td class=\"row2\">".$lang['step1_prefix_info']."</td>
+ </tr>
+ <tr>
+ <td colspan=\"3\">&nbsp;</th>
+ </tr>
+ <tr>
+ <td colspan=3 align=center><input type='submit' name='Valider' value=\"".$lang['submit']." *\"></td>
+ </tr>
+ </table>
+ </form>";
+ }
+ echo footer_install();
+ }
+ /*---------------------------------------Step 2------------------------------------*/
+ else if ( $HTTP_GET_VARS['step'] == 2 )
+ {
+ include( "../include/mysql.inc.php" );
+ mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or die ( "erreur de connexion au serveur" );
+ mysql_select_db( $cfgBase ) or die ( "erreur de connexion a la base de donnees" );
+
+ if ( !isset( $HTTP_POST_VARS['submit'] ) )
+ {
+ $query = "CREATE TABLE ".$prefixeTable."categories (
+ id tinyint(3) unsigned NOT NULL auto_increment,
+ date_dernier date NOT NULL default '0000-00-00',
+ nb_images smallint(5) unsigned NOT NULL default '0',
+ name varchar(255) default NULL,
+ id_uppercat tinyint(3) unsigned default NULL,
+ comment text,
+ dir varchar(255) NOT NULL default '',
+ rank tinyint(3) unsigned default NULL,
+ status enum('visible','invisible') NOT NULL default 'visible',
+ site_id tinyint(4) unsigned NOT NULL default '1',
+ PRIMARY KEY (id)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."comments (
+ id int(11) unsigned NOT NULL auto_increment,
+ image_id smallint(5) unsigned NOT NULL default '0',
+ date int(11) unsigned NOT NULL default '0',
+ author varchar(255) NOT NULL default '',
+ content longtext,
+ PRIMARY KEY (id)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."config (
+ periode_courte smallint(5) unsigned NOT NULL default '7',
+ periode_longue smallint(5) unsigned NOT NULL default '14',
+ prefixe_thumbnail varchar(10) NOT NULL default 'TN-',
+ webmaster varchar(255) NOT NULL default '',
+ mail_webmaster varchar(255) NOT NULL default '',
+ acces enum('libre','restreint') NOT NULL default 'libre',
+ session_id_size tinyint(3) unsigned NOT NULL default '4',
+ session_keyword varchar(255) NOT NULL default '',
+ session_time tinyint(3) unsigned NOT NULL default '30',
+ max_user_listbox tinyint(3) unsigned NOT NULL default '10',
+ expand enum('true','false') NOT NULL default 'false',
+ 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'
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."favorites (
+ user_id smallint(5) unsigned NOT NULL default '0',
+ image_id smallint(5) unsigned NOT NULL default '0',
+ KEY user_id (user_id,image_id)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."history (
+ date int(11) NOT NULL default '0',
+ login varchar(15) default NULL,
+ IP varchar(50) NOT NULL default '',
+ categorie varchar(150) default NULL,
+ page varchar(50) default NULL,
+ titre varchar(150) default NULL,
+ commentaire varchar(200) default NULL
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."images (
+ id smallint(5) unsigned NOT NULL auto_increment,
+ file varchar(255) NOT NULL default '',
+ cat_id tinyint(3) unsigned NOT NULL default '0',
+ 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 varchar(255) default NULL,
+ 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,
+ PRIMARY KEY (id),
+ KEY cat_id (cat_id)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."restrictions (
+ user_id smallint(5) unsigned NOT NULL default '0',
+ cat_id tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (user_id,cat_id)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."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)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."sites (
+ id tinyint(4) NOT NULL auto_increment,
+ galleries_url varchar(255) NOT NULL default '',
+ PRIMARY KEY (id),
+ UNIQUE KEY galleries_url (galleries_url)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."users (
+ id smallint(5) unsigned NOT NULL auto_increment,
+ pseudo varchar(20) binary NOT NULL default '',
+ password varchar(255) NOT NULL default '',
+ mail_address varchar(255) default NULL,
+ nombre_image_ligne tinyint(1) unsigned NOT NULL default '5',
+ nombre_ligne_page tinyint(3) unsigned NOT NULL default '3',
+ theme varchar(255) NOT NULL default 'melodie/blue',
+ status enum('admin','membre','visiteur') NOT NULL default 'visiteur',
+ language varchar(50) NOT NULL default 'english',
+ maxwidth smallint(6) default NULL,
+ maxheight smallint(6) default NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY pseudo (pseudo)
+ );";
+ mysql_query( $query );
+ $query = "CREATE TABLE ".$prefixeTable."waiting (
+ id int(10) unsigned NOT NULL auto_increment,
+ cat_id tinyint(3) 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,
+ PRIMARY KEY (id)
+ );";
+ mysql_query( $query );
+ }
+ if ( isset( $HTTP_POST_VARS['submit'] ) )
+ {
+ $configuration = false;
+ $erreur = "";
+ $nb_erreur = 0;
+ // le pseudo du webmaster ne doit pas
+ // 1. être vide
+ // 2. commencer ou se terminer par un espace
+ // 3. comporter les caractères ' ou "
+ // Notes sur le pseudo du webmaster :
+ // - lorsque l'on trouve plusieurs occurences
+ // consécutives du caractère espace, on réduit à une seule occurence
+ if ( $HTTP_POST_VARS['webmaster'] == "" )
+ {
+ $erreur .= "<li>".$lang['step2_err_login1']."</li>";
+ $nb_erreur++;
+ }
+ $webmaster = ereg_replace( "[ ]{2,}", " ", $HTTP_POST_VARS['webmaster'] );
+ if ( ereg( "^.* $", $webmaster ) || ereg( "^ .*$", $webmaster) )
+ {
+ $erreur .= "<li>".$lang['step2_err_login2']."</li>";
+ $nb_erreur++;
+ }
+ if ( ereg( "'",$webmaster ) || ereg( "\"",$webmaster ) )
+ {
+ $erreur .= "<li>".$lang['step2_err_login3']."</li>";
+ $nb_erreur++;
+ }
+ // on vérifie que le password rentré correspond bien à la confirmation faite par l'utilisateur
+ if ( $HTTP_POST_VARS['pwdWebmaster'] != $HTTP_POST_VARS['pwdWebmasterConf'] )
+ {
+ $erreur .= "<li>".$lang['step2_err_pass']."</li>";
+ $nb_erreur++;
+ }
+ // le mail doit être conforme à qqch du type : nom@serveur.com
+ if( !ereg("([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)", $HTTP_POST_VARS['mail_webmaster'] ) )
+ {
+ $erreur .= "<li>".$lang['step2_err_mail']."</li>";
+ $nb_erreur++;
+ }
+ // on met à jour les paramètres de l'application dans le cas où il n'y aucune erreur
+ if ( $nb_erreur == 0 )
+ {
+ mysql_query( "delete from $prefixeTable"."config" );
+ $query = "insert into $prefixeTable"."config (webmaster,mail_webmaster) values ('$webmaster','".$HTTP_POST_VARS['mail_webmaster']."')";
+ mysql_query($query);
+ $query = "insert into $prefixeTable"."sites values (1, './galleries/');";
+ mysql_query($query);
+ $query = "insert into $prefixeTable"."users (pseudo,password,status,language) values ('$webmaster','".md5( $pwdWebmaster )."','admin','".$HTTP_GET_VARS['language']."')";
+ mysql_query($query);
+ mysql_query("insert into $prefixeTable"."users (pseudo,password,status,language) values ('visiteur','".md5( "" )."','visiteur','".$HTTP_GET_VARS['language']."')");
+ $configuration = true;
+ }
+ }
+
+ echo header_install();
+ if ( $configuration )
+ {
+ echo"
+ <table width=\"100%\">
+ <tr>
+ <th>".$lang['install_end_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</th>
+ </tr>
+ <tr>
+ <td>".$lang['install_end_message']."</td>
+ </tr>
+ </table>";
+ }
+ else
+ {
+ if ( $nb_erreur > 0 )
+ {
+ echo"
+ <table width=100%>
+ <tr>
+ <th>".$lang['install_message']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>$erreur</td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ </table>";
+ }
+ echo"
+ <form method=\"post\" action=\"install.php?step=2&amp;language=".$HTTP_GET_VARS['language']."\">
+ <table width=100%>
+ <tr>
+ <th colspan=\"3\">".$lang['step2_title']."</th>
+ </tr>
+ <tr>
+ <td colspan=\"3\">&nbsp;</td>
+ </tr>
+ <tr>
+ <td>".$lang['conf_general_webmaster']."</td>
+ <td align=\"center\"><input type='text' name='webmaster' value=\"".$HTTP_POST_VARS['webmaster']."\"></td>
+ <td class=\"row2\">".$lang['conf_general_webmaster_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step2_pwd']."</td>
+ <td align=center><input type='password' name='pwdWebmaster' value=''></td>
+ <td class=\"row2\">".$lang['step2_pwd_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['step2_pwd_conf']."</td>
+ <td align=center><input type='password' name='pwdWebmasterConf' value=''></td>
+ <td class=\"row2\">".$lang['step2_pwd_conf_info']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['conf_general_mail']."</td>
+ <td align=center><input type='text' name='mail_webmaster' value=\"".$HTTP_POST_VARS['mail_webmaster']."\"></td>
+ <td class=\"row2\">".$lang['conf_general_mail_info']."</td>
+ </tr>
+ <tr>
+ <td colspan=\"3\">&nbsp;</th>
+ </tr>
+ <tr>
+ <td colspan=3 align=center>
+ <input type='submit' name='submit' value='".$lang['submit']."'>
+ </td>
+ </tr>
+ </table>
+ </form>";
+ }
+ echo footer_install();
+ }
+ /*----------------------------------Language choice------------------------------------*/
+ else
+ {
+ include( "../include/functions.php" );
+ echo header_install();
+ echo"
+ <form method=\"get\" action=\"install.php\">
+ <input type=\"hidden\" name=\"step\" value=\"1\"/>
+ <table width=\"100%\">
+ <tr>
+ <td align=\"center\">
+ <select name=\"language\">";
+ $languages = get_languages( "../language/" );
+ for ( $i = 0; $i < sizeof ( $languages ); $i++ )
+ {
+ echo"
+ <option>".$languages[$i]."</option>";
+ }
+ echo"
+ </select>
+ <input type=\"submit\" value=\"Go\">
+ </td>
+ </tr>
+ </table>
+ </form>";
+ echo footer_install();
+ }
+?> \ No newline at end of file
diff --git a/admin/manuel.php b/admin/manuel.php
new file mode 100644
index 000000000..c36a0917e
--- /dev/null
+++ b/admin/manuel.php
@@ -0,0 +1,151 @@
+<?
+/***************************************************************************
+ * manuel.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+
+ echo"
+ <table style=\"width:100%;\">
+ <tr>
+ <th>".$lang['help_images_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <div style=\"text-align:center;margin:auto;margin-bottom:10px;\"><img src=\"".$conf['repertoire_image']."admin.png\" style=\"border:1px solid black;\" alt=\"\"/></div>
+ ".$lang['help_images_intro']." :
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_images'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_images'][$i]."</li>";
+ }
+ echo"
+ </ul>";
+ echo"
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <th>".$lang['help_thumbnails_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_thumbnails'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_thumbnails'][$i]."</li>";
+ }
+ echo"
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <th>".$lang['help_database_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_database'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_database'][$i]."</li>";
+ }
+ echo"
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <th>".$lang['help_remote_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_remote'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_remote'][$i]."</li>";
+ }
+ echo"
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <th>".$lang['help_upload_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_upload'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_upload'][$i]."</li>";
+ }
+ echo"
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <th>".$lang['help_infos_title']."</th>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+ <ul style=\"margin-right:10px;\">";
+ for ( $i = 0; $i < sizeof( $lang['help_infos'] ); $i++ )
+ {
+ echo"
+ <li>".$lang['help_infos'][$i]."</li>";
+ }
+ echo"
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ </table>";
+?> \ No newline at end of file
diff --git a/admin/miseajour.php b/admin/miseajour.php
new file mode 100644
index 000000000..53ce3371d
--- /dev/null
+++ b/admin/miseajour.php
@@ -0,0 +1,531 @@
+<?
+/***************************************************************************
+ * miseajour.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+
+ function insert_local_category( $cat_id )
+ {
+ global $prefixeTable,$conf,$page,$HTTP_GET_VARS;
+
+ $site_id = 1;
+
+ // 0. retrieving informations on the category to display
+ $cat_directory = "../galleries";
+
+ if ( is_numeric( $cat_id ) )
+ {
+ $result = get_cat_info( $cat_id );
+ $cat_directory.= "/".$result['local_dir'];
+ // 1. display the category name to update
+ echo "
+ <img src=\"".$conf['lien_puce']."\" alt=\"&gt;\" /><span style=\"font-weight:bold;\">".$result['name'][0]."</span> [ dir : ".$result['last_dir']." ]
+ <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'] ) || $HTTP_GET_VARS['update'] == 'all' )
+ {
+ insert_local_image( $cat_directory, $cat_id );
+ update_cat_info( $cat_id );
+ }
+ }
+
+ // 3. we have to remove the categories of the database not present anymore
+ $query = "select id from $prefixeTable"."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;";
+ }
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ // retrieving the directory
+ $rep = "../galleries";
+ $resultat = get_cat_info( $row['id'] );
+ $rep.= "/".$resultat['local_dir'];
+
+ // is the directory present ?
+ if ( !is_dir( $rep ) )
+ {
+ delete_category( $row['id'] );
+ }
+ }
+
+ // 4. retrieving the sub-directories
+ $sub_rep = array();
+ $i = 0;
+ $dirs = "";
+ if ( $opendir = opendir ( $cat_directory ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( $file != "." && $file != ".." && is_dir ( $cat_directory."/".$file ) && $file != "thumbnail" )
+ {
+ $sub_rep[$i++] = $file;
+ }
+ }
+ }
+
+ for ( $i = 0; $i < sizeof( $sub_rep ); $i++ )
+ {
+ // 5. is the category already existing ? we create a subcat if not existing
+ $category_id = "";
+ $query = "select id from $prefixeTable"."categories";
+ $query.= " where site_id = $site_id";
+ $query.= " and dir = '".$sub_rep[$i]."'";
+ if ( !is_numeric( $cat_id ) )
+ {
+ $query.= " and id_uppercat is NULL;";
+ }
+ else
+ {
+ $query.= " and id_uppercat = $cat_id;";
+ }
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ // we have to create the category
+ $query = "insert into $prefixeTable"."categories (dir,site_id,id_uppercat) values ('".$sub_rep[$i]."','$site_id'";
+ if ( !is_numeric( $cat_id ) )
+ {
+ $query.= ",NULL";
+ }
+ else
+ {
+ $query.= ",'$cat_id'";
+ }
+ $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'];
+ }
+ // 6. recursive call
+ insert_local_category( $category_id );
+ }
+
+ if ( is_numeric( $cat_id ) )
+ {
+ echo "
+ </div>";
+ }
+ }
+
+ function insert_local_image( $rep, $category_id )
+ {
+ global $prefixeTable,$lang,$conf,$count_new;
+
+ // 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 from $prefixeTable"."images";
+ $query.= " where cat_id = $category_id;";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $lien_image = $rep."/".$row['file'];
+ $lien_thumbnail = $rep."/"."thumbnail/".$conf['prefixe_thumbnail'].substr( $row['file'], 0, strrpos( $row['file'], "." ) ).".".$row['tn_ext'];
+
+ if ( !is_file ( $lien_image ) || !is_file ( $lien_thumbnail ) )
+ {
+ if ( !is_file ( $lien_image ) )
+ {
+ echo $row['file']." <span style=\"font-weight:bold;\">".$lang['update_disappeared']."</span><br />";
+ }
+ if ( !is_file ( $lien_thumbnail ) )
+ {
+ echo $row['file']." : <span style=\"font-weight:bold;\">".$lang['update_disappeared_tn']."</span><br />";
+ }
+ // suppression de la base :
+ delete_image( $row['id'] );
+ }
+ }
+
+ // searching the new images in the directory
+ $pictures = array();
+ $i = 0;
+ $tn_ext = "";
+ $root = "";
+ if ( $opendir = opendir ( $rep ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( is_file( $rep."/".$file ) && is_image( $rep."/".$file ) )
+ {
+ // is the picture waiting for validation by an administrator ?
+ $query = "select id from $prefixeTable"."waiting";
+ $query.= " where cat_id = $category_id";
+ $query.= " and file = '$file';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ if ( $tn_ext = TN_exist( $rep, $file ) )
+ {
+ // is the picture already in the database ?
+ $query = "select id from $prefixeTable"."images";
+ $query.= " where cat_id = $category_id";
+ $query.= " and file = '$file';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ $pictures[$i] = array();
+ $pictures[$i]['file'] = $file;
+ $pictures[$i]['tn_ext'] = $tn_ext;
+ $pictures[$i]['date'] = date( "Y-m-d", filemtime ( $rep."/".$file ) );
+ $pictures[$i]['filesize'] = floor ( filesize( $rep."/".$file ) / 1024 );
+ $image_size = @getimagesize( $rep."/".$file );
+ $pictures[$i]['width'] = $image_size[0];
+ $pictures[$i]['height'] = $image_size[1];
+ $i++;
+ }
+ }
+ else
+ {
+ echo "<span style=\"color:red;\">".$lang['update_missing_tn']." : $file (<span style=\"font-weight:bold;\">".$conf['prefixe_thumbnail'].substr( $file, 0, strrpos( $file, "." ) ).".XXX</span>, XXX = gif, png or jpg)</span><br />";
+ }
+ }
+ }
+ }
+ }
+ // inserting the pictures found in the directory
+ $root.= "\n".$indent."<root>";
+ if ( sizeof( $pictures ) > 0 )
+ {
+ for( $i = 0; $i < sizeof( $pictures ); $i++ )
+ {
+ $query = "insert into $prefixeTable"."images (file,cat_id,date_available,tn_ext,filesize,width,height) values ('".$pictures[$i]['file']."','".$category_id."','".$pictures[$i]['date']."','".$pictures[$i]['tn_ext']."','".$pictures[$i]['filesize']."','".$pictures[$i]['width']."','".$pictures[$i]['height']."');";
+ echo"
+ ".$pictures[$i]['file']." <span style=\"font-weight:bold;\">".$lang['update_research_added']."</span> (".$lang['update_research_tn_ext']." ".$pictures[$i]['tn_ext'].")<br />";
+ $count_new++;
+ mysql_query( $query );
+ }
+ }
+ }
+
+ // The function "update_cat_info" updates the information about the last online image
+ // and the number of images in the category
+ function update_cat_info( $category_id )
+ {
+ global $prefixeTable;
+
+ $query = "select date_available from $prefixeTable"."images";
+ $query.= " where cat_id = $category_id";
+ $query.= " order by date_available desc limit 0,1;";
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $date_last = $row['date_available'];
+
+ $query = "select count(*) as nb_images from $prefixeTable"."images";
+ $query.= " where cat_id = $category_id";
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $nb_images = $row['nb_images'];
+
+ $query = "update $prefixeTable"."categories";
+ $query.= " set date_dernier = '$date_last'";
+ $query.= ", nb_images = $nb_images";
+ $query.= " where id = $category_id;";
+ mysql_query( $query );
+ }
+
+ function getContent( $element, $node )
+ {
+ $content = str_replace( "<".$node.">", "", $element );
+ $content = str_replace( "</".$node.">", "", $content );
+ return $content;
+ }
+
+ function getChild( $document, $node )
+ {
+ preg_match("/\<".$node.">.*\<\/".$node."\>/U", $document, $retour);
+ return $retour[0];
+ }
+
+ function getChildren( $document, $node )
+ {
+ preg_match_all("/\<".$node.">.*\<\/".$node."\>/U", $document, $retour);
+ return $retour[0];
+ }
+
+ function remote_images()
+ {
+ global $conf, $prefixeTable, $lang;
+
+ // 1.is there a file listing.xml ?
+ $filename = "listing.xml";
+ $xml_content = "";
+ if ( $fp = @fopen ( $filename, "r" ) )
+ {
+ while ( !feof ( $fp ) )
+ {
+ $xml_content .= fgets ( $fp, 1024 );
+ }
+ @fclose( $file );
+ $xml_content = str_replace("\n","",$xml_content);
+ $xml_content = str_replace("\t","",$xml_content);
+ }
+ else
+ {
+ return false;
+ }
+ $url = getContent( getChild( $xml_content, "url" ), "url" );
+ echo "<span style=\"font-weight:bold;color:navy;\">$url</span><br /><br />";
+
+ // 2. is the site already existing ?
+ $site_id = "";
+ $result = mysql_query( "select id from $prefixeTable"."sites where galleries_url = '$url';" );
+ if ( mysql_num_rows($result ) == 0 )
+ {
+ // we have to register this site in the database
+ mysql_query( "insert into $prefixeTable"."sites (galleries_url) values ('$url');" );
+ $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
+ insert_remote_category( $xml_content, $site_id, "NULL", 0 );
+ }
+
+ // insert_remote_category search the "dir" node of the xml_dir given
+ // and insert the contained categories if the are not in the database yet.
+ // The function also delete 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 $prefixeTable,$conf;;
+
+ $categories = array();
+ $list_dirs = getChildren( $xml_dir, "dir".$level );
+ for ( $i = 0; $i < sizeof( $list_dirs ); $i++ )
+ {
+ // is the category already existing ?
+ $category_id = "";
+ $name = getContent( getChild( $list_dirs[$i], "name" ), "name" );
+ $categories[$i] = $name;
+ echo "
+ <img src=\"".$conf['lien_puce']."\"><span style=\"font-weight:bold;\">$name</span>
+ <div class=\"retrait\">";
+ $query = "select id from $prefixeTable"."categories";
+ $query.= " where site_id = '$site_id'";
+ $query.= " and dir = '$name'";
+ if ( $id_uppercat == "NULL" )
+ {
+ $query.= " and id_uppercat is NULL;";
+ }
+ else
+ {
+ $query.= " and id_uppercat = '$id_uppercat';";
+ }
+ //echo "<br />".$query;
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ // we have to create the category
+ $query = "insert into $prefixeTable"."categories (dir,site_id,id_uppercat) values ('$name','$site_id'";
+ if ( $id_uppercat == "NULL" )
+ {
+ $query.= ",NULL";
+ }
+ else
+ {
+ $query.= ",'$id_uppercat'";
+ }
+ $query.= ");";
+ //echo "<br />".$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'];
+ }
+ insert_remote_image( $list_dirs[$i], $category_id );
+ update_cat_info( $category_id );
+ insert_remote_category( $list_dirs[$i], $site_id, $category_id, $level + 1 );
+ echo "
+ </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 from $prefixeTable"."categories";
+ $query.= " where site_id = '$site_id'";
+ if ( $id_uppercat == "NULL" )
+ {
+ $query.= " and id_uppercat is NULL;";
+ }
+ else
+ {
+ $query.= " and id_uppercat = '$id_uppercat';";
+ }
+ $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'] );
+ }
+ }
+ }
+
+ // insert_remote_image search 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 $prefixeTable,$count_new,$lang;
+
+ $root = getChild( $xml_dir, "root" );
+ $pictures = array();
+ $xml_pictures = getChildren( $root, "picture" );
+ for ( $j = 0; $j < sizeof( $xml_pictures ); $j++ )
+ {
+ //<picture>
+ // <file>albatros.jpg</file>
+ // <tn_ext>png</tn_ext>
+ // <date>2002-04-14</date>
+ // <filesize>35</filesize>
+ // <width>640</width>
+ // <height>480</height>
+ //</picture>
+ $file = getContent( getChild( $xml_pictures[$j], "file" ), "file" );
+ $tn_ext = getContent( getChild( $xml_pictures[$j], "tn_ext" ), "tn_ext" );
+ $date = getContent( getChild( $xml_pictures[$j], "date" ), "date" );
+ $filesize = getContent( getChild( $xml_pictures[$j], "filesize" ), "filesize" );
+ $width = getContent( getChild( $xml_pictures[$j], "width" ), "width" );
+ $height = getContent( getChild( $xml_pictures[$j], "height" ), "height" );
+
+ $pictures[$j] = $file;
+
+ // is the picture already existing in the database ?
+ $query = "select id,tn_ext from $prefixeTable"."images where cat_id = '$category_id' and file = '$file';";
+ $result = mysql_query( $query );
+ $query = "";
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ $query = "insert into $prefixeTable"."images (file,cat_id,date_available,tn_ext,filesize,width,height) values ('$file','$category_id','$date','$tn_ext','$filesize','$width','$height');";
+ echo"
+ $file <span style=\"font-weight:bold;\">".$lang['update_research_added']."</span> (".$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 $prefixeTable"."images set tn_ext = '$tn_ext' where cat_id = '$category_id' and file = '$file';";
+ }
+ }
+ // 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 from $prefixeTable"."images where cat_id = '$category_id';";
+ $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'] );
+ }
+ }
+ }
+ //------------------------------------------------------------------------------
+ echo "<table style=\"width:100%;\">";
+ //------------------------------------------------------------------------------
+ // Display choice if "update" var is not specified
+ check_cat_id( $HTTP_GET_VARS['update'] );
+ if ( !isset( $HTTP_GET_VARS['update'] ) && !( isset( $page['cat'] ) || $HTTP_GET_VARS['update'] == 'cats' || $HTTP_GET_VARS['update'] == 'all' ) )
+ {
+ echo"
+ <tr><th>".$lang['update_default_title']."</th></tr>
+ <tr>
+ <td>
+ <div class=\"retrait\">
+ <img src=\"".$conf['lien_puce']."\" alt=\"&gt;\" /><a href=\"".add_session_id_to_url( "./admin.php?page=miseajour&amp;update=cats" )."\">".$lang['update_only_cat']."</a>
+ <br /><img src=\"".$conf['lien_puce']."\" alt=\"&gt;\" /><a href=\"".add_session_id_to_url( "./admin.php?page=miseajour&amp;update=all" )."\">".$lang['update_all']."</a>
+ </div>
+ </td>
+ </tr>";
+ }
+ //------------------------------------------------------------------------------
+ // Recherche des nouvelles images dans les repertoires
+ else
+ {
+ $count_new = 0;
+ $count_deleted = 0;
+ echo"
+ <tr><th>".$lang['update_part_research']."</th></tr>
+ <tr>
+ <td>
+ <div class=\"retrait\">";
+ if ( isset( $page['cat'] ) )
+ {
+ insert_local_category( $page['cat'] );
+ }
+ else
+ {
+ insert_local_category( "NULL" );
+ }
+ echo "<br /><span style=\"color:blue;\">$count_new ".$lang['update_research_conclusion']."</span>";
+ echo "<br /><span style=\"color:red;\">$count_deleted ".$lang['update_deletion_conclusion']."</span>";
+ echo "
+ </div>
+ </td>
+ </tr>";
+ }
+ //------------------------------------------------------------------------------
+ // Searching new pictures in the file listing.xml from a remote storage server
+ if ( @is_file( "./listing.xml" ) )
+ {
+ $count_new = 0;
+ $count_deleted = 0;
+ echo"
+ <tr><th>Site distant</th></tr>
+ <tr>
+ <td>
+ <div class=\"retrait\">";
+ remote_images();
+ echo "<br /><span style=\"color:blue;\">$count_new ".$lang['update_research_conclusion']."</span>";
+ echo "<br /><span style=\"color:red;\">$count_deleted ".$lang['update_deletion_conclusion']."</span>";
+ echo "
+ </div>
+ </td>
+ </tr>";
+ }
+ //------------------------------------------------------------------------------
+ echo "</table>";
+?> \ No newline at end of file
diff --git a/admin/perm.php b/admin/perm.php
new file mode 100644
index 000000000..2407d9f6f
--- /dev/null
+++ b/admin/perm.php
@@ -0,0 +1,270 @@
+<?php
+/***************************************************************************
+ * perm.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+ //---------------------------------------------------données de l'utilisateur
+ if ( isset( $HTTP_GET_VARS['user_id'] ) )
+ {
+ $query = "select id,pseudo,status from $prefixeTable"."users where id = '".$HTTP_GET_VARS['user_id']."';";
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $page['pseudo'] = $row['pseudo'];
+ $page['status'] = $row['status'];
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ echo"<div class=\"erreur\">".$lang['user_err_unknown']."</div>";
+ $erreur = true;
+ }
+ if ( $row['pseudo'] == $conf['webmaster'] )
+ {
+ echo"<div class=\"erreur\">".$lang['user_err_modify']."</div>";
+ $erreur = true;
+ }
+ }
+ //---------------------------------------------------données de la catégorie
+ if ( isset( $HTTP_GET_VARS['cat_id'] ) )
+ {
+ $HTTP_GET_VARS['cat'] = $HTTP_GET_VARS['cat_id'];
+ check_cat_id( $HTTP_GET_VARS['cat_id'] );
+ if ( isset( $page['cat'] ) )
+ {
+ $result = get_cat_info( $page['cat'] );
+ $page['cat_name'] = $result['name'];
+ $page['id_uppercat'] = $result['id_uppercat'];
+ }
+ }
+ //--------------------------------------------------------------- mise à jour
+ if ( isset( $HTTP_POST_VARS['submit'] ) )
+ {
+ if ( isset( $HTTP_GET_VARS['user_id'] ) )
+ {
+ mysql_query ( "delete from $prefixeTable"."restrictions where user_id = ".$HTTP_GET_VARS['user_id'].";" );
+ $result = mysql_query ( "select id from $prefixeTable"."categories;" );
+ while ( $row = mysql_fetch_array ( $result ) )
+ {
+ $nom_select = "acces-".$row['id'];
+ if ( $HTTP_POST_VARS[$nom_select] == 1 )
+ {
+ mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$HTTP_GET_VARS['user_id']."','".$row['id']."');" );
+ }
+ }
+ check_favorites( $HTTP_GET_VARS['user_id'] );
+ echo "<div class=\"info\">".$lang['permuser_info_message']." [ <a href=\"".add_session_id_to_url( "./admin.php?page=liste_users" )."\">".$lang['adduser_info_back']."</a> ]</div>";
+ }
+ else if ( isset( $HTTP_GET_VARS['cat_id'] ) )
+ {
+ mysql_query ( "delete from $prefixeTable"."restrictions where cat_id = '".$page['cat']."';" );
+ $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );
+ while ( $row = mysql_fetch_array ( $result ) )
+ {
+ $nom_select = "acces-".$row['id'];
+ if ( $HTTP_POST_VARS[$nom_select] == 1 )
+ {
+ mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$row['id']."','".$page['cat']."');" );
+ }
+ 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>";
+ }
+ }
+ //--------------------------------------------------------------- formulaire
+ function display_cat_manager( $id_uppercat, $indent, $uppercat_authorized, $level, $restriction )
+ {
+ global $prefixeTable,$lang,$conf;
+
+ $output = "";
+
+ // will we use <th> or <td> lines ?
+ if ( $level == 0 )
+ {
+ $start_line = "<th ";
+ $start_line2 = "<th ";
+ $end_line = "</th>";
+ }
+ else
+ {
+ $start_line = "<td ";
+ $end_line = "</td>";
+ if ( $level == 1 )
+ {
+ $start_line2 = "<td class=\"row1\" ";
+ }
+ else if ( $level == 2 )
+ {
+ $start_line2 = "<td class=\"row2\" ";
+ }
+ else if ( $level == 3 )
+ {
+ $start_line2 = "<td class=\"row3\" ";
+ }
+ else if ( $level == 4 )
+ {
+ $start_line2 = "<td class=\"row4\" ";
+ }
+ else
+ {
+ $start_line2 = "<td ";
+ }
+ }
+
+ $query = "select id,name,dir,rank";
+ $query.= " from $prefixeTable"."categories";
+ if ( !is_numeric( $id_uppercat ) )
+ {
+ $query.= " where id_uppercat is NULL";
+ }
+ else
+ {
+ $query.= " where id_uppercat = $id_uppercat";
+ }
+ $query.= " order by rank asc;";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $subcat_authorized = true;
+
+ $output.= "\n<tr>";
+ $output.= "\n\t".$start_line."style=\"width:85%;text-align:left;\">$indent<img src=\"".$conf['lien_puce']."\" alt=\"&gt;\" />&nbsp;";
+ if ( in_array( $row['id'], $restriction ) || !$uppercat_authorized )
+ {
+ $subcat_authorized = false;
+ $color = "red";
+ }
+ else
+ {
+ $color = "green";
+ }
+ $output.= "<span style=\"color:$color;\">";
+ if ( $row['name'] == "" )
+ {
+ $output.= str_replace( "_", " ", $row['dir'] );
+ }
+ else
+ {
+ $output.= $row['name'];
+ }
+ $output.= " [ dir : ".$row['dir']." ]";
+ $output.= "</span>".$end_line;
+ $output.= "\n\t".$start_line2." style=\"width:15%;white-space:nowrap;text-align:right;font-weight:normal;\">";
+ $output.= "\n\t\t<input type=\"radio\" name=\"acces-".$row['id']."\" value=\"0\" checked=\"checked\"/>".$lang['permuser_authorized'];
+ $output.= "\n\t\t<input type=\"radio\" name=\"acces-".$row['id']."\" value=\"1\"";
+ if ( in_array( $row['id'], $restriction ) )
+ {
+ $output.= " checked=\"checked\"";
+ }
+ $output.= "/>".$lang['permuser_forbidden'];
+ $output.= $end_line;
+ $output.= "\n<tr>";
+ $output.= display_cat_manager( $row['id'], $indent."&nbsp;&nbsp;&nbsp;&nbsp;", $subcat_authorized, $level + 1, $restriction );
+ }
+ return $output;
+ }
+
+ if ( !$erreur )
+ {
+ //----------------------------------------------
+ // cas 1 : permissions pour un utilisateur donné
+ if ( isset( $HTTP_GET_VARS['user_id'] ) )
+ {
+ echo"
+ <table style=\"width:100%;\">
+ <tr>
+ <th>".$lang['permuser_title']." \"".$page['pseudo']."\"</th>
+ </tr>
+ </table>";
+ $restriction = get_restrictions( $HTTP_GET_VARS['user_id'], $page['status'], false );
+ echo"
+ <form action=\"".add_session_id_to_url( "./admin.php?page=perm&amp;user_id=".$HTTP_GET_VARS['user_id'] )."\" method=\"post\">
+ <div style=\"color:darkblue;margin:10px;text-align:center;\">".$lang['permuser_warning']."</div>
+ <table style=\"width:100%;\">";
+
+ echo display_cat_manager( "NULL", "&nbsp;&nbsp;&nbsp;&nbsp;", true, 0, $restriction );
+
+ echo"
+ <tr>
+ <td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ <table>
+ </form>";
+ }
+ //----------------------------------------------
+ // cas 2 : permissions pour une catégorie donnée
+ else if ( isset( $HTTP_GET_VARS['cat_id'] ) )
+ {
+ echo"
+ <table style=\"width:100%;\">
+ <tr>
+ <th>".$lang['permuser_cat_title']."\"".get_cat_display_name( $page['cat_name'], " - ", "font-style:italic;" )."\"</th>
+ </tr>
+ </table>";
+ echo"
+ <form action=\"".add_session_id_to_url( "./admin.php?page=perm&amp;cat_id=".$page['cat'] )."\" method=\"post\">
+ <table style=\"width:100%;\">";
+
+ $result = mysql_query( "select id,pseudo,status from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );
+ $i = 0;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $restrictions = get_restrictions( $row['id'], $row['status'], false );
+ $is_user_allowed = is_user_allowed( $page['cat'], $restrictions );
+ $class = "";
+ if ( $i%2 == 1 )
+ {
+ $class = "class=\"row2\"";
+ }
+ echo"
+ <tr>
+ <td $class><a href=\"".add_session_id_to_url( "./admin.php?page=perm&amp;user_id=".$row['id'] )."\">";
+ echo "<span style=\"color:";
+ if ( $is_user_allowed > 0 )
+ {
+ echo "red";
+ }
+ else
+ {
+ echo "green";
+ }
+ echo "\">".$row['pseudo']."</span></a></td>
+ <td $class style=\"text-align:right;\">";
+ if ( $is_user_allowed == 2 )
+ {
+ echo "<a href=\"".add_session_id_to_url( "./admin.php?page=perm&amp;cat_id=".$page['id_uppercat'] )."\"><span style=\"color:red;\">".$lang['permuser_parent_forbidden']."</span></a>";
+ }
+ else
+ {
+ echo"
+ <input type=\"radio\" name=\"acces-".$row['id']."\" value=\"0\" checked=\"checked\"/>".$lang['permuser_authorized']."
+ <input type=\"radio\" name=\"acces-".$row['id']."\" value=\"1\"";
+ if ( $is_user_allowed == 1 )
+ {
+ echo" checked=\"checked\"";
+ }
+ echo"/>".$lang['permuser_forbidden'];
+ }
+ echo"
+ </td>
+ </tr>";
+ $i++;
+ }
+ echo"
+ <tr>
+ <td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ </table>
+ </form>";
+ }
+ }
+?> \ No newline at end of file
diff --git a/admin/thumbnail.php b/admin/thumbnail.php
new file mode 100644
index 000000000..e68ee2407
--- /dev/null
+++ b/admin/thumbnail.php
@@ -0,0 +1,568 @@
+<?php
+/***************************************************************************
+ * thumbnail.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Thursday, July 25, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+
+function get_subdirs( $rep )
+{
+ $sub_rep = array();
+ $i = 0;
+ if ( $opendir = opendir ( $rep ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( $file != "thumbnail" && $file != "."
+ && $file != ".." && is_dir ( $rep.$file ) )
+ {
+ $sub_rep[$i++] = $file;
+ }
+ }
+ }
+ return $sub_rep;
+}
+
+/*
+ $tab_ext = array ( 'jpg', 'JPG','png','PNG' );
+ $tab_tn_ext = array ( 'jpg', 'JPG','png','PNG', 'gif', 'GIF' );
+*/
+function get_images_without_thumbnail( $dir )
+{
+ $i = 0;
+ if ( $opendir = opendir ( $dir ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ $lien_image = $dir."/".$file;
+ if ( is_image( $lien_image, true ) )
+ {
+ if ( !TN_exist( $dir, $file ) )
+ {
+ $taille_image = getimagesize( $lien_image );
+ $size = floor ( filesize( $lien_image ) / 1024 ). " KB";
+ $images[$i++] = array( 'name' => $file,
+ 'width' => $taille_image[0],
+ 'height' => $taille_image[1],
+ 'size' => $size
+ );
+ }
+ }
+ }
+ }
+ return $images;
+}
+
+function scandir( $DIR, $width, $height )
+{
+ global $HTTP_POST_VARS, $conf, $output;
+ $compteur = 0;
+ $temps = array();
+ if ( $ODIR = opendir( $DIR ) )
+ {
+ while ( $FILE = readdir ( $ODIR ) )
+ {
+ $TMP = $DIR."/".$FILE;
+ if ( is_image ( $TMP, true ) )
+ {
+ if ( $compteur < $HTTP_POST_VARS['n'] && !TN_exist( $DIR, $FILE ) )
+ {
+ $t1 = explode( " ", microtime() );
+ $t2 = explode( ".", $t1[0] );
+ $t2 = $t1[1].".".$t2[1];
+ $info = RatioResizeImg( $FILE, $width, $height, $DIR."/", "jpg" );
+ $t3 = explode( " ", microtime() );
+ $t4 = explode( ".", $t3[0] );
+ $t4 = $t3[1].".".$t4[1];
+ $info['temps'] = ( $t4 - $t2 ) * 1000;
+ $temps[$compteur++] = $info;
+ //$output.= " (".number_format( $temps[$compteur-1], 2, '.', ' ')." ms)<br />";;
+ }
+ }
+ }
+ }
+ return $temps;
+}
+
+function RatioResizeImg( $image, $newWidth, $newHeight, $path, $extension)
+{
+ global $conf, $HTTP_POST_VARS;
+ // chemin complet de l'image :
+ $chemin = $path.$image;
+ // détéction du type de l'image
+ eregi( "(...)$", $chemin, $regs);
+ $type = $regs[1];
+ switch( $type )
+ {
+ case "jpg": $srcImage = @imagecreatefromjpeg( $chemin ); break;
+ case "JPG": $srcImage = @imagecreatefromjpeg( $chemin ); break;
+ case "png": $srcImage = @imagecreatefrompng( $chemin ); break;
+ case "PNG": $srcImage = @imagecreatefrompng( $chemin ); break;
+ default : unset( $type ); break;
+ }
+
+ if( $srcImage )
+ {
+ // hauteurs/largeurs
+ $srcWidth = imagesx( $srcImage );
+ $srcHeight = imagesy( $srcImage );
+ $ratioWidth = $srcWidth/$newWidth;
+ $ratioHeight = $srcHeight/$newHeight;
+
+ // taille maximale dépassée ?
+ if (($ratioWidth > 1) || ($ratioHeight > 1))
+ {
+ if( $ratioWidth < $ratioHeight)
+ {
+ $destWidth = $srcWidth/$ratioHeight;
+ $destHeight = $newHeight;
+ }
+ else
+ {
+ $destWidth = $newWidth;
+ $destHeight = $srcHeight/$ratioWidth;
+ }
+ }
+ else
+ {
+ $destWidth = $srcWidth;
+ $destHeight = $srcHeight;
+ }
+ // selon votre version de GD installée sur le serveur hébergeur
+ if ( $HTTP_POST_VARS['gd'] == 2 )
+ {
+ // Partie 1 : GD 2.0 ou supérieur, résultat très bons
+ $destImage = imagecreatetruecolor( $destWidth, $destHeight);
+ imagecopyresampled( $destImage, $srcImage, 0, 0, 0, 0, $destWidth,$destHeight,$srcWidth,$srcHeight );
+ }
+ else
+ {
+ // Partie 2 : GD inférieur à 2, résultat très moyens
+ $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['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension;
+
+ // création et sauvegarde de l'image finale
+ imagejpeg($destImage, $dest_file);
+ // libère la mémoire
+ imagedestroy( $srcImage );
+ imagedestroy( $destImage );
+
+ // renvoit l'URL de l'image
+ //return $dest_file;
+ $taille_image = getimagesize( $chemin );
+ $size = number_format( floor ( filesize( $chemin ) / 1024 ), 0, '', ' ')." KB";
+ $tn_taille_image = getimagesize( $dest_file );
+ $tn_size = number_format( floor ( filesize( $dest_file ) ), 0, '', ' ')." octets";
+ $info = array( 'name' => $image,
+ 'width' => $taille_image[0],
+ 'height' => $taille_image[1],
+ 'size' => $size,
+ 'tn_name' => $conf['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension,
+ 'tn_width' => $tn_taille_image[0],
+ 'tn_height' => $tn_taille_image[1],
+ 'tn_size' => $tn_size
+ );
+ return $info;
+ }
+ // erreur
+ else
+ {
+ echo $lang['tn_no_support']." ";
+ if ($type)
+ {
+ echo $lang['tn_format']." $type";
+ }
+ else
+ {
+ echo $lang['tn_thisformat'];
+ }
+ exit();
+ }
+}
+
+function array_max( $array )
+{
+ $max = 0;
+ for ( $i = 0; $i < sizeof( $array ); $i++ )
+ {
+ if ( $array[$i] > $max )
+ {
+ $max = $array[$i];
+ }
+ }
+ return $max;
+}
+
+function array_min( $array )
+{
+ $min = 99999999999999;
+ for ( $i = 0; $i < sizeof( $array ); $i++ )
+ {
+ if ( $array[$i] < $min )
+ {
+ $min = $array[$i];
+ }
+ }
+ return $min;
+}
+
+function array_moy( $array )
+{
+ return array_sum( $array ) / sizeof( $array );
+}
+
+// get_dirs retourne un tableau contenant tous les sous-répertoires d'un répertoire
+function get_displayed_dirs( $rep, $indent )
+{
+ global $conf,$lang;
+
+ $sub_rep = array();
+ $i = 0;
+ $dirs = "";
+ if ( $opendir = opendir ( $rep ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( $file != "." && $file != ".." && is_dir ( $rep."/".$file ) && $file != "thumbnail" )
+ {
+ $sub_rep[$i++] = $file;
+ }
+ }
+ }
+ // write of the dirs
+ for ( $i = 0; $i < sizeof( $sub_rep ); $i++ )
+ {
+ $images = get_images_without_thumbnail( $rep."/".$sub_rep[$i] );
+ $nb_picture_without_TN = sizeof( $images );
+ $dirs.= $indent;
+ if ( $nb_picture_without_TN > 0 )
+ {
+ $dirs.= "<a href=\"".add_session_id_to_url( "./admin.php?page=thumbnail&amp;dir=".$rep."/".$sub_rep[$i] )."\">";
+ }
+ $dirs.= "<img src=\"".$conf['lien_puce']."\" style=\"border:none;\" alt=\"&gt;\"/>".$sub_rep[$i];
+ if ( $nb_picture_without_TN > 0 )
+ {
+ $dirs.= "</a>";
+ }
+ if ( $nb_picture_without_TN > 0 )
+ {
+ $dirs.= " [ $nb_picture_without_TN ".$lang['tn_dirs_alone']." ]";
+ }
+ $dirs.= "<br />";
+ $dirs.= get_displayed_dirs( $rep."/".$sub_rep[$i], $indent."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" );
+ }
+ return $dirs;
+}
+
+$output = "";
+
+if ( isset( $HTTP_GET_VARS['dir'] ) )
+{
+ //---------------vérification de la présence d'images sans thumbnail
+ $images = get_images_without_thumbnail( $HTTP_GET_VARS['dir'] );
+ if ( sizeof( $images ) == 0 )
+ {
+ $output.= "<div style=\"text-align:center;font-weight:bold;margin:10px;\"> [ 0 ".$lang['tn_dirs_alone']." ]</div>";
+ }
+ else if ( isset( $HTTP_POST_VARS['submit'] ) )
+ {
+ //----------------------------------------vérification des variables
+ $nb_erreur = 0;
+ $erreur = "";
+ if ( !ereg( "^[0-9]{2,3}$", $HTTP_POST_VARS['width'] ) || $HTTP_POST_VARS['width'] < 10 )
+ {
+ $nb_erreur++;
+ $erreur.= "<li>".$lang['tn_err_width']." 10</li>";
+ }
+ if ( !ereg( "^[0-9]{2,3}$", $HTTP_POST_VARS['height'] ) || $HTTP_POST_VARS['height'] < 10 )
+ {
+ $nb_erreur++;
+ $erreur.= "<li>".$lang['tn_err_height']." 10</li>";
+ }
+ if ( !isset( $HTTP_POST_VARS['gd'] ) )
+ {
+ $nb_erreur++;
+ $erreur.= "<li>".$lang['tn_err_GD']."</li>";
+ }
+
+ //---------------------------------------------listing des résultats
+ if ( $nb_erreur == 0 )
+ {
+ $style = "class=\"row2\" style=\"text-align:center;font-weight:bold;";
+ $output.= "
+ <table style=\"width:100%;\">
+ <tr>
+ <th colspan=\"10\">".$lang['tn_results_title']."</th>
+ </tr>
+ <tr>
+ <td ".$style."\">&nbsp;</td>
+ <td ".$style."\">".$lang['tn_picture']."</td>
+ <td ".$style."\">".$lang['tn_filesize']."</td>
+ <td ".$style."\">".$lang['tn_width']."</td>
+ <td ".$style."\">".$lang['tn_height']."</td>
+ <td ".$style."background-color:#D3DCE3;\">".$lang['tn_results_gen_time']."</td>
+ <td ".$style."\">".$lang['thumbnail']."</td>
+ <td ".$style."\">".$lang['tn_filesize']."</td>
+ <td ".$style."\">".$lang['tn_width']."</td>
+ <td ".$style."\">".$lang['tn_height']."</td>
+ </tr>";
+ $tab_infos = scandir( $HTTP_GET_VARS['dir'], $HTTP_POST_VARS['width'], $HTTP_POST_VARS['height'] );
+ for ( $i = 0; $i < sizeof ( $tab_infos ); $i++ )
+ {
+ $temps[$i] = $tab_infos[$i]['temps'];
+ }
+ $max = array_max( $temps );
+ $min = array_min( $temps );
+ for ( $i = 0; $i < sizeof ( $tab_infos ); $i++ )
+ {
+ $temps[$i] = $tab_infos[$i]['temps'];
+ $num = $i + 1;
+ $class = "";
+ if ( $i%2 == 1 )
+ {
+ $class = "class=\"row2\"";
+ }
+ $output.= "
+ <tr>
+ <td class=\"row2\">$num</td>
+ <td $class>".$tab_infos[$i]['name']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['size']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['width']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['height']."</td>
+ <th><div style=\"text-align:right;margin-right:5px;";
+ if ( $tab_infos[$i]['temps'] == $max )
+ {
+ $output.= "color:red;";
+ }
+ if ( $tab_infos[$i]['temps'] == $min )
+ {
+ $output.= "color:green;";
+ }
+ $output.= "\">".number_format( $tab_infos[$i]['temps'], 2, '.', ' ')." ms</div></th>
+ <td $class>".$tab_infos[$i]['tn_name']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['tn_size']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['tn_width']."</td>
+ <td $class style=\"text-align:right;\">".$tab_infos[$i]['tn_height']."</td>
+ </tr>";
+ }
+ $output.= "
+ <tr>
+ <td colspan=\"10\">&nbsp;</td>
+ </tr>
+ </table>
+ <table style=\"margin:auto;border:1px solid black;\">
+ <tr>
+ <td colspan=\"2\" style=\"text-align:center;font-weight:bold;\" class=\"row2\">".$lang['tn_stats']."</td>
+ </tr>
+ <tr>
+ <td>".$lang['tn_stats_nb']." : </td>
+ <td style=\"text-align:center;\">".sizeof( $temps )."</td>
+ </tr>
+ <tr>
+ <td>".$lang['tn_stats_total']." : </td>
+ <td style=\"text-align:right;\">".number_format( array_sum( $temps ), 2, '.', ' ')." ms</td>
+ </tr>
+ <tr>
+ <td>".$lang['tn_stats_max']." : </td>
+ <td style=\"text-align:right;\">".number_format( $max, 2, '.', ' ')." ms</td>
+ </tr>
+ <tr>
+ <td>".$lang['tn_stats_min']." : </td>
+ <td style=\"text-align:right;\">".number_format( $min, 2, '.', ' ')." ms</td>
+ </tr>
+ <tr>
+ <td>".$lang['tn_stats_mean']." : </td>
+ <td style=\"text-align:right;\">".number_format( array_moy( $temps ), 2, '.', ' ')." ms</td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ </table>";
+ }
+ else
+ {
+ $output.= "
+ <div class=\"erreur\" style=\"margin-top:10px;\">".$lang['tn_err']."</div>
+ <div class=\"erreur\" style=\"text-align:left;margin-left:20px;\">
+ <ul>
+ $erreur
+ </ul>
+ </div>";
+ }
+ }
+ //-------------------------------------paramètres de miniaturisation
+ if ( sizeof( $images ) != 0 )
+ {
+ $output.= "
+ <style>
+ div.key
+ {
+ margin-left : 10px;
+ }
+ td.choice
+ {
+ text-align : center;
+ }
+ </style>";
+ $output.= "
+ <form method=\"post\" action=\"".add_session_id_to_url( "./admin.php?page=thumbnail&amp;dir=".$HTTP_GET_VARS['dir'] )."\">
+ <table style=\"width:100%;\">
+ <tr>
+ <th colspan=\"3\">".$lang['tn_params_title']."</th>
+ </tr>";
+ $output.= "
+ <tr>
+ <td colspan=\"3\">&nbsp;</td>
+ </tr>";
+ $output.= "
+ <tr>
+ <td><div class=\"key\">".$lang['tn_params_GD']."</div></td>
+ <td class=\"choice\">
+ <input type=\"radio\" name=\"gd\" value=\"2\"/ checked=\"checked\">2.x
+ <input type=\"radio\" name=\"gd\" value=\"1\"";
+ if ( $HTTP_POST_VARS['gd'] == 1 )
+ {
+ $output.= " checked=\"checked\"";
+ }
+ $output.= "/>1.x
+ </td>
+ <td style=\"width:50%;\" class=\"row2\">".$lang['tn_params_GD_info']."</td>
+ </tr>
+ <tr>
+ <td><div class=\"key\">".$lang['tn_width']."</div></td>
+ <td class=\"choice\"><input type=\"text\" name=\"width\" value=\"";
+ if ( isset( $HTTP_POST_VARS['width'] ) )
+ {
+ $output.= $HTTP_POST_VARS['width'];
+ }
+ else
+ {
+ $output.= "128";
+ }
+ $output.="\"/></td>
+ <td class=\"row2\">".$lang['tn_params_width_info']."</td>
+ </tr>
+ <tr>
+ <td><div class=\"key\">".$lang['tn_height']."</div></td>
+ <td class=\"choice\"><input type=\"text\" name=\"height\" value=\"";
+ if ( isset( $HTTP_POST_VARS['height'] ) )
+ {
+ $output.= $HTTP_POST_VARS['height'];
+ }
+ else
+ {
+ $output.= "96";
+ }
+ $output.="\"/></td>
+ <td class=\"row2\">".$lang['tn_params_height_info']."</td>
+ </tr>
+ <tr>
+ <td><div class=\"key\">".$lang['tn_params_create']."</div></td>
+ <td class=\"choice\">
+ <select name=\"n\">
+ <option>5</option>
+ <option>10</option>
+ <option>20</option>
+ <option>40</option>
+ </select>
+ </td>
+ <td class=\"row2\">".$lang['tn_params_create_info']."</td>
+ </tr>
+ <tr>
+ <td><div class=\"key\">".$lang['tn_params_format']."</div></td>
+ <td class=\"choice\"><span style=\"font-weight:bold;\">jpeg</span></td>
+ <td class=\"row2\">".$lang['tn_params_format_info']."</td>
+ </tr>
+ <tr>
+ <td colspan=\"3\">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan=\"3\" style=\"text-align:center;\">
+ <input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\"/>
+ </td>
+ </tr>";
+ $output.= "
+ </table>
+ </form>";
+ //-----------------------------------liste des images sans miniature
+ $images = get_images_without_thumbnail( $HTTP_GET_VARS['dir'] );
+ $style = "class=\"row2\" style=\"text-align:center;font-weight:bold;";
+ $output.= "
+ <table style=\"width:100%;\">
+ <tr>
+ <th colspan=\"5\"><span style=\"color:#006699;\">".sizeof( $images )."</span> ".$lang['tn_alone_title']."</th>
+ </tr>
+ <tr>
+ <td ".$style."\">&nbsp;</td>
+ <td ".$style."width:50%;\">".$lang['tn_picture']."</td>
+ <td ".$style."width:17%;\">".$lang['tn_filesize']."</td>
+ <td ".$style."width:17%;\">".$lang['tn_width']."</td>
+ <td ".$style."width:16%;\">".$lang['tn_height']."</td>
+ </tr>";
+ for ( $i = 0; $i < sizeof( $images ); $i++ )
+ {
+ $num = $i + 1;
+ $class = "";
+ if ( $i%2 == 1 )
+ {
+ $class = " class=\"row2\"";
+ }
+ $output.= "
+ <tr>
+ <td class=\"row2\">".$num."</td>
+ <td $class><div style=\"margin-left:10px;\">".$images[$i]['name']."</div></td>
+ <td $class><div style=\"margin-left:10px;\">".$images[$i]['size']."</div></td>
+ <td $class><div style=\"margin-left:10px;\">".$images[$i]['width']."</div></td>
+ <td $class><div style=\"margin-left:10px;\">".$images[$i]['height']."</div></td>
+ </tr>";
+ }
+ $output.= "
+ </table>";
+ }
+}
+//-----------------------------------liste des répertoires
+//-------------------------si aucun répertoire selectionné
+else
+{
+ $output = "
+ <table style=\"width:100%;\">
+ <tr>
+ <th>".$lang['tn_dirs_title']."</th>
+ </tr>";
+ $output.= "
+ <tr>
+ <td>
+ <div class=\"retrait\">
+ <img src=\"".$conf['lien_puce']."\" alt=\"\"/>galleries";
+ $output.= "<br />";
+ $output.= get_displayed_dirs( "../galleries", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" );
+ $output.= "
+ </div>
+ </td>
+ </tr>
+ </table>";
+}
+echo $output;
+?> \ No newline at end of file
diff --git a/admin/user_add.php b/admin/user_add.php
new file mode 100644
index 000000000..cf67dcaa3
--- /dev/null
+++ b/admin/user_add.php
@@ -0,0 +1,255 @@
+<?php
+/***************************************************************************
+ * ajout.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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' );
+
+$error = array();
+$absent = false;
+
+$query = 'select';
+$query.= ' pseudo,status,mail_address';
+$query.= ' from '.$prefixeTable.'users';
+$query.= ' where id = '.$_GET['user_id'];
+$query.= ';';
+$row = mysql_fetch_array( mysql_query( $query ) );
+
+$pseudo = $row['pseudo'];
+$status = $row['status'];
+$mail_address = $row['mail_address'];
+
+if ( $pseudo == 'visiteur' ||
+ ( $pseudo == $conf['webmaster']
+ && $user['pseudo'] != $conf['webmaster'] ) )
+{
+ echo "<div class=\"erreur\">".$lang['user_err_modify']."</div>";
+ $absent = true;
+}
+if ( $_GET['mode'] == 'modif' )
+{
+ if ( $pseudo == '' )
+ {
+ echo"<div class=\"info\">".$lang['user_err_unknown']."</div>";
+ $absent = true;
+ }
+}
+if ( !$absent )
+{
+ if ( $_GET['valider'] == 1 )
+ {
+ if ( $_GET['mode'] != 'modif' )
+ {
+ $error = register_user( $_POST['pseudo'], $_POST['password'],
+ $_POST['password'], $_POST['mail_address'],
+ $_POST['status'] );
+ }
+ else
+ {
+ $use_new_password = false;
+ if ( $_POST['use_new_pwd'] == 1)
+ {
+ $use_new_password = true;
+ }
+ $error = update_user( $_GET['user_id'], $_POST['mail_address'],
+ $_POST['status'], $use_new_password,
+ $_POST['password'] );
+ }
+ }
+ if ( sizeof( $error ) > 0 )
+ {
+ echo "<div class=\"erreur\">".$lang['adduser_err_message'].sizeof( $error )." :";
+ echo "<ul>";
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ echo "<li>".$error[$i]."</li>";
+ }
+ echo "</ul>";
+ echo "</div>";
+ }
+ if ( sizeof( $error ) == 0 && $_GET['valider'] == 1 )
+ {
+ echo"<div class=\"info\">".$lang['adduser_info_message']."\"$pseudo\" ";
+ if ( $_POST['use_new_pwd'] == 1 )
+ {
+ echo $lang['adduser_info_password_updated']." ";
+ }
+ echo"[ <a href=\"".add_session_id_to_url( "./admin.php?page=liste_users" )."\">".$lang['adduser_info_back']."</a> ]</div>";
+ }
+ if ( $_GET['valider'] != 1 || $_GET['mode'] != "modif" || sizeof( $error ) > 0 )
+ {
+ if ( $_GET['mode'] != "modif" && sizeof( $error ) == 0 )
+ {
+ unset( $pseudo, $password, $status, $mail_address );
+ }
+ if ( !isset( $_POST['use_new_pwd'] ) || $_POST['use_new_pwd'] != 1 )
+ {
+ unset( $password );
+ }
+ $action = "./admin.php?page=ajout&amp;valider=1";
+ if ( $_GET['mode'] == "modif" )
+ {
+ $action.= "&amp;mode=modif&amp;user_id=".$_GET['user_id'];
+ }
+ echo"<form method=\"post\" action=\"".add_session_id_to_url( $action )."\">
+ <table style=\"width:100%;\">
+ <tr align=\"center\" valign=\"middle\">
+ <td>
+ <table style=\"margin-left:auto;margin-right:auto;\">
+ <tr>
+ <th colspan=\"2\">".$lang['adduser_fill_form']."</th>
+ </tr>
+ <tr>
+ <td colspan=\"2\"><div style=\"margin-bottom:0px;\">&nbsp;</div></td>
+ </tr>
+ <tr>
+ <td>".$lang['adduser_login']."</td>
+ <td>";
+ if ( $_GET['mode'] == "modif" )
+ {
+ echo"<span style=\"color:red;\">$pseudo [".$lang['adduser_unmodify']."]</span>";
+ echo"<input type=\"hidden\" name=\"pseudo\" value=\"$pseudo\"/>";
+ }
+ else
+ {
+ echo"<input type=\"text\" name=\"pseudo\" value=\"$pseudo\"/>";
+ }
+ echo"
+ </td>
+ </tr>";
+ echo"
+ <tr>
+ <td>";
+ if ( $_GET['mode'] == "modif" )
+ {
+ echo $lang['new']." ".$lang['password']."<input type=\"checkbox\" name=\"use_new_pwd\" value=\"1\"";
+ if ( isset( $_POST['use_new_pwd'] ) && $_POST['use_new_pwd'] == 1 )
+ {
+ echo " checked=\"checked\"";
+ }
+ echo " />";
+ }
+ else
+ {
+ echo $lang['password'];
+ }
+ echo"</td>
+ <td>";
+ echo"<input type=\"text\" name=\"password\" value=\"$password\"/></td>
+ </tr>";
+ echo"
+ <tr>
+ <td>".$lang['reg_mail_address']."</td>";
+ echo "
+ <td><input type=\"text\" name=\"mail_address\" value=\"$mail_address\"/></td>
+ </tr>";
+ echo"
+ <tr>
+ <td>".$lang['adduser_status']."</td>
+ <td>";
+ if ( $pseudo == $conf['webmaster'] )
+ {
+ echo "<span style=\"color:red;\">$status [".$lang['adduser_unmodify']."]</span>
+ <input type=\"hidden\" name=\"status\" value=\"$status\"/>";
+ }
+ else
+ {
+ echo"
+ <select name=\"status\">";
+ // on récupère toutes les status possibles dans la base
+ // par l'intermédiaire de la fonction get_enums
+ $option = get_enums( $prefixeTable."users", "status" );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ if ( isset( $status ) )
+ {
+ echo"
+ <option value=\"$option[$i]\"";
+ if ( $option[$i] == $status )
+ {
+ echo" selected=\"selected\"";
+ }
+ echo">";
+ switch ( $option[$i] )
+ {
+ case "admin" :
+ {
+ echo $lang['adduser_status_admin'];
+ break;
+ }
+ case "membre" :
+ {
+ echo $lang['adduser_status_member'];
+ break;
+ }
+ case "visiteur" :
+ {
+ echo $lang['adduser_status_guest'];
+ break;
+ }
+ }
+ echo"</option>";
+ }
+ else
+ {
+ echo"
+ <option value=\"$option[$i]\"";
+ if ( $option[$i] == "visiteur" )
+ {
+ echo" selected=\"selected\"";
+ }
+ echo">";
+ switch ( $option[$i] )
+ {
+ case "admin" :
+ {
+ echo $lang['adduser_status_admin'];
+ break;
+ }
+ case "membre" :
+ {
+ echo $lang['adduser_status_member'];
+ break;
+ }
+ case "visiteur" :
+ {
+ echo $lang['adduser_status_guest'];
+ break;
+ }
+ }
+ echo"</option>";
+ }
+ }
+ echo"
+ </select>";
+ }
+ echo"
+ </td>
+ </tr>
+ <tr>
+ <td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </form>";
+ if ( $_GET['mode'] == "modif" )
+ {
+ echo "<div style=\"text-align:center;margin-bottom:10px;\">[ <a href=\"".add_session_id_to_url( "./admin.php?page=liste_users" )."\">".$lang['adduser_info_back']."</a> ]</div>";
+ }
+ }
+}
+?> \ No newline at end of file
diff --git a/admin/user_list.php b/admin/user_list.php
new file mode 100644
index 000000000..8221ed30f
--- /dev/null
+++ b/admin/user_list.php
@@ -0,0 +1,244 @@
+<?php
+/***************************************************************************
+ * liste_users.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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' );
+// language
+$vtp->setGlobalVar( $sub, 'listuser_confirm', $lang['listuser_confirm'] );
+$vtp->setGlobalVar( $sub, 'listuser_modify_hint',
+ $lang['listuser_modify_hint'] );
+$vtp->setGlobalVar( $sub, 'listuser_modify', $lang['listuser_modify'] );
+$vtp->setGlobalVar( $sub, 'listuser_permission',
+ $lang['listuser_permission'] );
+$vtp->setGlobalVar( $sub, 'listuser_permission_hint',
+ $lang['listuser_permission_hint'] );
+$vtp->setGlobalVar( $sub, 'listuser_delete_hint',
+ $lang['listuser_delete_hint'] );
+$vtp->setGlobalVar( $sub, 'listuser_delete', $lang['listuser_delete'] );
+$vtp->setGlobalVar( $sub, 'yes', $lang['yes'] );
+$vtp->setGlobalVar( $sub, 'no', $lang['no'] );
+$vtp->setGlobalVar( $sub, 'listuser_button_all',
+ $lang['listuser_button_all'] );
+$vtp->setGlobalVar( $sub, 'listuser_button_invert',
+ $lang['listuser_button_invert'] );
+$vtp->setGlobalVar( $sub, 'listuser_button_create_address',
+ $lang['listuser_button_create_address'] );
+//--------------------------------------------------------------- delete a user
+if ( isset ( $_GET['delete'] ) && is_numeric( $_GET['delete'] ) )
+{
+ $query = 'select pseudo';
+ $query.= ' from '.$prefixeTable.'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['pseudo'] );
+ $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['pseudo'] != 'visiteur' && $row['pseudo'] != $conf['webmaster'] )
+ {
+ $query = 'select count(*) as nb_result';
+ $query.= ' from '.$prefixeTable.'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['pseudo'].'" '.$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
+{
+ $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,pseudo,status,mail_address';
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= ' order by status asc, pseudo 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 'visiteur' :
+ {
+ $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'] != '' && $row['pseudo'] != 'visiteur' )
+ {
+ $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['pseudo'] == $conf['webmaster'] )
+ {
+ $vtp->setVar( $sub, 'user.color', 'red' );
+ }
+ if ( $row['pseudo'] == "visiteur" )
+ {
+ $vtp->setVar( $sub, 'user.color', 'green' );
+ }
+ $vtp->setVar( $sub, 'user.login', $row['pseudo'] );
+ // modify or not modify ?
+ if ( $row['pseudo'] == "visiteur"
+ || ( $row['pseudo'] == $conf['webmaster']
+ && $user['pseudo'] != $conf['webmaster'] ) )
+ {
+ $vtp->addSession( $sub, 'not_modify' );
+ $vtp->closeSession( $sub, 'not_modify' );
+ }
+ else
+ {
+ $vtp->addSession( $sub, 'modify' );
+ $url = './admin.php?page=user_add&amp;mode=modif&amp;user_id=';
+ $url.= $row['id'];
+ $vtp->setVar( $sub, 'modify.url', add_session_id( $url ) );
+ $vtp->setVar( $sub, 'modify.login', $row['pseudo'] );
+ $vtp->closeSession( $sub, 'modify' );
+ }
+ // manage permission or not ?
+ if ( $row['pseudo'] == $conf['webmaster'] )
+ {
+ $vtp->addSession( $sub, 'not_permission' );
+ $vtp->closeSession( $sub, 'not_permission' );
+ }
+ else
+ {
+ $vtp->addSession( $sub, 'permission' );
+ $url = './admin.php?page=perm&amp;user_id='.$row['id'];
+ $vtp->setVar( $sub, 'permission.url', add_session_id( $url ) );
+ $vtp->setVar( $sub, 'permission.login', $row['pseudo'] );
+ $vtp->closeSession( $sub, 'permission' );
+ }
+ // is the user deletable or not ?
+ if ( $row['pseudo'] == 'visiteur' || $row['pseudo'] == $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['pseudo'] );
+ $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';
+ $query.= ' id,mail_address';
+ $query.= ' from '.$prefixeTable.'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 );
+?> \ No newline at end of file
diff --git a/admin/waiting.php b/admin/waiting.php
new file mode 100644
index 000000000..9e8f16dcc
--- /dev/null
+++ b/admin/waiting.php
@@ -0,0 +1,117 @@
+<?php
+/***************************************************************************
+ * waiting.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Monday, October 28, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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" );
+ //-------------------------------------------------------------- mise à jour
+ if ( isset( $HTTP_POST_VARS['submit'] ) )
+ {
+ $query = "select id,cat_id,file,tn_ext";
+ $query.= " from $prefixeTable"."waiting";
+ $query.= ";";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $key = "validate-".$row['id'];
+ if ( isset( $HTTP_POST_VARS[$key] ) )
+ {
+ $query = "delete from $prefixeTable"."waiting";
+ $query.= " where id = ".$row['id'];
+ $query.= ";";
+ mysql_query( $query );
+ if ( $HTTP_POST_VARS[$key] == "false" )
+ {
+ // we have to delete the picture and the thumbnail if it exists
+ $cat = get_cat_info( $row['cat_id'] );
+ unlink( ".".$cat['dir'].$row['file'] );
+ if ( $row['tn_ext'] != "" )
+ {
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+ unlink( ".".$cat['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'] );
+ }
+ }
+ }
+ }
+ }
+ //--------------------------------------------------------------- formulaire
+ $cat_names = array();
+ echo "
+ <form action=\"".add_session_id_to_url( "./admin.php?page=waiting" )."\" method=\"post\">
+ <table style=\"width:100%;\">
+ <tr>
+ <th style=\"width:20%;\">".$lang['category']."</th>
+ <th style=\"width:20%;\">".$lang['date']."</th>
+ <th style=\"width:20%;\">".$lang['file']."</th>
+ <th style=\"width:20%;\">".$lang['thumbnail']."</th>
+ <th style=\"width:20%;\">".$lang['author']."</th>
+ <th style=\"width:1px;\">&nbsp;</th>
+ </tr>";
+ $query = "select id,cat_id,file,username,mail_address,date,tn_ext";
+ $query.= " from $prefixeTable"."waiting";
+ $query.= " order by cat_id";
+ $query.= ";";
+ $result = mysql_query( $query );
+ $i = 0;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $style = "";
+ if ( $i%2 == 0 )
+ {
+ $style = "class=\"row2\"";
+ }
+ if ( !isset( $cat_names[$row['cat_id']] ) )
+ {
+ $cat = get_cat_info( $row['cat_id'] );
+ $cat_names[$row['cat_id']] = array();
+ $cat_names[$row['cat_id']]['dir'] = ".".$cat['dir'];
+ $cat_names[$row['cat_id']]['display_name'] = get_cat_display_name( $cat['name'], " - ", "font-style:italic;" );
+ }
+ echo "
+ <tr>
+ <td $style style=\"white-space:nowrap;\">".$cat_names[$row['cat_id']]['display_name']."</td>
+ <td $style style=\"white-space:nowrap;\">".$lang['day'][date( "w", $row['date'] )].date( " j ", $row['date'] ).$lang['month'][date( "n", $row['date'] )].date( " Y G:i", $row['date'] )."</td>
+ <td $style style=\"white-space:nowrap;\">
+ <a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir'].$row['file']."\">".$row['file']."</td>
+ </td>
+ <td $style style=\"white-space:nowrap;\">";
+ if ( $row['tn_ext'] != "" )
+ {
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+ echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ }
+ else
+ {
+ echo "&nbsp;";
+ }
+ echo "
+ </td>
+ <td $style style=\"white-space:nowrap;\">
+ <a href=\"mailto:".$row['mail_address']."\">".$row['username']."</a>
+ </td>
+ <td $style style=\"white-space:nowrap;\">
+ <input type=\"radio\" name=\"validate-".$row['id']."\" value=\"true\" />".$lang['submit']."
+ <input type=\"radio\" name=\"validate-".$row['id']."\" value=\"false\" />".$lang['delete']."
+ </td>
+ </tr>";
+ $i++;
+ }
+ echo "
+ <tr>
+ <td colspan=\"5\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\" style=\"margin:5px;\" /></td>
+ </tr>";
+ echo "
+ </table>
+ </form>";
+?> \ No newline at end of file
diff --git a/category.php b/category.php
new file mode 100644
index 000000000..dce31da7f
--- /dev/null
+++ b/category.php
@@ -0,0 +1,499 @@
+<?php
+/***************************************************************************
+ * category.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+// determine the initial instant to indicate the generation time of this page
+$t1 = explode( ' ', microtime() );
+$t2 = explode( '.', $t1[0] );
+$t2 = $t1[1].'.'.$t2[1];
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_cat_id( $_GET['cat'] );
+check_login_authorization();
+if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
+{
+ check_restrictions( $page['cat'] );
+}
+//-------------------------------------------------------------- initialization
+// creation of the array containing the cat ids to expand in the menu
+// $page['tab_expand'] contains an array with the category ids
+// $page['expand'] contains the string to display in URL with comma
+$page['tab_expand'] = array();
+if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' )
+{
+ $j = 0;
+ $tab_expand = explode( ",", $_GET['expand'] );
+ $size = sizeof( $tab_expand );
+ for ( $i = 0; $i < $size; $i++ )
+ {
+ if ( is_numeric( $tab_expand[$i] ) )
+ {
+ $page['tab_expand'][$j++] = $tab_expand[$i];
+ }
+ }
+ $page['expand'] = implode( ',', $page['tab_expand'] );
+}
+// in case of expanding all authorized cats
+// The $page['expand'] equals 'all' and
+// $page['tab_expand'] contains all the authorized cat ids
+if ( $user['expand'] == 'true' or $_GET['expand'] == 'all' )
+{
+ $page['tab_expand'] = array();
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id_uppercat is null;';
+ $result = mysql_query( $query );
+ $i = 0;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $page['tab_expand'][$i++] = $row['id'];
+ }
+ $page['expand'] = 'all';
+}
+// detection of the start picture to display
+if ( !isset( $_GET['start'] )
+ or !is_numeric( $_GET['start'] )
+ or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
+{
+ $page['start'] = 0;
+}
+else
+{
+ $page['start'] = $_GET['start'];
+}
+// Sometimes, a "num" is provided in the URL. It is the number
+// of the picture to show. This picture must be in the thumbnails page.
+// We have to find the right $page['start'] that show the num picture
+// in this category
+if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 )
+{
+ $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] );
+ $page['start']*= $user['nb_image_page'];
+}
+initialize_category();
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/category.vtp' );
+initialize_template();
+
+$tpl = array( 'categories','hint_category','sub-cat','images_available',
+ 'total','title_menu','nb_image_category','send_mail',
+ 'title_send_mail','generation_time','upload_name',
+ 'connected_user','recent_image','days','generation_time',
+ 'favorite_cat_hint','favorite_cat','stats',
+ 'most_visited_cat_hint','most_visited_cat','recent_cat',
+ 'recent_cat_hint' );
+templatize_array( $tpl, 'lang' );
+
+$tpl = array( 'mail_webmaster','webmaster','top_number','version','site_url' );
+templatize_array( $tpl, 'conf' );
+
+$tpl = array( 'short_period','long_period','style','lien_collapsed','pseudo' );
+templatize_array( $tpl, 'user' );
+
+$tpl = array( 'title','navigation_bar','cat_comment','cat_nb_images' );
+templatize_array( $tpl, 'page' );
+
+// special global template vars
+$vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) );
+$icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) );
+$vtp->setGlobalVar( $handle, 'icon_long', $icon_long );
+$nb_total_pictures = get_total_image( "", $user['restrictions'] );
+$vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures );
+//------------------------------------------------------------- categories menu
+// normal categories
+display_cat( '', '&nbsp;', $user['restrictions'], $page['tab_expand'] );
+// favorites cat
+if ( !$user['is_the_guest'] )
+{
+ $vtp->addSession( $handle, 'favorites' );
+ $url = add_session_id('./category.php?cat=fav&amp;expand='.$page['expand'] );
+ $vtp->setVar( $handle, 'favorites.url', $url );
+ // searching the number of favorite picture
+ $query = 'select count(*) as count';
+ $query.= ' from '.$prefixeTable.'favorites';
+ $query.= ' where user_id = '.$user['id'].';';
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] );
+ $vtp->closeSession( $handle, 'favorites' );
+}
+// most visited pictures category
+$url = add_session_id( './category.php?cat=most_visited'.
+ '&amp;expand='.$page['expand'] );
+$vtp->setGlobalVar( $handle, 'most_visited_url', $url );
+// recent pictures
+$url = add_session_id( './category.php?cat=recent'.
+ '&amp;expand='.$page['expand'] );
+$vtp->setGlobalVar( $handle, 'recent_url', $url );
+//--------------------------------------------------------------------- summary
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url', './identification.php' );
+if ( !$user['is_the_guest'] )
+{
+ $vtp->setVar( $handle, 'summary.title', '' );
+ $vtp->setVar( $handle, 'summary.name',
+ replace_space( $lang['change_login'] ) );
+}
+else
+{
+ $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] );
+ $vtp->setVar( $handle, 'summary.name',
+ replace_space( $lang['login'] ) );
+}
+$vtp->closeSession( $handle, 'summary' );
+// links for registered users
+if ( !$user['is_the_guest'] )
+{
+ // logout link
+ $vtp->addSession( $handle, 'summary' );
+ $vtp->setVar( $handle, 'summary.url', './category.php?cat='.$page['cat'] );
+ $vtp->setVar( $handle, 'summary.title', '' );
+ $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) );
+ $vtp->closeSession( $handle, 'summary' );
+ // customization link
+ $vtp->addSession( $handle, 'summary' );
+ $url = './profile.php?cat='.$page['cat'];
+ $url.= '&amp;expand='.$page['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url.= '&amp;search='.$_GET['search'];
+ }
+ $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) );
+ $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] );
+ $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) );
+ $vtp->closeSession( $handle, 'summary' );
+}
+// search link
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) );
+$vtp->setVar( $handle, 'summary.title', $lang['hint_search'] );
+$vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) );
+$vtp->closeSession( $handle, 'summary' );
+// about link
+$vtp->addSession( $handle, 'summary' );
+$vtp->setVar( $handle, 'summary.url',
+ add_session_id( './about.php?expand='.$page['expand'] ) );
+$vtp->setVar( $handle, 'summary.title', $lang['hint_about'] );
+$vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) );
+$vtp->closeSession( $handle, 'summary' );
+// administration link
+if ( $user['status'] == 'admin' )
+{
+ $vtp->addSession( $handle, 'summary' );
+ $vtp->setVar( $handle, 'summary.url',
+ add_session_id( './admin/admin.php' ) );
+ $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] );
+ $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) );
+ $vtp->closeSession( $handle, 'summary' );
+}
+//-------------------------------------------------------------- category title
+if ( isset ( $page['cat'] ) )
+{
+ if ( is_numeric( $page['cat'] ) )
+ {
+ $cat_title = get_cat_display_name( $page['cat_name'], '<br />',
+ 'font-style:italic;' );
+ $vtp->setGlobalVar( $handle, "cat_title", $cat_title );
+ }
+ else
+ {
+ if ( $page['cat'] == 'search' )
+ {
+ $page['title'].= ' : <span style="font-style:italic;">';
+ $page['title'].= $_GET['search']."</span>";
+ }
+ $page['title'] = replace_space( $page['title'] );
+ $vtp->setGlobalVar( $handle, "cat_title", $page['title'] );
+ }
+}
+else
+{
+ $vtp->setGlobalVar( $handle, "cat_title",
+ replace_space( $lang['no_category'] ) );
+}
+//------------------------------------------------------------------ thumbnails
+if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 )
+{
+ if ( is_numeric( $page['cat'] ) )
+ {
+ $cat_directory = $page['cat_dir'];
+ }
+ else if ( $page['cat'] == 'search' or $page['cat'] == 'fav' )
+ {
+ $array_cat_directories = array();
+ }
+
+ $query = 'select id,file,date_available,comment,';
+ $query.= ' author,tn_ext,name,filesize,width,height,cat_id';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= $page['where'];
+ $query.= $conf['order_by'];
+ $query.= ' limit '.$page['start'].','.$page['nb_image_page'];
+ $query.= ';';
+ $result = mysql_query( $query );
+
+ $vtp->addSession( $handle, 'thumbnails' );
+ $vtp->addSession( $handle, 'line' );
+ // compteur d'itération pour aller à la ligne
+ // toutes les "$nb_image_ligne" images
+ $i = 1;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ if ( !is_numeric( $page['cat'] ) )
+ {
+ if ( $array_cat_directories[$row['cat_id']] == '' )
+ {
+ $cat_result = get_cat_info( $row['cat_id'] );
+ $array_cat_directories[$row['cat_id']] = $cat_result['dir'];
+ }
+ $cat_directory = $array_cat_directories[$row['cat_id']];
+ }
+ // filename without extension
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], '.' ) );
+ // name of the picture
+ if ( $row['name'] != '' )
+ {
+ $name = $row['name'];
+ }
+ else
+ {
+ $name = str_replace( '_', ' ', $file );
+ }
+ if ( $page['cat'] == 'search' )
+ {
+ $name = replace_search( $name, $_GET['search'] );
+ }
+ // thumbnail url
+ $thumbnail_url = $cat_directory;
+ $thumbnail_url.= 'thumbnail/'.$conf['prefixe_thumbnail'];
+ $thumbnail_url.= $file.'.'.$row['tn_ext'];
+ // message in title for the thumbnail
+ $tab_date = explode( '-', $row['date_available'] );
+ $thumbnail_title = $lang['registration_date'];
+ $thumbnail_title.= ' '.$tab_date[2].'/'.$tab_date[1].'/'.$tab_date[0];
+ if ( $row['comment'] != '' )
+ {
+ $thumbnail_title .= "\n".$lang['comment'].' : '.$row['comment'];
+ }
+ if ( $row['author'] != '' )
+ {
+ $thumbnail_title .= "\n".$lang['author'].' : '.$row['author'];
+ }
+ if ( $row['width'] == '' )
+ {
+ $taille_image = @getimagesize( $lien_image );
+ $width = $taille_image[0];
+ $height = $taille_image[1];
+ }
+ else
+ {
+ $width = $row['width'];
+ $height = $row['height'];
+ }
+ $thumbnail_title .= "\n".$lang['size'].' : '.$width.'*'.$height;
+ $thumbnail_title .= "\n".$lang['file'].' : '.$row['file'];
+ if ( $row['filesize'] == '' )
+ {
+ $poids = floor( filesize( $lien_image ) / 1024 );
+ }
+ else
+ {
+ $poids = $row['filesize'];
+ }
+ $thumbnail_title .= "\n".$lang['filesize'].' : '.$poids.' KB';
+ // url link on picture.php page
+ $url_link = './picture.php?cat='.$page['cat'];
+ $url_link.= '&amp;image_id='.$row['id'].'&amp;expand='.$page['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url_link.= '&amp;search='.$_GET['search'];
+ }
+ // date of availability for creation icon
+ $date = explode( '-', $row['date_available'] );
+ $date = mktime( 0, 0, 0, $date[1], $date[2], $date[0] );
+ // sending vars to display
+ $vtp->addSession( $handle, 'thumbnail' );
+ $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
+ $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url );
+ $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] );
+ $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
+ $vtp->setVar( $handle, 'thumbnail.name', $name );
+ $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );
+
+ if ( $conf['show_comments'] and $user['show_nb_comments'] )
+ {
+ $vtp->addSession( $handle, 'nb_comments' );
+ $query = 'select count(*) as nb_comments';
+ $query.= ' from '.$prefixeTable.'comments';
+ $query.= ' where image_id = '.$row['id'];
+ $query.= ';';
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] );
+ $vtp->closeSession( $handle, 'nb_comments' );
+ }
+
+ $vtp->closeSession( $handle, 'thumbnail' );
+
+ if ( $i == $user['nb_image_line'] )
+ {
+ $vtp->closeSession( $handle, 'line' );
+ $vtp->addSession( $handle, 'line' );
+ $i = 1;
+ }
+ else
+ {
+ $i++;
+ }
+ }
+ if ( $i < $user['nb_image_line'] )
+ {
+ $vtp->closeSession( $handle, 'line' );
+ }
+ $vtp->closeSession( $handle, 'thumbnails' );
+}
+else if ( isset( $page['cat'] )
+ and is_numeric( $page['cat'] )
+ and $page['cat_nb_images'] == 0 )
+{
+ $vtp->addSession( $handle, 'thumbnails' );
+
+ $query = 'select id,name,dir,date_dernier';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id_uppercat = '.$page['cat'];
+ $query.= ' order by rank;';
+ $cat_result = mysql_query( $query );
+ $i = 1;
+ $vtp->addSession( $handle, 'line' );
+ while ( $cat_row = mysql_fetch_array( $cat_result ) )
+ {
+ $result = get_cat_info( $cat_row['id'] );
+ $cat_directory = $result['dir'];
+
+ $name = $lang['sub-cat'].'"<span style="font-weight:bold;">';
+ if ( $cat_row['name'] != '' )
+ {
+ $name.= $cat_row['name'];
+ }
+ else
+ {
+ $name.= $cat_row['dir'];
+ }
+ $name.= '</span>"';
+
+ $query = 'select file,tn_ext';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= ' where cat_id = '.$cat_row['id'];
+ $query.= ' order by rand()';
+ $query.= ' limit 0,1';
+ $query.= ';';
+ $image_result = mysql_query( $query );
+ $image_row = mysql_fetch_array( $image_result );
+
+ $file = substr ( $image_row['file'], 0,
+ strrpos ( $image_row['file'], '.' ) );
+
+ // creating links for thumbnail and associated category
+ $lien_image = $cat_directory;
+ $lien_thumbnail = $lien_image;
+ $lien_thumbnail.= 'thumbnail/'.$conf['prefixe_thumbnail'];
+ $lien_thumbnail.= $file.'.'.$image_row['tn_ext'];
+ $lien_image.= $image_row['file'];
+
+ $thumbnail_title = '';
+
+ $url_link = './category.php?cat='.$cat_row['id'];
+ if ( !in_array( $page['cat'], $page['tab_expand'] ) )
+ {
+ $page['tab_expand'][sizeof( $page['tab_expand'] )] = $page['cat'];
+ $page['expand'] = implode( ',', $page['tab_expand'] );
+ }
+ $url_link.= '&amp;expand='.$page['expand'];
+
+ // sending vars to display
+ $vtp->addSession( $handle, 'thumbnail' );
+ $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
+ $vtp->setVar( $handle, 'thumbnail.src', $lien_thumbnail );
+ $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] );
+ $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
+ $vtp->setVar( $handle, 'thumbnail.name', $name );
+
+ $date = explode( '-', $cat_row['date_dernier'] );
+ $date = mktime( 0, 0, 0, $date[1], $date[2], $date[0] );
+ $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );
+
+ $vtp->closeSession( $handle, 'thumbnail' );
+
+ if ( $i == $user['nb_image_line'] )
+ {
+ $vtp->closeSession( $handle, 'line' );
+ $vtp->addSession( $handle, 'line' );
+ $i = 1;
+ }
+ else
+ {
+ $i++;
+ }
+ }
+ $vtp->closeSession( $handle, 'thumbnails' );
+}
+//------------------------------------------------------- category informations
+if ( isset ( $page['cat'] ) )
+{
+ $vtp->addSession( $handle, 'cat_infos' );
+ // navigation bar
+ if ( $page['navigation_bar'] != '' )
+ {
+ $vtp->addSession( $handle, 'navigation' );
+ $vtp->closeSession( $handle, 'navigation' );
+ }
+ // category comment
+ if ( isset( $page['comment'] ) and $page['comment'] != '' )
+ {
+ $vtp->addSession( $handle, 'cat_comment' );
+ $vtp->closeSession( $handle, 'cat_navigation' );
+ }
+ // total number of pictures in the category
+ if ( is_numeric( $page['cat'] ) )
+ {
+ $vtp->setVar( $handle, 'cat_infos.cat_name',
+ get_cat_display_name( $page['cat_name'], ' - ',
+ 'font-style:italic;' ) );
+ }
+ else
+ {
+ $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] );
+ }
+ // upload a picture in the category
+ if ( $page['cat_site_id'] == 1 and $conf['upload_available'] )
+ {
+ $vtp->addSession( $handle, 'upload' );
+ $url = './upload.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+ $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) );
+ $vtp->closeSession( $handle, 'upload' );
+ }
+ $vtp->closeSession( $handle, 'cat_infos' );
+}
+//------------------------------------------------------------ log informations
+pwg_log( 'category', $page['title'] );
+mysql_close();
+//------------------------------------------------------------- generation time
+$time = get_elapsed_time( $t2, get_moment() );
+$vtp->setGlobalVar( $handle, 'time', $time );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?> \ No newline at end of file
diff --git a/identification.php b/identification.php
new file mode 100644
index 000000000..d4c734939
--- /dev/null
+++ b/identification.php
@@ -0,0 +1,122 @@
+<?php
+/***************************************************************************
+ * identification.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Thursday, December 26, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( "./include/init.inc.php" );
+//-------------------------------------------------------------- identification
+$error = array();
+if ( isset( $_POST['login'] ) )
+{
+ $i = 0;
+ // retrieving the encrypted password of the login submitted
+ $query = 'select password';
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo = '".$_POST['login']."';";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ if( $row['password'] == md5( $_POST['pass'] ) )
+ {
+ $session_id = session_create( $_POST['login'] );
+ $url = 'category.php?id='.$session_id;
+ header( "Request-URI: $url" );
+ header( "Content-Location: $url" );
+ header( "Location: $url" );
+ exit();
+ }
+ else
+ {
+ $error[$i++] = $lang['invalid_pwd'];
+ }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/default/identification.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'ident_page_title', $lang['ident_page_title'] );
+$vtp->setGlobalVar( $handle, 'ident_title', $lang['ident_title'] );
+$vtp->setGlobalVar( $handle, 'login', $lang['login'] );
+$vtp->setGlobalVar( $handle, 'password', $lang['password'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
+$vtp->setGlobalVar( $handle, 'ident_register', $lang['ident_register'] );
+$vtp->setGlobalVar( $handle, 'ident_forgotten_password',
+ $lang['ident_forgotten_password'] );
+// conf
+$vtp->setGlobalVar( $handle, 'mail_webmaster', $conf['mail_webmaster'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+$vtp->setGlobalVar( $handle, 'user_theme', $user['theme'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+ $vtp->addSession( $handle, 'errors' );
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ $vtp->addSession( $handle, 'li' );
+ $vtp->setVar( $handle, 'li.li', $error[$i] );
+ $vtp->closeSession( $handle, 'li' );
+ }
+ $vtp->closeSession( $handle, 'errors' );
+}
+//------------------------------------------------------------------ users list
+// retrieving all the users login
+$query = 'select pseudo from '.$prefixeTable.'users;';
+$result = mysql_query( $query );
+if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
+{
+ $vtp->addSession( $handle, 'select_field' );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ if ( $row['pseudo'] != 'visiteur' )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $row['pseudo'] );
+ $vtp->closeSession( $handle, 'option' );
+ }
+ }
+ $vtp->closeSession( $handle, 'select_field' );
+}
+else
+{
+ $vtp->addSession( $handle, 'text_field' );
+ $vtp->closeSession( $handle, 'text_field' );
+}
+//-------------------------------------------------------------- visit as guest
+if ( $conf['acces'] == "libre" )
+{
+ $vtp->addSession( $handle, 'guest_visit' );
+ $vtp->closeSession( $handle, 'guest_visit' );
+}
+//---------------------------------------------------------------- registration
+if ( $conf['acces'] == "libre" )
+{
+ $vtp->addSession( $handle, 'register' );
+ $vtp->closeSession( $handle, 'register' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+//------------------------------------------------------------ log informations
+$query = 'insert into '.$prefixeTable.'history';
+$query.= '(date,login,IP,page) values';
+$query.= "('".time()."', '".$user['pseudo'];
+$query.= "','$REMOTE_ADDR','identification');";
+$result = mysql_query( $query );
+?> \ No newline at end of file
diff --git a/include/config.inc.php b/include/config.inc.php
new file mode 100644
index 000000000..f0a348a24
--- /dev/null
+++ b/include/config.inc.php
@@ -0,0 +1,94 @@
+<?php
+/***************************************************************************
+ * config.inc.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+unset( $conf, $page, $user, $lang );
+$conf = array();
+$page = array();
+$user = array();
+$lang = array();
+
+include_once( PREFIXE_INCLUDE.'./include/mysql.inc.php' );
+include_once( PREFIXE_INCLUDE.'./include/functions.inc.php' );
+include_once( PREFIXE_INCLUDE.'./include/vtemplate.class.php' );
+//
+// How to change the order of display for images in a category ?
+//
+// You have to modify $conf['order_by'].
+// There are several fields that can order the display :
+// - date_available : the date of the adding to the gallery
+// - file : the name of the file
+// Once you've chosen which field(s) to use for ordering,
+// you must chose the ascending or descending order for each field.
+// examples :
+// 1. $conf['order_by'] = " order by date_available desc, file asc";
+// will order pictures by date_available descending & by filename ascending
+// 2. $conf['order_by'] = " order by file asc";
+// will only order pictures by file ascending
+// without taking into account the date_available
+$conf['order_by'] = " order by date_available desc, file asc";
+
+$conf['repertoire_image'] = './images/';
+$conf['nb_image_row'] = array ('4','5','6','7','8');
+$conf['nb_row_page'] = array ('2','3','4','5','6','7','10','20','1000');
+$conf['version'] = '1.3';
+$conf['site_url'] = 'http://www.phpwebgallery.net';
+$conf['forum_url'] = 'http://forum.phpwebgallery.net';
+
+database_connection();
+// rertieving the configuration informations for site
+// $infos array is used to know the fields to retrieve in the table "config"
+// Each field becomes an information of the array $conf.
+// Example :
+// prefixe_thumbnail --> $conf['prefixe_thumbnail']
+$infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 'acces',
+ 'session_id_size', 'session_keyword', 'session_time',
+ 'max_user_listbox', 'show_comments', 'nb_comment_page',
+ 'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
+ 'upload_maxheight', 'upload_maxwidth_thumbnail',
+ 'upload_maxheight_thumbnail' );
+
+$query = 'select';
+for ( $i = 0; $i < sizeof( $infos ); $i++ )
+{
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $infos[$i];
+}
+$query .= ' from '.$prefixeTable.'config;';
+
+$row = mysql_fetch_array( mysql_query( $query ) );
+
+// affectation of each field of the table "config" to an information of the
+// array $conf.
+for ( $i = 0; $i < sizeof( $infos ); $i++ )
+{
+ $conf[$infos[$i]] = $row[$infos[$i]];
+ // If the field is true or false, the variable is transformed into a boolean
+ // value.
+ if ( $row[$infos[$i]] == 'true' || $row[$infos[$i]] == 'false' )
+ {
+ $conf[$infos[$i]] = get_boolean( $row[$infos[$i]] );
+ }
+}
+$conf['log'] = false;
+$conf['top_number'] = 10;
+?> \ No newline at end of file
diff --git a/include/functions.inc.php b/include/functions.inc.php
new file mode 100644
index 000000000..a45c4f43d
--- /dev/null
+++ b/include/functions.inc.php
@@ -0,0 +1,286 @@
+<?php
+/***************************************************************************
+ * functions.inc.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * 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( 'functions_user.inc.php' );
+include( 'functions_session.inc.php' );
+include( 'functions_category.inc.php' );
+
+//----------------------------------------------------------- generic functions
+
+// The function get_boolean transforms a string to a boolean value. If the
+// string is "false" (case insensitive), then the boolean value false is
+// returned. In any other case, true is returned.
+function get_boolean( $string )
+{
+ $boolean = true;
+ if ( preg_match( '/^false$/i', $string ) )
+ {
+ $boolean = false;
+ }
+ return $boolean;
+}
+
+// The function array_remove removes a value from the given array if the value
+// existed in this array.
+function array_remove( $array, $value )
+{
+ $i = 0;
+ $output = array();
+ foreach ( $array as $v )
+ {
+ if ( $v != $value )
+ {
+ $output[$i++] = $v;
+ }
+ }
+ return implode( ',', $output );
+}
+
+// The function get_moment returns a float value coresponding to the number
+// of seconds since the unix epoch (1st January 1970) and the microseconds
+// are precised : e.g. 1052343429.89276600
+function get_moment()
+{
+ $t1 = explode( " ", microtime() );
+ $t2 = explode( ".", $t1[0] );
+ $t2 = $t1[1].".".$t2[1];
+ return $t2;
+}
+
+// The function get_elapsed_time returns the number of seconds (with 3
+// decimals precision) between the start time and the end time given.
+function get_elapsed_time( $start, $end )
+{
+ return number_format( $end - $start, 3, '.', ' ').' s';
+}
+
+// - The replace_space function replaces space and '-' characters
+// by their HTML equivalent &nbsb; and &minus;
+// - The function does not replace characters in HTML tags
+// - This function was created because IE5 does not respect the
+// CSS "white-space: nowrap;" property unless space and minus
+// characters are replaced like this function does.
+function replace_space( $string )
+{
+ //return $string;
+ $return_string = "";
+ $remaining = $string;
+
+ $start = 0;
+ $end = 0;
+ $start = strpos ( $remaining, "<" );
+ $end = strpos ( $remaining, ">" );
+ while ( is_numeric( $start ) and is_numeric( $end ) )
+ {
+ $treatment = substr ( $remaining, 0, $start );
+ $treatment = str_replace( " ", "&nbsp;", $treatment );
+ $treatment = str_replace( "-", "&minus;", $treatment );
+ $return_string.= $treatment.substr ( $remaining, $start,
+ $end - $start + 1 );
+ $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
+ $start = strpos ( $remaining, "<" );
+ $end = strpos ( $remaining, ">" );
+ }
+ $treatment = str_replace( " ", "&nbsp;", $remaining );
+ $treatment = str_replace( "-", "&minus;", $treatment );
+ $return_string.= $treatment;
+
+ return $return_string;
+}
+
+// get_dirs retourne un tableau contenant tous les sous-répertoires d'un
+// répertoire
+function get_dirs( $rep )
+{
+ $sub_rep = array();
+
+ if ( $opendir = opendir ( $rep ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( $file != "." and $file != ".." and is_dir ( $rep.$file ) )
+ {
+ array_push( $sub_rep, $file );
+ }
+ }
+ }
+ return $sub_rep;
+}
+
+// The get_picture_size function return an array containing :
+// - $picture_size[0] : final width
+// - $picture_size[1] : final height
+// The final dimensions are calculated thanks to the original dimensions and
+// the maximum dimensions given in parameters. get_picture_size respects
+// the width/height ratio
+function get_picture_size( $original_width, $original_height,
+ $max_width, $max_height )
+{
+ $width = $original_width;
+ $height = $original_height;
+ $is_original_size = true;
+
+ if ( $max_width != "" )
+ {
+ if ( $original_width > $max_width )
+ {
+ $width = $max_width;
+ $height = floor( ( $width * $original_height ) / $original_width );
+ }
+ }
+ if ( $max_height != "" )
+ {
+ if ( $original_height > $max_height )
+ {
+ $height = $max_height;
+ $width = floor( ( $height * $original_width ) / $original_height );
+ $is_original_size = false;
+ }
+ }
+ if ( is_numeric( $max_width ) and is_numeric( $max_height )
+ and $max_width != 0 and $max_height != 0 )
+ {
+ $ratioWidth = $original_width / $max_width;
+ $ratioHeight = $original_height / $max_height;
+ if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
+ {
+ if ( $ratioWidth < $ratioHeight )
+ {
+ $width = floor( $original_width / $ratioHeight );
+ $height = $max_height;
+ }
+ else
+ {
+ $width = $max_width;
+ $height = floor( $original_height / $ratioWidth );
+ }
+ $is_original_size = false;
+ }
+ }
+ $picture_size = array();
+ $picture_size[0] = $width;
+ $picture_size[1] = $height;
+ return $picture_size;
+}
+
+//-------------------------------------------- PhpWebGallery specific functions
+
+// get_languages retourne un tableau contenant tous les languages
+// disponibles pour PhpWebGallery
+function get_languages( $rep_language )
+{
+ $languages = array();
+ $i = 0;
+ if ( $opendir = opendir ( $rep_language ) )
+ {
+ while ( $file = readdir ( $opendir ) )
+ {
+ if ( is_file ( $rep_language.$file )
+ and $file != "index.php"
+ and strrchr ( $file, "." ) == ".php" )
+ {
+ $languages[$i++] =
+ substr ( $file, 0, strlen ( $file )
+ - strlen ( strrchr ( $file, "." ) ) );
+ }
+ }
+ }
+ return $languages;
+}
+
+// get_themes retourne un tableau contenant tous les "template - couleur"
+function get_themes( $theme_dir )
+{
+ $themes = array();
+ $main_themes = get_dirs( $theme_dir );
+ for ( $i = 0; $i < sizeof( $main_themes ); $i++ )
+ {
+ $colors = get_dirs( $theme_dir.$main_themes[$i].'/' );
+ for ( $j = 0; $j < sizeof( $colors ); $j++ )
+ {
+ array_push( $themes, $main_themes[$i].' - '.$colors[$j] );
+ }
+ }
+ return $themes;
+}
+
+// - The replace_search function replaces a $search string by the search in
+// another color
+// - The function does not replace characters in HTML tags
+function replace_search( $string, $search )
+{
+ //return $string;
+ $style_search = "background-color:white;color:red;";
+ $return_string = "";
+ $remaining = $string;
+
+ $start = 0;
+ $end = 0;
+ $start = strpos ( $remaining, "<" );
+ $end = strpos ( $remaining, ">" );
+ while ( is_numeric( $start ) and is_numeric( $end ) )
+ {
+ $treatment = substr ( $remaining, 0, $start );
+ $treatment = eregi_replace( $search, "<span style=\"".$style_search."\">".
+ $search."</span>", $treatment );
+ $return_string.= $treatment.substr ( $remaining, $start,
+ $end - $start + 1 );
+ $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
+ $start = strpos ( $remaining, "<" );
+ $end = strpos ( $remaining, ">" );
+ }
+ $treatment = eregi_replace( $search, "<span style=\"".$style_search."\">".
+ $search."</span>", $remaining );
+ $return_string.= $treatment;
+
+ return $return_string;
+}
+
+function database_connection()
+{
+ global $cfgHote,$cfgUser,$cfgPassword,$cfgBase;
+ @mysql_connect( $cfgHote, $cfgUser, $cfgPassword )
+ or die ( "Could not connect to server" );
+ @mysql_select_db( $cfgBase )
+ or die ( "Could not connect to database" );
+}
+
+function pwg_log( $file, $category, $picture = '' )
+{
+ global $conf, $user, $prefixeTable;
+
+ if ( $conf['log'] )
+ {
+ $query = 'insert into '.$prefixeTable.'history';
+ $query.= ' (date,login,IP,file,category,picture) values';
+ $query.= " (".time().", '".$user['pseudo']."'";
+ $query.= ",'".$_SERVER['REMOTE_ADDR']."'";
+ $query.= ",'".$file."','".$category."','".$picture."');";
+ mysql_query( $query );
+ }
+}
+
+function templatize_array( $array, $global_array_name )
+{
+ global $vtp, $handle, $lang, $page, $user, $conf;
+
+ for( $i = 0; $i < sizeof( $array ); $i++ )
+ {
+ $vtp->setGlobalVar( $handle, $array[$i],
+ ${$global_array_name}[$array[$i]] );
+ }
+}
+?> \ No newline at end of file
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
new file mode 100644
index 000000000..051e89f56
--- /dev/null
+++ b/include/functions_category.inc.php
@@ -0,0 +1,481 @@
+<?php
+/***************************************************************************
+ * functions_category.inc.php *
+ * -------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+function get_subcats_id( $cat_id )
+{
+ global $prefixeTable;
+
+ $restricted_cat = array();
+ $i = 0;
+
+ $query = "select id";
+ $query.= " from $prefixeTable"."categories";
+ $query.= " where id_uppercat = $cat_id;";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $restricted_cat[$i++] = $row['id'];
+ $sub_restricted_cat = get_subcats_id( $row['id'] );
+ for ( $j = 0; $j < sizeof( $sub_restricted_cat ); $j++ )
+ {
+ $restricted_cat[$i++] = $sub_restricted_cat[$j];
+ }
+ }
+
+ return $restricted_cat;
+}
+
+function check_restrictions( $category_id )
+{
+ global $user,$lang,$prefixeTable;
+
+ if ( is_user_allowed( $category_id, $user['restrictions'] ) > 0 )
+ {
+ echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
+ echo '<a href="'.add_session_id( './category.php' ).'">';
+ echo $lang['thumbnails'].'</a></div>';
+ exit();
+ }
+}
+
+// the check_cat_id function check whether the $cat is a right parameter :
+// - $cat is numeric and corresponds to a category in the database
+// - $cat equals 'fav' (for favorites)
+// - $cat equals 'search' (when the result of a search is displayed)
+function check_cat_id( $cat )
+{
+ global $page,$prefixeTable;
+ unset( $page['cat'] );
+ if ( isset( $cat ) )
+ {
+ if ( is_numeric( $cat ) )
+ {
+ $query = "select id from $prefixeTable"."categories where id = $cat;";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) != 0 )
+ {
+ $page['cat'] = $cat;
+ }
+ }
+ if ( $cat == 'fav' or $cat == 'search' or $cat == 'most_visited'
+ or $cat == 'best_rated' or $cat == 'recent' )
+ {
+ $page['cat'] = $cat;
+ }
+ }
+}
+
+function display_cat( $id_uppercat, $indent, $restriction, $tab_expand )
+{
+ global $prefixeTable,$user,$lang,$conf,$page,$vtp,$handle;
+
+ $query = 'select name,id,date_dernier,nb_images,dir';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id_uppercat';
+ if ( $id_uppercat == "" )
+ {
+ $query.= ' is NULL';
+ }
+ else
+ {
+ $query.= ' = '.$id_uppercat;
+ }
+ $query.= ' order by rank asc;';
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ if ( !in_array( $row['id'], $restriction ) )
+ {
+ $nb_subcats = get_nb_subcats( $row['id'] );
+
+ $expand = "";
+ // si la catégorie n'a pas de sous catégorie
+ // ou que l'on doit développer toutes les catégories par défaut
+ // alors on utilise l'expand par défaut
+ if ( $nb_subcats == 0 or $user['expand'] == "true" )
+ {
+ $expand = $page['expand'];
+ }
+ // si la catégorie n'est pas dans les catégories à développer
+ // alors on l'ajoute aux catégories à développer
+ else if ( !in_array( $row['id'], $tab_expand ) )
+ {
+ $expand = implode( ",", $tab_expand );
+ if ( strlen( $expand ) > 0 )
+ {
+ $expand.= ",";
+ }
+ $expand.= $row['id'];
+ }
+ // si la catégorie est déjà dans les catégories à développer
+ // alors on la retire des catégories à développer
+ else
+ {
+ $expand = array_remove( $tab_expand, $row['id'] );
+ }
+ $url = "./category.php?cat=".$page['cat']."&amp;expand=$expand";
+ if ( $page['cat'] == 'search' )
+ {
+ $url.= "&amp;search=".$_GET['search'];
+ }
+ $lien_cat = add_session_id_to_url( $url );
+ if ( $row['name'] == "" )
+ {
+ $name = str_replace( "_", " ", $row['dir'] );
+ }
+ else
+ {
+ $name = $row['name'];
+ }
+
+ $vtp->addSession( $handle, 'category' );
+ $vtp->setVar( $handle, 'category.indent', $indent );
+
+ if ( $user['expand'] == "true" or $nb_subcats == 0 )
+ {
+ $vtp->addSession( $handle, 'bullet_wo_link' );
+ $vtp->setVar( $handle, 'bullet_wo_link.bullet_url',
+ $user['lien_collapsed'] );
+ $vtp->setVar( $handle, 'bullet_wo_link.bullet_alt', '&gt;' );
+ $vtp->closeSession( $handle, 'bullet_wo_link' );
+ }
+ else
+ {
+ $vtp->addSession( $handle, 'bullet_w_link' );
+ $vtp->setVar( $handle, 'bullet_w_link.bullet_link', $lien_cat );
+ $vtp->setVar( $handle, 'bullet_w_link.bullet_alt', '&gt;' );
+ if ( in_array( $row['id'], $tab_expand ) )
+ {
+ $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
+ $user['lien_expanded'] );
+ }
+ else
+ {
+ $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
+ $user['lien_collapsed'] );
+ }
+ $vtp->closeSession( $handle, 'bullet_w_link' );
+ }
+ $vtp->setVar( $handle, 'category.link_url',
+ add_session_id( './category.php?cat='.
+ $row['id'].'&amp;expand='.$expand ) );
+ $vtp->setVar( $handle, 'category.link_name', $name );
+ if ( $id_uppercat == "" )
+ {
+ $vtp->setVar( $handle, 'category.name_style', 'font-weight:bold;' );
+ }
+ if ( $nb_subcats > 0 )
+ {
+ $vtp->addSession( $handle, 'subcat' );
+ $vtp->setVar( $handle, 'subcat.nb_subcats', $nb_subcats );
+ $vtp->closeSession( $handle, 'subcat' );
+ }
+ $vtp->setVar( $handle, 'category.total_cat', $row['nb_images'] );
+ $date_dispo = explode( "-", $row['date_dernier'] );
+ $date_cat = mktime( 0, 0, 0, $date_dispo[1], $date_dispo[2],
+ $date_dispo[0] );
+ $vtp->setVar( $handle, 'category.cat_icon', get_icon( $date_cat ) );
+ $vtp->closeSession( $handle, 'category' );
+
+ if ( in_array( $row['id'], $tab_expand ) or $user['expand'] == "true" )
+ {
+ display_cat( $row['id'], $indent.'&nbsp;&nbsp;&nbsp;&nbsp;',
+ $restriction, $tab_expand );
+ }
+ }
+ }
+}
+
+function get_nb_subcats( $id )
+{
+ global $prefixeTable,$user;
+
+ $query = 'select count(*) as count';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id_uppercat = '.$id;
+ for ( $i = 0; $i < sizeof( $user['restrictions'] ); $i++ )
+ {
+ $query.= " and id != ".$user['restrictions'][$i];
+ }
+ $query.= ';';
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ return $row['count'];
+}
+
+function get_total_image( $id, $restriction )
+{
+ global $prefixeTable;
+
+ $total = 0;
+
+ $query = 'select id,nb_images';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id_uppercat';
+ if ( !is_numeric( $id ) )
+ {
+ $query.= ' is NULL';
+ }
+ else
+ {
+ $query.= ' = '.$id;
+ }
+ $query.= ";";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ if ( !in_array( $row['id'], $restriction ) )
+ {
+ $total+= $row['nb_images'];
+ $total+= get_total_image( $row['id'], $restriction );
+ }
+ }
+ return $total;
+}
+
+// variables :
+// $cat['comment']
+// $cat['dir']
+// $cat['last_dir']
+// $cat['name'] is an array :
+// - $cat['name'][0] is the lowest cat name
+// and
+// - $cat['name'][n] is the most uppercat name findable
+// $cat['nb_images']
+// $cat['id_uppercat']
+// $cat['site_id']
+function get_cat_info( $id )
+{
+ global $prefixeTable;
+
+ $cat = array();
+ $cat['name'] = array();
+
+ $query = 'select nb_images,id_uppercat,comment,site_id,galleries_url,dir';
+ $query.= ' from '.$prefixeTable.'categories as a';
+ $query.= ', '.$prefixeTable.'sites as b';
+ $query.= ' where a.id = '.$id;
+ $query.= ' and a.site_id = b.id;';
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $cat['site_id'] = $row['site_id'];
+ $cat['id_uppercat'] = $row['id_uppercat'];
+ $cat['comment'] = nl2br( $row['comment'] );
+ $cat['nb_images'] = $row['nb_images'];
+ $cat['last_dir'] = $row['dir'];
+ $galleries_url = $row['galleries_url'];
+
+ $cat['dir'] = "";
+ $i = 0;
+ $is_root = false;
+ $row['id_uppercat'] = $id;
+ while ( !$is_root )
+ {
+ $query = 'select name,dir,id_uppercat';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= ' where id = '.$row['id_uppercat'].';';
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $cat['dir'] = $row['dir']."/".$cat['dir'];
+ if ( $row['name'] == "" )
+ {
+ $cat['name'][$i] = str_replace( "_", " ", $row['dir'] );
+ }
+ else
+ {
+ $cat['name'][$i] = $row['name'];
+ }
+ if ( $row['id_uppercat'] == "" )
+ {
+ $is_root = true;
+ }
+ $i++;
+ }
+ $cat['local_dir'] = substr( $cat['dir'], 0 , strlen( $cat['dir'] ) - 1 );
+ $cat['dir'] = $galleries_url.$cat['dir'];
+
+ return $cat;
+}
+
+// The function get_cat_display_name returns a string containing the list
+// of upper categories to the root category from the lowest category shown
+// example : "anniversaires - fete mere 2002 - animaux - erika"
+// You can give two parameters :
+// - $separation : the string between each category name " - " for example
+// - $style : the style of the span tag for the lowest category,
+// "font-style:italic;" for example
+function get_cat_display_name( $array_cat_names, $separation, $style )
+{
+ $output = "";
+ for ( $i = sizeof( $array_cat_names ) - 1; $i >= 0; $i-- )
+ {
+ if ( $i != sizeof( $array_cat_names ) - 1 )
+ {
+ $output.= $separation;
+ }
+ if ( $i != 0 )
+ {
+ $output.= $array_cat_names[$i];
+ }
+ else
+ {
+ if ( $style != "" )
+ {
+ $output.= '<span style="'.$style.'">';
+ }
+ $output.= $array_cat_names[$i];
+ if ( $style != "" )
+ {
+ $output.= "</span>";
+ }
+ }
+ }
+ return replace_space( $output );
+}
+
+// initialize_category initializes ;-) the variables in relation
+// with category :
+// 1. calculation of the number of pictures in the category
+// 2. determination of the SQL query part to ask to find the right category
+// $page['where'] is not the same if we are in
+// - simple category
+// - search result
+// - favorites displaying
+// - most visited pictures
+// - best rated pictures
+// - recent pictures
+// 3. determination of the title of the page
+// 4. creation of the navigation bar
+function initialize_category( $calling_page = 'category' )
+{
+ global $prefixeTable,$page,$lang,$user,$conf;
+
+ if ( isset( $page['cat'] ) )
+ {
+ // $page['nb_image_page'] is the number of picture to display on this page
+ // By default, it is the same as the $user['nb_image_page']
+ $page['nb_image_page'] = $user['nb_image_page'];
+ // $url is used to create the navigation bar
+ $url = './category.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+ // simple category
+ if ( is_numeric( $page['cat'] ) )
+ {
+ $result = get_cat_info( $page['cat'] );
+ $page['comment'] = $result['comment'];
+ $page['cat_dir'] = $result['dir'];
+ $page['cat_name'] = $result['name'];
+ $page['cat_nb_images'] = $result['nb_images'];
+ $page['cat_site_id'] = $result['site_id'];
+ $page['title'] = get_cat_display_name( $page['cat_name'], ' - ', '' );
+ $page['where'] = ' where cat_id = '.$page['cat'];
+ }
+ else
+ {
+ $query = '';
+ // search result
+ if ( $page['cat'] == 'search' )
+ {
+ $page['title'] = $lang['search_result'];
+ if ( $calling_page == 'picture' )
+ {
+ $page['title'].= ' : <span style="font-style:italic;">';
+ $page['title'].= $_GET['search']."</span>";
+ }
+ $page['where'] = " where ( file like '%".$_GET['search']."%'";
+ $page['where'].= " or name like '%".$_GET['search']."%'";
+ $page['where'].= " or comment like '%".$_GET['search']."%' )";
+
+ $query = 'select count(*) as nb_total_images';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= $page['where'];
+ $query.= ';';
+
+ $url.= '&amp;search='.$_GET['search'];
+ }
+ // favorites displaying
+ else if ( $page['cat'] == 'fav' )
+ {
+ $page['title'] = $lang['favorites'];
+
+ $page['where'] = ', '.$prefixeTable.'favorites';
+ $page['where'].= ' where user_id = '.$user['id'];
+ $page['where'].= ' and image_id = id';
+
+ $query = 'select count(*) as nb_total_images';
+ $query.= ' from '.$prefixeTable.'favorites';
+ $query.= ' where user_id = '.$user['id'];
+ $query.= ';';
+ }
+ // pictures within the short period
+ else if ( $page['cat'] == 'recent' )
+ {
+ $page['title'] = $lang['recent_cat_title'];
+ // We must find the date corresponding to :
+ // today - $conf['periode_courte']
+ $date = time() - 60*60*24*$user['short_period'];
+ $page['where'] = " where date_available > '";
+ $page['where'].= date( 'Y-m-d', $date )."'";
+
+ $query = 'select count(*) as nb_total_images';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= $page['where'];
+ $query.= ';';
+ }
+ // most visited pictures
+ else if ( $page['cat'] == 'most_visited' )
+ {
+ $page['title'] = $conf['top_number'].' '.$lang['most_visited_cat'];
+ $page['where'] = ' where cat_id != -1';
+ $conf['order_by'] = ' order by hit desc, file asc';
+ $page['cat_nb_images'] = $conf['top_number'];
+ if ( $page['start'] + $user['nb_image_page'] >= $conf['top_number'] )
+ {
+ $page['nb_image_page'] = $conf['top_number'] - $page['start'];
+ }
+ }
+
+ if ( $query != '' )
+ {
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $page['cat_nb_images'] = $row['nb_total_images'];
+ }
+
+ if ( $page['cat'] == 'search' or $page['cat'] == 'most_visited'
+ or $page['cat'] == 'recent' or $page['cat'] == 'best_rated' )
+ {
+ // we must not show pictures of a forbidden category
+ $restricted_cat = get_all_restrictions( $user['id'], $user['status'] );
+ if ( sizeof( $restricted_cat ) > 0 )
+ {
+ for ( $i = 0; $i < sizeof( $restricted_cat ); $i++ )
+ {
+ $page['where'].= ' and cat_id != '.$restricted_cat[$i];
+ }
+ }
+ }
+ }
+ if ( $calling_page == 'category' )
+ {
+ $page['navigation_bar'] =
+ create_navigation_bar( $url, $page['cat_nb_images'], $page['start'],
+ $user['nb_image_page'], 'back' );
+ }
+ }
+ else
+ {
+ $page['title'] = $lang['diapo_default_page_title'];
+ }
+}
+?> \ No newline at end of file
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
new file mode 100644
index 000000000..e85447221
--- /dev/null
+++ b/include/functions_session.inc.php
@@ -0,0 +1,135 @@
+<?php
+/***************************************************************************
+ * functions_session.inc.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+function generate_key()
+{
+ global $conf;
+ $md5 = md5( substr( microtime(), 2, 6 ).$conf['session_keyword'] );
+ $init = "";
+ for ( $i = 0; $i < strlen( $md5 ); $i++ )
+ {
+ if ( is_numeric( $md5[$i] ) )
+ {
+ $init.= "$md5[$i]";
+ }
+ }
+ $init = substr( $init, 0, 8 );
+ mt_srand( $init );
+ $key = "";
+ for ( $i = 0; $i < $conf['session_id_size']; $i++ )
+ {
+ $c = mt_rand( 0, 2 );
+ if ( $c == 0 )
+ {
+ $key .= chr( mt_rand( 65, 90 ) );
+ }
+ elseif ( $c == 1 )
+ {
+ $key .= chr( mt_rand( 97, 122 ) );
+ }
+ else
+ {
+ $key .= mt_rand( 0, 9 );
+ }
+ }
+ return $key;
+}
+
+function session_create( $pseudo )
+{
+ global $conf,$prefixeTable,$REMOTE_ADDR;
+ // 1. trouver une clé de session inexistante
+ $id_found = false;
+ while ( !$id_found )
+ {
+ $generated_id = generate_key();
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'sessions';
+ $query.= " where id = '".$generated_id."';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) == 0 )
+ {
+ $id_found = true;
+ }
+ }
+ // 2. récupération de l'id de l'utilisateur dont le pseudo
+ // est passé en paramètre
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo = '".$pseudo."';";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $user_id = $row['id'];
+ // 3. insertion de la session dans la base de donnée
+ $expiration = $conf['session_time']*60+time();
+ $query = 'insert into '.$prefixeTable.'sessions';
+ $query.= ' (id,user_id,expiration,ip) values';
+ $query.= "('".$generated_id."','".$user_id;
+ $query.= "','".$expiration."','".$REMOTE_ADDR."');";
+ mysql_query( $query );
+
+ return $generated_id;
+}
+
+function add_session_id_to_url( $url, $redirect = false )
+{
+ global $page, $user;
+ $amp = "&amp;";
+ if ( $redirect )
+ {
+ $amp = "&";
+ }
+ if ( !$user['is_the_guest'] )
+ {
+ if ( ereg( "\.php\?",$url ) )
+ {
+ return $url.$amp."id=".$page['session_id'];
+ }
+ else
+ {
+ return $url."?id=".$page['session_id'];
+ }
+ }
+ else
+ {
+ return $url;
+ }
+}
+
+function add_session_id( $url, $redirect = false )
+{
+ global $page, $user;
+ $amp = "&amp;";
+ if ( $redirect )
+ {
+ $amp = "&";
+ }
+ if ( !$user['is_the_guest'] )
+ {
+ if ( ereg( "\.php\?",$url ) )
+ {
+ return $url.$amp."id=".$page['session_id'];
+ }
+ else
+ {
+ return $url."?id=".$page['session_id'];
+ }
+ }
+ else
+ {
+ return $url;
+ }
+}
+?> \ No newline at end of file
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
new file mode 100644
index 000000000..48160f113
--- /dev/null
+++ b/include/functions_user.inc.php
@@ -0,0 +1,302 @@
+<?php
+/***************************************************************************
+ * functions_user.inc.php *
+ * -------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+function validate_mail_address( $mail_address )
+{
+ global $lang;
+
+ $output = '';
+ // le mail doit être conforme à qqch du type : nom@serveur.com
+ if ( $mail_address != ''
+ and !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
+ $mail_address ) )
+ {
+ $output = $lang['reg_err_mail_address'];
+ }
+
+ return $output;
+}
+
+function register_user( $login, $password, $password_conf,
+ $mail_address, $status = 'visiteur' )
+{
+ global $prefixeTable;
+
+ $error = array();
+ $i = 0;
+ // le login ne doit pas
+ // 1. être vide
+ // 2. commencer ou se terminer par un espace
+ // 3. comporter les caractères ' ou "
+ // 4. être déjà utilisé
+ if ( $login == '' )
+ {
+ $error[$i++] = $lang['reg_err_login1'];
+ }
+ if ( ereg( "^.* $", $login) )
+ {
+ $error[$i++] = $lang['reg_err_login2'];
+ }
+ if ( ereg( "^ .*$", $login ) )
+ {
+ $error[$i++] = $lang['reg_err_login3'];
+ }
+ if ( ereg( "'", $login ) or ereg( "\"", $login ) )
+ {
+ $error[$i++] = $lang['reg_err_login4'];
+ }
+ else
+ {
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo = '".$login."';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) > 0 )
+ {
+ $error[$i++] = $lang['reg_err_login5'];
+ }
+ }
+ // on vérifie que le password rentré correspond bien
+ // à la confirmation faite par l'utilisateur
+ if ( $password != $password_conf )
+ {
+ $error[$i++] = $lang['reg_err_pass'];
+ }
+
+ $error_mail_address = validate_mail_address( $mail_address );
+ if ( $error_mail_address != '' )
+ {
+ $error[$i++] = $error_mail_address;
+ }
+
+ // on enregistre le nouvel utilisateur si aucune
+ //erreur détectée dans les paramètres
+ if ( sizeof( $error ) == 0 )
+ {
+ // 1.récupération des valeurs par défaut de l'application
+ $infos = array( 'nb_image_line', 'nb_line_page', 'theme', 'language',
+ 'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
+ 'short_period', 'long_period', 'template' );
+ $query = 'select';
+ for ( $i = 0; $i < sizeof( $infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $infos[$i];
+ }
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo = 'visiteur';";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ // 2.ajout du nouvel utilisateur
+ $query = 'insert into '.$prefixeTable.'users';
+ $query.= ' (';
+ $query.= ' pseudo,password,mail_address,status';
+ for ( $i = 0; $i < sizeof( $infos ); $i++ )
+ {
+ $query.= ','.$infos[$i];
+ }
+ $query.= ' values (';
+ $query.= " '".$login."'";
+ $query.= ",'".md5( $password )."'";
+ if ( $mail_address != '' )
+ {
+ $query.= ",'".$mail_address."'";
+ }
+ else
+ {
+ $query.= ',NULL';
+ }
+ $query.= ",'".$status."'";
+ for ( $i = 0; $i < sizeof( $infos ); $i++ )
+ {
+ $query.= ','.$row[$infos[$i]];
+ }
+ $query.= ');';
+ mysql_query( $query );
+ // 3. récupérer l'identifiant de l'utilisateur nouvellement créé
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'users';
+ $query.= " where pseudo = '".$login."';";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $user_id = $row['id'];
+ // 4.ajouter les restrictions au nouvel utilisateur,
+ // les mêmes que celles de l'utilisateur par défaut
+ $query = 'select cat_id';
+ $query.= ' from '.$prefixeTable.'restrictions as r';
+ $query.= ','.$prefixeTable.'users as u ';
+ $query.= ' where u.id = r.user_id';
+ $query.= " and u.pseudo = 'visiteur';";
+ $result = mysql_query( $query );
+ while( $row = mysql_fetch_array( $result ) )
+ {
+ $query = 'insert into '.$prefixeTable.'restrictions';
+ $query.= ' (user_id,cat_id) values';
+ $query.= ' ('.$user_id.','.$row['cat_id'].');';
+ mysql_query ( $query );
+ }
+ }
+ return $error;
+}
+
+function update_user( $user_id, $mail_address, $status,
+ $use_new_password = false, $password = '' )
+{
+ global $prefixeTable;
+
+ $error = array();
+ $i = 0;
+
+ $error_mail_address = validate_mail_address( $mail_address );
+ if ( $error_mail_address != '' )
+ {
+ $error[$i++] = $error_mail_address;
+ }
+
+ if ( sizeof( $error ) == 0 )
+ {
+ $query = 'update '.$prefixeTable.'users';
+ $query.= " set status = '".$status."'";
+ if ( $use_new_password )
+ {
+ $query.= ", password = '".md5( $password )."'";
+ }
+ $query.= ', mail_address = ';
+ if ( $mail_address != '' )
+ {
+ $query.= "'".$mail_address."'";
+ }
+ else
+ {
+ $query.= 'NULL';
+ }
+ $query.= ' where id = '.$user_id;
+ $query.= ';';
+ mysql_query( $query );
+ }
+ return $error;
+}
+
+function check_login_authorization()
+{
+ global $user,$lang,$conf,$page;
+ if ( $user['is_the_guest']
+ and ( $conf['acces'] == 'restreint' or $page['cat'] == 'fav' ) )
+ {
+ echo '<div style="text-align:center;">'.$lang['only_members'].'<br />';
+ echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
+ exit();
+ }
+}
+
+// The function get_restrictions returns an array with the ids of the
+// restricted categories for the user.
+// If the $check_invisible parameter is set to true, invisible categories
+// are added to the restricted one in the array.
+function get_restrictions( $user_id, $user_status, $check_invisible )
+{
+ global $prefixeTable;
+
+ // 1. getting the ids of the restricted categories
+ $query = "select cat_id";
+ $query.= " from $prefixeTable"."restrictions";
+ $query.= " where user_id = $user_id;";
+ $result = mysql_query( $query );
+ $i = 0;
+ $restriction = array();
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $restriction[$i++] = $row['cat_id'];
+ }
+ if ( $check_invisible )
+ {
+ // 2. adding to the restricted categories, the invisible ones
+ if ( $user_status != "admin" )
+ {
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'categories';
+ $query.= " where status='invisible';";
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $restriction[$i++] = $row['id'];
+ }
+ }
+ }
+ return $restriction;
+}
+
+// The get_all_restrictions function returns an array with all the
+// categories id which are restricted for the user. Including the
+// sub-categories and invisible categories
+function get_all_restrictions( $user_id, $user_status )
+{
+ global $prefixeTable;
+
+ $restricted_cat = get_restrictions( $user_id, $user_status, true );
+ $i = sizeof( $restricted_cat );
+ for ( $k = 0; $k < sizeof( $restricted_cat ); $k++ )
+ {
+ $sub_restricted_cat = get_subcats_id( $restricted_cat[$k] );
+ for ( $j = 0; $j < sizeof( $sub_restricted_cat ); $j++ )
+ {
+ $restricted_cat[$i++] = $sub_restricted_cat[$j];
+ }
+ }
+ return $restricted_cat;
+}
+
+// The function is_user_allowed returns :
+// - 0 : if the category is allowed with this $restrictions array
+// - 1 : if this category is not allowed
+// - 2 : if an uppercat category is not allowed
+function is_user_allowed( $category_id, $restrictions )
+{
+ global $user,$prefixeTable;
+
+ $lowest_category_id = $category_id;
+
+ $is_root = false;
+ while ( !$is_root and !in_array( $category_id, $restrictions ) )
+ {
+ $query = "select id_uppercat";
+ $query.= " from $prefixeTable"."categories";
+ $query.= " where id = $category_id;";
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ if ( $row['id_uppercat'] == "" )
+ {
+ $is_root = true;
+ }
+ $category_id = $row['id_uppercat'];
+ }
+
+ if ( in_array( $lowest_category_id, $restrictions ) )
+ {
+ return 1;
+ }
+ if ( in_array( $category_id, $restrictions ) )
+ {
+ return 2;
+ }
+ // this user is allowed to go in this category
+ return 0;
+}
+?> \ No newline at end of file
diff --git a/include/index.php b/include/index.php
new file mode 100644
index 000000000..0b5239bb2
--- /dev/null
+++ b/include/index.php
@@ -0,0 +1,7 @@
+<?php
+$url = '../category.php';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?> \ No newline at end of file
diff --git a/include/init.inc.php b/include/init.inc.php
new file mode 100644
index 000000000..041545b3f
--- /dev/null
+++ b/include/init.inc.php
@@ -0,0 +1,38 @@
+<?php
+/***************************************************************************
+ * init.inc.php *
+ * ------------------- *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+define( PREFIXE_INCLUDE, '' );
+
+include_once( './include/config.inc.php' );
+include_once( './include/user.inc.php' );
+
+include( './theme/'.$user['theme'].'/conf.php' );
+$user['lien_expanded'] = './theme/'.$user['theme'].'/expanded.gif';
+$user['lien_collapsed'] = './theme/'.$user['theme'].'/collapsed.gif';
+// calculation of the number of picture to display per page
+$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
+// retrieving the restrictions for this user
+$user['restrictions'] = get_restrictions( $user['id'], $user['status'], true );
+
+$isadmin = false;
+include_once( './language/'.$user['language'].'.php' );
+if ( $user['is_the_guest'] )
+{
+ $user['pseudo'] = $lang['guest'];
+}
+include_once( './template/'.$user['template'].'/style.inc.php' );
+include_once( './template/'.$user['template'].'/htmlfunctions.inc.php' );
+?> \ No newline at end of file
diff --git a/include/user.inc.php b/include/user.inc.php
new file mode 100644
index 000000000..b323385e7
--- /dev/null
+++ b/include/user.inc.php
@@ -0,0 +1,93 @@
+<?php
+/***************************************************************************
+ * user.inc.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Saturday, October 26, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+// retrieving user informations
+// $infos array is used to know the fields to retrieve in the table "users"
+// Each field becomes an information of the array $user.
+// Example :
+// status --> $user['status']
+$infos = array( 'id', 'pseudo', 'mail_address', 'nb_image_line',
+ 'nb_line_page', 'status', 'theme', 'language', 'maxwidth',
+ 'maxheight', 'expand', 'show_nb_comments', 'short_period',
+ 'long_period', 'template' );
+
+$query_user = 'select';
+for ( $i = 0; $i < sizeof( $infos ); $i++ )
+{
+ if ( $i > 0 )
+ {
+ $query_user.= ',';
+ }
+ else
+ {
+ $query_user.= ' ';
+ }
+ $query_user.= $infos[$i];
+}
+$query_user.= ' from '.$prefixeTable.'users';
+$query_done = false;
+$user['is_the_guest'] = false;
+if ( isset( $_GET['id'] )
+ && ereg( "^[0-9a-zA-Z]{".$conf['session_id_size']."}$", $_GET['id'] ) )
+{
+ $page['session_id'] = $_GET['id'];
+ $query = "select user_id, expiration, ip ";
+ $query.= "from $prefixeTable"."sessions ";
+ $query.= "where id = '".$_GET['id']."';";
+ $result = mysql_query( $query );
+ if ( mysql_num_rows( $result ) > 0 )
+ {
+ $row = mysql_fetch_array( $result );
+ if ( $row['expiration'] < time() )
+ {
+ // deletion of the session from the database,
+ // because it is out-of-date
+ $delete_query = "delete from ".$prefixeTable."sessions";
+ $delete_query.= " where id = ".$page['session_id'].";";
+ mysql_query( $delete_query );
+ }
+ else
+ {
+ if ( $REMOTE_ADDR == $row['ip'] )
+ {
+ $query_user .= ' where id = '.$row['user_id'];
+ $query_done = true;
+ }
+ }
+ }
+}
+if ( !$query_done )
+{
+ $query_user .= " where pseudo = 'visiteur'";
+ $user['is_the_guest'] = true;
+}
+$query_user .= ';';
+
+$row = mysql_fetch_array( mysql_query( $query_user ) );
+
+// affectation of each value retrieved in the users table into a variable
+// of the array $user.
+for ( $i = 0; $i < sizeof( $infos ); $i++ )
+{
+ $user[$infos[$i]] = $row[$infos[$i]];
+ // If the field is true or false, the variable is transformed into a boolean
+ // value.
+ if ( $row[$infos[$i]] == 'true' || $row[$infos[$i]] == 'false' )
+ {
+ $user[$infos[$i]] = get_boolean( $row[$infos[$i]] );
+ }
+}
+?> \ No newline at end of file
diff --git a/include/vtemplate.class.php b/include/vtemplate.class.php
new file mode 100644
index 000000000..8f531412c
--- /dev/null
+++ b/include/vtemplate.class.php
@@ -0,0 +1,519 @@
+<?php
+/*****************************************************************
+ * VIRTUAL-TEMPLATE
+ *
+ * Version : 1.3.1 Base Edition ( Juillet 2002 ) build 6
+ *
+ * Address : http://vtemplate.sourceforge.net
+ *
+ * Authors:
+ * + THIEBAUT Jean-Baptiste(J.Baptiste@leweby.com) - http://www.leweby.com .
+ * + CAMPANA François (fc@netouaibe.com).
+ * Licence: GPL.
+ *
+ *
+ *****************************************************************/
+
+if ( !isset($DEFINE_VTEMPLATE) )
+{
+ define("ALL",1);
+ define("VARTAG","{#"); // Tag d'ouverture des variables :
+ // vous pouvez changer ce paramètre.
+ define("VTEMPLATE_VERSION","1.3.1");
+ define("VTEMPLATE_TYPE","BA");
+ define("VTEMPLATE_BUILD","6");
+
+
+ class Err
+ {
+ var $msg;
+ var $titre;
+
+ function error( $errno, $arg = "", $code = 0, $disp = 0 )
+ {
+// Gestion des erreurs
+ switch($errno)
+ {
+ case 1:
+ $this->titre="Erreur de session n° $code";
+ $this->msg = "La zone $arg est déjà ouverte.Avant d'ajouter une session sur cette zone, vous devez la fermer à l'aide de la fonction closeSession().<br>" ;
+ break;
+ case 2:
+ $this->titre="Erreur de session n° $code";
+ $this->msg = "Vous tentez de fermer une session de la zone $arg alors qu'aucune session pour cette zone n'existe.Pour ouvrir une session, utilisez la fonction addSession().<br>";
+ break;
+ case 3:
+ $this->titre="Erreur de session n° $code";
+ $var = $arg[1];
+ $zone = $arg[0];
+ $this->msg = "Vous essayez de valoriser la variable $var sans avoir créer de session de la zone $zone.Utilisez la fonction addSession() pour créer une session, puis setVar pour valoriser une variable.<br>";
+ break;
+ case 4:
+ $this->titre="Erreur de session n° $code";
+ $var = $arg[1];
+ $zone = $arg[0];
+ $this->msg = "La variable $var que vous souhaitez valoriser n'existe pas dans la zone $zone.<br>";
+ break;
+ case 5:
+ $this->titre="Erreur de parsing n° $code";
+ $this->msg = "Vous utilisez des caractère non autorisés pour déclarer vos zones.Vous pouvez utiliser tous les caractères à l'exception de \'{\' , \'#\' \'}\' et \'|\'.<br>";
+ break;
+ case 6:
+ $this->titre="Erreur de parsing n° $code";
+ $this->msg = "Vous ne pouvez pas utiliser le même nom ($arg)de zone plusieurs fois.<br>";
+ break;
+ case 7:
+ $this->titre="Erreur de parsing n° $code";
+ $this->msg = "Vous avez oublié de fermer la zone $arg.<br>";
+ break;
+ case 8:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "Le fichier template $arg est introuvable.<br>";
+ break;
+ case 9:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "Impossible d'ouvrir le fichier $arg.Vérifiez les droits de ce fichier.<br>";
+ break;
+ case 10:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "Impossible de lire le fichier template $arg.<br>";
+ break;
+ case 11:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "La zone $arg est introuvable.Vérifiez la syntaxe de cette zone.<br>";
+ break;
+ case 12:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "La variable $arg est introuvable .Vérifiez la syntaxe de la variable.<br>";
+ break;
+ case 13:
+ $this->titre="Erreur de traitement n° $code";
+ $this->msg = "L'identifiant de fichier spécifié n'existe pas.Vérifiez les fonctions Open() de votre script.<br>";
+ break;
+ case 14:
+ $this->titre="Erreur de traitement n° $code";
+ $var = $arg[1];
+ $file = $arg[0];
+ $this->msg = "La variable $var dans le fichier $file est introuvable.Vérifiez la syntaxe de la variable.<br>";
+ break;
+ case 15:
+ $this->titre="Erreur de traitement n° $code";
+ $var = $arg[2];
+ $zone = $arg[1];
+ $fichier = $arg[0];
+ $this->msg = "La variable $var dans la zone $zone du fichier $fichier est introuvable.Vérifiez la syntaxe de la variable et du nom de la zone.<br>";
+ break;
+ default:
+ $this->titre = "Erreur inconnue $code";
+ $this->msg = "Veuillez le rapporter aux auteurs de la classe.";
+ }
+ $this->titre .= ": <br>";
+ if ($disp){
+ $web = "Pour plus d'informations, consultez la <a href=\"http://www.virtual-solution.net/vtemplate/docs/debug-mod.php?version=".VTEMPLATE_VERSION."&build=".VTEMPLATE_BUILD."&type=".VTEMPLATE_TYPE."&error=$code\" target=\"_blank\">doc en ligne</a>";
+ echo "<font face=verdana size=2 color=red><u>$this->titre</u><i>$this->msg</i>$web<br><br></font>";
+ }
+ return -1;
+ }
+// Fin classe
+ }
+
+ class Session extends err{
+
+ var $name; // Name of the session
+ var $globalvar = array(); // List of global variable of the session
+ var $varlist = array(); // List of var in this session
+ var $subzone = array(); // list of sub-zone
+ var $temp; // Generated code for the current session
+ var $generated = NULL; // The final code
+ var $source; // Source code
+ var $used=0; // Indicates if the session contain used variable
+ var $stored; // Give the filename were is stored the session
+
+ function Session($name,$source,$stored){
+ $this->name = $name;
+ $this->source = $source;
+ $this->stored = $stored;
+ $this->parseVar();
+ }
+
+ function parseVar(){
+ // Récupération des noms des variables
+ $regle = "|".VARTAG."(.*)}|sU";
+ preg_match_all ($regle,$this->source,$var1);
+ // Création du tableau de variable à partir de la liste parsée.
+ $this->varlist=@array_merge($var[1],$var1[1]);
+ return 1;
+ }
+
+ function init(){
+ if($this->used) return $this->error(1,array($this->stored,$this->name),"SESSION1",1);
+// Reset generated code
+ $this->temp = $this->source;
+ $this->used = 1;
+ }
+ function closeSession(){
+// Check if the zone has been used.
+ if(!$this->used) return $this->error(2,array($this->stored,$this->name),"SESSION2",1);
+// Set Globals vars.
+ $this->generateCode();
+ $this->used=0;
+ return 1;
+ }
+
+ function reset(){
+ $this->used = 0;
+ $this->generated = NULL;
+ return 1;
+ }
+
+ function addSubZone(&$subzone){
+ $this->subzone[$subzone->name] = &$subzone;
+ return 1;
+ }
+
+ function setVar($varname,$value){
+ if (!$this->used) return $this->error(3,array($this->stored,$this->name,$varname),"SESSION3",1);
+ if (!in_array($varname,$this->varlist)) return $this->error(4,array($this->name,$varname),"SESSION4",1);
+ $regle = "(\\".VARTAG."$varname\})";
+ $this->temp = preg_replace($regle,$value,$this->temp);
+ return 1;
+ }
+
+ function dispVar(){
+ echo "Liste variables de $this->name:<br>";
+ foreach ( $this->varlist as $vars )
+ echo "$vars <br>";
+ }
+
+ function setGlobalVar($varname,$value){
+ $set = 0;
+ if (in_array($varname,$this->varlist)){
+ // Replace the var into this session
+ $this->globalvar[$varname]=$value;
+ $set = 1;
+ }
+ // Replace the var into sub zones
+ foreach(array_keys($this->subzone) as $subzone){
+ $set = $this->subzone[$subzone]->setGlobalVar($varname,$value) || $set;
+ }
+ return $set;
+ }
+
+ function replaceGlobalVar(){
+ if ( count($this->globalvar) )
+ foreach($this->globalvar as $varname => $value){
+ $regle = "(\\".VARTAG."$varname\})";
+ $this->temp = preg_replace($regle,$value,$this->temp);
+ }
+ }
+
+
+ function generateCode(){
+ if ($this->used == 0) return $this->generated;
+ // Replace global var.
+ if ( count($this->globalvar) ) $this->replaceGlobalVar();
+ // Replace all unused variable by ""
+ $regle = "|\\".VARTAG."(.*)\}|";
+ $this->temp = preg_replace($regle,"",$this->temp);
+ // Generate the subzone(s) code
+ if(count($this->subzone)){
+ foreach(array_keys($this->subzone) as $subzone){
+ $text = ($this->subzone[$subzone]->used) ? $this->subzone[$subzone]->generateCode() : $this->subzone[$subzone]->generated;
+ $this->temp = preg_replace("(\|$subzone\|)",$text,$this->temp);
+ $this->subzone[$subzone]->reset();
+ }
+ }
+ $this->generated .= $this->temp;
+ return $this->generated;
+ }
+
+ function inVarList($varname){
+ return in_array($varname,$this->varlist);
+ }
+
+// Fin classe
+ }
+
+ class VTemplate_Private extends Err{
+/****************************************
+ * Private Class. *
+ * ***************************************/
+
+ var $sources=array(); // Sources des zones issues de la premiere partie du parsing.
+ var $sessions=array(); // Tableau de sessions
+ var $v_global=array(); // Globla var array.
+
+/****************************************************************
+ Parsing Functions for Template files. ( PF 1.0 )
+****************************************************************/
+
+ function getNom($code){
+// Retourne le premier nom de zone qu'il trouve dans le code
+
+ preg_match("(<!--VTP_([^()]+)-->)sU",$code,$reg);
+
+ // Tester la présence des caratère invalides dans le nom ( | et {});
+ if (@count(explode("|",$reg[1]))>1 || @count(explode("{",$reg[1]))>1 || @count(explode("}",$reg[1]))>1) exit($this->error(5,$reg[1],"PARSE1",1));
+
+ return @$reg[1];
+ }
+
+ function endTag($code,$nom){
+// Renvoie TRUE(1) si le tag de fermeture est présent.
+
+ preg_match("(<!--/VTP_$nom-->)sU",$code,$reg);
+
+ return ($reg[0]!="<!--/VTP_$nom-->") ? 0 : 1;
+ }
+
+ function getSource($code,$nom,$type=0){
+// Retourne le source de la zone de nom $nom
+
+ preg_match_all ("(<!--VTP_$nom-->(.*)<!--/VTP_$nom-->)sU",$code,$reg);
+
+ return $reg[$type][0];
+ }
+
+ function parseZone($code_source,$nom_zone="|root|"){
+// Fonction récursive de parsing du fichier template
+ // Vérification que la zone n'existe pas
+ if (isset($this->sources[$nom_zone])) exit($this->error(6,$nom_zone,"PARSE2",1));
+
+ // Enregistrement du code source
+ $this->sources[$nom_zone]["source"]=$code_source;
+
+ // Rappel de la fonction pour chaque fils.
+ while($nom_fils=$this->getNom($this->sources[$nom_zone]["source"])){
+
+ // Vérification que le tag de fin est présent.
+ if (!$this->endTag($code_source,$nom_fils)) exit($this->error(7,$nom_fils,"PARSE3",1));
+
+ // Parse le fils
+ $this->parseZone($this->getSource($this->sources[$nom_zone]["source"],$nom_fils,1),$nom_fils);
+
+ // Enregistre le nom du fils dans la liste des fils
+ $this->sources[$nom_zone]["fils"][]=$nom_fils;
+
+ // Remplace le code du fils dans le source du père
+ $this->sources[$nom_zone]["source"]=str_replace(
+ $this->getSource($this->sources[$nom_zone]["source"],$nom_fils,0),
+ "|$nom_fils|",
+ $this->sources[$nom_zone]["source"]
+ );
+ // Teste si la zone $nom_fils n'existe pas plusieurs fois dans la zone $nom_zone
+ if (count(explode("|$nom_fils|",$this->sources[$nom_zone]["source"]))>2) exit($this->error(6,$nom_fils,"PARSE4",1));
+ }// fin While
+
+ return 1;
+ }
+
+/****************************************************************
+ Session Management functions ( SMF 1.0 )
+****************************************************************/
+
+ function createSession($handle,$zone = "|root|"){
+// Create a new session of the zone
+ $this->sessions[$handle][$zone] = new Session($zone,$this->sources[$zone]["source"],$this->file_name[$handle]);
+
+// Create sub-zone
+ if (@count($this->sources[$zone]["fils"])){
+ foreach($this->sources[$zone]["fils"] as $subzone){
+ $this->createSession($handle,$subzone);
+ $this->sessions[$handle][$zone]->addSubZone($this->sessions[$handle][$subzone]);
+ }
+ }
+
+//end createSession
+ }
+
+
+/****************************************************************
+ Global Variable Management Functions ( GVMF 1.0 )
+****************************************************************/
+
+ function setGZone($handle,$zone,$var,$value){
+ // Define Global var for $zone and its sub-zone.
+ // Set global value to $zone vars.
+ return $this->sessions[$handle][$zone]->setGlobalVar($var,$value);
+ }
+
+ function setGFile($handle,$var,$value) {
+ return $this->sessions[$handle]["|root|"]->setGlobalVar($var,$value);
+ }
+
+ function setGAll($var,$value){
+ $declare = 0;
+ $this->v_global[$var]=$value;
+ if (is_array($this->sessions)){
+ foreach($this->sessions as $handle => $v){
+ $declare = $this->setGFile($handle,$var,$value) || $declare;
+ }
+ }
+ return $declare;
+ }
+
+ function setGOpened($handle){
+// Set Global var into the opened file
+ foreach($this->v_global as $name => $val){
+ $this->setGFile($handle,$name,$val);
+ }
+ return 1;
+ }
+
+// Fin VTemplate_Private
+ }
+
+
+ class VTemplate extends VTemplate_Private{
+/****************************************
+ * Public Class. *
+ * ***************************************/
+
+
+/****************************************************************
+ Core Functions
+*****************************************************************/
+
+
+ function Open($nomfichier){
+// Ouverture d'un fichier source et retourne le handle de ce fichier
+// Création du handle:
+ $handle = "{".count($this->sessions)."}" ;
+
+
+// Récupération du source à parser
+ if (!@file_exists($nomfichier)) return $this->error(8,$nomfichier,"TTT1",1);
+ if (!$f_id=@fopen($nomfichier,"r")) return $this->error(9,$nomfichier,"TTT2",1);
+ if (!$source=@fread($f_id, filesize($nomfichier))) return $this->error(10,$nomfichier,"TTT3",1);
+ clearstatcache();
+ fclose($f_id);
+
+// Store the filename
+ $this->file_name[$handle]=$nomfichier;
+
+// Parse les zones
+ $this->parseZone($source);
+
+// Création du tableau de session
+ $this->createSession($handle);
+
+//Nettoyage des variables temporaires
+ $this->sources=NULL;
+
+// Set global var.
+ $this->setGOpened($handle);
+
+ $this->addSession($handle);
+ return $handle;
+ }
+
+ function newSession($handle="{0}",$nom_zone = "|root|"){
+ if ( $this->sessions[$handle][$nom_zone]->used ) $this->closeSession($handle,$nom_zone);
+ $this->addSession($handle,$nom_zone,$cache,$time,$num_session);
+ return 1;
+ }
+
+ function addSession($handle="{0}",$nom_zone = "|root|"){
+ // Does the zone exist ?
+ if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT4",1);
+ $this->sessions[$handle][$nom_zone]->init();
+ return 1;
+ }
+
+ function closeSession($handle="{0}",$nom_zone = "|root|"){
+// Close the current session and all his sub-session
+ // Check if the zone exists.
+ if(!isset($this->sessions[$handle][$nom_zone])) return $this->error(11,array($nom_zone,$this->file_name[$handle]),"TTT5",1);
+ // Closing sub-zone
+ $this->sessions[$handle][$nom_zone]->closeSession();
+ return 1;
+ }
+
+ function setGlobalVar($arg1,$arg2,$arg3){
+ if ($arg1 == 1){
+ if (!$this->setGAll($arg2,$arg3)) return $this->error(12,$arg2,"TTT6",1);
+ return 1;
+ }
+ if (!isset($this->sessions[$arg1])) return $this->error(13,$arg1,"TTT7",1);
+ $tab=explode(".",$arg2);
+ if (count($tab)==1){
+ if (!$this->setGFile($arg1,$arg2,$arg3)) return $this->error(14,array($this->file_name[$arg1],$arg2),"TTT8",1);
+ }
+ else if (count($tab==2)){
+ if (!isset($this->sessions[$arg1][$tab[0]])) return $this->error(11,array($tab[0],$this->file_name[$arg1],"TTT9",1));
+ if (!$this->setGZone($arg1,$tab[0],$tab[1],$arg3)) return $this->error(15,array($this->file_name[$arg1],$tab[0],$tab[1]),"TTT10",1);
+ }
+ return 1;
+ }
+
+ function setVar($handle,$zone_var,$val){
+ // Fill the variable
+ $tab=explode(".",$zone_var);
+ if(count($tab)==2){
+ $zone=$tab[0];
+ $var=$tab[1];
+ }
+ else
+ {
+ $zone="|root|";
+ $var=$tab[0];
+ }
+
+ // Teste l'existence de la zone dans la liste
+ if (!isset($this->sessions[$handle][$zone])) return $this->error(11,array($this->file_name[$handle],$zone),"TTT11",1);
+
+ //Enregistre la variable
+ return $this->sessions[$handle][$zone]->setVar($var,$val);
+ }
+
+ function Parse($handle_dest,$zone_var_dest,$handle_source,$zone_source="|root|"){
+ if($this->sessions[$handle_source][$zone_source]->used == 1) $this->closeSession($handle_source,$zone_source);
+ $this->setVar($handle_dest,$zone_var_dest, $this->sessions[$handle_source][$zone_source]->generated);
+ }
+
+ function setVarF($handle,$zone_var,$file){
+// Fonction qui ouvre le fichier file et copie ce qu'il y a dedans dans une variable.
+ $tab=explode(".",$zone_var);
+
+// Récupération nom de la zone et de la variable.
+ if(count($tab)==2){
+ $zone=$tab[0];
+ $var=$tab[1];
+ }
+ else
+ {
+ $zone="|root|";
+ $var=$tab[0];
+ }
+// Teste l'existence de la zone dans la liste
+ if (!is_object($this->sessions[$handle][$zone])) return $this->error(11,array($handle,$zone),"TTT12",1);
+
+ // Récupération du source à lire
+ if (!@file_exists($file)) return $this->error(8,$file,"TTT13",1);
+ if (!$f_id=@fopen($file,"r")) return $this->error(9,$file,"TTT14",1);
+ if (!$val=@fread($f_id, filesize($file))) return $this->error(10,$file,"TTT15",1);
+ clearstatcache();
+ fclose($f_id);
+
+//Enregistre la variable
+ return $this->sessions[$handle][$zone]->setVar($var,$val);
+ }
+
+ function isZone($handle, $zone="|root|")
+ {
+ return isset($this->sessions[$handle][$zone]) ;
+ }
+
+ function Display($handle="{0}",$display=1,$zone="|root|"){
+ $this->closeSession($handle,$zone);
+ $c_genere = $this->sessions[$handle][$zone]->generated;
+
+ if ($display) echo $c_genere; else return ($c_genere);
+ }
+
+
+// End VTemplate
+ }
+ $DEFINE_VTEMPLATE = 1;
+}
+?>
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..bea8122e7
--- /dev/null
+++ b/index.php
@@ -0,0 +1,20 @@
+<?php
+include_once( './include/mysql.inc.php' );
+include_once( './include/functions.inc.php' );
+database_connection();
+// récupération des informations de configuration du site
+$query = 'select acces ';
+$query .= 'from '.$prefixeTable.'config;';
+$row = mysql_fetch_array( mysql_query( $query ) );
+$url = 'category';
+if ( $row['acces'] == 'restreint' )
+{
+ $url = 'identification';
+}
+// redirection
+$url.= '.php';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?> \ No newline at end of file
diff --git a/language/english.php b/language/english.php
new file mode 100644
index 000000000..bc4642ae3
--- /dev/null
+++ b/language/english.php
@@ -0,0 +1,492 @@
+<?php
+ $lang['only_members'] = "Only members can access this page";
+ $lang['invalid_pwd'] = "Invalid password!";
+ $lang['access_forbiden'] = "You are not authorized to access this page";
+ $lang['submit'] = "Submit";
+ $lang['login'] = "login";
+ $lang['password'] = "password";
+ $lang['new'] = "new";
+ $lang['delete'] = "delete";
+ $lang['category'] = "category";
+ $lang['thumbnail'] = "thumbnail";
+ $lang['date'] = "date";
+
+ // diapo page
+ $lang['diapo_default_page_title'] = "No category selected";
+ $lang['thumbnails'] = "Thumbnails";
+ $lang['categories'] = "Categories";
+ $lang['hint_category'] = "shows images at the root of this categry";
+ $lang['total_images'] = "total";
+ $lang['title_menu'] = "Menu";
+ $lang['change_login'] = "change login";
+ $lang['login'] = "login";
+ $lang['hint_login'] = "identification enables site's appareance customization";
+ $lang['logout'] = "logout";
+ $lang['customize'] = "customize";
+ $lang['hint_customize'] = "customize the appareance of the gallery";
+ $lang['hint_search'] = "search";
+ $lang['search'] = "search";
+ $lang['favorite_cat'] = "favorites";
+ $lang['favorite_cat_hint'] = "display your favorites";
+ $lang['about'] = "about";
+ $lang['hint_about'] = "more informations on PhpWebGallery...";
+ $lang['admin'] = "admin";
+ $lang['hint_admin'] = "available for administrators only";
+ $lang['no_category'] = "No category selected<br />please select it in the menu";
+ $lang['page_number'] = "page number";
+ $lang['previous_page'] = "Previous";
+ $lang['next_page'] = "Next";
+ $lang['nb_image_category'] = "number of images in this category";
+ $lang['connected_user_female'] = "connected user";
+ $lang['connected_user_male'] = "connected user";
+ $lang['recent_image'] = "image within the";
+ $lang['days'] = "days";
+ $lang['send_mail'] = "Any comment? Send me an e-mail";
+ $lang['title_send_mail'] = "A comment on your site";
+ $lang['sub-cat'] = "subcategories";
+ $lang['images_available'] = "images in this category";
+ $lang['total'] = "images";
+ $lang['upload_picture'] = "Upload a picture";
+
+ // both diapo and photo pages
+ $lang['registration_date'] = "registered on";
+ $lang['creation_date'] = "created on";
+ $lang['comment'] = "comment";
+ $lang['author'] = "author";
+ $lang['size'] = "size";
+ $lang['filesize'] = "filesize";
+ $lang['file'] = "file";
+ $lang['generation_time'] = "Page generated in";
+ $lang['favorites'] = "Favorites";
+ $lang['search_result'] = "Search results";
+
+ // about page
+ $lang['about_page_title'] = "About PhpWebGallery";
+ $lang['about_title'] = "About...";
+ $lang['about_message'] = "<div style=\"text-align:center;font-weigh:bold;\">Information about PhpWebGallery</div>
+ <ul>
+ <li>This website uses <a href=\"http://www.z0rglub.com/phpwebgallery\" style=\"text-decoration:underline\">PhpWebGallery</a> version 1.2. PhpWebGallery is a web application giving you the possibility to create an online images gallery easily.</li>
+ <li>Technicaly, PhpWebGallery is fully developped with PHP (the elePHPant) with a MySQL database (the SQuirreL).</li>
+ <li>If you have any suggestions or comments, please visit <a href=\"http://www.z0rglub.com/phpwebgallery\" style=\"text-decoration:underline\">PhpWebGallery</a> official site, and its dedicated <a href=\"http://www.z0rglub.com/phpwebgallery/forum\" style=\"text-decoration:underline\">forum</a>.</li>
+ </ul>";
+ $lang['about_return'] = "Back";
+
+ // identification page
+ $lang['ident_page_title'] = "Identification";
+ $lang['ident_title'] = "Identification";
+ $lang['actual_user'] = "User currently registered as: ";
+ $lang['ident_register'] = "Register";
+ $lang['ident_forgotten_password'] = "Forget your password ?";
+ $lang['ident_guest_visit'] = "Go through the gallery as a visitor";
+
+ // page personnalisation
+ $lang['customize_page_title'] = "Customization";
+ $lang['customize_title'] = "Customization";
+ $lang['customize_nb_image_per_row'] = "number of images per row";
+ $lang['customize_nb_row_per_page'] = "number of rows per page";
+ $lang['customize_color'] = "site color";
+ $lang['customize_language'] = "language";
+ $lang['sex'] = "sex";
+ $lang['male'] = "male";
+ $lang['female'] = "female";
+ $lang['maxwidth'] = "maximum width of the pictures";
+ $lang['maxheight'] = "maximum height of the pictures";
+ $lang['err_maxwidth'] = "maximum width must be a number superior to 50";
+ $lang['err_maxheight'] = "maximum height must be a number superior to 50";
+
+ // photo page
+ $lang['previous_image'] = "Previous";
+ $lang['next_image'] = "Next";
+ $lang['back'] = "Click on the image to go back to the thumbnails page";
+ $lang['info_image_title'] = "Image information";
+ $lang['link_info_image'] = "Modify information";
+ $lang['true_size'] = "Real size";
+ $lang['comments_title'] = "Comments from the users of the site";
+ $lang['comments_del'] = "delete this comment";
+ $lang['comments_add'] = "Add a comment";
+ $lang['month'][1] = "January";
+ $lang['month'][2] = "February";
+ $lang['month'][3] = "March";
+ $lang['month'][4] = "April";
+ $lang['month'][5] = "May";
+ $lang['month'][6] = "June";
+ $lang['month'][7] = "July";
+ $lang['month'][8] = "August";
+ $lang['month'][9] = "September";
+ $lang['month'][10] = "October";
+ $lang['month'][11] = "November";
+ $lang['month'][12] = "December";
+ $lang['day'][0] = "Sunday";
+ $lang['day'][1] = "Monday";
+ $lang['day'][2] = "Tuesday";
+ $lang['day'][3] = "Wednesday";
+ $lang['day'][4] = "Thursday";
+ $lang['day'][5] = "Friday";
+ $lang['day'][6] = "Saturday";
+ $lang['add_favorites_alt'] = "Add to favorites";
+ $lang['add_favorites_hint'] = "Add this picture to your favorites";
+ $lang['del_favorites_alt'] = "Delete from favorites";
+ $lang['del_favorites_hint'] = "Delete this picture from your favorites";
+
+ // page register
+ $lang['register_page_title'] = "Registration";
+ $lang['register_title'] = "Registration";
+ $lang['reg_err_login1'] = "Please, enter a login";
+ $lang['reg_err_login2'] = "login mustn't end with a space character";
+ $lang['reg_err_login3'] = "login mustn't start with a space character";
+ $lang['reg_err_login4'] = "login mustn't contain characters \" and '";
+ $lang['reg_err_login5'] = "this login is already used";
+ $lang['reg_err_pass'] = "please enter your password again";
+ $lang['reg_confirm'] = "confirm";
+ $lang['reg_mail_address'] = "mail address";
+ $lang['reg_err_mail_address'] = "mail address must be like xxx@yyy.eee (example : jack@altern.org)";
+
+ // page search
+ $lang['search_title'] = "Search";
+ $lang['invalid_search'] = "search must be done on 3 caracters or more";
+ $lang['search_field_search'] = "Search";
+ $lang['search_return_main_page'] = "Return to thumbnails page";
+
+ // page upload
+ $lang['upload_forbidden'] = "You can't upload pictures in this category";
+ $lang['upload_file_exists'] = "A picture's name already used";
+ $lang['upload_filenotfound'] = "You must choose a picture fileformat for the image";
+ $lang['upload_cannot_upload'] = "can't upload the picture on the server";
+ $lang['upload_title'] = "Upload a picture";
+ $lang['upload_advise'] = "Choose an image to place in the category : ";
+ $lang['upload_advise_thumbnail'] = "Optional, but recommended : choose a thumbnail to associate to ";
+ $lang['upload_advise_filesize'] = "the filesize of the picture must not exceed : ";
+ $lang['upload_advise_width'] = "the width of the picture must not exceed : ";
+ $lang['upload_advise_height'] = "the height of the picture must not exceed : ";
+ $lang['upload_advise_filetype'] = "the picture must be to the fileformat jpg, gif or png";
+ $lang['upload_err_username'] = "the username must be given";
+ $lang['upload_username'] = "Username";
+ $lang['upload_successful'] = "Picture uploaded with success, an administrator will validate it as soon as possible";
+
+ //----------------------------------administration
+ if ( $isadmin )
+ {
+ // page admin
+ $lang['title_add'] = "Add/Modify a user";
+ $lang['title_liste_users'] = "Users list";
+ $lang['title_history'] = "History";
+ $lang['title_update'] = "Database update";
+ $lang['title_configuration'] = "PhpWebGallery configuration";
+ $lang['title_instructions'] = "Instructions";
+ $lang['title_permissions'] = "Modify an user permission";
+ $lang['title_categories'] = "Categories management";
+ $lang['title_edit_cat'] = "Edit a category";
+ $lang['title_info_images'] = "Modify category's image information";
+ $lang['title_thumbnails'] = "Thumbnail creation";
+ $lang['title_thumbnails_2'] = "for";
+ $lang['title_default'] = "PhpWebGallery administration";
+
+ $lang['menu_title'] = "Administration";
+ $lang['menu_config'] = "Configuration";
+ $lang['menu_users'] = "Users";
+ $lang['menu_add_user'] = "add";
+ $lang['menu_list_user'] = "list";
+ $lang['menu_categories'] = "Categories";
+ $lang['menu_update'] = "Database update";
+ $lang['menu_thumbnails'] = "Thumbnails";
+ $lang['menu_history'] = "History";
+ $lang['menu_instructions'] = "Instructions";
+ $lang['menu_back'] = "Back to galleries";
+
+ $lang['title_waiting'] = "Pictures waiting for validation";
+ $lang['menu_waiting'] = "Waiting";
+
+ $lang['default_message'] = "PhpWebGallery administration panel";
+
+ // page de configuration
+ $lang['conf_err_prefixe'] = "thumbnail's prefix mustn't contain any accentued character";
+ $lang['conf_err_mail'] = "e-mail address refused, it must be like name@server.com";
+ $lang['conf_err_periods'] = "periods must be integer values";
+ $lang['conf_err_periods_2'] = "periods must be superior to 0, the long period must be superior to the short one";
+ $lang['conf_err_sid_size'] = "the session identifier size must be an integer value between 4 and 50";
+ $lang['conf_err_sid_time'] = "the session time must be an integer value between 5 and 60";
+ $lang['conf_err_max_user_listbox'] = "the max user listbox number must be an integer value between 0 and 255";
+ $lang['conf_err_message'] = "The number of mistakes you have done is ";
+ $lang['conf_confirmation'] = "Information data registered in database";
+
+ $lang['no'] = "no";
+ $lang['yes'] = "yes";
+
+ $lang['conf_general_title'] = "Main configuration";
+ $lang['conf_general_webmaster'] = "webmaster login";
+ $lang['conf_general_webmaster_info'] = "It will be shown to the visitors. It is necessary for website administration";
+ $lang['conf_general_mail'] = "webmaster mail adress";
+ $lang['conf_general_mail_info'] = "Visitors will be able to contact by this mail";
+ $lang['conf_general_prefix'] = "thumbnail prefix";
+ $lang['conf_general_prefix_info'] = "Thumbnails use this prefix. Do not fill if your not sure.";
+ $lang['conf_general_short_period'] = "short period";
+ $lang['conf_general_short_period_info'] = "By days. Period within a picture is shown with a red mark. The short period must be superior to 1 day.";
+ $lang['conf_general_long_period'] = "long period";
+ $lang['conf_general_long_period_info'] = "By days. Period within a picture is shown with a green mark. The long period must be superior to the short period.";
+ $lang['conf_general_access'] = "access type";
+ $lang['conf_general_access_1'] = "free";
+ $lang['conf_general_access_2'] = "restricted";
+ $lang['conf_general_access_info'] = "- free : anyone can enter the site, any visitor can create an account in order to customize the appareance of the website<br />- restricted : the webmaster create accounts. Only registered users can enter the site";
+ $lang['conf_general_max_user_listbox'] = "max listbox users number";
+ $lang['conf_general_max_user_listbox_info'] = "- this is the number maximum of users for which PhpWebGallery display a listbox instead of a simple text box on the identification page<br />- enter a number between 0 and 255, 0 means that you want to display the listbox";
+ $lang['conf_general_default_page'] = "default page";
+ $lang['conf_general_default_page_1'] = "thumbnails";
+ $lang['conf_general_default_page_2'] = "identification";
+ $lang['conf_general_default_page_info'] = "page on which users are redirected when they go to the root of the site";
+ $lang['conf_general_expand'] = "expand all categories";
+ $lang['conf_general_expand_1'] = "no";
+ $lang['conf_general_expand_2'] = "yes";
+ $lang['conf_general_expand_info'] = "expand all categories by default in the menu ?";
+ $lang['conf_comments'] = "users comments";
+ $lang['conf_comments_title'] = "Configuration of ".$lang['conf_comments'];
+ $lang['conf_comments_show_comments'] = $lang['conf_comments'];
+ $lang['conf_comments_show_comments_info'] = "display the users comments under each picture ?";
+ $lang['conf_comments_comments_number'] = "number of comments per page";
+ $lang['conf_comments_comments_number_info'] = "number of comments to display on each page. This number is unlimited for a picture. Enter a number between 5 and 50.";
+ $lang['conf_err_comment_number'] = "The number of comments a page must be between 5 and 50 included.";
+ $lang['conf_remote_site_title'] = "Remote server";
+ $lang['conf_remote_site_delete_info'] = "Deleting a remote server will delete all the image and the categories in relation with this server.";
+ $lang['conf_upload_title'] = "Configuration of the users upload";
+ $lang['conf_upload_available'] = "authorized the upload of pictures";
+ $lang['conf_upload_available_info'] = "Authorizing the upload of pictures by users on the categories of the website (not on a remote server).";
+ $lang['conf_upload_maxfilesize'] = "maximum filesize";
+ $lang['conf_upload_maxfilesize_info'] = "Maximum filesize for the uploaded pictures. Must be a number between 10 and 1000 Ko.";
+ $lang['conf_err_upload_maxfilesize'] = "Maximum filesize for the uploaded pictures must be a number between 10 and 1000 Ko.";
+ $lang['conf_upload_maxwidth'] = "maximum width";
+ $lang['conf_upload_maxwidth_info'] = "Maximum width authorized for the uploaded images. Must be a number superior to 10 pixels";
+ $lang['conf_err_upload_maxwidth'] = "maximum width authorized for the uploaded images must be a number superior to 10 pixels.";
+ $lang['conf_upload_maxheight'] = "maximum height";
+ $lang['conf_upload_maxheight_info'] = "Maximum height authorized for the uploaded images. Must be a number superior to 10 pixels";
+ $lang['conf_err_upload_maxwidth'] = "maximum height authorized for the uploaded images must be a number superior to 10 pixels.";
+ $lang['conf_upload_maxwidth_thumbnail'] = "thumbnails maximum width";
+ $lang['conf_upload_maxwidth_thumbnail_info'] = "Maximum width authorized for the uploaded thumbnails. Must be a number superior to 10 pixels";
+ $lang['conf_err_upload_maxwidth_thumbnail'] = "Maximum width authorized for the uploaded thumbnails must be a number superior to 10 pixels.";
+ $lang['conf_upload_maxheight_thumbnail'] = "thumbnails maximum height";
+ $lang['conf_upload_maxheight_thumbnail_info'] = "Maximum height authorized for the uploaded thumbnails. Must be a number superior to 10 pixels";
+ $lang['conf_err_upload_maxheight_thumbnail'] = "Maximum height authorized for the uploaded thumbnails must be a number superior to 10 pixels.";
+
+ $lang['conf_default_title'] = "Default display properties for unregistered visitors and new accounts";
+ $lang['conf_default_language'] = "default language";
+ $lang['conf_default_language_info'] = "default language";
+ $lang['conf_default_image_per_row'] = "number of images per row";
+ $lang['conf_default_image_per_row_info'] = "default number of images per row";
+ $lang['conf_default_row_per_page'] = "number of row per page";
+ $lang['conf_default_row_per_page_info'] = "default number of row per page";
+ $lang['conf_default_theme'] = "theme";
+ $lang['conf_default_theme_info'] = "default theme";
+
+ $lang['conf_session_title'] = "Sessions configuration";
+ $lang['conf_session_size'] = "identifier size";
+ $lang['conf_session_size_info'] = "- the longer your identifier is, the more secure your site is<br />- enter a number between 4 and 50";
+ $lang['conf_session_time'] = "validity period";
+ $lang['conf_session_time_info'] = "- the shorter the validity period is, the more secure your site is<br />- enter a number between 5 and 60, in minutes";
+ $lang['conf_session_key'] = "keyword";
+ $lang['conf_session_key_info'] = "- the session keyword improve the encoding of the session identifier<br />- enter any sentence shorter than 255 caracters";
+ $lang['conf_session_delete'] = "delete out-of-date sessions";
+ $lang['conf_session_delete_info'] = "it is recommanded to empty the database table of session, because out-of-date sessions remains in the database (but it doesn't make any security trouble)";
+
+ // page user, clés générales
+ $lang['user_err_modify'] = "This user can't be modified or deleted";
+ $lang['user_err_unknown'] = "This user doesn't exist in the database";
+
+ // page d'ajout/modification d'utilisateur
+ $lang['adduser_err_message'] = "The number of mistakes you have done is ";
+ $lang['adduser_info_message'] = "Informations registered in the database for user ";
+ $lang['adduser_info_password_updated'] = "(password updated)";
+ $lang['adduser_info_back'] = "back to the users list";
+
+ $lang['adduser_fill_form'] = "Please fill the following form";
+ $lang['adduser_login'] = "login";
+ $lang['adduser_unmodify'] = "unmodifiable";
+ $lang['adduser_status'] = "status";
+ $lang['adduser_status_admin'] = "admin";
+ $lang['adduser_status_member'] = "member";
+ $lang['adduser_status_guest'] = "guest";
+
+ // page permissions
+ $lang['permuser_info_message'] = "Permissions registered";
+ $lang['permuser_title'] = "Restrictions for user";
+ $lang['permuser_warning'] = "Warning : a \"<span style=\"font-weight:bold;\">forbidden access</span>\" to the root of a category prevent from accessing the whole category";
+ $lang['permuser_authorized'] = "authorized";
+ $lang['permuser_forbidden'] = "forbidden";
+ $lang['permuser_parent_forbidden'] = "parent category forbidden";
+ $lang['permuser_cat_title'] = "Modify permissions for ";
+
+ // page list users
+ $lang['listuser_confirm'] = "Do you really want to delete this user";
+ $lang['listuser_yes'] = "yes";
+ $lang['listuser_no'] = "no";
+ $lang['listuser_info_deletion'] = "was removed from database";
+ $lang['listuser_user_group'] = "Users group";
+ $lang['listuser_modify'] = "modify";
+ $lang['listuser_modify_hint'] = "modify informations of";
+ $lang['listuser_permission'] = "permissions";
+ $lang['listuser_permission_hint'] = "modify permissions of";
+ $lang['listuser_delete'] = "delete";
+ $lang['listuser_delete_hint'] = "delete user";
+ $lang['listuser_button_all'] = "all";
+ $lang['listuser_button_invert'] = "invert";
+ $lang['listuser_button_create_address'] = "create mail address";
+
+ // page categories
+ $lang['cat_invisible'] = "invisible";
+ $lang['cat_edit'] = "Edit";
+ $lang['cat_up'] = "Move up";
+ $lang['cat_down'] = "Move down";
+ $lang['cat_image_info'] = "Images info";
+ $lang['cat_total'] = "total";
+
+ // page édition d'une catégorie
+ $lang['editcat_confirm'] = "Information registered in the database";
+ $lang['editcat_back'] = "categories";
+ $lang['editcat_title1'] = "Options for the";
+ $lang['editcat_name'] = "Name";
+ $lang['editcat_comment'] = "Comment";
+ $lang['editcat_status'] = "Status";
+ $lang['editcat_status_info'] = "(invisible except for the administrators)";
+
+ // page info images
+ $lang['infoimage_err_date'] = "wrong date";
+ $lang['infoimage_general'] = "General options for the category";
+ $lang['infoimage_useforall'] = "use for all pictures ?";
+ $lang['infoimage_creation_date'] = "creation date";
+ $lang['infoimage_detailed'] = "Option for each picture";
+ $lang['infoimage_title'] = "title";
+ $lang['infoimage_comment'] = "comment";
+
+ // page database update
+ $lang['update_missing_tn'] = "the thumbnail is missing for";
+ $lang['update_disappeared_tn'] = "the thumbnail disapeared";
+ $lang['update_disappeared'] = "doesn't exist";
+ $lang['update_part_deletion'] = "Deletion of images that have no thumbnail or that doesn't exist";
+ $lang['update_deletion_conclusion'] = "pictures removed from database";
+ $lang['update_part_research'] = "Search for new images in the directories";
+ $lang['update_research_added'] = "added";
+ $lang['update_research_tn_ext'] = "thumbnail in";
+ $lang['update_research_conclusion'] = "pictures added to the database";
+ $lang['update_default_title'] = "Choose an option";
+ $lang['update_only_cat'] = "update categories, not pictures";
+ $lang['update_all'] = "update all";
+
+ // page de génération miniatures
+ $lang['tn_width'] = "width";
+ $lang['tn_height'] = "height";
+
+ $lang['tn_no_support'] = "Picture unreachable or no support";
+ $lang['tn_format'] = "for the file format";
+ $lang['tn_thisformat'] = "for this file format";
+ $lang['tn_err_width'] = "width must be a number superior to";
+ $lang['tn_err_height'] = "height must be a number superior to";
+ $lang['tn_err_GD'] = "you must choose a version of GD library";
+
+ $lang['tn_results_title'] = "Results of miniaturization";
+ $lang['tn_picture'] = "picture";
+ $lang['tn_filesize'] = "filesize";
+ $lang['tn_results_gen_time'] = "generated in";
+
+ $lang['tn_stats'] = "General statistics";
+ $lang['tn_stats_nb'] = "number of miniaturized pictures";
+ $lang['tn_stats_total'] = "total time";
+ $lang['tn_stats_max'] = "max time";
+ $lang['tn_stats_min'] = "min time";
+ $lang['tn_stats_mean'] = "average time";
+
+ $lang['tn_err'] = "You made mistakes";
+
+ $lang['tn_params_title'] = "Miniaturization parameters";
+ $lang['tn_params_GD'] = "GD version";
+ $lang['tn_params_GD_info'] = "- GD is the picture manipulating library for PHP<br />-choose the version installed on your server. If you choose the wrong, you'll just have errors messages, come back with your browser and choose the other version. If no version works, it means your server doesn't support GD.";
+ $lang['tn_params_width_info'] = "maximum width that thumbnails can take";
+ $lang['tn_params_height_info'] = "maximum height that thumbnails can take";
+ $lang['tn_params_create'] = "create";
+ $lang['tn_params_create_info'] = "Do not try to miniaturize too many pictures in the same time.<br />Indeed, miniaturization uses a lot of CPU. If you installed PhpWebGallery on a free provider, a too high CPU load can sometime lead to the deletion of your website.";
+ $lang['tn_params_format'] = "file format";
+ $lang['tn_params_format_info'] = "only jpeg file format is supported for thumbnail creation";
+
+ $lang['tn_alone_title'] = "pictures without thumbnail (jpeg and png only)";
+
+ $lang['tn_dirs_title'] = "Directories list";
+ $lang['tn_dirs_alone'] = "pictures without thumbnail";
+
+ // help page
+ $lang['help_images_title'] = "Adding pictures";
+ $lang['help_images_intro'] = "How to place pictures in your directories";
+ $lang['help_images'][0] = "in the directory \"galleries\", create directories that will represent your categories";
+ $lang['help_images'][1] = "in each directory, you can create as many sub-level directories as you wish.";
+ $lang['help_images'][2] = "you can create as many categories and sub-categories for each category as you wish";
+ $lang['help_images'][3] = "picture files must have jpeg format (extension jpg or JPG), gif format (extension gif or GIF) or png format (extension png or PNG).";
+ $lang['help_images'][4] = "try not to use blank space \" \" or hyphen \"-\" in picture files, I advise you to use underscore \"_\" character which is managed by PhpWebGallery and will provide better results";
+
+ $lang['help_thumbnails_title'] = "Thumbnails";
+ $lang['help_thumbnails'][0] = "in each directory containing picture to display on your site, there is a sub-directory nammed \"thumbnail\", if it doesn't exist, create it to place your thumbnails into it.";
+ $lang['help_thumbnails'][1] = "thumbnails don't need to have the same extension as their associated picture (a picture with .jpg extension can have a thumbnail in .GIF extention for instance).";
+ $lang['help_thumbnails'][2] = "the thumbnail associated to a picture must be prefixed with the prefix given on the configuration page(image.jpg -> TN_image.GIF for instance).";
+ $lang['help_thumbnails'][3] = "I advise you to use the module for windows downloadable on the presentation site of PhpWebGallery for thumbnails management.";
+ $lang['help_thumbnails'][4] = "you can use the thumbnail creation page integrated in PhpWebGallery, but I don't advice you so, because thumbnail quality may be poor and it uses a high CPU load which can be a problem if you use free web hosting.";
+ $lang['help_thumbnails'][5] = "if you choose to use your hosting provider to create thumbnails, you must give 775 rights on \"galleries\" folder and all its sub-folders.";
+
+ $lang['help_database_title'] = "Updating database";
+ $lang['help_database'][0] = "once pictures files and thumbnails correctly placed in the directories, clic on \"database update\" in the menu of the administration panel.";
+
+ $lang['help_infos_title'] = "Miscellanous informations";
+ $lang['help_infos'][0] = "The webmaster has the possibility to forbid the access to galleries for a identified user. In ordre to do this, go in the user list, then clic on \"permissions\" for any user.";
+ $lang['help_infos'][1] = "As soon as you created your gallery, go in the user list and modify permissions for user \"visiteur\". Indeed, every new registered users will have by default the same permissions as \"visiteur\" user.";
+ $lang['help_infos'][2] = "If you have any question, do not hesitate to take a look at the forum or ask a question there. The forum (message board) is available on the presentation site of PhpWebGallery.";
+
+ $lang['help_remote_title'] = "Remote site";
+ $lang['help_remote'][0] = "PhpWebGallery offers the possibility to use several servers to store the images which will compose your gallery. It can be useful if your gallery is installed on one limited space and that you have a big quantity of images to be shown. Please , follow this procedure : ";
+ $lang['help_remote'][1] = "1. edit file \"create_listing_file.php\" (you will find it in the directory \"admin\"), by modifying the line \"$prefixe_thumbnail = \"TN-\";\" if the prefix for your thumbnails is not \"TN-\".";
+ $lang['help_remote'][2] = "2. place file \"create_listing_file.php\" modified on your distant website, in the root directory of your directories of images (as the directory \"galleries\" of this website) by ftp.";
+ $lang['help_remote'][3] = "3. launch script using the url http://domaineDistant/repGalerie/create_listing_file.php, a file listing.xml has just been created.";
+ $lang['help_remote'][4] = "4. get back file listing.xml from your distant website to place it in directory \"admin\" of this website.";
+ $lang['help_remote'][5] = "5. please , launch an update of the data of images by the interface of administration, once the listing.xml used file, kill it from the directory \"admin\".";
+ $lang['help_remote'][6] = "You can update the contents of a distant website by redoing the described manipulation. You can also kill a distant website by choosing the option in the configuration section of the administration panel.".
+
+ $lang['help_upload_title'] = "Added images by users";
+ $lang['help_upload'][0] = "PhpWebGallery offers the possibility for users to upload images. in order to do it :";
+ $lang['help_upload'][1] = "1. authorize the option in the configuration zone of the administration panel";
+ $lang['help_upload'][2] = "2. authorize the rights in writing in the images directories";
+ $lang['help_upload'][3] = "Uploaded images by the users are not directly visible on the website, they must be validated by an administrator. For that purpose, an administrator must go on the page \"en attente\" of the administration panel, to validate or to refuse the images proposed, then launch an update of the images data.";
+
+ // installation
+ $lang['install_message'] = "Message";
+
+ $lang['step1_confirmation'] = "Parameters are correct";
+ $lang['step1_err_db'] = "Connection to server succeed, but it was impossible to connect to database";
+ $lang['step1_err_server'] = "Can't connect to server";
+ $lang['step1_err_copy'] = "Copy the text between hyphens and paste it into the file \"include/mysql.inc.php\"(Warning : mysql.inc.php must only contain what is in blue)";
+ $lang['step1_err_copy_2'] = "The next step of the installation is now possible";
+ $lang['step1_err_copy_next'] = "next step";
+ $lang['step1_title'] = "Step 1/2";
+ $lang['step1_host'] = "MySQL host";
+ $lang['step1_host_info'] = "localhost, sql.multimania.com, toto.freesurf.fr";
+ $lang['step1_user'] = "user";
+ $lang['step1_user_info'] = "user login given by your host provider";
+ $lang['step1_pass'] = "Password";
+ $lang['step1_pass_info'] = "user password given by your host provider";
+ $lang['step1_database'] = "Database name";
+ $lang['step1_database_info'] = "also given by your host provider";
+ $lang['step1_prefix'] = "Database table prefix";
+ $lang['step1_prefix_info'] = "database tables names will be prefixed with it (enables you to manage better your tables)";
+
+ $lang['step2_err_login1'] = "enter a login for webmaster";
+ $lang['step2_err_login2'] = "webmaster login can't start or end with a space character";
+ $lang['step2_err_login3'] = "webmaster login can't contain characters ' or \"";
+ $lang['step2_err_pass'] = "please enter your password again";
+ $lang['step2_err_mail'] = $lang['conf_err_mail'];
+
+ $lang['install_end_title'] = "Installation finished";
+ $lang['install_end_message'] = "The configuration of PhpWebGallery is finished, here is the next step<br /><br />
+ For security reason, please delete file \"install.php\" in the directory \"admin\"<br />
+ Once this file deleted , follow this instructions :
+ <ul>
+ <li>go to the identification page : [ <a href='../identification.php'>identification</a> ] and use the login/password given for webmaster</li>
+ <li>this login will enable you to access to the [ <a href='admin.php'>administration panel</a> ] and to the instructions in order to place pictures in your directories</li>
+ </ul>";
+ $lang['step2_title'] = "Step 2/2";
+ $lang['step2_pwd'] = "webmaster password";
+ $lang['step2_pwd_info'] = "Keep it confidential, it enables you to access administration panel";
+ $lang['step2_pwd_conf'] = "confirm password";
+ $lang['step2_pwd_conf_info'] = "verification";
+ }
+?>
diff --git a/language/francais.php b/language/francais.php
new file mode 100644
index 000000000..5ff817ab3
--- /dev/null
+++ b/language/francais.php
@@ -0,0 +1,556 @@
+<?php
+$lang['only_members'] = 'Seuls les membres du site peuvent accéder à cette page';
+$lang['invalid_pwd'] = 'le mot de passe rentré n\'est pas valide';
+$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé à aller dans cette section';
+$lang['submit'] = 'Valider';
+$lang['login'] = 'login';
+$lang['password'] = 'mot de passe';
+$lang['new'] = 'nouveau';
+$lang['delete'] = 'supprimer';
+$lang['category'] = 'catégorie';
+$lang['thumbnail'] = 'miniature';
+$lang['date'] = 'date';
+// start version 1.3
+$lang['no'] = 'non';
+$lang['yes'] = 'oui';
+$lang['guest'] = 'visiteur';
+// end version 1.3
+
+// page diapo
+$lang['diapo_default_page_title'] = 'Aucune catégorie séléctionnée';
+$lang['thumbnails'] = 'Miniatures';
+$lang['categories'] = 'Rubriques';
+$lang['hint_category'] = 'affiche les images à la racine de cette catégorie';
+$lang['total_images'] = 'total';
+$lang['title_menu'] = 'Sommaire';
+$lang['change_login'] = 'changer de login';
+$lang['hint_login'] = 's&#039;identifier permet de personnaliser l&#039;apparence du site';
+$lang['logout'] = 'logout';
+$lang['customize'] = 'personnalisation';
+$lang['hint_customize'] = 'personnaliser votre affichage';
+$lang['hint_search'] = 'lancer une recherche';
+$lang['search'] = 'rechercher';
+$lang['favorite_cat'] = 'favoris';
+$lang['favorite_cat_hint'] = 'afficher vos favoris';
+$lang['about'] = 'à propos';
+$lang['hint_about'] = 'des infos sur PhpWebGallery...';
+$lang['admin'] = 'admin';
+$lang['hint_admin'] = 'accessible uniquement aux administrateurs';
+$lang['no_category'] = 'Aucune rubrique n\'est selectionnée,<br />veuillez en choisir une dans le menu.';
+$lang['page_number'] = 'numéro de page';
+$lang['previous_page'] = 'Précédente';
+$lang['next_page'] = 'Suivante';
+$lang['nb_image_category'] = 'nombre d\'images dans la catégorie';
+// start version 1.3
+//$lang['connected_user_female'] = 'utilisatrice connectée';
+// end version 1.3
+$lang['connected_user_male'] = 'utilisateur connecté';
+$lang['recent_image'] = 'image datant de moins de';
+$lang['days'] = 'jours';
+$lang['send_mail'] = 'Une remarque : mailez moi';
+$lang['title_send_mail'] = '[phpwebgallery] une remarque sur ton site';
+$lang['sub-cat'] = 'sous-catégories';
+$lang['images_available'] = 'images dans cette catégorie';
+$lang['total'] = 'images';
+$lang['upload_picture'] = 'Ajouter une image';
+
+// page diapo et photo
+$lang['registration_date'] = 'enregistré le';
+$lang['creation_date'] = 'créé le';
+$lang['comment'] = 'commentaire';
+$lang['author'] = 'auteur';
+$lang['size'] = 'dimensions';
+$lang['filesize'] = 'poids';
+$lang['file'] = 'fichier';
+$lang['generation_time'] = 'Page générée en';
+$lang['favorites'] = 'Favoris';
+$lang['search_result'] = 'Résultats de la recherche';
+// start version 1.3
+$lang['stats'] = 'statistiques';
+$lang['most_visited_cat_hint'] = 'affiche les images les plus visitées';
+$lang['most_visited_cat'] = 'plus vues';
+$lang['best_rated_cat_hint'] = 'affiche les images les mieux notées';
+$lang['best_rated_cat'] = 'mieux notées';
+$lang['recent_cat_hint'] = 'affiche les images les plus récentes';
+$lang['recent_cat'] = 'plus récentes';
+$lang['recent_cat_title'] = 'Images récentes';
+$lang['visited'] = 'visité';
+$lang['times'] = 'fois';
+// end version 1.3
+
+// page a_propos
+$lang['about_page_title'] = 'A propos de PhpWebGallery';
+$lang['about_title'] = 'A propos...';
+// start version 1.3
+$lang['about_message'] = '<div style="text-align:center;font-weigh:bold;">Informations sur le PhpWebGallery</div>
+<ul>
+ <li>Ce site utilise la version '.$conf['version'].' de <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a>. PhpWebGallery est une application web permettant de créer simplement une galerie d\'images en ligne.</li>
+ <li>D\'un point de vue technique, PhpWebGallery est entièrement développé en PHP (l\'elePHPant) avec une base de données MySQL(le mySQreuiL).</li>
+ <li>Si vous avez des suggestions ou des commentaires, n\'hésitez pas à visiter le site de <a href="'.$conf['site_url'].'" style="text-decoration:underline">PhpWebGallery</a> et son <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a>.</li>
+</ul>';
+// end version 1.3
+$lang['about_return'] = 'Retour';
+
+// page identification
+$lang['ident_page_title'] = 'Identification';
+$lang['ident_title'] = 'Identification';
+// start version 1.3
+//$lang['actual_user'] = 'Vous êtes actuellement : ';
+// end version 1.3
+$lang['ident_register'] = 'S\'enregistrer';
+$lang['ident_forgotten_password'] = 'Mot de passe oublié ?';
+$lang['ident_guest_visit'] = 'Parcourir la galerie en tant que visiteur';
+
+// page profile
+$lang['customize_page_title'] = 'Personnalisation';
+$lang['customize_title'] = 'Personnalisation';
+$lang['customize_nb_image_per_row'] = 'nombre d\'images par ligne';
+$lang['customize_nb_row_per_page'] = 'nombre de lignes par page';
+// start version 1.3
+// $lang['customize_color'] = 'couleur interface';
+$lang['customize_theme'] = 'theme de l\'interface';
+// end version 1.3
+$lang['customize_language'] = 'langue';
+// start version 1.3
+// $lang['sex'] = 'sexe';
+// $lang['male'] = 'masculin';
+// $lang['female'] = 'féminin';
+$lang['customize_expand'] = 'développer toutes les catégories';
+$lang['customize_show_nb_comments'] = 'montrer le nombre de commentaires';
+$lang['customize_short_period'] = 'période courte';
+$lang['customize_long_period'] = 'période longue';
+$lang['customize_template'] = 'template';
+$lang['err_periods'] = 'les périodes doivent être des entiers';
+$lang['err_periods_2'] = 'les périodes doivent être supérieures à 0, la période longue doit être plus grande que la période courte';
+// end version 1.3
+$lang['maxwidth'] = 'largeur maximum des images';
+$lang['maxheight'] = 'hauteur maximum des images';
+$lang['err_maxwidth'] = 'la largeur maximum des images doit être un entier supérieur à 50';
+$lang['err_maxheight'] = 'la hauteur maximum des images doit être un entier supérieur à 50';
+
+// page photo
+$lang['previous_image'] = 'Précédent';
+$lang['next_image'] = 'Suivant';
+$lang['back'] = 'Cliquez sur l\'image pour revenir à la page des miniatures';
+$lang['info_image_title'] = 'Informations';
+$lang['link_info_image'] = 'Modifier les informations de cette image';
+$lang['true_size'] = 'Taille réelle';
+$lang['comments_title'] = 'Commentaires des visiteurs du site';
+$lang['comments_del'] = 'supprimer ce message';
+$lang['comments_add'] = 'Ajouter un commentaire';
+$lang['month'][1] = 'Janvier';
+$lang['month'][2] = 'Février';
+$lang['month'][3] = 'Mars';
+$lang['month'][4] = 'Avril';
+$lang['month'][5] = 'Mai';
+$lang['month'][6] = 'Juin';
+$lang['month'][7] = 'Juillet';
+$lang['month'][8] = 'Août';
+$lang['month'][9] = 'Septembre';
+$lang['month'][10] = 'Octobre';
+$lang['month'][11] = 'Novembre';
+$lang['month'][12] = 'Décembre';
+$lang['day'][0] = 'Dimanche';
+$lang['day'][1] = 'Lundi';
+$lang['day'][2] = 'Mardi';
+$lang['day'][3] = 'Mercredi';
+$lang['day'][4] = 'Jeudi';
+$lang['day'][5] = 'Vendredi';
+$lang['day'][6] = 'Samedi';
+$lang['add_favorites_alt'] = 'Ajouter aux favoris';
+$lang['add_favorites_hint'] = 'ajouter cette image à vos favoris';
+$lang['del_favorites_alt'] = 'Retirer des favoris';
+$lang['del_favorites_hint'] = 'supprimer cette image de vos favoris';
+
+// page register
+$lang['register_page_title'] = 'Enregistrement';
+$lang['register_title'] = 'Enregistrement';
+$lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
+$lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
+$lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
+$lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
+$lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
+$lang['reg_err_pass'] = 'veuillez retaper le mot de passe';
+$lang['reg_confirm'] = 'confirmer';
+$lang['reg_mail_address'] = 'adresse mail';
+$lang['reg_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
+
+// page search
+$lang['search_title'] = 'Recherche';
+$lang['invalid_search'] = 'La recherche doit porter sur 3 caractères ou plus';
+$lang['search_field_search'] = 'Rechercher';
+$lang['search_return_main_page'] = 'Retour à la page des miniatures';
+
+// page upload
+$lang['upload_forbidden'] = 'On ne peut pas ajouter d\'image dans cette catégorie';
+$lang['upload_file_exists'] = 'Une image du même nom existe déjà';
+$lang['upload_filenotfound'] = 'vous devez choisir un fichier image pour la photo';
+$lang['upload_cannot_upload'] = 'impossible d\'uploader la photo sur le serveur';
+$lang['upload_title'] = 'Ajouter une image';
+$lang['upload_advise'] = 'Choisissez une image à placer dans la catégorie : ';
+$lang['upload_advise_thumbnail'] = 'Optionnel, mais recommandé : Choisissez la miniature à associer à ';
+$lang['upload_advise_filesize'] = 'le poids de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_width'] = 'la largeur de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_height'] = 'la hauteur de l\'image ne doit pas dépasser : ';
+$lang['upload_advise_filetype'] = 'l\'image doit être au format jpg, gif ou png';
+$lang['upload_err_username'] = 'le nom de l\'utilisateur doit être renseigné';
+$lang['upload_username'] = 'Nom d\'utilisateur';
+$lang['upload_successful'] = 'Image uploadée avec succès, un administrateur validera celle-ci dès que possible.';
+
+//----------------------------------administration
+if ( $isadmin )
+{
+ // page admin
+ $lang['title_add'] = 'Ajouter/Modifier un utilisateur';
+ $lang['title_liste_users'] = 'Liste des utilisateurs';
+ $lang['title_history'] = 'Historique';
+ $lang['title_update'] = 'Mise à jour de la base de données';
+ $lang['title_configuration'] = 'Configuration de PhpWebGallery';
+ $lang['title_instructions'] = 'Instructions';
+ $lang['title_permissions'] = 'Modifier les permissions pour un utilisateur';
+ $lang['title_categories'] = 'Gestion des catégories';
+ $lang['title_edit_cat'] = 'Editer une catégorie';
+ $lang['title_info_images'] = 'Modifier les informations sur les images d\'une catégorie';
+ $lang['title_thumbnails'] = 'Création des miniatures';
+ $lang['title_thumbnails_2'] = 'pour';
+ $lang['title_default'] = 'Administration de PhpWebGallery';
+
+ $lang['menu_title'] = 'Administration';
+ $lang['menu_config'] = 'Configuration';
+ $lang['menu_users'] = 'Utilisateurs';
+ $lang['menu_add_user'] = 'ajout';
+ $lang['menu_list_user'] = 'liste';
+ $lang['menu_categories'] = 'Catégories';
+ $lang['menu_update'] = 'MaJ base d\'images';
+ $lang['menu_thumbnails'] = 'Miniatures';
+ $lang['menu_history'] = 'Historique';
+ $lang['menu_instructions'] = 'Instructions';
+ $lang['menu_back'] = 'Page diapo';
+
+ $lang['title_waiting'] = 'Images en attente de validation';
+ $lang['menu_waiting'] = 'En attente';
+
+ $lang['default_message'] = 'Zone d\'administration de PhpWebGallery';
+
+ // page de configuration
+ $lang['conf_err_prefixe'] = 'le préfixe des thumbnails ne doit pas comporter d\'accent';
+ $lang['conf_err_mail'] = 'mail refusé, il doit être de la forme nom@serveur.com';
+ // start version 1.3
+// $lang['conf_err_periods'] = 'les périodes doivent être des entiers';
+// $lang['conf_err_periods_2'] = 'les périodes doivent être supérieures à 0, la période longue doit être plus grande que la période courte';
+ // end version 1.3
+ $lang['conf_err_sid_size'] = 'la taille de l\'identifiant de session doit être un entier supérieur ou égal à 4 et inférieur à 50';
+ $lang['conf_err_sid_time'] = 'la durée de la session doit être comprise entre 5 et 60 minutes';
+ $lang['conf_err_max_user_listbox'] = 'le nombre max utilisateur listbox doit être un entier compris entre 0 et 255';
+ // start version 1.3
+// $lang['conf_err_message'] = 'Vous avez commis des erreurs au nombre de ';
+ // end version 1.3
+ $lang['conf_confirmation'] = 'Informations enregistrées dans la base de données';
+ // start version 1.3
+// $lang['no'] = 'non';
+// $lang['yes'] = 'oui';
+ // end version 1.3
+ $lang['conf_general_title'] = 'Configuration générale';
+ $lang['conf_general_webmaster'] = 'pseudo webmaster';
+ $lang['conf_general_webmaster_info'] = 'Il apparaîtra à tous vos visiteurs. Il vous sert pour administrer le site';
+ $lang['conf_general_mail'] = 'mail webmaster';
+ $lang['conf_general_mail_info'] = 'Les visiteurs pourront vous contacter par ce mail';
+ $lang['conf_general_prefix'] = 'préfixe thumbnail';
+ $lang['conf_general_prefix_info'] = 'Les noms des fichiers miniatures en sont préfixé. Laissez vide en cas de doute.';
+ // start version 1.3
+// $lang['conf_general_short_period'] = 'période courte';
+// $lang['conf_general_short_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque rouge. La période courte fait au minimum 1 jour.';
+// $lang['conf_general_long_period'] = 'période longue';
+// $lang['conf_general_long_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque verte. La période longue doit être plus grande que la période courte.';
+ // end version 1.3
+ $lang['conf_general_access'] = 'type d\'acces';
+ $lang['conf_general_access_1'] = 'libre';
+ $lang['conf_general_access_2'] = 'restreint';
+ $lang['conf_general_access_info'] = '- libre : n\'importe qui peut accéder à vos photos, tous les visiteurs peuvent se créer un compte pour pouvoir personnaliser l\'affichage<br />- restreint : l\'administrateur s\'occupe de créer des comptes, seuls les personnes membres peuvent accéder au site';
+ $lang['conf_general_max_user_listbox'] = 'nombre max utilisateur listbox';
+ $lang['conf_general_max_user_listbox_info'] = '- c\'est le nombre maximum d\'utilisateurs pour lequel on affiche une liste déroulante sur la page d\'identification<br />- mettez un nombre entier entre 0 et 255, 0 signifiant que vous ne voulez jamais qu\'on affiche de liste déroulante';
+ // start version 1.3
+// $lang['conf_general_default_page'] = 'page par défaut';
+// $lang['conf_general_default_page_1'] = 'diapo';
+// $lang['conf_general_default_page_2'] = 'identification';
+// $lang['conf_general_default_page_info'] = 'page sur laquelle les utilisateurs sont redirigés s\'ils vont à la racine du site.';
+// $lang['conf_general_expand'] = 'développer toutes les catégories';
+// $lang['conf_general_expand_info'] = 'développer toutes les catégories par défaut dans le menu ?';
+ // end version 1.3
+ $lang['conf_comments'] = 'commentaires utilisateurs';
+ $lang['conf_comments_title'] = 'Configuration des '.$lang['conf_comments'];
+ $lang['conf_comments_show_comments'] = $lang['conf_comments'];
+ $lang['conf_comments_show_comments_info'] = 'afficher les commentaires utilisateurs sous chaque images ?';
+ $lang['conf_comments_comments_number'] = 'nombre de commentaires par page';
+ $lang['conf_comments_comments_number_info'] = 'nombre de commentaire à afficher sur chaque page. Le nombre de commentaires pour une image reste illimité. Entrer un nombre entre 5 et 50.';
+ $lang['conf_err_comment_number'] = 'le nombre de commentaires par page doit être compris entre 5 et 50 inclus.';
+ $lang['conf_remote_site_title'] = 'Site distant';
+ $lang['conf_remote_site_delete_info'] = 'Supprimer un site revient à supprimer toutes les images et les catégories en relation avec ce site.';
+ $lang['conf_upload_title'] = 'Configurer l\'upload des utilisateurs';
+ $lang['conf_upload_available'] = 'autoriser l\'ajout d\'images';
+ $lang['conf_upload_available_info'] = 'Autoriser l\'ajout d\'image par les utilisateurs dans les catégories du site (pas sur un site distant).';
+ $lang['conf_upload_maxfilesize'] = 'poids maximum';
+ $lang['conf_upload_maxfilesize_info'] = 'Poids maximum autorisé pour les images uploadées. Celui-ci doit être un entier compris entre 10 et 1000, en Ko.';
+ $lang['conf_err_upload_maxfilesize'] = 'Le poids maximum pour les images uploadés doit être un entier compris entre 10 et 1000.';
+ $lang['conf_upload_maxwidth'] = 'largeur maximum';
+ $lang['conf_upload_maxwidth_info'] = 'Largeur maximum autorisée pour les images. Celle-ci doit être un entier supérieur à 10, en pixels.';
+ $lang['conf_err_upload_maxwidth'] = 'la largeur maximum des images uploadées doit être un entier supérieur à 10.';
+ $lang['conf_upload_maxheight'] = 'hauteur maximum';
+ $lang['conf_upload_maxheight_info'] = 'Hauteur maximum autorisée pour les images. Celle-ci doit être un entier supérieur à 10, en pixels.';
+ $lang['conf_err_upload_maxwidth'] = 'la hauteur maximum des images uploadées doit être un entier supérieur à 10.';
+ $lang['conf_upload_maxwidth_thumbnail'] = 'largeur maximum miniatures.';
+ $lang['conf_upload_maxwidth_thumbnail_info'] = 'Largeur maximum autorisée pour les miniatures. Celle-ci doit être un entier supérieur à 10, en pixels.';
+ $lang['conf_err_upload_maxwidth_thumbnail'] = 'la largeur maximum des miniatures uploadées doit être un entier supérieur à 10.';
+ $lang['conf_upload_maxheight_thumbnail'] = 'hauteur maximum miniatures';
+ $lang['conf_upload_maxheight_thumbnail_info'] = 'Hauteur maximum autorisée pour les miniatures. Celle-ci doit être un entier supérieur à 10, en pixels.';
+ $lang['conf_err_upload_maxheight_thumbnail'] = 'la hauteur maximum des miniatures uploadées doit être un entier supérieur à 10.';
+
+ $lang['conf_default_title'] = 'Affichage par défaut pour les visiteurs non enregistrés et les nouveaux comptes';
+ // start version 1.3
+// $lang['conf_default_language'] = 'langue par défaut';
+ // end version 1.3
+ $lang['conf_default_language_info'] = 'langue par défaut';
+ // start version 1.3
+// $lang['conf_default_image_per_row'] = 'nombre d\'images par ligne';
+// $lang['conf_default_image_per_row_info'] = 'nombre d\'images par ligne par défaut';
+// $lang['conf_default_row_per_page'] = 'nombre de lignes par page';
+// $lang['conf_default_row_per_page_info'] = 'nombre de lignes par page par défaut';
+ $lang['conf_default_nb_image_per_row_info'] = 'nombre d\'images par ligne par défaut';
+ $lang['conf_default_nb_row_per_page_info'] = 'nombre de lignes par page par défaut';
+// $lang['conf_default_theme'] = 'thème';
+ // end version 1.3
+ $lang['conf_default_theme_info'] = 'thème par défaut';
+ // start version 1.3
+ $lang['conf_default_short_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque rouge. La période courte fait au minimum 1 jour.';
+ $lang['conf_default_long_period_info'] = 'En nombre de jours. Période pendant laquelle l\'image est notée avec une marque verte. La période longue doit être plus grande que la période courte.';
+ $lang['conf_default_expand_info'] = 'développer toutes les catégories par défaut dans le menu ?';
+ $lang['conf_default_show_nb_comments_info'] = 'montrer le nombre de commentaires pour chaque image sur la page des miniatures';
+ // end version 1.3
+
+ $lang['conf_session_title'] = 'Configuration des sessions';
+ $lang['conf_session_size'] = 'taille de l\'identifiant';
+ $lang['conf_session_size_info'] = '- plus votre identifiant de session est grand, plus la sécurité est bonne<br />- mettez une valeur entre 4 et 50';
+ $lang['conf_session_time'] = 'durée de validité';
+ $lang['conf_session_time_info'] = '- plus votre durée de validité de la session est petite, plus la sécurité est bonne<br />- elle doit supérieur à 5 et inférieur à 60, en minutes';
+ $lang['conf_session_key'] = 'mot-clef';
+ $lang['conf_session_key_info'] = '- le mot-clef de session permet d\'améliorer le cryptage des identifiants de session.<br />- mettez n\'importe quelle chaîne de moins de 255 caractères.';
+ $lang['conf_session_delete'] = 'supprimer les sessions périmées';
+ $lang['conf_session_delete_info'] = 'il est recommandé de vider sa table de sessions car les sessions périmées restent enregistrées (mais ça ne pose pas de problème de sécurité)';
+
+ // page user, clés générales
+ $lang['user_err_modify'] = 'Cet utilisateur ne peut pas être modifé ou supprimé';
+ $lang['user_err_unknown'] = 'Cet utilisateur n\'existe pas dans la base de données';
+
+ // page d\'ajout/modification d\'utilisateur
+
+ $lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
+ $lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
+ $lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
+ $lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
+ $lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
+
+ $lang['adduser_err_message'] = 'Vous avez commis des erreurs au nombre de ';
+ $lang['adduser_info_message'] = 'Informations enregistrées dans la base de données concernant ';
+ $lang['adduser_info_password_updated'] = '(mot de passe modifié)';
+ $lang['adduser_info_back'] = 'retour liste utilisateurs';
+
+ $lang['adduser_fill_form'] = 'Veuillez remplir les champs suivants';
+ $lang['adduser_login'] = 'pseudo';
+ $lang['adduser_unmodify'] = 'non modifiable';
+ $lang['adduser_status'] = 'status';
+ $lang['adduser_status_admin'] = 'admin';
+ $lang['adduser_status_member'] = 'membre';
+ $lang['adduser_status_guest'] = 'visiteur';
+
+ // page permissions
+ $lang['permuser_info_message'] = 'Permissions enregistrées';
+ $lang['permuser_title'] = 'Restrictions pour l\'utilisateur';
+ $lang['permuser_warning'] = 'Attention : un "<span style="font-weight:bold;">accès interdit</span>" à la racine d\'une catégorie empêche l\'accès à toute la catégorie';
+ $lang['permuser_authorized'] = 'autorisé';
+ $lang['permuser_forbidden'] = 'interdit';
+ $lang['permuser_parent_forbidden'] = 'catégorie parente interdite';
+ $lang['permuser_cat_title'] = 'Modifier les permissions pour ';
+
+ // page liste utilisateurs
+ $lang['listuser_confirm'] = 'Etes-vous sûr de vouloir supprimer l\'utilisateur';
+ // start version 1.3
+// $lang['listuser_yes'] = 'oui';
+// $lang['listuser_no'] = 'non';
+ // end version 1.3
+ $lang['listuser_info_deletion'] = 'a été supprimé de la base de données';
+ $lang['listuser_user_group'] = 'Utilisateurs';
+ $lang['listuser_modify'] = 'modifier';
+ $lang['listuser_modify_hint'] = 'modifier les infos de';
+ $lang['listuser_permission'] = 'permissions';
+ $lang['listuser_permission_hint'] = 'modifier les permissions de';
+ $lang['listuser_delete'] = 'supprimer';
+ $lang['listuser_delete_hint'] = 'supprimer';
+ $lang['listuser_button_all'] = 'tous';
+ $lang['listuser_button_invert'] = 'inverser';
+ $lang['listuser_button_create_address'] = 'générer adresse mail';
+
+ // page catégories
+ $lang['cat_invisible'] = 'invisible';
+ $lang['cat_edit'] = 'Editer';
+ $lang['cat_up'] = 'Monter';
+ $lang['cat_down'] = 'Descendre';
+ $lang['cat_image_info'] = 'infos images';
+ $lang['cat_total'] = 'total';
+ // start version 1.3
+ $lang['cat_permission'] = 'permissions';
+ $lang['cat_update'] = 'mis à jour';
+ // end version 1.3
+
+ // page édition d\'une catégorie
+ $lang['editcat_confirm'] = 'Informations enregistrées dans la base de données';
+ $lang['editcat_back'] = 'catégories';
+ $lang['editcat_title1'] = 'Options pour la';
+ $lang['editcat_name'] = 'Nom';
+ $lang['editcat_comment'] = 'Commentaire';
+ $lang['editcat_status'] = 'Status';
+ $lang['editcat_status_info'] = '(invisible sauf pour les administrateurs)';
+
+ // page info images
+ $lang['infoimage_err_date'] = 'date erronée';
+ $lang['infoimage_general'] = 'Options générale pour la catégorie';
+ $lang['infoimage_useforall'] = 'utiliser pour toutes les images ?';
+ $lang['infoimage_creation_date'] = 'date de création';
+ $lang['infoimage_detailed'] = 'Options pour chaque image / photo';
+ $lang['infoimage_title'] = 'titre';
+ $lang['infoimage_comment'] = 'commentaire';
+
+ // page de mise à jour de la base de données
+ $lang['update_missing_tn'] = 'il manque la miniature pour';
+ $lang['update_disappeared_tn'] = 'la miniature a disparu';
+ $lang['update_disappeared'] = 'a disparu';
+ $lang['update_part_deletion'] = 'Suppression des images de la base qui n\'ont pas de thumbnail ou qui n\'existent pas';
+ $lang['update_deletion_conclusion'] = 'images supprimées de la base de données';
+ $lang['update_part_research'] = 'Recherche des nouvelles images dans les répertoires';
+ $lang['update_research_added'] = 'ajouté';
+ $lang['update_research_tn_ext'] = 'miniature en';
+ $lang['update_research_conclusion'] = 'images ajoutées à la base de données';
+ $lang['update_default_title'] = 'Choisir une option';
+ $lang['update_only_cat'] = 'mettre à jour les catégories, mais pas les images';
+ $lang['update_all'] = 'mettre tout à jour';
+
+ // page de génération miniatures
+ $lang['tn_width'] = 'largeur';
+ $lang['tn_height'] = 'hauteur';
+
+ $lang['tn_no_support'] = 'Image inexistante ou aucun support';
+ $lang['tn_format'] = 'pour le format';
+ $lang['tn_thisformat'] = 'pour ce format de fichier';
+ $lang['tn_err_width'] = 'la largeur doit être un entier supérieur à';
+ $lang['tn_err_height'] = 'la hauteur doit être un entier supérieur à';
+ $lang['tn_err_GD'] = 'il faut choisir une version de GD';
+
+ $lang['tn_results_title'] = 'Résultats de la miniaturisation';
+ $lang['tn_picture'] = 'image';
+ $lang['tn_filesize'] = 'poids';
+ $lang['tn_results_gen_time'] = 'généré en';
+
+ $lang['tn_stats'] = 'Statistiques générales';
+ $lang['tn_stats_nb'] = 'nombre d\'images miniaturisées';
+ $lang['tn_stats_total'] = 'temps total';
+ $lang['tn_stats_max'] = 'temps max';
+ $lang['tn_stats_min'] = 'temps min';
+ $lang['tn_stats_mean'] = 'temps moyen';
+
+ $lang['tn_err'] = 'Vous avez commis des erreurs';
+
+ $lang['tn_params_title'] = 'Paramètres de miniaturisation';
+ $lang['tn_params_GD'] = 'version de GD';
+ $lang['tn_params_GD_info'] = '- GD est la bibliothèque de manipulation graphique pour PHP<br />- cochez la version de GD installée sur le serveur. Si vous choisissez l\'une et que vous obtenez ensuite des messages d\'erreur, choisissez l\'autre version. Si aucune version ne marche, cela signifie que GD n\'est pas installé sur le serveur.';
+ $lang['tn_params_width_info'] = 'largeur maximum que peut prendre les miniatures';
+ $lang['tn_params_height_info'] = 'hauteur maximum que peut prendre les miniatures';
+ $lang['tn_params_create'] = 'en créer';
+ $lang['tn_params_create_info'] = 'N\'essayez pas de lancer directement un grand nombre de miniaturisation.<br />En effet la miniaturisation est coûteuse en ressources processeur pour le serveur. Si vous êtes chez un hébergeur gratuit, une trop forte occupation processeur peut amener l\'hébergeur à supprimer votre compte.';
+ $lang['tn_params_format'] = 'format';
+ $lang['tn_params_format_info'] = 'seul le format jpeg est supporté pour la création des miniatures';
+
+ $lang['tn_alone_title'] = 'images sans miniatures (format jpg et png uniquement)';
+
+ $lang['tn_dirs_title'] = 'Liste des répertoires';
+ $lang['tn_dirs_alone'] = 'images sans miniatures';
+
+ // help page
+ $lang['help_images_title'] = 'Ajout d\'images';
+ $lang['help_images_intro'] = 'Voici comment il faut placer les images dans vos répertoires';
+ $lang['help_images'][0] = 'dans le répertoire "galleries" placer des repertoires qui vont représenter vos futures catégories';
+ $lang['help_images'][1] = 'dans chacun de ces répertoires, vous avez le droit de créer autant de niveau de sous-répertoire que vous le souhaitez';//modifié
+ $lang['help_images'][2] = 'vous avez le droit à un nombre illimité de catégories et de sous catégories pour chaque catégorie';
+ $lang['help_images'][3] = 'les fichiers images doivent être au format jpg (extension jpg ou JPG), gif (GIF ou gif) ou encore png (PNG ou png)';
+ $lang['help_images'][4] = 'Evitez d\'utiliser des espaces " " ou des tirets "-" dans les noms de fichiers ou de catégorie, je conseille d\'utiliser le caractère underscore "_" qui est géré par l\'application et donnera des résultats plus appréciables';
+
+ $lang['help_thumbnails_title'] = 'Miniatures';
+ $lang['help_thumbnails'][0] = 'dans chaque répertoire contenant des images à afficher sur le site, il y a un sous-répertoire nommé "thumbnail", s\'il n\'existe pas, créez-le pour placer vos miniatures dedans';
+ $lang['help_thumbnails'][1] = 'les miniatures n\'ont pas besoin d\'avoir la même extension que les images associées (une image en .jpg peut avoir sa miniature en .GIF par exemple)';
+ $lang['help_thumbnails'][2] = 'la miniature associée à une image doit être préfixée par le préfixe donné sur la page de configuration générale (image.jpg -> TN_image.GIF par exemple).';
+ $lang['help_thumbnails'][3] = 'il est conseillé d\'utiliser le module pour windows téléchargeable sur le site de PhpWebGallery pour la création des miniatures.';
+ $lang['help_thumbnails'][4] = 'vous pouvez utilisez la gestion de création de miniatures, intégrée à PhpWebGallery, mais ce n\'est pas conseillé, car la qualité des miniatures sera moindre qu\'avec un véritable outil de manipulation d\'images et que cela consommera des ressources sur le serveur, ce qui peut se révéler gênant pour un hébergement gratuit.';
+ $lang['help_thumbnails'][5] = 'si vous choisissez d\'utiliser votre hébergeur pour créer les miniatures, il faut avant cela passer le répertoire "galleries" en 775 ainsi que tous ses sous-répertoires.';
+
+ $lang['help_database_title'] = 'Remplissage de la base de données';
+ $lang['help_database'][0] = 'Une fois les fichiers placés correctement et les miniatures placées ou créées, cliquez sur "MaJ base d\'images" dans le menu de la zone d\'administration.';
+
+ $lang['help_remote_title'] = 'Site distant';
+ $lang['help_remote'][0] = 'PhpWebGallery offre la possibilité d\'utiliser plusieurs serveurs pour stocker les images qui composeront votre galerie. Cela peut être utile si votre galerie est installée sur une espace limité et que vous avez une grande quantité d\'images à montrer. Suivez la procédure suivante :';
+ $lang['help_remote'][1] = '1. éditez le fichier "create_listing_file.php" (vous le trouverez dans le répertoire "admin"), en modifiant la ligne "$prefixe_thumbnail = "TN-";" si le préfixe pour vos miniatures n\'est pas "TN-".';
+ $lang['help_remote'][2] = '2. placez le fichier "create_listing_file.php" modifié sur votre site distant, dans le répertoire racine de vos répertoires d\'images (comme le répertoire "galleries" du présent site) par ftp.';
+ $lang['help_remote'][3] = '3. lancez le script en allant à l\'url http://domaineDistant/repGalerie/create_listing_file.php, un fichier listing.xml vient de se créer.';
+ $lang['help_remote'][4] = '4. récupérez le fichier listing.xml de votre site distant pour le placer dans le répertoire "admin" du présent site.';
+ $lang['help_remote'][5] = '5. lancez une mise à jour de la base d\'images par l\'interface d\'administration, une fois le fichier listing.xml utilisé, supprimez le du répertoire "admin".';
+ $lang['help_remote'][6] = 'Vous pouvez mettre à jour le contenu d\'un site distant en refaisant la manipulation décrite. Vous pouvez également supprimer un site distant en choisissant l\'option dans la section configuration du panneau d\'administration.';
+ $lang['help_upload_title'] = 'Ajout d\'images par les utilisateurs';
+ $lang['help_upload'][0] = 'PhpWebGallery offre la possibilité aux visiteurs d\'uploader des images. Pour cela :';
+ $lang['help_upload'][1] = '1. autorisez l\'option dans la zone configuration du panneau d\'administration';
+ $lang['help_upload'][2] = '2. autorisez les droits en écriture sur les répertoires d\'images';
+ $lang['help_upload'][3] = 'Les images uploadées par les visiteurs ne sont pas directement visibles sur le site, elles doivent être validées par un administrateur. Pour cela, un administrateur doit se rendre sur la page "en attente" du panneau d\'administration, valider ou refuser les images proposée, puis lancer une mise à jour de la base d\'images.';
+
+ $lang['help_infos_title'] = 'Informations complémentaires';
+ $lang['help_infos'][0] = 'Le webmaster a la possiblité d\'interdire certaines rubrique ou sous-rubriques à certains utilisateurs. Pour cela, allez voir la liste des utilisateurs, puis cliquez sur "permissions" pour l\'un d\'entre eux';
+ $lang['help_infos'][1] = 'Dès que vous avez créé votre galerie, allez dans la gestion des utilisateurs et modifiez les permissions pour l\'utilisateur visiteur. En effet, tous les utilisateurs qui s\'enregistrent eux-même auront par défaut les mêmes permissions que l\'utilisateur "visiteur".';
+ $lang['help_infos'][2] = 'Pour n\'importe quelle question, n\'hésitez pas à consulter le forum ou à y poser une question, sur le site';
+
+ // installation
+ $lang['install_message'] = 'Message';
+
+ $lang['step1_confirmation'] = 'Les paramètres rentrés sont corrects';
+ $lang['step1_err_db'] = 'La connexion au serveur est OK, mais impossible de se connecter à cette base de données';
+ $lang['step1_err_server'] = 'Impossible de se connecter au serveur';
+ $lang['step1_err_copy'] = 'Copiez le texte entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé PhpWebGallery (le fichier mysql.inc.php ne doit comporter QUE ce qui est en bleu entre les tirets)';
+ $lang['step1_err_copy_2'] = 'La configuration du reste de l\'application est maintenant possible';
+ $lang['step1_err_copy_next'] = 'prochaine étape';
+ $lang['step1_title'] = 'Etape 1 sur 2';
+ $lang['step1_host'] = 'Hôte MySQL';
+ $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
+ $lang['step1_user'] = 'Utilisateur';
+ $lang['step1_user_info'] = 'nom d\'utilisateur pour votre hébergeur';
+ $lang['step1_pass'] = 'Password';
+ $lang['step1_pass_info'] = 'celui fourni par votre hébergeur';
+ $lang['step1_database'] = 'Nom de la base';
+ $lang['step1_database_info'] = 'celui fourni par votre hébergeur';
+ $lang['step1_prefix'] = 'Préfixe des noms de table';
+ $lang['step1_prefix_info'] = 'le nom des tables apparaîtra avec ce préfixe (permet de mieux gérer sa base de données)';
+
+ $lang['step2_err_login1'] = 'veuillez rentrer un pseudo pour le webmaster';
+ $lang['step2_err_login2'] = 'le pseudo du webmaster ne doit pas se terminer ou commencer par un espace';
+ $lang['step2_err_login3'] = 'le pseudo du webmaster ne doit pas comporter les caractère " et \'';
+ $lang['step2_err_pass'] = 'veuillez retaper votre mot de passe';
+ $lang['step2_err_mail'] = $lang['conf_err_mail'];
+
+ $lang['install_end_title'] = 'Installation terminée';
+ $lang['install_end_message'] = 'La configuration de l\'application s\'est correctement déroulée, place à la prochaine étape<br /><br />
+Par mesure de sécurité, merci de supprimer le fichier "install.php" du repertoire "admin"<br />
+Un fois ce fichier supprimé, veuillez suivre ces indications :
+<ul>
+ <li>allez sur la page d\'identification : [ <a href="../identification.php">identification</a> ] et connectez-vous avec le pseudo donné pour le webmaster</li>
+ <li>celui-ci vous permet d\'accéder à la [ <a href="admin.php">partie administration</a> ] et aux instructions pour placer les images dans les répertoires.</li>
+</ul>';
+ $lang['step2_title'] = 'Etape 2 sur 2';
+ $lang['step2_pwd'] = 'password webmaster';
+ $lang['step2_pwd_info'] = 'Il doit rester confidentiel, il permet d\'accéder au panneau d\'administration.';
+ $lang['step2_pwd_conf'] = 'confirmer password';
+ $lang['step2_pwd_conf_info'] = 'Vérification';
+}
+?> \ No newline at end of file
diff --git a/language/index.htm b/language/index.htm
new file mode 100644
index 000000000..960cd928d
--- /dev/null
+++ b/language/index.htm
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>PhpWebGallery</title>
+ </head>
+ <body>
+ No access authorized
+ </body>
+</html> \ No newline at end of file
diff --git a/picture.php b/picture.php
new file mode 100644
index 000000000..c3523fb80
--- /dev/null
+++ b/picture.php
@@ -0,0 +1,589 @@
+<?php
+/***************************************************************************
+ * picture.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+// this page shows the image full size
+// (or resized to the max size the user has chosen)
+// and two thumbnail : previous and next picture of your gallery
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_cat_id( $_GET['cat'] );
+check_login_authorization();
+if ( isset( $page['cat'] ) && is_numeric( $page['cat'] ) )
+{
+ check_restrictions( $page['cat'] );
+}
+//---------------------------------------- incrementation of the number of hits
+$query = 'update '.$prefixeTable.'images';
+$query.= ' set hit=hit+1';
+$query.= ' where id='.$_GET['image_id'];
+$query.= ';';
+@mysql_query( $query );
+//-------------------------------------------------------------- initialization
+initialize_category( 'picture' );
+$cat_directory = $page['cat_dir']; // by default
+//------------------------------------- main picture information initialization
+$query = 'select id,date_available,comment,hit';
+$query.= ',author,name,file,date_creation,filesize,width,height,cat_id';
+$query.= ' from '.$prefixeTable.'images';
+$query.= $page['where'];
+$query.= ' and id = '.$_GET['image_id'];
+$query.= $conf['order_by'];
+$query.= ';';
+$result = mysql_query( $query );
+$row = mysql_fetch_array( $result );
+$page['id'] = $row['id'];
+$page['file'] = $row['file'];
+$page['name'] = $row['name'];
+$page['date_available'] = $row['date_available'];
+$page['comment'] = $row['comment'];
+$page['hit'] = $row['hit'];
+$page['author'] = $row['author'];
+$page['date_creation'] = $row['date_creation'];
+$page['filesize'] = $row['filesize'];
+$page['width'] = $row['width'];
+$page['height'] = $row['height'];
+$page['cat_id'] = $row['cat_id'];
+// retrieving the number of the picture in its category (in order)
+$query = 'select id';
+$query.= ' from '.$prefixeTable.'images';
+$query.= $page['where'];
+$query.= $conf['order_by'];
+$query.= ';';
+$result = mysql_query( $query );
+$page['num'] = 0;
+$row = mysql_fetch_array( $result );
+while ( $row['id'] != $page['id'] )
+{
+ $page['num']++;
+ $row = mysql_fetch_array( $result );
+}
+//--------------------------------------------------------- favorite management
+if ( isset( $_GET['add_fav'] ) )
+{
+ if ( $_GET['add_fav'] == 1 )
+ {
+ // verify if the picture is already in the favorite of the user
+ $query = 'select count(*) as nb_fav';
+ $query.= ' from '.$prefixeTable.'favorites';
+ $query.= ' where image_id = '.$page['id'];
+ $query.= ' and user_id = '.$user['id'];
+ $query.= ';';
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ if ( $row['nb_fav'] == 0 )
+ {
+ $query = 'insert into '.$prefixeTable.'favorites';
+ $query.= ' (image_id,user_id) values';
+ $query.= ' ('.$page['id'].','.$user['id'].')';
+ $query.= ';';
+ $result = mysql_query( $query );
+ }
+ }
+ if ( $_GET['add_fav'] == 0 )
+ {
+ $query = 'delete from '.$prefixeTable.'favorites';
+ $query.= ' where user_id = '.$user['id'];
+ $query.= ' and image_id = '.$page['id'];
+ $query.= ';';
+ $result = mysql_query( $query );
+
+ $page['cat_nb_images'] = $page['cat_nb_images'] - 1;
+ if ( $page['cat_nb_images'] <= 0 )
+ {
+ // there is no favorite picture anymore
+ // we redirect the user to the category page
+ $url = add_session_id( 'category.php' );
+ header( 'Request-URI: '.$url );
+ header( 'Content-Location: '.$url );
+ header( 'Location: '.$url );
+ exit();
+ }
+ // redirection of the user to the picture.php page
+ // with the right picture
+ $page['num'] = $page['num'] - 1;
+ if ( $page['num'] == -1 )
+ {
+ $page['num'] = 0;
+ }
+ $query = 'select id';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= $page['where'];
+ $query.= $conf['order_by'];
+ $query.= ' limit '.$page['num'].',1';
+ $query.= ';';
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $redirect = './picture.php?image_id='.$row['id'].'&cat='.$page['cat'];
+ $redirect.= '&expand='.$_GET['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $redirect.= '&search='.$_GET['search'];
+ }
+ $url = add_session_id( $redirect, true );
+ header( 'Request-URI: '.$url );
+ header( 'Content-Location: '.$url );
+ header( 'Location: '.$url );
+ exit();
+ }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/default/picture.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'back', $lang['back'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+$vtp->setGlobalVar( $handle, 'comments_title', $lang['comments_title'] );
+$vtp->setGlobalVar( $handle, 'comments_del', $lang['comments_del'] );
+$vtp->setGlobalVar( $handle, 'delete', $lang['delete'] );
+$vtp->setGlobalVar( $handle, 'comments_add', $lang['comments_add'] );
+$vtp->setGlobalVar( $handle, 'author', $lang['author'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+$vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+//------------------------------------------------------------------ page title
+if ( $page['name'] != "" )
+{
+ $vtp->setGlobalVar( $handle, 'page_title', $page['name'] );
+}
+else
+{
+ $vtp->setGlobalVar( $handle, 'page_title', $page['file'] );
+}
+//-------------------------------------------------- previous picture thumbnail
+if ( $page['num'] >= 1 )
+{
+ $prev = $page['num'] - 1;
+ $query = 'select id,name,file,tn_ext,cat_id';
+ $query.= ' from '.$prefixeTable.'images';
+ $query.= $page['where'];
+ $query.= $conf['order_by'];
+ $query.= ' limit '.$prev.',1';
+ $query.= ';';
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+
+ if ( !is_numeric( $page['cat'] ) )
+ {
+ if ( $array_cat_directories[$row['cat_id']] == '' )
+ {
+ $cat_result = get_cat_info( $row['cat_id'] );
+ $array_cat_directories[$row['cat_id']] = $cat_result['dir'];
+ }
+ $cat_directory = $array_cat_directories[$row['cat_id']];
+ }
+
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], '.' ) );
+ $lien_thumbnail = $cat_directory.'/thumbnail/';
+ $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+
+ $prev_title = $lang['previous_image'].' : ';
+ $alt_thumbnaill = '';
+ if ( $row['name'] != "" )
+ {
+ $alt_thumbnail = $row['name'];
+ }
+ else
+ {
+ $alt_thumbnail = $file;
+ }
+ $prev_title.= $alt_thumbnail;
+
+ $url_link = './picture.php?image_id='.$row['id'].'&amp;cat='.$page['cat'];
+ $url_link.= '&amp;expand='.$_GET['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url_link.= '&amp;search='.$_GET['search'];
+ }
+ // sending vars for display
+ $vtp->addSession( $handle, 'previous' );
+ $vtp->setGlobalVar( $handle, 'previous.url', add_session_id( $url_link ) );
+ $vtp->setGlobalVar( $handle, 'previous.title', $prev_title );
+ $vtp->setGlobalVar( $handle, 'previous.src', $lien_thumbnail );
+ $vtp->setGlobalVar( $handle, 'previous.alt', $alt_thumbnail );
+ $vtp->closeSession( $handle, 'previous' );
+}
+else
+{
+ $vtp->addSession( $handle, 'previous_empty' );
+ $vtp->closeSession( $handle, 'previous_empty' );
+}
+//-------------------------------------------------------- main picture display
+if ( is_numeric( $page['cat'] ) )
+{
+ $intitule_cat = get_cat_display_name( $page['cat_name'], " - ",
+ "font-style:italic;" );
+}
+else
+{
+ $cat_result = get_cat_info( $page['cat_id'] );
+ if ( $array_cat_directories[$page['cat_id']] == "" )
+ {
+ $array_cat_directories[$page['cat_id']] = $cat_result['dir'];
+ }
+ $cat_directory = $array_cat_directories[$page['cat_id']];
+ $intitule_cat = $page['title'];
+}
+$n = $page['num'] + 1;
+$intitule_titre = replace_space( $intitule_cat." - " ).$n.'/'.
+$intitule_titre.= $page['cat_nb_images']."<br />";
+if ( $page['name'] != "" )
+{
+ $intitule_file = $page['name'];
+}
+else
+{
+ $intitule_file = str_replace( "_", " ",
+ substr( $page['file'], 0,
+ strrpos ( $page['file'], ".") ) );
+}
+if ( $page['cat'] == 'search' )
+{
+ $intitule_file = replace_search( $intitule_file, $_GET['search'] );
+}
+$vtp->setGlobalVar( $handle, 'title', $intitule_titre.$intitule_file );
+
+$lien_image = $cat_directory.$page['file'];
+
+// calcul de la largeur et de la hauteur
+if ( $page['width'] == "" )
+{
+ $taille_image = @getimagesize( $lien_image );
+ $original_width = $taille_image[0];
+ $original_height = $taille_image[1];
+}
+else
+{
+ $original_width = $page['width'];
+ $original_height = $page['height'];
+}
+
+$picture_size = get_picture_size( $original_width, $original_height,
+ $user['maxwidth'], $user['maxheight'] );
+$final_width = $picture_size[0];
+$final_height = $picture_size[1];
+
+$url_link = './category.php?cat='.$page['cat'].'&amp;';
+$url_link.= 'num='.$page['num'].'&amp;expand='.$_GET['expand'];
+if ( $page['cat'] == 'search' )
+{
+ $url_link.= "&amp;search=".$_GET['search'];
+}
+$vtp->setGlobalVar( $handle, 'picture_link', add_session_id( $url_link ) );
+$vtp->setGlobalVar( $handle, 'picture_width', $final_width );
+$vtp->setGlobalVar( $handle, 'picture_height', $final_height );
+$vtp->setGlobalVar( $handle, 'picture_border_color', $user['couleur_text'] );
+$vtp->setGlobalVar( $handle, 'picture_src', $lien_image );
+$vtp->setGlobalVar( $handle, 'picture_alt', $page['file'] );
+
+if ( $page['comment'] != '' )
+{
+ if ( $page['cat'] == 'search' )
+ {
+ $picture_comment = replace_search( $page['comment'], $_GET['search'] );
+ $vtp->setGlobalVar( $handle, 'picture_comment', $picture_comment );
+ }
+ else
+ {
+ $vtp->setGlobalVar( $handle, 'picture_comment', $page['comment'] );
+ }
+}
+//--------------------------------------------------------- picture information
+// author
+if ( $page['author'] != "" )
+{
+ $vtp->addSession( $handle, 'info_line' );
+ $vtp->setVar( $handle, 'info_line.name', $lang['author'].' : ' );
+ $vtp->setVar( $handle, 'info_line.content', $page['author'] );
+ $vtp->closeSession( $handle, 'info_line' );
+}
+// creation date
+if ( $page['date_creation'] != "" )
+{
+ $vtp->addSession( $handle, 'info_line' );
+ $vtp->setVar( $handle, 'info_line.name', $lang['creation_date'].' : ' );
+ $tab_date = explode( '-', $page['date_creation'] );
+ $vtp->setVar( $handle, 'info_line.content',
+ $tab_date[2].'/'.$tab_date[1].'/'.$tab_date[0] );
+ $vtp->closeSession( $handle, 'info_line' );
+}
+// date of availability
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['registration_date'].' : ' );
+$tab_date = explode( '-', $page['date_available'] );
+$vtp->setVar( $handle, 'info_line.content',
+ $tab_date[2].'/'.$tab_date[1].'/'.$tab_date[0] );
+$vtp->closeSession( $handle, 'info_line' );
+// size in pixels
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['size'].' : ' );
+if ( $original_width != $final_width || $original_height != $final_height )
+{
+ $content = '[ <a href="'.$lien_image.'" title="'.$lang['true_size'].'">';
+ $content.= $original_width.'*'.$original_height.'</a> ]';
+ $vtp->setVar( $handle, 'info_line.content', $content );
+}
+else
+{
+ $content = $original_width.'*'.$original_height;
+ $vtp->setVar( $handle, 'info_line.content', $content );
+}
+$vtp->closeSession( $handle, 'info_line' );
+// file
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['file'].' : ' );
+if ( $page['cat'] == 'search' )
+{
+ $content = replace_search( $page['file'], $_GET['search'] );
+ $vtp->setVar( $handle, 'info_line.content', $content );
+}
+else
+{
+ $vtp->setVar( $handle, 'info_line.content', $page['file'] );
+}
+$vtp->closeSession( $handle, 'info_line' );
+// filesize
+if ( $page['filesize'] == "" )
+{
+ $poids = floor ( filesize( $lien_image ) / 1024 );
+}
+else
+{
+ $poids = $page['filesize'];
+}
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['filesize'].' : ' );
+$vtp->setVar( $handle, 'info_line.content', $poids.' KB' );
+$vtp->closeSession( $handle, 'info_line' );
+// number of visits
+$vtp->addSession( $handle, 'info_line' );
+$vtp->setVar( $handle, 'info_line.name', $lang['visited'].' : ' );
+$vtp->setVar( $handle, 'info_line.content', $page['hit'].' '.$lang['times'] );
+$vtp->closeSession( $handle, 'info_line' );
+//------------------------------------------------------- favorite manipulation
+if ( $page['cat'] != 'fav' && !$user['is_the_guest'] )
+{
+ $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+ $url.= '&amp;expand='.$_GET['expand'].'&amp;add_fav=1';
+ if ( $page['cat'] == 'search' )
+ {
+ $url.= '&amp;search='.$_GET['search'];
+ }
+ $vtp->addSession( $handle, 'favorite' );
+ $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
+ $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] );
+ $vtp->setVar( $handle, 'favorite.src',
+ './theme/'.$user['theme'].'/favorite.gif' );
+ $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['add_favorites_alt'].' ]' );
+ $vtp->closeSession( $handle, 'favorite' );
+}
+if ( $page['cat'] == 'fav' )
+{
+ $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+ $url.= '&amp;expand='.$_GET['expand'].'&amp;add_fav=0';
+ $vtp->addSession( $handle, 'favorite' );
+ $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
+ $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] );
+ $vtp->setVar( $handle, 'favorite.src',
+ './theme/'.$user['theme'].'/del_favorite.gif' );
+ $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['del_favorites_alt'].' ]' );
+ $vtp->closeSession( $handle, 'favorite' );
+}
+//------------------------------------ admin link for information modifications
+if ( $user['status'] == "admin" && is_numeric( $page['cat'] ) )
+{
+ $vtp->addSession( $handle, 'modification' );
+ $url = './admin/admin.php?page=infos_images&amp;cat_id='.$page['cat'];
+ $url.= '&amp;num='.$page['num'];
+ $vtp->setVar( $handle, 'modification.link',
+ add_session_id( $url )."#".$page['id'] );
+ $vtp->setVar( $handle, 'modification.name', $lang['link_info_image'] );
+}
+//---------------------------------------------- next picture thumbnail display
+if ( $page['num'] < $page['cat_nb_images']-1 )
+{
+ $next = $page['num'] + 1;
+ $query = "select id,name,file,tn_ext,cat_id";
+ $query.= " from $prefixeTable"."images";
+ $query.= $page['where'];
+ $query.= $conf['order_by'];
+ $query.= " limit $next,1";
+ $query.= ";";
+ $result = mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+
+ if ( !is_numeric( $page['cat'] ) )
+ {
+ if ( $array_cat_directories[$row['cat_id']] == "" )
+ {
+ $cat_result = get_cat_info( $row['cat_id'] );
+ $array_cat_directories[$row['cat_id']] = $cat_result['dir'];
+ }
+ $cat_directory = $array_cat_directories[$row['cat_id']];
+ }
+
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+ $lien_thumbnail = $cat_directory."thumbnail/";
+ $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+
+ if ( $row['name'] != "" )
+ {
+ $alt_thumbnail = $row['name'];
+ }
+ else
+ {
+ $alt_thumbnail = $file;
+ }
+ $next_title = $lang['next_image']." : ".$alt_thumbnail;
+
+ $url_link = './picture.php?image_id='.$row['id'].'&amp;cat='.$page['cat'];
+ $url_link.= '&amp;expand='.$_GET['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url_link.= "&amp;search=".$_GET['search'];
+ }
+ // sending vars for display
+ $vtp->addSession( $handle, 'next' );
+ $vtp->setGlobalVar( $handle, 'next.url', add_session_id( $url_link ) );
+ $vtp->setGlobalVar( $handle, 'next.title', $next_title );
+ $vtp->setGlobalVar( $handle, 'next.src', $lien_thumbnail );
+ $vtp->setGlobalVar( $handle, 'next.alt', $alt_thumbnail );
+ $vtp->closeSession( $handle, 'next' );
+}
+else
+{
+ $vtp->addSession( $handle, 'previous_empty' );
+ $vtp->closeSession( $handle, 'previous_empty' );
+}
+//---------------------------------------------------- users's comments display
+if ( $conf['show_comments'] )
+{
+ $vtp->addSession( $handle, 'comments' );
+ // comment registeration
+ if ( isset( $_POST['content'] ) && $_POST['content'] != '' )
+ {
+ $author = $user['pseudo'];
+ if ( $_POST['author'] != "" )
+ {
+ $author = $_POST['author'];
+ }
+ $query = 'insert into '.$prefixeTable.'comments';
+ $query.= ' (author,date,image_id,content) values';
+ $query.= " ('".$author."',".time().",".$page['id'];
+ $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."');";
+ mysql_query( $query );
+ }
+ // comment deletion
+ if ( isset( $_GET['del'] )
+ && is_numeric( $_GET['del'] )
+ && $user['status'] == 'admin' )
+ {
+ $query = 'delete from '.$prefixeTable.'comments';
+ $query.= ' where id = '.$_GET['del'].';';
+ mysql_query( $query );
+ }
+ // number of comment for this picture
+ $query = 'select count(*) as nb_comments';
+ $query.= ' from '.$prefixeTable.'comments';
+ $query.= ' where image_id = '.$page['id'].';';
+ $row = mysql_fetch_array( mysql_query( $query ) );
+ $page['nb_comments'] = $row['nb_comments'];
+ // navigation bar creation
+ $url = './picture.php?cat='.$page['cat'].'&amp;image_id='.$page['id'];
+ $url.= '&amp;expand='.$_GET['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url.= '&amp;search='.$_GET['search'];
+ }
+ if( !isset( $_GET['start'] )
+ || !is_numeric( $_GET['start'] )
+ || ( is_numeric( $_GET['start'] ) && $_GET['start'] < 0 ) )
+ {
+ $page['start'] = 0;
+ }
+ else
+ {
+ $page['start'] = $_GET['start'];
+ }
+ $page['navigation_bar'] = create_navigation_bar( $url, $page['nb_comments'],
+ $page['start'],
+ $conf['nb_comment_page'],
+ '' );
+ // sending vars for display
+ $vtp->setGlobalVar( $handle, 'navigation_bar', $page['navigation_bar'] );
+ $vtp->setGlobalVar( $handle, 'nb_comments', $page['nb_comments'] );
+
+ $query = 'select id,author,date,image_id,content';
+ $query.= ' from '.$prefixeTable.'comments';
+ $query.= ' where image_id = '.$page['id'];
+ $query.= ' order by date asc';
+ $query.= ' limit '.$page['start'].', '.$conf['nb_comment_page'].';';
+ $result = mysql_query( $query );
+
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $vtp->addSession( $handle, 'comment' );
+ $vtp->setVar( $handle, 'comment.author', $row['author'] );
+ $displayed_date = $lang['day'][date( "w", $row['date'] )];
+ $displayed_date.= date( " j ", $row['date'] );
+ $displayed_date.= $lang['month'][date( "n", $row['date'] )];
+ $displayed_date.= date( " Y G:i", $row['date'] );
+ $vtp->setVar( $handle, 'comment.date', $displayed_date );
+ $vtp->setVar( $handle, 'comment.content', nl2br( $row['content'] ) );
+ if ( $user['status'] == 'admin' )
+ {
+ $vtp->addSession( $handle, 'delete' );
+ $vtp->setVar( $handle, 'delete.link',
+ add_session_id( $url.'&amp;del='.$row['id'] ) );
+ $vtp->closeSession( $handle, 'delete' );
+ }
+ $vtp->closeSession( $handle, 'comment' );
+ }
+ // form action
+ $action = str_replace( '&', '&amp;', $_SERVER['REQUEST_URI'] );
+ $vtp->setGlobalVar( $handle, 'form_action', $action );
+ // display author field if the user is not logged in
+ if ( !$user['is_the_guest'] )
+ {
+ $vtp->addSession( $handle, 'author_known' );
+ $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] );
+ $vtp->closeSession( $handle, 'author_known' );
+ }
+ else
+ {
+ $vtp->addSession( $handle, 'author_field' );
+ $vtp->closeSession( $handle, 'author_field' );
+ }
+ $vtp->closeSession( $handle, 'comments' );
+}
+//------------------------------------------------------------ log informations
+pwg_log( 'picture', $intitule_cat, $page['file'] );
+mysql_close();
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+//------------------------------------------------------------ log informations
+$query = 'insert into '.$prefixeTable.'history';
+$query.= ' (date,login,IP,page,titre,categorie) values';
+$query.= " (".time().", '".$user['pseudo']."','".$_SERVER['REMOTE_ADDR']."'";
+$query.= ",'picture','".$page['file']."','".$intitule_cat."');";
+@mysql_query( $query );
+?> \ No newline at end of file
diff --git a/profile.php b/profile.php
new file mode 100644
index 000000000..1f3d63828
--- /dev/null
+++ b/profile.php
@@ -0,0 +1,403 @@
+<?php
+/***************************************************************************
+ * profile.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Tuesday, July 16, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+// customize appearance of the site for a user
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+if ( $user['is_the_guest'] )
+{
+ echo '<div style="text-align:center;">'.$lang['only_members'].'<br />';
+ echo '<a href="./identification.php">'.$lang['ident_title'].'</a></div>';
+ exit();
+}
+//-------------------------------------------------------------- initialization
+check_cat_id( $_GET['cat'] );
+//------------------------------------------------------ update & customization
+$infos = array( 'nb_image_line', 'nb_line_page', 'theme', 'language',
+ 'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
+ 'short_period', 'long_period', 'template', 'mail_address' );
+// mise à jour dans la base de données des valeurs
+// des paramètres pour l'utilisateur courant
+// - on teste si chacune des variables est passée en argument à la page
+// - ce qui signifie que l'on doit venir de la page de personnalisation
+$error = array();
+if ( isset( $_POST['submit'] ) )
+{
+ $i = 0;
+ if ( $_POST['maxwidth'] != '' )
+ {
+ if ( !ereg( "^[0-9]{2,}$", $_POST['maxwidth'] )
+ || $_POST['maxwidth'] < 50 )
+ {
+ $error[$i++] = $lang['err_maxwidth'];
+ }
+ }
+ if ( $_POST['maxheight'] != '' )
+ {
+ if ( !ereg( "^[0-9]{2,}$", $_POST['maxheight'] )
+ || $_POST['maxheight'] < 50 )
+ {
+ $error[$i++] = $lang['err_maxheight'];
+ }
+ }
+ // les période doivent être des entiers, il représentent des nombres de jours
+ if ( !ereg( "^[0-9]*$", $_POST['short_period'] )
+ || !ereg("^[0-9]*$", $_POST['long_period'] ) )
+ {
+ $error[$i++] = $lang['err_periods'];
+ }
+ else
+ {
+ // la période longue doit être supérieure à la période courte
+ if ( $_POST['long_period'] <= $_POST['short_period']
+ || $_POST['short_period'] <= 0 )
+ {
+ $error[$i++] = $lang['err_periods_2'];
+ }
+ }
+ // le mail doit être conforme à qqch du type : nom@serveur.com
+ if( $_POST['mail_address'] != ""
+ && !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
+ $_POST['mail_address'] ) )
+ {
+ $error[$i++] = $lang['reg_err_mail_address'];
+ }
+ if ( $_POST['use_new_pwd'] == 1 )
+ {
+ // on vérifie que le password rentré correspond bien
+ // à la confirmation faite par l'utilisateur
+ if ( $_POST['password'] != $_POST['passwordConf'] )
+ {
+ $error[$i++] = $lang['reg_err_pass'];
+ }
+ }
+
+ if ( sizeof( $error ) == 0 )
+ {
+ $tab_theme = explode( ' - ', $_POST['theme'] );
+ $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
+
+ $query = 'update '.$prefixeTable.'users';
+ $query.= ' set';
+ for ( $i = 0; $i < sizeof( $infos ); $i++ )
+ {
+ if ( $i > 0 )
+ {
+ $query.= ',';
+ }
+ else
+ {
+ $query.= ' ';
+ }
+ $query.= $infos[$i];
+ $query.= ' = ';
+ if ( $_POST[$infos[$i]] == '' )
+ {
+ $query.= 'NULL';
+ }
+ else
+ {
+ $query.= "'".$_POST[$infos[$i]]."'";
+ }
+ }
+ $query.= ' where id = '.$user['id'];
+ $query.= ';';
+ mysql_query( $query );
+
+ if ( $_POST['use_new_pwd'] == 1 )
+ {
+ $query = 'update '.$prefixeTable.'users';
+ $query.= " set password = '".md5( $_POST['password'] )."'";
+ $query.= ' where id = '.$user['id'];
+ $query.= ';';
+ mysql_query( $query );
+ echo '<br />'.$query;
+ }
+ // redirection
+ $url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url.= '&search='.$_GET['search'];
+ }
+ $url = add_session_id( $url, true );
+ header( 'Request-URI: '.$url );
+ header( 'Content-Location: '.$url );
+ header( 'Location: '.$url );
+ exit();
+ }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'customize_page_title',
+ $lang['customize_page_title'] );
+$vtp->setGlobalVar( $handle, 'customize_title', $lang['customize_title'] );
+$vtp->setGlobalVar( $handle, 'password', $lang['password'] );
+$vtp->setGlobalVar( $handle, 'new', $lang['new'] );
+$vtp->setGlobalVar( $handle, 'reg_confirm', $lang['reg_confirm'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+//----------------------------------------------------------------- form action
+$url = './profile.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
+if ( $page['cat'] == 'search' )
+{
+ $url.= '&amp;search='.$_GET['search'];
+}
+$vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+ $vtp->addSession( $handle, 'errors' );
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ $vtp->addSession( $handle, 'li' );
+ $vtp->setVar( $handle, 'li.li', $error[$i] );
+ $vtp->closeSession( $handle, 'li' );
+ }
+ $vtp->closeSession( $handle, 'errors' );
+}
+//---------------------------------------------------- number of images per row
+if ( in_array( 'nb_image_line', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_nb_image_per_row'] );
+ $vtp->addSession( $handle, 'select' );
+ $vtp->setVar( $handle, 'select.name', 'nb_image_line' );
+ for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $conf['nb_image_row'][$i] );
+ if ( $conf['nb_image_row'][$i] == $user['nb_image_line'] )
+ {
+ $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $handle, 'option' );
+ }
+ $vtp->closeSession( $handle, 'select' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//------------------------------------------------------ number of row per page
+if ( in_array( 'nb_line_page', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_nb_row_per_page'] );
+ $vtp->addSession( $handle, 'select' );
+ $vtp->setVar( $handle, 'select.name', 'nb_line_page' );
+ for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $conf['nb_row_page'][$i] );
+ if ( $conf['nb_row_page'][$i] == $user['nb_line_page'] )
+ {
+ $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $handle, 'option' );
+ }
+ $vtp->closeSession( $handle, 'select' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------------------- template
+if ( in_array( 'template', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_template'] );
+ $vtp->addSession( $handle, 'select' );
+ $vtp->setVar( $handle, 'select.name', 'template' );
+ $option = get_dirs( './template/' );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $option[$i] );
+ if ( $option[$i] == $user['template'] )
+ {
+ $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $handle, 'option' );
+ }
+ $vtp->closeSession( $handle, 'select' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------------------------- theme
+if ( in_array( 'theme', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_theme'] );
+ $vtp->addSession( $handle, 'select' );
+ $vtp->setVar( $handle, 'select.name', 'theme' );
+ $option = get_themes( './theme/' );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $option[$i] );
+ if ( $option[$i] == str_replace( '/', ' - ', $user['theme'] ) )
+ {
+ $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $handle, 'option' );
+ }
+ $vtp->closeSession( $handle, 'select' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------------------- language
+if ( in_array( 'language', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_language'] );
+ $vtp->addSession( $handle, 'select' );
+ $vtp->setVar( $handle, 'select.name', 'language' );
+ $option = get_languages( './language/' );
+ for ( $i = 0; $i < sizeof( $option ); $i++ )
+ {
+ $vtp->addSession( $handle, 'option' );
+ $vtp->setVar( $handle, 'option.option', $option[$i] );
+ if( $option[$i] == $user['language'] )
+ {
+ $vtp->setVar( $handle, 'option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $handle, 'option' );
+ }
+ $vtp->closeSession( $handle, 'select' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------------------------------------- short period
+if ( in_array( 'short_period', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_short_period'] );
+ $vtp->addSession( $handle, 'text' );
+ $vtp->setVar( $handle, 'text.name', 'short_period' );
+ $vtp->setVar( $handle, 'text.value', $user['short_period'] );
+ $vtp->closeSession( $handle, 'text' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------------------- long period
+if ( in_array( 'long_period', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_long_period'] );
+ $vtp->addSession( $handle, 'text' );
+ $vtp->setVar( $handle, 'text.name', 'long_period' );
+ $vtp->setVar( $handle, 'text.value', $user['long_period'] );
+ $vtp->closeSession( $handle, 'text' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//--------------------------------------------------------- max displayed width
+if ( in_array( 'maxwidth', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['maxwidth'] );
+ $vtp->addSession( $handle, 'text' );
+ $vtp->setVar( $handle, 'text.name', 'maxwidth' );
+ $vtp->setVar( $handle, 'text.value', $user['maxwidth'] );
+ $vtp->closeSession( $handle, 'text' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//-------------------------------------------------------- max displayed height
+if ( in_array( 'maxheight', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['maxheight'] );
+ $vtp->addSession( $handle, 'text' );
+ $vtp->setVar( $handle, 'text.name', 'maxheight' );
+ $vtp->setVar( $handle, 'text.value', $user['maxheight'] );
+ $vtp->closeSession( $handle, 'text' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------------------------------------- mail address
+if ( in_array( 'mail_address', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['reg_mail_address'] );
+ $vtp->addSession( $handle, 'text' );
+ $vtp->setVar( $handle, 'text.name', 'mail_address' );
+ $vtp->setVar( $handle, 'text.value', $user['mail_address'] );
+ $vtp->closeSession( $handle, 'text' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------- expand all categories ?
+if ( in_array( 'expand', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_expand'] );
+ $vtp->addSession( $handle, 'group' );
+ $vtp->addSession( $handle, 'radio' );
+ $vtp->setVar( $handle, 'radio.name', 'expand' );
+ $vtp->setVar( $handle, 'radio.value', 'true' );
+ $checked = '';
+ if ( $user['expand'] )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $handle, 'radio.checked', $checked );
+ $vtp->setVar( $handle, 'radio.option', $lang['yes'] );
+ $vtp->closeSession( $handle, 'radio' );
+ $vtp->addSession( $handle, 'radio' );
+ $vtp->setVar( $handle, 'radio.name', 'expand' );
+ $vtp->setVar( $handle, 'radio.value', 'false' );
+ $checked = '';
+ if ( !$user['expand'] )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $handle, 'radio.checked', $checked );
+ $vtp->setVar( $handle, 'radio.option', $lang['no'] );
+ $vtp->closeSession( $handle, 'radio' );
+ $vtp->closeSession( $handle, 'group' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//---------------------------------- show number of comments on thumbnails page
+if ( in_array( 'show_nb_comments', $infos ) )
+{
+ $vtp->addSession( $handle, 'line' );
+ $vtp->setVar( $handle, 'line.name', $lang['customize_show_nb_comments'] );
+ $vtp->addSession( $handle, 'group' );
+ $vtp->addSession( $handle, 'radio' );
+ $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' );
+ $vtp->setVar( $handle, 'radio.value', 'true' );
+ $checked = '';
+ if ( $user['show_nb_comments'] )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $handle, 'radio.checked', $checked );
+ $vtp->setVar( $handle, 'radio.option', $lang['yes'] );
+ $vtp->closeSession( $handle, 'radio' );
+ $vtp->addSession( $handle, 'radio' );
+ $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' );
+ $vtp->setVar( $handle, 'radio.value', 'false' );
+ $checked = '';
+ if ( !$user['show_nb_comments'] )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $handle, 'radio.checked', $checked );
+ $vtp->setVar( $handle, 'radio.option', $lang['no'] );
+ $vtp->closeSession( $handle, 'radio' );
+ $vtp->closeSession( $handle, 'group' );
+ $vtp->closeSession( $handle, 'line' );
+}
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?> \ No newline at end of file
diff --git a/register.php b/register.php
new file mode 100644
index 000000000..48d661d49
--- /dev/null
+++ b/register.php
@@ -0,0 +1,106 @@
+<?php
+/***************************************************************************
+ * register.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Saturday, December 28, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( "./include/init.inc.php" );
+//-------------------------------------------------- access authorization check
+if ( $conf['acces'] == "restreint" )
+{
+ echo $lang['only_members'];
+ exit();
+}
+//----------------------------------------------------------- user registration
+$error = array();
+if ( isset( $_POST['submit'] ) )
+{
+ $error = register_user( $_POST['login'], $_POST['password'],
+ $_POST['password_conf'], $_POST['mail_address'] );
+ if ( sizeof( $error ) == 0 )
+ {
+ $session_id = session_create( $_POST['login'] );
+ $url = 'category.php?id='.$session_id;
+ header( 'Request-URI: '.$url );
+ header( 'Content-Location: '.$url );
+ header( 'Location: '.$url );
+ exit();
+ }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'register_page_title',
+ $lang['register_page_title'] );
+$vtp->setGlobalVar( $handle, 'register_title', $lang['register_title'] );
+$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+//----------------------------------------------------------------- form action
+$vtp->setGlobalVar( $handle, 'form_action', './register.php' );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+ $vtp->addSession( $handle, 'errors' );
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ $vtp->addSession( $handle, 'li' );
+ $vtp->setVar( $handle, 'li.li', $error[$i] );
+ $vtp->closeSession( $handle, 'li' );
+ }
+ $vtp->closeSession( $handle, 'errors' );
+}
+//----------------------------------------------------------------------- login
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['login'] );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.name', 'login' );
+$vtp->setVar( $handle, 'text.value', $_POST['login'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+//-------------------------------------------------------------------- password
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['password'] );
+$vtp->addSession( $handle, 'password' );
+$vtp->setVar( $handle, 'password.name', 'password' );
+$vtp->setVar( $handle, 'password.value', '' );
+$vtp->closeSession( $handle, 'password' );
+$vtp->closeSession( $handle, 'line' );
+//------------------------------------------------------- password confirmation
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] );
+$vtp->addSession( $handle, 'password' );
+$vtp->setVar( $handle, 'password.name', 'password_conf' );
+$vtp->setVar( $handle, 'password.value', '' );
+$vtp->closeSession( $handle, 'password' );
+$vtp->closeSession( $handle, 'line' );
+//---------------------------------------------------------------- mail address
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['reg_mail_address'] );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.name', 'mail_address' );
+$vtp->setVar( $handle, 'text.value', $_POST['mail_address'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?> \ No newline at end of file
diff --git a/search.php b/search.php
new file mode 100644
index 000000000..7538ae712
--- /dev/null
+++ b/search.php
@@ -0,0 +1,90 @@
+<?php
+/***************************************************************************
+ * search.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Wednesday, July 25, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+//----------------------------------------------------------------- redirection
+$error = array();
+if ( isset( $_POST['search'] ) )
+{
+ $i = 0;
+ if ( strlen( $_POST['search'] ) > 2 )
+ {
+ $url = add_session_id( 'category.php?cat=search&search='.
+ $_POST['search'], true );
+ header( 'Request-URI: '.$url );
+ header( 'Content-Location: '.$url );
+ header( 'Location: '.$url );
+ exit();
+ }
+ else
+ {
+ $error[$i++] = $lang['invalid_search'];
+ }
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/default/search.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'search_page_title',$lang['search_title'] );
+$vtp->setGlobalVar( $handle, 'search_title', $lang['search_title'] );
+$vtp->setGlobalVar( $handle, 'search_return_main_page',
+ $lang['search_return_main_page'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+//----------------------------------------------------------------- form action
+$vtp->setGlobalVar( $handle, 'form_action', add_session_id( './search.php' ) );
+//-------------------------------------------------------------- errors display
+if ( sizeof( $error ) != 0 )
+{
+ $vtp->addSession( $handle, 'errors' );
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ $vtp->addSession( $handle, 'li' );
+ $vtp->setVar( $handle, 'li.li', $error[$i] );
+ $vtp->closeSession( $handle, 'li' );
+ }
+ $vtp->closeSession( $handle, 'errors' );
+}
+//---------------------------------------------------------------- search field
+$vtp->addSession( $handle, 'line' );
+$vtp->setVar( $handle, 'line.name', $lang['search_field_search'] );
+$vtp->addSession( $handle, 'text' );
+$vtp->setVar( $handle, 'text.size', '40' );
+$vtp->setVar( $handle, 'text.name', 'search' );
+$vtp->setVar( $handle, 'text.value', $_POST['search'] );
+$vtp->closeSession( $handle, 'text' );
+$vtp->closeSession( $handle, 'line' );
+//---------------------------------------------------- return to main page link
+$vtp->setGlobalVar( $handle, 'back_url', add_session_id( './category.php' ) );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+//------------------------------------------------------------ log informations
+$query = 'insert into '.$prefixeTable.'history';
+$query.= '(date,login,IP,page) values';
+$query.= "('".time()."', '".$user['pseudo']."','".$_SERVER['REMOTE_ADDR']."'";
+$query.= ",'search');";
+@mysql_query( $query );
+?> \ No newline at end of file
diff --git a/template/default/about.vtp b/template/default/about.vtp
new file mode 100644
index 000000000..6e55751a8
--- /dev/null
+++ b/template/default/about.vtp
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#about_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#about_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ {#frame_start}50%{#frame_begin}
+ <div class="menu" style="white-space:normal;margin:10px;">
+ {#about_message}
+ </div>
+ {#frame_end}
+ <div style="text-align:center;margin:5px;">
+ <a onclick="history.back()" style="font-style:italic;font-family:verdana,arial,sans-serif;font-size:12px;">{#about_return}</a>
+ </div>
+ <div style="text-align:center;margin:5px;">
+ <img src="./images/php_sqreuil_artistes.gif" alt="php logo" />
+ </div>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/admin/admin.vtp b/template/default/admin/admin.vtp
new file mode 100644
index 000000000..1516e6c48
--- /dev/null
+++ b/template/default/admin/admin.vtp
@@ -0,0 +1,163 @@
+<html>
+ <head>
+ <title>{#page_title}</title>
+ <style>
+ a {
+ text-decoration:none;
+ color:#006699;
+ }
+ a:hover {
+ text-decoration:underline;
+ }
+ body,table,input,form,select,textarea {
+ font-family:arial,verdana,sans-serif;
+ font-size:12px;
+ }
+ .miniature {
+ border:solid 1px black;
+ }
+ body {
+ background-color:#E5E5E5;
+ }
+ .titretable1 {
+ color:black;
+ background-color:#D3DCE3;
+ text-align:center;
+ border:2px solid #006699;
+ font-weight:bold;
+ border-bottom:0px;
+ }
+ .grostitre {
+ text-align:center;
+ margin:10px 50px 10px 50px;
+ font-size:20px;
+ width:300px;
+ }
+ .plan {
+ margin:10px 10px 10px 2px;
+ white-space:nowrap;
+ }
+ .table1 {
+ border-collapse:collapse;
+ background-color:#FFFFFF;
+ }
+ .contenucellule {
+ background-color:#EEEEEE;
+ border:2px solid #006699;
+ }
+ .style1 {
+ margin-top:20px;
+ }
+ th {
+ font-weight:bold;
+ background-color:#D3DCE3;
+ }
+ td.row1 {
+ background-color:#E6E4E4;
+ }
+ td.row2 {
+ background-color:#E8E8E8;
+ }
+ td.row3 {
+ background-color:#eeeeee;
+ }
+ td.row4 {
+ background-color:#cccccc;
+ }
+ .cat_plan {
+ font-weight:bold;
+ }
+ .retrait {
+ margin:10px;
+ margin-left:30px;
+ margin-top:2px;
+ }
+ input,textarea {
+ border-width:1;
+ border-color:#000000;
+ background:#ffffff;
+ color: #000000;
+ }
+ .erreur {
+ color:red;
+ text-align:center;
+ }
+ .errors {
+ text-align:left;
+ margin:25px;
+ background-color:red;
+ font-weight:bold;
+ border:1px solid black;
+ color:white;
+ }
+ .info {
+ color:darkblue;
+ text-align:center;
+ }
+ </style>
+ <script language="javascript">
+ function SelectAll( formulaire )
+ {
+ len = formulaire.elements.length;
+ var i=0;
+ for( i = 0; i < len; i++)
+ {
+ if ( formulaire.elements[i].type=='checkbox'
+ && formulaire.elements[i].name != 'copie')
+ {
+ formulaire.elements[i].checked = true;
+ }
+ }
+ }
+
+ function Inverser( formulaire )
+ {
+ len = formulaire.elements.length;
+ var i=0;
+ for( i=0; i<len; i++)
+ {
+ if ( formulaire.elements[i].type=='checkbox'
+ && formulaire.elements[i].name != 'copie')
+ {
+ formulaire.elements[i].checked = !formulaire.elements[i].checked;
+ }
+ }
+ }
+ </script>
+ </head>
+ <body>
+ <table>
+ <tr>
+ <td width="1%" valign="top">
+ <table class="table1">
+ <tr>
+ <td class="titretable1">{#menu_title}</td>
+ </tr>
+ <tr>
+ <td class="contenucellule">
+ <div class="plan">
+ <!--VTP_summary-->
+ {#indent}<img src="./images/puce.gif"><a href="{#link}" class="cat_plan">{#name}</a><br />
+ <!--/VTP_summary-->
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td align="center" valign="top">
+ <div class="grostitre">{#title}</div>
+ <br />
+ <center>
+ <table width="95%" class="table1">
+ <tr>
+ <td class="contenucellule">
+ {#sub}
+ </td>
+ </tr>
+ </table>
+ </center>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/admin/cat.vtp b/template/default/admin/cat.vtp
new file mode 100644
index 000000000..4c0aca7e9
--- /dev/null
+++ b/template/default/admin/cat.vtp
@@ -0,0 +1,58 @@
+<table style="width:100%;">
+<!--VTP_cat-->
+<tr>
+ <{#td} style="width:40%;text-align:left;">
+ {#indent}<img src="./images/puce.gif" alt="&gt;" />
+ &nbsp;{#name} [ dir : {#dir} ]
+ <span style="color:red;font-weight:normal;"> {#invisible}</span>
+ </{#td}>
+ <{#td} style="text-align:center;">
+ <div style="margin-left:3px;margin-right:3px;">{#nb_picture}</div>
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <a href="{#edit_url}">{#cat_edit}</a>
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <!--VTP_up-->
+ <a href="{#up_url}">{#cat_up}</a>
+ <!--/VTP_up-->
+ <!--VTP_no_up-->
+ <span style="color:darkgray;">{#cat_up}</span>
+ <!--/VTP_no_up-->
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <!--VTP_down-->
+ <a href="{#down_url}">{#cat_down}</a>
+ <!--/VTP_down-->
+ <!--VTP_no_down-->
+ <span style="color:darkgray;">{#cat_down}</span>
+ <!--/VTP_no_down-->
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <!--VTP_image_info-->
+ <a href="{#image_info_url}">{#cat_image_info}</a>
+ <!--/VTP_image_info-->
+ <!--VTP_no_image_info-->
+ <span style="color:darkgray;">{#cat_image_info}</span>
+ <!--/VTP_no_image_info-->
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <a href="{#permission_url}">{#cat_permission}</a>
+ </{#td}>
+ <{#td} class="{#class}"
+ style="width:10%;white-space:nowrap;text-align:center;">
+ <!--VTP_update-->
+ <a href="{#update_url}">{#cat_update}</a>
+ <!--/VTP_update-->
+ <!--VTP_no_update-->
+ <span style="color:darkgray;">{#cat_update}</span>
+ <!--/VTP_no_update-->
+ </{#td}>
+<tr>
+<!--/VTP_cat-->
+</table> \ No newline at end of file
diff --git a/template/default/admin/configuration.vtp b/template/default/admin/configuration.vtp
new file mode 100644
index 000000000..a44c7d5be
--- /dev/null
+++ b/template/default/admin/configuration.vtp
@@ -0,0 +1,87 @@
+<!--VTP_errors-->
+<div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+</div>
+<!--/VTP_errors-->
+<!--VTP_confirmation-->
+ <div class="info">{#conf_confirmation}</div>
+<!--/VTP_confirmation-->
+<form method="post" action="{#form_action}">
+ <table width="100%">
+ <!--VTP_line-->
+ <!--VTP_param_line-->
+ <tr>
+ <td>{#name}</td>
+ <td align="center">
+ <!--VTP_select-->
+ <select name="{#name}">
+ <!--VTP_option-->
+ <option{#selected}>{#option}</option>
+ <!--/VTP_option-->
+ </select>
+ <!--/VTP_select-->
+ <!--VTP_hidden-->
+ {#text}<input type="hidden" name="{#name}" value="{#value}" />
+ <!--/VTP_hidden-->
+ <!--VTP_text-->
+ <input type="text" name="{#name}" value="{#value}" />
+ <!--/VTP_text-->
+ <!--VTP_group-->
+ <!--VTP_radio-->
+ <input type="radio" name="{#name}" value="{#value}"{#checked}/>{#option}
+ <!--/VTP_radio-->
+ <!--/VTP_group-->
+ <!--VTP_check-->
+ <!--VTP_box-->
+ <input type="checkbox" name="{#name}" value="{#value}"{#checked}/>{#option}
+ <!--/VTP_box-->
+ <!--/VTP_check-->
+ </td>
+ <td width="50%" class="row2">{#def}</td>
+ </tr>
+ <!--/VTP_param_line-->
+ <!--VTP_title_line-->
+ <tr>
+ <th colspan="3" align="center">{#title}</th>
+ </tr>
+ <!--/VTP_title_line-->
+ <!--VTP_space_line-->
+ <tr>
+ <td colspan="3"><div style="margin-bottom:0px">&nbsp;</div></td>
+ </tr>
+ <!--/VTP_space_line-->
+ <!--/VTP_line-->
+ <!--VTP_remote_sites-->
+ <tr>
+ <th colspan="3" align="center">{#conf_remote_site_title}</th>
+ </tr>
+ <tr>
+ <td colspan=3><div style='margin-bottom:0px'>&nbsp;</div></td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td align="center">{#delete}</td>
+ <td>&nbsp;</td>
+ </tr>
+ <!--VTP_site-->
+ <tr>
+ <td>{#url}</td>
+ <td align="center"><input type="checkbox" name="delete_site_{#id}" value="1" /></td>
+ <!--VTP_rowspan--><td class="row2" rowspan="{#nb_sites}">{#conf_remote_site_delete_info}</td><!--/VTP_rowspan-->
+ </tr>
+ <!--/VTP_site-->
+ <tr>
+ <td colspan=3><div style='margin-bottom:0px'>&nbsp;</div></td>
+ </tr>
+ <!--/VTP_remote_sites-->
+ <tr>
+ <td colspan="3" align="center">
+ <input type="submit" value="{#submit}">
+ </td>
+ </tr>
+ </table>
+</form> \ No newline at end of file
diff --git a/template/default/admin/user_list.vtp b/template/default/admin/user_list.vtp
new file mode 100644
index 000000000..a1032aa36
--- /dev/null
+++ b/template/default/admin/user_list.vtp
@@ -0,0 +1,77 @@
+<!--VTP_deletion-->
+<table style="width:100%;">
+ <tr>
+ <th colspan="2">{#listuser_confirm} "{#login}" ?</th>
+ </tr>
+ <tr>
+ <td align="center"><a href="{#yes_url}">{#yes}</a></td>
+ <td align="center" class="row2"><a href="{#no_url}">{#no}</a></td>
+ </tr>
+</table>
+<!--/VTP_deletion-->
+<!--VTP_confirmation-->
+<div class="{#class}">{#info}</div>
+<!--/VTP_confirmation-->
+<!--VTP_users-->
+<form method="post" action="{#form_action}" name="{#form_name}">
+<table width="100%">
+ <!--VTP_category-->
+ <tr>
+ <th colspan="5">{#title}</th>
+ </tr>
+ <!--VTP_user-->
+ <tr>
+ <td style="width:0px;">
+ <div style="margin-left:2px;margin-right:2px;">
+ <!--VTP_checkbox-->
+ <input type="checkbox" name="{#name}" value="1" />
+ <!--/VTP_checkbox-->
+ </div>
+ </td>
+ <td style="width:25%;">
+ <div style="margin-left:10px;color:{#color}">{#login}</div>
+ </td>
+ <td class="row2" style="text-align:center;width:25%;">
+ <!--VTP_modify-->
+ <a href="{#url}" title="{#listuser_modify_hint} {#login}">{#listuser_modify}</a>
+ <!--/VTP_modify-->
+ <!--VTP_not_modify-->
+ <span style="color:darkgray;">{#listuser_modify}</span>
+ <!--/VTP_not_modify-->
+ </td>
+ <td class="row2" style="text-align:center;width:25%;">
+ <!--VTP_permission-->
+ <a href="{#url}" title="{#listuser_permission_hint} {#login}">{#listuser_permission}</a>
+ <!--/VTP_permission-->
+ <!--VTP_not_permission-->
+ <span style="color:darkgray;">{#listuser_permission}</span>
+ <!--/VTP_not_permission-->
+ </td>
+ <td class="row2" style="text-align:center;width:25%;">
+ <!--VTP_delete-->
+ <a href="{#url}" title="{#listuser_delete_hint} {#login}">{#listuser_delete}</a>
+ <!--/VTP_delete-->
+ <!--VTP_not_delete-->
+ <span style="color:darkgray;">{#listuser_delete}</span>
+ <!--/VTP_not_delete-->
+ </td>
+ </tr>
+ <!--/VTP_user-->
+ <!--/VTP_category-->
+ <tr>
+ <td colspan="5">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="5">
+ <img src="./images/arrow_up.gif" alt="&lt;" />
+ <input type="button" value="{#listuser_button_all}" onClick="SelectAll(this.form)" style="margin-left:5px;margin-right:5px;" />
+ <input type="button" value="{#listuser_button_invert}" onClick="Inverser(this.form)" style="margin-left:5px;margin-right:5px;" />
+ <input type="submit" value="{#listuser_button_create_address}" style="margin-left:5px;margin-right:5px;" />
+ <!--VTP_mail_link-->
+ <a href="mailto:{#mailto}">mailto:{#mail_address_start}...</a>
+ <!--/VTP_mail_link-->
+ </td>
+ </tr>
+</table>
+</form>
+<!--/VTP_users--> \ No newline at end of file
diff --git a/template/default/category.vtp b/template/default/category.vtp
new file mode 100644
index 000000000..2cf06e234
--- /dev/null
+++ b/template/default/category.vtp
@@ -0,0 +1,111 @@
+<html>
+ <head>
+ {#style}
+ <title>{#title}</title>
+ </head>
+ <body>
+ {#header}
+ <table style="width:100%;">
+ <tr>
+ <td valign="top" style="width:1%;padding:10px;">
+ {#frame_start}100%{#frame_begin}
+ <div class="titreMenu">{#categories}</div>
+ <div class="menu">
+ <!--VTP_category-->{#indent}<!--VTP_bullet_w_link--><a href="{#bullet_link}"><img src="{#bullet_url}" style="border:none;" alt="{#bullet_alt}" /></a><!--/VTP_bullet_w_link--><!--VTP_bullet_wo_link--><img src="{#bullet_url}" style="border:none;" alt="{#bullet_alt}" /><!--/VTP_bullet_wo_link-->&nbsp;<a href="{#link_url}"><span title="{#hint_category}" style="{#name_style}">{#link_name}</span>&nbsp;<span class="menuInfoCat">[&nbsp;<!--VTP_subcat--><span title="{#nb_subcats} {#sub-cat}">{#nb_subcats}</span>&nbsp;-&nbsp;<!--/VTP_subcat--><span title="{#total_cat} {#images_available}">{#total_cat}</span>&nbsp;]</span></a>{#cat_icon}<br />
+ <!--/VTP_category-->
+ <div class="totalImages">[&nbsp;{#nb_total_pictures}&nbsp;{#total}&nbsp;]</div>
+ <!--VTP_favorites-->
+ <br />&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#url}"><span title="{#favorite_cat_hint}" style="font-weight:bold;">{#favorite_cat}</span></a>&nbsp;<span class="menuInfoCat">[&nbsp;{#nb_favorites}&nbsp;]</span>
+ <!--/VTP_favorites-->
+ <br />&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<span style="font-weight:bold;">{#stats}</span></a>
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#most_visited_url}"><span title="{#most_visited_cat_hint}" style="font-weight:bold;">{#top_number}&nbsp;{#most_visited_cat}</span></a>
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="{#lien_collapsed}" al="&gt;" />&nbsp;<a href="{#recent_url}"><span title="{#recent_cat_hint}" style="font-weight:bold;">{#recent_cat}</span></a> {#icon_short}
+ </div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ {#frame_start}100%{#frame_begin}
+ <div class="titreMenu">{#title_menu}</div>
+ <div class="menu">
+ <!--VTP_summary-->
+ &nbsp;<img src="{#lien_collapsed}" alt="&gt;"/>&nbsp;<a href="{#url}" title="{#title}">{#name}</a><br />
+ <!--/VTP_summary-->
+ </div>
+ {#frame_end}
+ </td>
+ <td style="padding:5px;width:99%;" valign="top">
+ <table style="width:100%;">
+ <tr>
+ <td align="center">
+ {#frame_start}1%{#frame_begin}
+ <div class="titrePage">{#cat_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ <!--VTP_thumbnails-->
+ <table class="thumbnail">
+ <!--VTP_line-->
+ <tr>
+ <!--VTP_thumbnail-->
+ <td valign="bottom" class="thumbnail">
+ <a href="{#url}" class="back">
+ <img src="{#src}"
+ alt="{#alt}"
+ title="{#title}"
+ class="imgLink"/><br />
+ {#name}
+ </a>
+ {#icon}
+ <!--VTP_nb_comments-->
+ <br />{#nb} comments
+ <!--/VTP_nb_comments-->
+ </td>
+ <!--/VTP_thumbnail-->
+ </tr>
+ <!--/VTP_line-->
+ </table>
+ <!--/VTP_thumbnails-->
+ </td>
+ </tr>
+ <tr>
+ <td align="left">
+ <!--VTP_cat_infos-->
+ <!--VTP_navigation-->
+ <div class="navigationBar">{#navigation_bar}</div>
+ <!--/VTP_navigation-->
+ <!--VTP_comment-->
+ <div class="comments">{#cat_comment}</div>
+ <!--/VTP_comment-->
+ <div class="infoCat">
+ {#nb_image_category} "{#cat_name}" : {#cat_nb_images}
+ <!--VTP_upload-->
+ <br /><a href="{#url}" class="back">{#upload_name}</a>
+ <!--/VTP_upload-->
+ </div>
+ <!--/VTP_cat_infos-->
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ {#frame_start}1%{#frame_begin}
+ <div class="info">
+ {#connected_user}&nbsp;{#pseudo}<br />
+ {#recent_image}&nbsp;{#short_period}&nbsp;{#days}
+ {#icon_short}<br />
+ {#recent_image}&nbsp;{#long_period}&nbsp;{#days}
+ {#icon_long}<br />
+ {#send_mail}&nbsp;<a href="mailto:{#mail_webmaster}?subject={#title_send_mail}"><span style="font-weight:bold;">{#webmaster}</span></a>
+ </div>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <div class="copyright">{#generation_time} {#time}</div>
+ <!-- Please, do not remove this copyright. If you really want to,
+ contact me pierrick@z0rglub.com to find a solution on how
+ to show the origin of the script...-->
+ <div class="copyright">Powered by <a href="{#site_url}" class="back">PhpWebGallery</a> {#version}</div>
+ {#footer}
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/footer.htm b/template/default/footer.htm
new file mode 100644
index 000000000..a56ca5332
--- /dev/null
+++ b/template/default/footer.htm
@@ -0,0 +1 @@
+footer \ No newline at end of file
diff --git a/template/default/header.htm b/template/default/header.htm
new file mode 100644
index 000000000..6a6dd105c
--- /dev/null
+++ b/template/default/header.htm
@@ -0,0 +1 @@
+header \ No newline at end of file
diff --git a/template/default/htmlfunctions.inc.php b/template/default/htmlfunctions.inc.php
new file mode 100644
index 000000000..d7464610c
--- /dev/null
+++ b/template/default/htmlfunctions.inc.php
@@ -0,0 +1,187 @@
+<?php
+/***************************************************************************
+ * htmlfunctions.inc.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Wednesday, 25 December 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************
+
+ ***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+function get_icon( $date_comparaison )
+{
+ global $user, $conf;
+ $difference = time() - $date_comparaison;
+ $jours = 24*60*60;
+ $output = '';
+ if ( $difference < $user['long_period'] * $jours )
+ {
+ $icon_url = './theme/'.$user['theme'].'/';
+ if ( $difference < $user['short_period'] * $jours )
+ {
+ $icon_url.= 'new_short.gif';
+ }
+ else
+ {
+ $icon_url.= 'new_long.gif';
+ }
+ $size = getimagesize( $icon_url );
+ $output = '<img src="'.$icon_url.'" style="border:0;';
+ $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
+ }
+ return $output;
+}
+/*
+function affiche_icone_recent( $date_comparaison )
+{
+ global $user, $conf;
+ $difference = time() - $date_comparaison;
+ $jours = 24*60*60;
+ $output = '';
+ if ( $difference < $conf['periode_longue'] * $jours )
+ {
+ $icon_url = './theme/'.$user['theme'].'/';
+ if ( $difference < $conf['periode_courte'] * $jours )
+ {
+ $icon_url.= 'new_long.gif';
+ }
+ else
+ {
+ $icon_url.= 'new_short.gif';
+ }
+ $size = getimagesize( $icon_url );
+ $output = '<img src="'.$icon_url.'" style="border:0;height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
+ }
+ return $output;
+}
+*/
+
+function create_navigation_bar( $url, $nb_element, $start,
+ $nb_element_page, $link_class )
+{
+ global $lang;
+ $navigation_bar = "";
+ // 0. détection de la page en cours
+ if( !isset( $start )
+ || !is_numeric( $start )
+ || ( is_numeric( $start ) && $start < 0 ) )
+ {
+ $start = 0;
+ }
+ // on n'affiche la bare de navigation que si on plus de 1 page
+ if ( $nb_element > $nb_element_page )
+ {
+ // 1.une page précédente ?
+ if ( $start != 0 )
+ {
+ $previous = $start - $nb_element_page;
+ $navigation_bar.= '<a href="';
+ $navigation_bar.= add_session_id( $url.'&amp;start='.$previous );
+ $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page'];
+ $navigation_bar.= '</a>';
+ $navigation_bar.= ' | ';
+ }
+ // 2.liste des numéros de page
+ $maximum = ceil ( $nb_element / $nb_element_page );
+ for ( $i = 1; $i <= $maximum; $i++ )
+ {
+ $temp_start = ( $i - 1 ) * $nb_element_page;
+ if ( $temp_start == $start )
+ {
+ $navigation_bar.= ' <span style="font-weight:bold;">'.$i.'</span> ';
+ }
+ else
+ {
+ $navigation_bar.= ' <a href="';
+ $navigation_bar.= add_session_id( $url.'&amp;start='.$temp_start );
+ $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> ';
+ }
+ }
+ // 3.une page suivante ?
+ if ( $nb_element > $nb_element_page
+ && $start + $nb_element_page < $nb_element )
+ {
+ $next = $start + $nb_element_page;
+ $navigation_bar.= ' | <a href="';
+ $navigation_bar.= add_session_id( $url.'&amp;start='.$next );
+ $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
+ }
+ }
+ return $navigation_bar;
+}
+
+function get_frame_start()
+{
+ return '<table style="width:';
+}
+/*
+function get_frame_begin()
+{
+ return ';">
+ <tr>
+ <td style="border:2px solid lightgreen;width:100%;padding:5px;background-color:black;">';
+}
+
+function get_frame_end()
+{
+ return '
+ </td>
+ </tr>
+ </table>';
+}
+*/
+function get_frame_begin()
+{
+ global $user;
+ $path = './theme/'.$user['theme'].'/';
+ $size_01 = getimagesize( $path.'01.gif' );
+ $size_02 = getimagesize( $path.'02.gif' );
+ $size_03 = getimagesize( $path.'03.gif' );
+ return ';">
+ <tr>
+ <td><img src="'.$path.'01.gif" style="width:'.$size_01[0].'px;display:box;" alt="" /></td>
+ <td><img src="'.$path.'02.gif" style="display:box;width:100%;height:'.$size_02[1].'px;" alt="" /></td>
+ <td><img src="'.$path.'03.gif" style="display:box;width:'.$size_03[0].'px;" alt="" /></td>
+ </tr>
+ <tr>
+ <td style="background:url('.$path.'04.gif);"></td>
+ <td style="background:url('.$path.'05.gif);width:100%;">';
+}
+
+function get_frame_end()
+{
+ global $user;
+ $path = './theme/'.$user['theme'].'/';
+ $size_08 = getimagesize( $path.'08.gif' );
+ return '
+ </td>
+ <td style="background:url('.$path.'06.gif);"></td>
+ </tr>
+ <tr>
+ <td><img src="'.$path.'07.gif" alt="" /></td>
+ <td><img src="'.$path.'08.gif" style="width:100%;height:'.$size_08[1].'px;" alt="" /></td>
+ <td><img src="'.$path.'09.gif" alt="" /></td>
+ </tr>
+ </table>';
+}
+
+function initialize_template()
+{
+ global $vtp, $handle, $user;
+
+ $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+ $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+ $vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+ $vtp->setVarF( $handle, 'header',
+ './template/'.$user['template'].'/header.htm' );
+ $vtp->setVarF( $handle, 'footer',
+ './template/'.$user['template'].'/footer.htm' );
+}
+?> \ No newline at end of file
diff --git a/template/default/identification.vtp b/template/default/identification.vtp
new file mode 100644
index 000000000..eb03977c1
--- /dev/null
+++ b/template/default/identification.vtp
@@ -0,0 +1,75 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#ident_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#ident_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ {#frame_start}50%{#frame_begin}
+ <div style="margin-left:auto;margin-right:auto;text-align:center;">
+ <form method="post" action="./identification.php">
+ <table style="width:80%;margin-left:auto;margin-right:auto;">
+ <!--VTP_errors-->
+ <tr>
+ <td colspan="3">
+ <div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <!--/VTP_errors-->
+ <tr>
+ <td class="menu" align="center">{#login}</td>
+ <td class="menu" align="center">{#password}</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="center">
+ <!--VTP_select_field-->
+ <select name="login">
+ <!--VTP_option-->
+ <option>{#option}</option>
+ <!--/VTP_option-->
+ </select>
+ <!--/VTP_select_field-->
+ <!--VTP_text_field-->
+ <input type="text" name="login" value="" />
+ <!--/VTP_text_field-->
+ </td>
+ <td align="center"><input type="password" name="pass"/></td>
+ <td align="center"><input type="submit" name="submit" value="{#submit}" class="bouton"/></td>
+ </tr>
+ </table>
+ </form>
+ <table style="width:80%;margin-left:auto;margin-right:auto;">
+ <tr>
+ <td colspan="3" align="center">
+ <!--VTP_guest_visit-->
+ <a href="./category.php">[ {#ident_guest_visit} ]</a>
+ <!--/VTP_guest_visit-->
+ <div style="margin-top:10px;text-align:left;">
+ <!--VTP_register-->
+ <a href="register.php"><img src="./theme/{#user_theme}/register.gif" style="border:0;" alt="{#ident_register}"/>&nbsp;{#ident_register}</a><br />
+ <!--/VTP_register-->
+ <a href="mailto:{#mail_webmaster}?subject=[PhpWebGallery] {#ident_forgotten_password}"><img src="./theme/{#user_theme}/lost.gif" style="border:0;" alt=""/>&nbsp;{#ident_forgotten_password}</a>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/picture.vtp b/template/default/picture.vtp
new file mode 100644
index 000000000..2e20a4949
--- /dev/null
+++ b/template/default/picture.vtp
@@ -0,0 +1,166 @@
+<html>
+ <head>
+ {#page_style}
+ <!-- Specific style to picture.php-->
+ <style type="text/css">
+ .commentsAuthor,.commentsTitle,.commentsInfos,.commentsContent,.commentsNavigationBar {
+ color:{#text_color};
+ font-family:arial,sans-Serif;
+ font-size:12px;
+ }
+ .commentsTitle,.commentsAuthor {
+ text-align:center;
+ font-weight:bold;
+ }
+ .commentsInfos {
+ margin:3px 3px 3px 10px;
+ font-size:11px;
+ }
+ .commentsContent {
+ margin:10px;
+ }
+ .commentsTitle {
+ margin-top:15px;
+ }
+ .commentsAuthor {
+ margin:5px;
+ }
+ .commentsNavigationBar {
+ margin:10px;
+ }
+ .tableComment {
+ width:90%;
+ border:2px solid {#text_color};
+ margin:10px;
+ }
+ .cellAuthor {
+ border-right:1px solid {#text_color};
+ width:100px;
+ }
+ .cellInfo {
+ border-bottom:1px solid {#text_color};
+ }
+ </style>
+ <title>{#page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%;">
+ <tr align="center" valign="middle">
+ <td>
+ <!--VTP_previous-->
+ <a href="{#url}" title="{#title}">
+ <img src="{#src}" class="imgLink" style="margin-right:10px;margin-left:5px;" alt="{#alt}"/>
+ </a>
+ <!--/VTP_previous-->
+ <!--VTP_previous_empty-->
+ &nbsp;
+ <!--/VTP_previous_empty-->
+ </td>
+ <td style="width:100%;">
+ {#frame_start}1%{#frame_begin}
+ <div class="titrePage">{#title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px">&nbsp;</div>
+ {#frame_start}1%{#frame_begin}
+ <a href="{#picture_link}">
+ <img style="margin:10px;width:{#picture_width}px;height:{#picture_height}px;border:1px solid {#picture_border_color}" src="{#picture_src}" alt="{#picture_alt}"/>
+ </a>
+ <div class="commentImage">{#picture_comment}</div>
+ <table style="width:100%;">
+ <tr>
+ <td align="center">
+ <table style="margin:auto;margin-top:5px;margin-bottom:5px;">
+ <!--VTP_info_line-->
+ <tr>
+ <td class="menu" style="font-weight:bold;">{#name}</td>
+ <td class="menu" style="text-align:right;">{#content}</td>
+ </tr>
+ <!--/VTP_info_line-->
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!--VTP_favorite-->
+ <div class="menu" style="text-align:center;margin:5px;">
+ <a href="{#link}" title="{#title}">
+ <img src="{#src}" style="border:none;margin-left:5px;" alt="{#alt}"/>
+ </a>
+ </div>
+ <!--/VTP_favorite-->
+ <!--VTP_modification-->
+ <div class="menu" style="text-align:center;margin:5px;">
+ [ <a href="{#link}">{#name}</a> ]
+ </div>
+ <!--/VTP_modification-->
+ {#frame_end}
+ <div style="text-align:center;">{#back}</div>
+ </td>
+ <td>
+ <!--VTP_next-->
+ <a href="{#url}" title="{#title}">
+ <img src="{#src}" class="imgLink" style="margin-right:10px;margin-left:5px;" alt="{#alt}"/>
+ </a>
+ <!--/VTP_next-->
+ <!--VTP_next_empty-->
+ &nbsp;
+ <!--/VTP_next_empty-->
+ </td>
+ </tr>
+ <!--VTP_comments-->
+ <tr align="center" valign="middle">
+ <td colspan="3">
+ {#frame_start}90%{#frame_begin}
+ <table style="width:100%;">
+ <tr align="center">
+ <td>
+ <div class="commentsTitle">
+ [{#nb_comments}] {#comments_title}
+ </div>
+ <div class="commentsNavigationBar">{#navigation_bar}</div>
+ <!--VTP_comment-->
+ <table class="tableComment">
+ <tr>
+ <td rowspan="2" valign="top" class="cellAuthor">
+ <div class="commentsAuthor">{#author}</div>
+ </td>
+ <td align="right" class="cellInfo">
+ <div class="commentsInfos">
+ {#date}<!--VTP_delete--><a href="{#link}" title="{#comments_del}"><img src="./theme/{#user_theme}/delete.gif" style="border:none;margin-left:5px;" alt="[{#delete}]"/></a><!--/VTP_delete-->
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div class="commentsContent">{#content}</div>
+ </td>
+ </tr>
+ </table>
+ <!--/VTP_comment-->
+ <div class="commentsNavigationBar">{#navigation_bar}</div>
+ </td>
+ </tr>
+ </table>
+ <form method="post" action="{#form_action}">
+ <table style="width:100%;">
+ <tr align="center">
+ <td>
+ <div class="commentsTitle">{#comments_add}</div>
+ <!--VTP_author_field-->
+ <div class="menu">{#author} : <input type="text" name="author" style="margin-top:5px;"/></div>
+ <!--/VTP_author_field-->
+ <!--VTP_author_known-->
+ <input type="hidden" name="author" value="{#value}" />
+ <!--/VTP_author_known-->
+ <textarea name="content" rows="10" cols="50" style="overflow:auto;width:450px;margin:10px;"></textarea><br />
+ <input type="submit" value="{#submit}" style="margin:10px;"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ {#frame_end}
+ </td>
+ </tr>
+ <!--/VTP_comments-->
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/profile.vtp b/template/default/profile.vtp
new file mode 100644
index 000000000..ed6a8998a
--- /dev/null
+++ b/template/default/profile.vtp
@@ -0,0 +1,84 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#customize_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#customize_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:20px"></div>
+ {#frame_start}50%{#frame_begin}
+ <form method="post" action="{#form_action}">
+ <table style="width:100%;margin-top:10px;margin-bottom:10px;">
+ <tr align="center" valign="middle">
+ <td>
+ <table width="80%">
+ <!--VTP_errors-->
+ <tr>
+ <td colspan="2">
+ <div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <!--/VTP_errors-->
+ <!--VTP_line-->
+ <tr>
+ <td class="menu">{#name}</td>
+ <td class="menu">
+ <!--VTP_select-->
+ <select name="{#name}">
+ <!--VTP_option-->
+ <option{#selected}>{#option}</option>
+ <!--/VTP_option-->
+ </select>
+ <!--/VTP_select-->
+ <!--VTP_text-->
+ <input type="text" name="{#name}" value="{#value}" />
+ <!--/VTP_text-->
+ <!--VTP_group-->
+ <!--VTP_radio-->
+ <input type="radio" name="{#name}" value="{#value}"{#checked}/>{#option}
+ <!--/VTP_radio-->
+ <!--/VTP_group-->
+ </td>
+ </tr>
+ <!--/VTP_line-->
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="menu">{#new} {#password}<input type="checkbox" name="use_new_pwd" value="1" /></td>
+ <td class="menu"><input type="password" name="password" value="" /></td>
+ </tr>
+ <tr>
+ <td class="menu">{#reg_confirm}</td>
+ <td class="menu"><input type="password" name="passwordConf" value="" /></td>
+ </tr>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" name="submit" value="{#submit}" style="margin:5px;"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </form>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/register.vtp b/template/default/register.vtp
new file mode 100644
index 000000000..c687c4deb
--- /dev/null
+++ b/template/default/register.vtp
@@ -0,0 +1,71 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#register_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#register_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:20px"></div>
+ {#frame_start}50%{#frame_begin}
+ <form method="post" action="{#form_action}">
+ <table style="width:80%;margin-top:10px;margin-bottom:10px;margin-left:auto;margin-right:auto;">
+ <!--VTP_errors-->
+ <tr>
+ <td colspan="2">
+ <div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <!--/VTP_errors-->
+ <!--VTP_line-->
+ <tr>
+ <td class="menu">{#name}</td>
+ <td class="menu">
+ <!--VTP_select-->
+ <select name="{#name}">
+ <!--VTP_option-->
+ <option{#selected}>{#option}</option>
+ <!--/VTP_option-->
+ </select>
+ <!--/VTP_select-->
+ <!--VTP_text-->
+ <input type="text" name="{#name}" value="{#value}" />
+ <!--/VTP_text-->
+ <!--VTP_password-->
+ <input type="password" name="{#name}" value="{#value}" />
+ <!--/VTP_password-->
+ </td>
+ </tr>
+ <!--/VTP_line-->
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" name="submit" value="{#submit}" style="margin:5px;"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <a href="./category.php">[ {#ident_guest_visit} ]</a>
+ </td>
+ </tr>
+ </table>
+ </form>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/search.vtp b/template/default/search.vtp
new file mode 100644
index 000000000..3b79b6637
--- /dev/null
+++ b/template/default/search.vtp
@@ -0,0 +1,71 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#search_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#search_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ {#frame_start}50%{#frame_begin}
+ <div style="margin-left:auto;margin-right:auto;text-align:center;">
+ <form method="post" action="{#form_action}">
+ <table style="width:80%;margin-left:auto;margin-right:auto;">
+ <!--VTP_errors-->
+ <tr>
+ <td colspan="2">
+ <div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <!--/VTP_errors-->
+ <tr>
+ <td colspan="2">
+ <div style="margin-bottom:10px;">&nbsp;</div>
+ </td>
+ </tr>
+ <!--VTP_line-->
+ <tr>
+ <td class="menu">{#name}</td>
+ <td class="menu">
+ <!--VTP_select-->
+ <select name="{#name}">
+ <!--VTP_option-->
+ <option{#selected}>{#option}</option>
+ <!--/VTP_option-->
+ </select>
+ <!--/VTP_select-->
+ <!--VTP_text-->
+ <input type="text" name="{#name}" size="{#size}" value="{#value}" />
+ <!--/VTP_text-->
+ </td>
+ </tr>
+ <!--/VTP_line-->
+ <tr>
+ <td align="center" colspan="2">
+ <input type="submit" name="submit" value="{#submit}" class="bouton" style="margin:10px;" />
+ </td>
+ </tr>
+ <tr>
+ <td align="center" colspan="2">
+ <a href="{#back_url}">[ {#search_return_main_page} ]</a>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/template/default/style.inc.php b/template/default/style.inc.php
new file mode 100644
index 000000000..c364367be
--- /dev/null
+++ b/template/default/style.inc.php
@@ -0,0 +1,140 @@
+<?php
+/***************************************************************************
+ * style.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Friday, November 1, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+$user['style'] = '<style type="text/css">
+ a {
+ text-decoration:none;
+ }
+ a:hover {
+ text-decoration:underline;
+ }
+ a.back, body {
+ color:'.$user['couleur_text_fond'].';
+ }
+ body,table,input {
+ font-family:arial,sans-serif;
+ font-size:12px;
+ }
+ .imgLink {
+ border:1px solid '.$user['couleur_text_fond'].';
+ }
+ .titrePage,.titreMenu,.menu,.info, a {
+ color:'.$user['couleur_text'].';
+ }
+ .titreMenu,.menu,.info {
+ margin-bottom:5px;
+ white-space:nowrap;
+ }
+ .menu,.titrePage,.info {
+ margin-left:2px;
+ margin-right:2px;
+ }
+ .menuInfoCat {
+ font-family:sans-serif;
+ font-size:11px;
+ }
+ .totalImages {
+ text-align:center;
+ margin-top:5px;
+ font-family:sans-serif;
+ font-size:11px;
+ }
+ .titreMenu {
+ font-weight:600;
+ text-align:center;
+ }
+ .info {
+ text-align:right;
+ }
+ .titrePage {
+ white-space:nowrap;
+ font-weight:500;
+ font-size:18px;
+ text-align:center;
+ }
+ .comments,.infoCat,.navigationBar {
+ margin-top:10px;
+ margin-bottom:10px;
+ }
+ .comments {
+ text-align:justify;
+ font-style:italic;
+ }
+ .navigationBar {
+ text-align:center;
+ }
+ .infoCat {
+ text-align:left;
+ }
+ .thumbnail {
+ font-size:11px;
+ text-align:center;
+ }
+ .copyright {
+ font-size:11px;
+ text-align:center;
+ font-family:sans-serif;
+ letter-spacing:0.3mm;
+ }
+ .commentImage {
+ font-weight:bold;
+ text-align:center;
+ font-size:17px;
+ }
+ .bouton {
+ background:#EEEEEE;
+ }
+ input {
+ border-width:1;
+ border-color:#000000;
+ background:#ffffff;
+ color: #000000;
+ }
+ body {';
+$image = './theme/'.$user['theme'].'/background.gif';
+if ( @is_file( $image ) )
+{
+ $user['style'].= '
+ background-image:url('.$image.');';
+}
+else
+{
+ $user['style'].= '
+ background-color:'.$user['couleur_fond'].';';
+}
+$user['style'].= '
+ margin:5px;
+ }
+ table {
+ border-collapse:collapse;
+ }
+ table.thumbnail {
+ border-collapse:separate;
+ }
+ td {
+ font-family:sans-serif;
+ padding:0;
+ }
+ .errors {
+ text-align:left;
+ margin-top:5px;
+ margin-bottom:5px;
+ background-color:red;
+ font-weight:bold;
+ border:1px solid black;
+ color:white;
+ }
+ </style>'; \ No newline at end of file
diff --git a/template/default/upload.vtp b/template/default/upload.vtp
new file mode 100644
index 000000000..4e4d4390c
--- /dev/null
+++ b/template/default/upload.vtp
@@ -0,0 +1,79 @@
+<html>
+ <head>
+ {#page_style}
+ <title>{#upload_page_title}</title>
+ </head>
+ <body>
+ <table style="width:100%;height:100%">
+ <tr align="center" valign="middle">
+ <td>
+ {#frame_start}1px{#frame_begin}
+ <div class="titrePage">{#upload_title}</div>
+ {#frame_end}
+ <div style="margin-bottom:5px;">&nbsp;</div>
+ {#frame_start}50%{#frame_begin}
+ <!--VTP_upload_not_successful-->
+ <form enctype="multipart/form-data" method="post" action="{#form_action}">
+ <table style="width:80%;margin-left:auto;margin-right:auto;">
+ <!--VTP_errors-->
+ <tr>
+ <td colspan="3">
+ <div class="errors">
+ <ul>
+ <!--VTP_li-->
+ <li>{#li}</li>
+ <!--/VTP_li-->
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <!--/VTP_errors-->
+ <tr>
+ <td colspan="2" class="menu">
+ <div style="text-align:center;">{#advise_title}</div>
+ <ul>
+ <!--VTP_advise-->
+ <li>{#content}</li>
+ <!--/VTP_advise-->
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center" style="padding:10px;">
+ <input name="picture" type="file" value="" />
+ </td>
+ </tr>
+ <!--VTP_fields-->
+ <tr>
+ <td class="menu">{#upload_username}</td>
+ <td align="center" style="padding:10px;">
+ <input name="username" type="text" value="{#user_login}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="menu">{#reg_mail_address}</td>
+ <td align="center" style="padding:10px;">
+ <input name="mail_address" type="text" value="{#user_mail_address}" />
+ </td>
+ </tr>
+ <!--/VTP_fields-->
+ <tr>
+ <td colspan="2" align="center">
+ <input name="submit" type="submit" value="{#submit}" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ <!--/VTP_upload_not_successful-->
+ <!--VTP_upload_successful-->
+ {#upload_successful}<br />
+ <!--/VTP_upload_successful-->
+ <div style="text-align:center;">
+ <a href="{#return_url}">[ {#search_return_main_page} ]</a>
+ </div>
+ {#frame_end}
+ </td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/upload.php b/upload.php
new file mode 100644
index 000000000..d352427db
--- /dev/null
+++ b/upload.php
@@ -0,0 +1,348 @@
+<?php
+/***************************************************************************
+ * upload.php is a part of PhpWebGallery *
+ * ------------------- *
+ * last update : Sunday, October 27, 2002 *
+ * email : pierrick@z0rglub.com *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+function get_extension( $filename )
+{
+ return substr ( strrchr( $filename, "." ), 1, strlen ( $filename ) );
+}
+// The validate_upload function checks if the image of the given path is valid.
+// A picture is valid when :
+// - width, height and filesize are not higher than the maximum
+// filesize authorized by the administrator
+// - the type of the picture is among jpg, gif and png
+// The function returns an array containing :
+// - $result['type'] contains the type of the image ('jpg', 'gif' or 'png')
+// - $result['error'] contains an array with the different errors
+// found with the picture
+function validate_upload( $temp_name, $my_max_file_size,
+ $image_max_width, $image_max_height )
+{
+ global $lang;
+
+ $result = array();
+ $result['error'] = array();
+ $i = 0;
+ //echo $_FILES['picture']['name']."<br />".$temp_name;
+ $extension = get_extension( $_FILES['picture']['name'] );
+ if ( $extension != 'gif' && $extension != 'jpg' && $extension != 'png' )
+ {
+ $result['error'][$i++] = $lang['upload_advise_filetype'];
+ return $result;
+ }
+ if ( !isset( $_FILES['picture'] ) )
+ {
+ // do we even have a file?
+ $result['error'][$i++] = "You did not upload anything!";
+ }
+ else if ( $_FILES['picture']['size'] > $my_max_file_size * 1024 )
+ {
+ $result['error'][$i++] = $lang['upload_advise_width'].$my_max_file_size." KB";
+ }
+ else
+ {
+ // check if we are allowed to upload this file_type
+ // upload de la photo sous un nom temporaire
+ if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) )
+ {
+ $result['error'][$i++] = $lang['upload_cannot_upload'];
+ }
+ else
+ {
+ $size = getimagesize( $temp_name );
+ if ( isset( $image_max_width )
+ && $image_max_width != ""
+ && $size[0] > $image_max_width )
+ {
+ $result['error'][$i++] = $lang['upload_advise_width'].$image_max_width." px";
+ }
+ if ( isset( $image_max_height )
+ && $image_max_height != ""
+ && $size[1] > $image_max_height )
+ {
+ $result['error'][$i++] = $lang['upload_advise_height'].$image_max_height." px";
+ }
+ // $size[2] == 1 means GIF
+ // $size[2] == 2 means JPG
+ // $size[2] == 3 means PNG
+ if ( $size[2] != 1 && $size[2] != 2 && $size[2] != 3 )
+ {
+ $result['error'][$i++] = $lang['upload_advise_filetype'];
+ }
+ else
+ {
+ switch ( $size[2] )
+ {
+ case 1 :
+ {
+ $result['type'] = 'gif';
+ break;
+ }
+ case 2 :
+ {
+ $result['type'] = 'jpg';
+ break;
+ }
+ case 3 :
+ {
+ $result['type'] = 'png';
+ break;
+ }
+ }
+ }
+ }
+ }
+ if ( sizeof( $result['error'] ) > 0 )
+ {
+ // destruction de l'image avec le nom temporaire
+ @unlink( $temp_name );
+ }
+ return $result;
+}
+//----------------------------------------------------------- personnal include
+include_once( './include/init.inc.php' );
+//-------------------------------------------------- access authorization check
+check_login_authorization();
+check_cat_id( $_GET['cat'] );
+if ( isset( $page['cat'] ) && is_numeric( $page['cat'] ) )
+{
+ check_restrictions( $page['cat'] );
+ $result = get_cat_info( $page['cat'] );
+ $page['cat_dir'] = $result['dir'];
+ $page['cat_site_id'] = $result['site_id'];
+ $page['cat_name'] = $result['name'];
+}
+else
+{
+ $access_forbidden = true;
+}
+if ( $access_forbidden == true
+ || $page['cat_site_id'] != 1
+ || $conf['upload_available'] == 'false' )
+{
+ echo"<div style=\"text-align:center;\">".$lang['upload_forbidden']."<br />";
+ echo "<a href=\"".add_session_id_to_url( "./diapo.php" )."\">".$lang['thumbnails']."</a></div>";
+ exit();
+}
+//----------------------------------------------------- template initialization
+$vtp = new VTemplate;
+$handle = $vtp->Open( './template/default/upload.vtp' );
+// language
+$vtp->setGlobalVar( $handle, 'upload_page_title',$lang['upload_title'] );
+$vtp->setGlobalVar( $handle, 'upload_title', $lang['upload_title'] );
+$vtp->setGlobalVar( $handle, 'upload_username', $lang['upload_username'] );
+$vtp->setGlobalVar( $handle, 'reg_mail_address', $lang['reg_mail_address'] );
+$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
+$vtp->setGlobalVar( $handle, 'upload_successful',$lang['upload_successful'] );
+$vtp->setGlobalVar( $handle, 'search_return_main_page',
+ $lang['search_return_main_page'] );
+// user
+$vtp->setGlobalVar( $handle, 'page_style', $user['style'] );
+$vtp->setGlobalVar( $handle, 'user_login', $user['pseudo'] );
+$vtp->setGlobalVar( $handle, 'user_mail_address',$user['mail_address'] );
+// structure
+$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
+$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
+$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
+
+$error = array();
+$i = 0;
+$page['upload_successful'] = false;
+if ( isset( $_GET['waiting_id'] ) )
+{
+ $page['waiting_id'] = $_GET['waiting_id'];
+}
+//-------------------------------------------------------------- picture upload
+// vérification de la présence et de la validité des champs.
+if ( isset( $_POST['submit'] ) && !isset( $_GET['waiting_id'] ) )
+{
+ $path = $page['cat_dir'].$_FILES['picture']['name'];
+ if ( @is_file( $path ) )
+ {
+ $error[$i++] = $lang['upload_file_exists'];
+ }
+ // test de la présence des champs obligatoires
+ if ( $_FILES['picture']['name'] == "" )
+ {
+ $error[$i++] = $lang['upload_filenotfound'];
+ }
+ if ( !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
+ $_POST['mail_address'] ) )
+ {
+ $error[$i++] = $lang['reg_err_mail_address'];
+ }
+ if ( $_POST['username'] == '' )
+ {
+ $error[$i++] = $lang['upload_err_username'];
+ }
+
+ if ( sizeof( $error ) == 0 )
+ {
+ $result = validate_upload( $path, $conf['upload_maxfilesize'],
+ $conf['upload_maxwidth'],
+ $conf['upload_maxheight'] );
+ $upload_type = $result['type'];
+ for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
+ {
+ $error[$i++] = $result['error'][$j];
+ }
+ }
+
+ if ( sizeof( $error ) == 0 )
+ {
+ $query = 'insert into '.$prefixeTable.'waiting';
+ $query.= ' (cat_id,file,username,mail_address,date) values';
+ $query.= " (".$page['cat'].",'".$_FILES['picture']['name']."'";
+ $query.= ",'".htmlspecialchars( $_POST['username'], ENT_QUOTES)."'";
+ $query.= ",'".$_POST['mail_address']."',".time().")";
+ $query.= ';';
+ mysql_query( $query );
+ $page['waiting_id'] = mysql_insert_id();
+ }
+}
+//------------------------------------------------------------ thumbnail upload
+if ( isset( $_POST['submit'] ) && isset( $_GET['waiting_id'] ) )
+{
+ // upload of the thumbnail
+ $query = 'select file';
+ $query.= ' from '.$prefixeTable.'waiting';
+ $query.= ' where id = '.$_GET['waiting_id'];
+ $query.= ';';
+ $result= mysql_query( $query );
+ $row = mysql_fetch_array( $result );
+ $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
+ $extension = get_extension( $_FILES['picture']['name'] );
+ $path = $page['cat_dir'].'thumbnail/';
+ $path.= $conf['prefixe_thumbnail'].$file.'.'.$extension;
+ $result = validate_upload( $path, $conf['upload_maxfilesize'],
+ $conf['upload_maxwidth_thumbnail'],
+ $conf['upload_maxheight_thumbnail'] );
+ $upload_type = $result['type'];
+ for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
+ {
+ $error[$i++] = $result['error'][$j];
+ }
+ if ( sizeof( $error ) == 0 )
+ {
+ $query = 'update '.$prefixeTable.'waiting';
+ $query.= " set tn_ext = '".$extension."'";
+ $query.= ' where id = '.$_GET['waiting_id'];
+ $query.= ';';
+ mysql_query( $query );
+ $page['upload_successful'] = true;
+ }
+}
+
+if ( !$page['upload_successful'] )
+{
+ $vtp->addSession( $handle, 'upload_not_successful' );
+//-------------------------------------------------------------- errors display
+ if ( sizeof( $error ) != 0 )
+ {
+ $vtp->addSession( $handle, 'errors' );
+ for ( $i = 0; $i < sizeof( $error ); $i++ )
+ {
+ $vtp->addSession( $handle, 'li' );
+ $vtp->setVar( $handle, 'li.li', $error[$i] );
+ $vtp->closeSession( $handle, 'li' );
+ }
+ $vtp->closeSession( $handle, 'errors' );
+ }
+//----------------------------------------------------------------- form action
+ $url = './upload.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
+ if ( isset( $page['waiting_id'] ) )
+ {
+ $url.= '&amp;waiting_id='.$page['waiting_id'];
+ }
+ $vtp->setGlobalVar( $handle, 'form_action', $url );
+//--------------------------------------------------------------------- advises
+ if ( $conf['upload_maxfilesize'] != '' )
+ {
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_filesize'];
+ $content.= $conf['upload_maxfilesize'].' KB';
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+ }
+ if ( isset( $page['waiting_id'] ) )
+ {
+ $advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
+ $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
+
+ if ( $conf['upload_maxwidth_thumbnail'] != '' )
+ {
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_width'];
+ $content.= $conf['upload_maxwidth_thumbnail'].' px';
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+ }
+ if ( $conf['upload_maxheight_thumbnail'] != '' )
+ {
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_height'];
+ $content.= $conf['upload_maxheight_thumbnail'].' px';
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+ }
+ }
+ else
+ {
+ $advise_title = $lang['upload_advise'];
+ $advise_title.= get_cat_display_name( $page['cat_name'], ' - ',
+ 'font-style:italic;' );
+ $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
+
+ if ( $conf['upload_maxwidth'] != '' )
+ {
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_width'];
+ $content.= $conf['upload_maxwidth'].' px';
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+ }
+ if ( $conf['upload_maxheight'] != '' )
+ {
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_height'];
+ $content.= $conf['upload_maxheight'].' px';
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+ }
+ }
+ $vtp->addSession( $handle, 'advise' );
+ $content = $lang['upload_advise_filetype'];
+ $vtp->setVar( $handle, 'advise.content', $content );
+ $vtp->closeSession( $handle, 'advise' );
+//----------------------------------------- optionnal username and mail address
+ if ( !isset( $page['waiting_id'] ) )
+ {
+ $vtp->addSession( $handle, 'fields' );
+ $vtp->closeSession( $handle, 'fields' );
+ }
+ $vtp->closeSession( $handle, 'upload_not_successful' );
+}
+else
+{
+ $vtp->addSession( $handle, 'upload_successful' );
+ $vtp->closeSession( $handle, 'upload_successful' );
+}
+//----------------------------------------------------- return to main page url
+$url = './category.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
+$vtp->setGlobalVar( $handle, 'return_url', add_session_id( $url ) );
+//----------------------------------------------------------- html code display
+$code = $vtp->Display( $handle, 0 );
+echo $code;
+?> \ No newline at end of file