From 867c2379ff66ce0f2c4f872a13027fd649aa076d Mon Sep 17 00:00:00 2001 From: z0rglub Date: Fri, 9 May 2003 12:42:42 +0000 Subject: [PATCH] Initial revision git-svn-id: http://piwigo.org/svn/trunk@2 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/admin.php | 222 ++++++ admin/ajout.php | 326 ++++++++ admin/cat.php | 282 +++++++ admin/configuration.php | 912 +++++++++++++++++++++++ admin/create_listing_file.php | 128 ++++ admin/edit_cat.php | 116 +++ admin/historique.php | 102 +++ admin/images/admin.png | Bin 0 -> 5844 bytes admin/images/arrow_up.gif | Bin 0 -> 88 bytes admin/images/index.htm | 8 + admin/images/moins.gif | Bin 0 -> 867 bytes admin/images/plus.gif | Bin 0 -> 870 bytes admin/images/puce.gif | Bin 0 -> 839 bytes admin/include/functions.php | 194 +++++ admin/include/index.htm | 8 + admin/include/isadmin.inc.php | 34 + admin/index.htm | 8 + admin/infos_images.php | 248 ++++++ admin/install.php | 599 +++++++++++++++ admin/manuel.php | 151 ++++ admin/miseajour.php | 531 +++++++++++++ admin/perm.php | 270 +++++++ admin/thumbnail.php | 568 ++++++++++++++ admin/user_add.php | 255 +++++++ admin/user_list.php | 244 ++++++ admin/waiting.php | 117 +++ category.php | 499 +++++++++++++ identification.php | 122 +++ include/config.inc.php | 94 +++ include/functions.inc.php | 286 +++++++ include/functions_category.inc.php | 481 ++++++++++++ include/functions_session.inc.php | 135 ++++ include/functions_user.inc.php | 302 ++++++++ include/index.php | 7 + include/init.inc.php | 38 + include/user.inc.php | 93 +++ include/vtemplate.class.php | 519 +++++++++++++ index.php | 20 + language/english.php | 492 ++++++++++++ language/francais.php | 556 ++++++++++++++ language/index.htm | 8 + picture.php | 589 +++++++++++++++ profile.php | 403 ++++++++++ register.php | 106 +++ search.php | 90 +++ template/default/about.vtp | 29 + template/default/admin/admin.vtp | 163 ++++ template/default/admin/cat.vtp | 58 ++ template/default/admin/configuration.vtp | 87 +++ template/default/admin/user_list.vtp | 77 ++ template/default/category.vtp | 111 +++ template/default/footer.htm | 1 + template/default/header.htm | 1 + template/default/htmlfunctions.inc.php | 187 +++++ template/default/identification.vtp | 75 ++ template/default/picture.vtp | 166 +++++ template/default/profile.vtp | 84 +++ template/default/register.vtp | 71 ++ template/default/search.vtp | 71 ++ template/default/style.inc.php | 140 ++++ template/default/upload.vtp | 79 ++ upload.php | 348 +++++++++ 62 files changed, 11911 insertions(+) create mode 100644 admin/admin.php create mode 100644 admin/ajout.php create mode 100644 admin/cat.php create mode 100644 admin/configuration.php create mode 100644 admin/create_listing_file.php create mode 100644 admin/edit_cat.php create mode 100644 admin/historique.php create mode 100644 admin/images/admin.png create mode 100644 admin/images/arrow_up.gif create mode 100644 admin/images/index.htm create mode 100644 admin/images/moins.gif create mode 100644 admin/images/plus.gif create mode 100644 admin/images/puce.gif create mode 100644 admin/include/functions.php create mode 100644 admin/include/index.htm create mode 100644 admin/include/isadmin.inc.php create mode 100644 admin/index.htm create mode 100644 admin/infos_images.php create mode 100644 admin/install.php create mode 100644 admin/manuel.php create mode 100644 admin/miseajour.php create mode 100644 admin/perm.php create mode 100644 admin/thumbnail.php create mode 100644 admin/user_add.php create mode 100644 admin/user_list.php create mode 100644 admin/waiting.php create mode 100644 category.php create mode 100644 identification.php create mode 100644 include/config.inc.php create mode 100644 include/functions.inc.php create mode 100644 include/functions_category.inc.php create mode 100644 include/functions_session.inc.php create mode 100644 include/functions_user.inc.php create mode 100644 include/index.php create mode 100644 include/init.inc.php create mode 100644 include/user.inc.php create mode 100644 include/vtemplate.class.php create mode 100644 index.php create mode 100644 language/english.php create mode 100644 language/francais.php create mode 100644 language/index.htm create mode 100644 picture.php create mode 100644 profile.php create mode 100644 register.php create mode 100644 search.php create mode 100644 template/default/about.vtp create mode 100644 template/default/admin/admin.vtp create mode 100644 template/default/admin/cat.vtp create mode 100644 template/default/admin/configuration.vtp create mode 100644 template/default/admin/user_list.vtp create mode 100644 template/default/category.vtp create mode 100644 template/default/footer.htm create mode 100644 template/default/header.htm create mode 100644 template/default/htmlfunctions.inc.php create mode 100644 template/default/identification.vtp create mode 100644 template/default/picture.vtp create mode 100644 template/default/profile.vtp create mode 100644 template/default/register.vtp create mode 100644 template/default/search.vtp create mode 100644 template/default/style.inc.php create mode 100644 template/default/upload.vtp create mode 100644 upload.php 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 @@ +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'].' '; + // $_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.= ' > '.$dir[$i]; + } + $titre.= ""; + } + $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', '  ' ); +$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', '  ' ); +$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', + '
'. + $lang['default_message']. + '
' ); +} +//----------------------------------------------------------- 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 @@ +".$lang['user_err_modify'].""; + $absent = true; + } + if ( $HTTP_GET_VARS['mode'] == "modif" ) + { + if ( $pseudo == "" ) + { + echo"
".$lang['user_err_unknown']."
"; + $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++] = "
  • ".$lang['reg_err_login5']."
  • "; + } + } + } + // 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 "
    ".$lang['adduser_err_message'].sizeof( $error )." :"; + echo ""; + echo "
    "; + } + if ( sizeof( $error ) == 0 && $HTTP_GET_VARS['valider'] == 1 ) + { + echo"
    ".$lang['adduser_info_message']."\"$pseudo\" "; + if ( $HTTP_POST_VARS['use_new_pwd'] == 1 ) + { + echo $lang['adduser_info_password_updated']." "; + } + echo"[ ".$lang['adduser_info_back']." ]
    "; + } + 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&valider=1"; + if ( $HTTP_GET_VARS['mode'] == "modif" ) + { + $action.= "&mode=modif&user_id=".$HTTP_GET_VARS['user_id']; + } + echo"
    + + + + +
    + + + + + + + + + + + "; + echo" + + + + "; + echo" + + "; + echo " + + "; + echo" + + + + + + + +
    ".$lang['adduser_fill_form']."
     
    ".$lang['adduser_login'].""; + if ( $HTTP_GET_VARS['mode'] == "modif" ) + { + echo"$pseudo [".$lang['adduser_unmodify']."]"; + echo""; + } + else + { + echo""; + } + echo" +
    "; + if ( $HTTP_GET_VARS['mode'] == "modif" ) + { + echo $lang['new']." ".$lang['password'].""; + } + else + { + echo $lang['password']; + } + echo""; + echo"
    ".$lang['reg_mail_address']."
    ".$lang['adduser_status'].""; + if ( $pseudo == $conf['webmaster'] ) + { + echo "$status [".$lang['adduser_unmodify']."] + "; + } + else + { + echo" + "; + } + echo" +
    +
    +
    "; + if ( $HTTP_GET_VARS['mode'] == "modif" ) + { + echo "
    [ ".$lang['adduser_info_back']." ]
    "; + } + } + } +?> \ 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 @@ +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 or 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&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&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&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&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&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&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( ' ', 4 ), + $subcat_visible, $level + 1 ); + } +} +display_cat_manager( 'NULL', str_repeat( ' ', 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 @@ + "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 @@ +$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.""; + $dirs.= "\n".$indent."\t".$sub_rep[$i].""; + $dirs.= get_pictures( $rep."/".$sub_rep[$i], $indent."\t" ); + $dirs.= get_dirs( $rep."/".$sub_rep[$i], $indent."\t", $level + 1 ); + $dirs.= "\n".$indent.""; + } + 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 with all the pictures at the root of the directory + $root.= "\n".$indent.""; + if ( sizeof( $pictures ) > 0 ) + { + for( $i = 0; $i < sizeof( $pictures ); $i++ ) + { + $root.= "\n".$indent."\t"; + $root.= "\n".$indent."\t\t".$pictures[$i]['file'].""; + $root.= "\n".$indent."\t\t".$pictures[$i]['tn_ext'].""; + $root.= "\n".$indent."\t\t".$pictures[$i]['date'].""; + $root.= "\n".$indent."\t\t".$pictures[$i]['filesize'].""; + $root.= "\n".$indent."\t\t".$pictures[$i]['width'].""; + $root.= "\n".$indent."\t\t".$pictures[$i]['height'].""; + $root.= "\n".$indent."\t"; + } + } + $root.= "\n".$indent.""; + 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", "        ", 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 @@ +".$lang['editcat_confirm']." [ ".$lang['editcat_back']." ]"; + } + + echo " +
    + "; + $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 " + + + "; + if ( $row['site_id'] != 1 ) + { + echo " + + + + "; + } + echo " + + + + + + + + + + + + + + + + + + +
    ".$lang['editcat_title1']." ".$lang['category']." \"".get_cat_display_name( $array_cat_names, " - ", "font-style:italic;" )."\" [ dir : ".$row['dir']." ]
    Server".$row['galleries_url']."
    ".$lang['editcat_name']."
    ".$lang['editcat_comment']."
    ".$lang['editcat_status']." + + ".$lang['editcat_status_info']." +
     
    +
    "; +?> \ 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 @@ + '$date_ref' order by date desc;"); + echo"
    empty / vider
    "; + echo"
    "; + // 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"
    "; +?> + + + + + + + + + + + + + + + + + + + + "; + // 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" + + + + + + + "; + } + } + echo"
    dateloginIPpagecategorieimage
    "; + echo"  "; + echo $tJours[date("w",$fin)] ." "; + echo date("j",$fin).(date("j",$fin) == 1 ? "er " : " "); + echo $tMois[date("n",$fin)-1]." ".date("Y",$fin).""; + echo"      
     |-  $date$row[login]$row[IP]$row[page]$row[categorie]$row[titre]
    + "; +?> \ No newline at end of file diff --git a/admin/images/admin.png b/admin/images/admin.png new file mode 100644 index 0000000000000000000000000000000000000000..ff8dc0160256b77c0ca1962efef0f554c8602322 GIT binary patch literal 5844 zcmYj#2T)Vn_jN#!5Ewve1d%3PdPk%gq==zu=+Y4(fB{005=5l8CshaprI(0wDT1^h zO^{v$q?b@6NC_?fyf?r3<~uWY&Y3g!+}UNFz1O<2#!y`lCkOxlfb{hsrT_qi5BXsM zQj&KH_c%Y0C)$^KmcHcqzd^C>!d?gfut)1dw4MZ_cjx(D{?ePp9pqI|*Sc{xJgiP$ z%Ze71{v#>kz*Q>~|GrD{skzQmG6w5Iz&bC%^9Q!72pn z$LB{$=GJC%ocaZUx>a`dg}td&cI_a0`K09JfPjFis;UXm^Yinmsi|#9-9hp+7r@?4 zL>xd_PzeAg)I_v;{x_ORs4RU`knZF|`-|;7A@x5^U@48u=r_MM;)N~IG0N)dl6mx1 zH5aVG*TNgx!Y<4G*(p2>s$D(b&eD`g;o0kjjq*ayj}vPs3rjmB=M$`4R(&n)>Vz3; zo{IizN0H_ly+0@^axz3nQ_X4_Yu4CPpRD$!F88H?3|`kn?DVPY+!NE!m@H?F@)POS zVj>iCpMOVW{1&+TVNxhE@L*ZzTfJZm+1&SQ1!GHW_1*GU`AghKWKY6#trYt6;#(5m zA){_M!l^aw{lvf7RSJ~3h1XC5`MPnqhdYnK4E-S9NGAM|>ah?#jnn_!-w}=~0}MIJ znAq*@B4VBl8@05wR5wy=4o5Tc{F1xNp1LvYT|DN?7s>Qo8_0JoluDc4vuMpYB?PmWfRA+!b)m5JQiPy#JK{nfa5bLje%Zy^qbB$gm zdn{l_Bpq!sw0A_3`}DBIKx}0ziqr;I_eg&+BWXaJVXe7QDVo{``L(yy<9k$e@rq-3 z;^sItcA!7`y#JeBnfFt9@n5))IKe*+UtD>5$taCdon<{L3WjQmxf^8lf4qt?EH19})>%mN z$*7TSdIXhXcss63cZhmGdstEcHA%i5pSkUaM~8p0ew=O2?xCQcU%cAsBUD-mV(*e9 zAgZSu2gmnN*Ayr{vyg>arMo`FXTYKww`9fj?-fV3JhLz11NA-3l3+f_3!|p02WPV- z_kV1F0<4G=^-1&Yc5vTjMRt!LmQ4+X$GMYE;`4R!TT@Q-6SLMk5|1+%u*$=Nc+R@` zcQXSo9*E@)5KtU?L%B7k_=Qf~?#ERxA|$BF&6Zu0-)f$vyDgD5aN&W)z})c0AFRzraFH3agc#DpW*0u+T zMNG>bZyxh?d)Mab#_!v$w@+FPm!{>>mMi#kIcxEX2FI_}HVRi=DWeWIW-{Xk-jpyt zvxS;xW@0$vX9%b&294f@Z+>qzfczxdrr_ga2=Kt|>eNRpV`F*SU7l=Rw1re&W>xjG^VY&mH{CT&f1c zZJsdI%P-Znv*@r^bl646SA_TZ_V(Gr`f<+;VR`xdxIx{b;;kI5_3As-TGiy6gw;Gd zsO7zt{AJK2*7+Y2yh~4NTKE=JqZ<#8V+b0bC#oxhr>)!Ff zbs#@r$7}NONkIiEH)+_+Ppi{mq|Zs-+D1#lNom|+s$XY=0-H|d=fmzs23Dh_=dRA@ z%a}Mar%qtnK!k6t`*H8@p{pJfGuia%wU-M-qn^|nSZ$?>pL|6))A9~sov^)J#gV)o zuW{9S0zW=mt;zZvbgi|vf_`Ec>TnnyG(RPxbcG8d>GNP^&;fJEqH~v^5$^jB&Q;0cL=i| zYgeTRJNZ;n@mS{Tc%~SaK3hX>`;KBL-ZXE&*#9}|w3=-Zl~te3#1S`5{tCOc8tUpe zk;&)6S(U9~Vlla=&cZsY&3@j1pJ=4X#G`S$HH0X83|kfZ@j`+mmZE1C?R6 zd*S1OtVgzZ*3^|VBe|u%W}lO@IWF^r)Y#EC2388y>>RsoT5>*pAp;41<%V$;&I|n( z4TNToPlDAfgYIhDQl+A$g={y1oL9SAL!g)a@Any2d|Fza(2)dd?NCd__L-OlxUP(z z%hRq~?uZIF(_q!4bQ^rh2|eh;rHFfBdVALS{`!-RsR-X&hZY*t0*F9m6B=0m0_gkM zSI^o&8}gg|Fg9si-|AI$_I`Gb6)bt%lZL?Yr>@!w{&X6rRVg4Kbfkn?8RHh;x1w|s zcg2{t7k{}&x9i1#33A?eH@i>a*MGsFT>3~Q&kcX~{7a4KUgEg=r_25~KvcyCDG!A$ zWn5p$!@vH_45d#_e!K{v6EGh=;s`#KfqEq4M$yp+R)r&_lb2`jcTIEZ71&+jMU#Vv zL32)O#4*u1Vtv%u*{9=QGK>#nq%^rKamq)N0}geA1<6)40s@&X31;2`Mqs%U?|Y8u zTg=KVRL z=<-P8S0($k*RjvFp83Qg2$&(8ps9D8FwXM#q&wEhxO*Yz3cQGI(jt-#DcZ~8nd`!1 zu2=-8o0zFQRI&&Xxw+sD79f?edxl?ktK7>S+f%gsREY0qCW+0(5RH)UJ)}!YpR=p5 z_FIA4!P{XdvGYv8+$tYo+Mx16_^@cUpgDN984pQ1MNK`_b`rn8szI@-MP48z11XrS zwC6$L4kFyvTXrN9`gEaG5?xE@(OJ8LIq;51?7-41>y!(sd>UGAD&*JSjxz6ur?yd6 z=@d-e7R~7&i-Fa~!dBvR67(ac7XwS#5*A9NvTjFp4Q5A4JE=^Nz}+c4={ipgg={*a z(Nu#}Hu&*Xh7T*NW~xWy$MPMiI05bxy?(gj;!M!==2)5NH}0DO;`LeA#I-L%lb21= zKV0K$3G$DE9KVS0>qLK4FZb;a8rKOw_Tb;*NCa&rtpZ2fNT^bsj7(7GWk4$ z(@zPNOD`7Xnv3$%D`JoD-+RE_k8KJ1CY>POHYi7JaAo*qLON6f1U~Bymi)J>= zU!jNc;k>v}tbOSwj9EUzi(1p$U;qS=m;3mJ*Aaa^_Dw!j;ur=SosNlQW?)UYqxgeXxd_K9AVwbwUyyw7WuQ& zB2^|jT270W6WM5LZAUZ$G3m$py{z~UT}(9krkr@z%*NwMzzqIlj&D&HlS6||wNxL5 z3YCtAEcn|!?e&;v!H!Ke>SwxCU~Ra1A)7o-;%o*hdGytdta{Y{DL!iorfG6a0DgS! zeAe3O;oUC&5lz6S+0fy)OpP4vd!Q?AQ(h^R-IPeNj_#gw+PGg><){}}GI+|z%UGLB zSQ{t`*ii5u)%L?m<1XW(!oTfvW^N-nkx=Qz<~#+WanWX}=;q@KFG2d`Inu?0cZ2Wi z$0?Dn7>HmmD_(VIqG2(r#^v>Ia=#Et)jzP!G#YzG#-?4uP2DAoUMKp@ug zG+Th_0O*-`gf|y2^A-%$w&OLy7M#k!*91xxu8+%1=phazH&<>}RT7*AGH zuq(F1pyQdSeiSE@f$Nm)DJf!icX8tAh*urYbEqKtFS;Ueun=~eV2=jSR?4-CYp0F& zaOP$&!7*@2lK;6?MbTegQCg%pAd2q;Sa|z}G(C}<>c$Gy9my-&bt^jN6{C2a6vp+czF5akI9K=O1>HW)>V}a{(_+ zG?+6X(hO!j;!NNRye+4{Wm6+(?BJd*g{lr1kaR@>k%wo|r_*0F_YZ<+d)}p6- zk=5jKFdKP0PH(N_##?&P7*x8asSK20F{m-E4}MdX)HBhMd7Vrli(*`~-DS@&Gwc&s zmY2oms08I3v=dTY9b>-ggl9&6vhI_|mEG$SNdkX}Y-R&=X(q6Qe)G#+S9Z{QcVwW_hzJ#}Ze{8RV^plm$yi7N;v*BlR&SHamm~unXU(Uhop+x$$OQ`% zZJ<9Tosff~YI`Sgm>m2@rzO1w^Spt#4Acel>^-KgE$7d8*kxYqW6dNo7|vo5K55r6 z3l6&+Thqk=imnt$2e8PlS5!-Mmnc^pk_CnjwCi zen#wd!2(N1mXxaRQ`qtBAazFRZ)JPa?ywxEhMJ;&b{RbMO+5v%9}X8J8z!3(F8lAn zv;v=>;r6Stco?8iiVOol7t=0pjJ%M2=`z}0D3KQY85k`4!Vnk(E}?q61&d0fJ?|!S%@e9exqCl-@b1J8WJuQ-X5isM1QkXyJ9bSW6X{wIorpy}*zc7@& z-j|zFSS-@FTZyL8bmDt+W7Vr{7vnINB}V*J==7uO@qJB^rCyjjT_)~M>p8=2F=VF6 z*e3kAvsamTTenWn3H1GzKgEdY=L&d1i45E1L(0@(gBhS?IIa^-yDgWff4iYn3TsrS z0|_GLX9FmDXdjkB9YC+1J!BX$RS&2*5hz3wS{5Q`r z2It0)>QjB(jY4wreFNE^mp=91ALej(_uVsi-=HevhitghtE{X37B zH~&*J+ev{A`9d|D7^;^+0kbi_LT>6BwF%f?iMkeXV>56Eue=>tU2}e7)9IkAqIyJ> zpc0zaz?iH6w4Bh{v|+vi(ynCj5W-<7fYa~NVj6jd#>1Lp5VBqGA!AR30iFQ))l<&otEg|Vx$40N4!*uJE{ z=z9>Qd!GVMKhTd~-Arw&zzYC+WU9=PmQRI)arP(&`SX96?3zyw*KkB{FYy9P(>xMV zhoz&BPK(x9o7wVBKgmElr@JOH*VU4me`jecP;i0+6UJ6y*ry8CAWgn%JWSgI#!)JC z(`0z-$?WXxtCKz30IoOMl+Po={S_~6@$mF6j8=>6!om~Aw=G8${$HB-{ls+=#)!l= zRfJ*=54S`edlXohSJ$DLtydb06!dgNYkyFoRAsKTuKuyFCO$5WE5rL}Hc?oCP!UZN zwsPbU5$QA6Rj-bKJ$(cw*y|raRD)JH__I3vrN4GE`yj@O-Q|`l`VJRLF zijd7mP;ETg1yA#vT^6jhmpJ=Bu26gcBwXb-TjQIej`1`&p^Iq)&qPObVaACd45v)p zx_<*4`$q=a)?&8_F8Ra-;$;73Mux8kQi*Knc=a?gH(U^pp8SyEil;FK`U;g!4oWzo zA^MJ~$D;?`_vgQc0n(TMM-Tw2%wcfB$4^A^l}L=|YS*ZC<6AfW{W-0#1BHCjwvYHf Dp*CZ; literal 0 HcmV?d00001 diff --git a/admin/images/arrow_up.gif b/admin/images/arrow_up.gif new file mode 100644 index 0000000000000000000000000000000000000000..90da978cdef95e4467e1ff4bbd0e8435211621d1 GIT binary patch literal 88 zcmZ?wbhEHbRAUfhXkY+=|Ns9h{$yblVPIs?0r5dH3{3hx{VPwu nm4HXrm6WuMs!j86A6jg4`COLwPS + + PhpWebGallery + + + No access authorized + + \ No newline at end of file diff --git a/admin/images/moins.gif b/admin/images/moins.gif new file mode 100644 index 0000000000000000000000000000000000000000..74fa8736fbfdde46c9c559c52da6a25f6bb8cbbf GIT binary patch literal 867 zcmZ?wbhEHb4F$SEY(F@@nFBO^PPSVzhN2gfEB T4iOdxg9XbQ=36r}F<1itlEV36 literal 0 HcmV?d00001 diff --git a/admin/images/puce.gif b/admin/images/puce.gif new file mode 100644 index 0000000000000000000000000000000000000000..b8494bb77ed201d91c6cdc053ed46904345077d9 GIT binary patch literal 839 zcmaJ=L1+_E5S`tP&6)(YQEbFOQW5DvLLg9Ti<;V4qop+`@vzXuW;XT;{uzTU+aNntn z4?JK4SxnQa7UvdlE5Be`0T2vFJ0w)Z2i}Uf zA*Bp|`kfh4MC4kW{tjIp}louA!e0z|*Q zwh*u5EUhgc1U)GTqVUNxsxb|6;N literal 0 HcmV?d00001 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 @@ + \ 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 @@ + + + PhpWebGallery + + + No access authorized + + \ 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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 '
    '.$lang['access_forbiden'].'
    '; + echo ''.$lang['ident_title'].'
    '; + 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 @@ + + + PhpWebGallery + + + No access authorized + + \ 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 @@ += 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&cat_id=".$page['cat']; + $page['navigation_bar'] = create_navigation_bar( $url, $cat['nb_images'], $page['start'], $page['nb_image_page'], "" ); + echo" +
    + + + + + + + + + + + + + + +
    ".$lang['infoimage_general']." \"".get_cat_display_name( $cat['name'], " - ", "font-style:italic;" )."\"
    ".$lang['author']."
    ".$lang['infoimage_useforall']."
    ".$lang['infoimage_creation_date']." [DD/MM/YYYY]
    ".$lang['infoimage_useforall']."
    "; + echo" + + + + + + + + + + + + + + "; + $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" + "; + // 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" + + + + + "; + echo" + "; + $i++; + } + echo" + + + +
    ".$lang['infoimage_detailed']."
    ".$page['navigation_bar']."
    ".$lang['thumbnail']."".$lang['infoimage_title']."".$lang['author']."".$lang['infoimage_comment']."".$lang['infoimage_creation_date']."
    \"\"$file
    +
    "; + } +?> \ 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 @@ + + + PhpWebGallery 1.2 + + + + + + + +
    +
    PhpWebGallery 1.2
    + + + + +
    "; + return $output; + } + + function footer_install() + { + $output = " +
    +
    + +"; + 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.= "
    ".$lang['step1_confirmation']."
    "; + $erreur1 = false; + } + else + { + $message.= "
    ".$lang['step1_err_db']."
    "; + } + } + else + { + $message.= "
    ".$lang['step1_err_server']."
    "; + } + + if ( !$erreur1 ) + { + // écriture du fichier de configuration + if ( $fp = @fopen("../include/mysql.inc.php","a+") ) + { + fwrite( $fp, "" ); + 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.="

    ".$lang['step1_err_copy']." :
    + -----------------------------------------------------
    +
    <?php
    + \$cfgBase = '".$HTTP_POST_VARS['cfgBase']."';
    + \$cfgUser = '".$HTTP_POST_VARS['cfgUser']."';
    + \$cfgPassword = '".$HTTP_POST_VARS['cfgPassword']."';
    + \$cfgHote = '".$HTTP_POST_VARS['cfgHote']."';
    + \$prefixeTable = '".$HTTP_POST_VARS['prefixe']."';
    + ?>
    + -----------------------------------------------------
    "; + $message.= "
    ".$lang['step1_err_copy_2']."
    "; + $message.= "".$lang['step1_err_copy_next']."
    "; + } + 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" + + + + + + + +
    ".$lang['install_message']."
    $message
    "; + } + if ( $erreur1 ) + { + echo" +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ".$lang['step1_title']."
      +
    ".$lang['step1_host']."".$lang['step1_host_info']."
    ".$lang['step1_user']."".$lang['step1_user_info']."
    ".$lang['step1_pass']."".$lang['step1_pass_info']."
    ".$lang['step1_database']."".$lang['step1_database_info']."
    ".$lang['step1_prefix']."".$lang['step1_prefix_info']."
      +
    +
    "; + } + 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 .= "
  • ".$lang['step2_err_login1']."
  • "; + $nb_erreur++; + } + $webmaster = ereg_replace( "[ ]{2,}", " ", $HTTP_POST_VARS['webmaster'] ); + if ( ereg( "^.* $", $webmaster ) || ereg( "^ .*$", $webmaster) ) + { + $erreur .= "
  • ".$lang['step2_err_login2']."
  • "; + $nb_erreur++; + } + if ( ereg( "'",$webmaster ) || ereg( "\"",$webmaster ) ) + { + $erreur .= "
  • ".$lang['step2_err_login3']."
  • "; + $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 .= "
  • ".$lang['step2_err_pass']."
  • "; + $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 .= "
  • ".$lang['step2_err_mail']."
  • "; + $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" + + + + + + + + + +
    ".$lang['install_end_title']."
      +
    ".$lang['install_end_message']."
    "; + } + else + { + if ( $nb_erreur > 0 ) + { + echo" + + + + + + + + + + + + + +
    ".$lang['install_message']."
     
    $erreur
     
    "; + } + echo" +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ".$lang['step2_title']."
     
    ".$lang['conf_general_webmaster']."".$lang['conf_general_webmaster_info']."
    ".$lang['step2_pwd']."".$lang['step2_pwd_info']."
    ".$lang['step2_pwd_conf']."".$lang['step2_pwd_conf_info']."
    ".$lang['conf_general_mail']."".$lang['conf_general_mail_info']."
      +
    + +
    +
    "; + } + echo footer_install(); + } + /*----------------------------------Language choice------------------------------------*/ + else + { + include( "../include/functions.php" ); + echo header_install(); + echo" +
    + + + + + +
    + + +
    +
    "; + 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 @@ + + + ".$lang['help_images_title']." + + +   + + + +
    \"\"/
    + ".$lang['help_images_intro']." : +
      "; + for ( $i = 0; $i < sizeof( $lang['help_images'] ); $i++ ) + { + echo" +
    • ".$lang['help_images'][$i]."
    • "; + } + echo" +
    "; + echo" + + + +   + + + ".$lang['help_thumbnails_title']." + + +   + + + +
      "; + for ( $i = 0; $i < sizeof( $lang['help_thumbnails'] ); $i++ ) + { + echo" +
    • ".$lang['help_thumbnails'][$i]."
    • "; + } + echo" +
    + + + +   + + + ".$lang['help_database_title']." + + +   + + + +
      "; + for ( $i = 0; $i < sizeof( $lang['help_database'] ); $i++ ) + { + echo" +
    • ".$lang['help_database'][$i]."
    • "; + } + echo" +
    + + + +   + + + ".$lang['help_remote_title']." + + +   + + + +
      "; + for ( $i = 0; $i < sizeof( $lang['help_remote'] ); $i++ ) + { + echo" +
    • ".$lang['help_remote'][$i]."
    • "; + } + echo" +
    + + + +   + + + ".$lang['help_upload_title']." + + +   + + + +
      "; + for ( $i = 0; $i < sizeof( $lang['help_upload'] ); $i++ ) + { + echo" +
    • ".$lang['help_upload'][$i]."
    • "; + } + echo" +
    + + + +   + + + ".$lang['help_infos_title']." + + +   + + + +
      "; + for ( $i = 0; $i < sizeof( $lang['help_infos'] ); $i++ ) + { + echo" +
    • ".$lang['help_infos'][$i]."
    • "; + } + echo" +
    + + + +   + + "; +?> \ 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 @@ +".$result['name'][0]." [ dir : ".$result['last_dir']." ] +
    "; + + // 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 " +
    "; + } + } + + 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']." ".$lang['update_disappeared']."
    "; + } + if ( !is_file ( $lien_thumbnail ) ) + { + echo $row['file']." : ".$lang['update_disappeared_tn']."
    "; + } + // 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 "".$lang['update_missing_tn']." : $file (".$conf['prefixe_thumbnail'].substr( $file, 0, strrpos( $file, "." ) ).".XXX, XXX = gif, png or jpg)
    "; + } + } + } + } + } + // inserting the pictures found in the directory + $root.= "\n".$indent.""; + 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']." ".$lang['update_research_added']." (".$lang['update_research_tn_ext']." ".$pictures[$i]['tn_ext'].")
    "; + $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( "", "", $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 "$url

    "; + + // 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 " + $name +
    "; + $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 "
    ".$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 "
    ".$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 " +
    "; + } + // 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++ ) + { + // + // albatros.jpg + // png + // 2002-04-14 + // 35 + // 640 + // 480 + // + $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 ".$lang['update_research_added']." (".$lang['update_research_tn_ext']." $tn_ext)
    "; + $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 ""; + //------------------------------------------------------------------------------ + // 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" + + + + "; + } + //------------------------------------------------------------------------------ + // Recherche des nouvelles images dans les repertoires + else + { + $count_new = 0; + $count_deleted = 0; + echo" + + + + "; + } + //------------------------------------------------------------------------------ + // 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" + + + + "; + } + //------------------------------------------------------------------------------ + echo "
    ".$lang['update_default_title']."
    + +
    ".$lang['update_part_research']."
    +
    "; + if ( isset( $page['cat'] ) ) + { + insert_local_category( $page['cat'] ); + } + else + { + insert_local_category( "NULL" ); + } + echo "
    $count_new ".$lang['update_research_conclusion'].""; + echo "
    $count_deleted ".$lang['update_deletion_conclusion'].""; + echo " +
    +
    Site distant
    +
    "; + remote_images(); + echo "
    $count_new ".$lang['update_research_conclusion'].""; + echo "
    $count_deleted ".$lang['update_deletion_conclusion'].""; + echo " +
    +
    "; +?> \ 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 @@ +".$lang['user_err_unknown'].""; + $erreur = true; + } + if ( $row['pseudo'] == $conf['webmaster'] ) + { + echo"
    ".$lang['user_err_modify']."
    "; + $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 "
    ".$lang['permuser_info_message']." [ ".$lang['adduser_info_back']." ]
    "; + } + 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 "
    ".$lang['permuser_info_message']." [ ".$lang['editcat_back']." ]
    "; + } + } + //--------------------------------------------------------------- formulaire + function display_cat_manager( $id_uppercat, $indent, $uppercat_authorized, $level, $restriction ) + { + global $prefixeTable,$lang,$conf; + + $output = ""; + + // will we use or lines ? + if ( $level == 0 ) + { + $start_line = "$indent\">\" "; + if ( in_array( $row['id'], $restriction ) || !$uppercat_authorized ) + { + $subcat_authorized = false; + $color = "red"; + } + else + { + $color = "green"; + } + $output.= ""; + if ( $row['name'] == "" ) + { + $output.= str_replace( "_", " ", $row['dir'] ); + } + else + { + $output.= $row['name']; + } + $output.= " [ dir : ".$row['dir']." ]"; + $output.= "".$end_line; + $output.= "\n\t".$start_line2." style=\"width:15%;white-space:nowrap;text-align:right;font-weight:normal;\">"; + $output.= "\n\t\t".$lang['permuser_authorized']; + $output.= "\n\t\t + + ".$lang['permuser_title']." \"".$page['pseudo']."\" + + "; + $restriction = get_restrictions( $HTTP_GET_VARS['user_id'], $page['status'], false ); + echo" +
    +
    ".$lang['permuser_warning']."
    + "; + + echo display_cat_manager( "NULL", "    ", true, 0, $restriction ); + + echo" + + + +
    + "; + } + //---------------------------------------------- + // cas 2 : permissions pour une catégorie donnée + else if ( isset( $HTTP_GET_VARS['cat_id'] ) ) + { + echo" +
    + + + +
    ".$lang['permuser_cat_title']."\"".get_cat_display_name( $page['cat_name'], " - ", "font-style:italic;" )."\"
    "; + echo" +
    + "; + + $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" + + + + "; + $i++; + } + echo" + + + +
    "; + echo " 0 ) + { + echo "red"; + } + else + { + echo "green"; + } + echo "\">".$row['pseudo'].""; + if ( $is_user_allowed == 2 ) + { + echo "".$lang['permuser_parent_forbidden'].""; + } + else + { + echo" + ".$lang['permuser_authorized']." + ".$lang['permuser_forbidden']; + } + echo" +
    +
    "; + } + } +?> \ 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 @@ + $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)
    ";; + } + } + } + } + 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.= ""; + } + $dirs.= "\">\"/".$sub_rep[$i]; + if ( $nb_picture_without_TN > 0 ) + { + $dirs.= ""; + } + if ( $nb_picture_without_TN > 0 ) + { + $dirs.= " [ $nb_picture_without_TN ".$lang['tn_dirs_alone']." ]"; + } + $dirs.= "
    "; + $dirs.= get_displayed_dirs( $rep."/".$sub_rep[$i], $indent."        " ); + } + 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.= "
    [ 0 ".$lang['tn_dirs_alone']." ]
    "; + } + 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.= "
  • ".$lang['tn_err_width']." 10
  • "; + } + if ( !ereg( "^[0-9]{2,3}$", $HTTP_POST_VARS['height'] ) || $HTTP_POST_VARS['height'] < 10 ) + { + $nb_erreur++; + $erreur.= "
  • ".$lang['tn_err_height']." 10
  • "; + } + if ( !isset( $HTTP_POST_VARS['gd'] ) ) + { + $nb_erreur++; + $erreur.= "
  • ".$lang['tn_err_GD']."
  • "; + } + + //---------------------------------------------listing des résultats + if ( $nb_erreur == 0 ) + { + $style = "class=\"row2\" style=\"text-align:center;font-weight:bold;"; + $output.= " + + + + + + + + + + + + + + + + "; + $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.= " + + + + + + + + + + + + "; + } + $output.= " + + + +
    ".$lang['tn_results_title']."
     ".$lang['tn_picture']."".$lang['tn_filesize']."".$lang['tn_width']."".$lang['tn_height']."".$lang['tn_results_gen_time']."".$lang['thumbnail']."".$lang['tn_filesize']."".$lang['tn_width']."".$lang['tn_height']."
    $num".$tab_infos[$i]['name']."".$tab_infos[$i]['size']."".$tab_infos[$i]['width']."".$tab_infos[$i]['height']."
    ".number_format( $tab_infos[$i]['temps'], 2, '.', ' ')." ms
    ".$tab_infos[$i]['tn_name']."".$tab_infos[$i]['tn_size']."".$tab_infos[$i]['tn_width']."".$tab_infos[$i]['tn_height']."
     
    + + + + + + + + + + + + + + + + + + + + + + + + +
    ".$lang['tn_stats']."
    ".$lang['tn_stats_nb']." : ".sizeof( $temps )."
    ".$lang['tn_stats_total']." : ".number_format( array_sum( $temps ), 2, '.', ' ')." ms
    ".$lang['tn_stats_max']." : ".number_format( $max, 2, '.', ' ')." ms
    ".$lang['tn_stats_min']." : ".number_format( $min, 2, '.', ' ')." ms
    ".$lang['tn_stats_mean']." : ".number_format( array_moy( $temps ), 2, '.', ' ')." ms
    + + + + +
     
    "; + } + else + { + $output.= " +
    ".$lang['tn_err']."
    +
    +
      + $erreur +
    +
    "; + } + } + //-------------------------------------paramètres de miniaturisation + if ( sizeof( $images ) != 0 ) + { + $output.= " + "; + $output.= " +
    + + + + "; + $output.= " + + + "; + $output.= " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + $output.= " +
    ".$lang['tn_params_title']."
     
    ".$lang['tn_params_GD']."
    + 2.x + ".$lang['tn_params_GD_info']."
    ".$lang['tn_width']."
    ".$lang['tn_params_width_info']."
    ".$lang['tn_height']."
    ".$lang['tn_params_height_info']."
    ".$lang['tn_params_create']."
    + + ".$lang['tn_params_create_info']."
    ".$lang['tn_params_format']."
    jpeg".$lang['tn_params_format_info']."
     
    + +
    +
    "; + //-----------------------------------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.= " + + + + + + + + + + + "; + for ( $i = 0; $i < sizeof( $images ); $i++ ) + { + $num = $i + 1; + $class = ""; + if ( $i%2 == 1 ) + { + $class = " class=\"row2\""; + } + $output.= " + + + + + + + "; + } + $output.= " +
    ".sizeof( $images )." ".$lang['tn_alone_title']."
     ".$lang['tn_picture']."".$lang['tn_filesize']."".$lang['tn_width']."".$lang['tn_height']."
    ".$num."
    ".$images[$i]['name']."
    ".$images[$i]['size']."
    ".$images[$i]['width']."
    ".$images[$i]['height']."
    "; + } +} +//-----------------------------------liste des répertoires +//-------------------------si aucun répertoire selectionné +else +{ + $output = " + + + + "; + $output.= " + + + +
    ".$lang['tn_dirs_title']."
    +
    + \"\"/galleries"; + $output.= "
    "; + $output.= get_displayed_dirs( "../galleries", "        " ); + $output.= " +
    +
    "; +} +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 @@ +".$lang['user_err_modify'].""; + $absent = true; +} +if ( $_GET['mode'] == 'modif' ) +{ + if ( $pseudo == '' ) + { + echo"
    ".$lang['user_err_unknown']."
    "; + $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 "
    ".$lang['adduser_err_message'].sizeof( $error )." :"; + echo "
      "; + for ( $i = 0; $i < sizeof( $error ); $i++ ) + { + echo "
    • ".$error[$i]."
    • "; + } + echo "
    "; + echo "
    "; + } + if ( sizeof( $error ) == 0 && $_GET['valider'] == 1 ) + { + echo"
    ".$lang['adduser_info_message']."\"$pseudo\" "; + if ( $_POST['use_new_pwd'] == 1 ) + { + echo $lang['adduser_info_password_updated']." "; + } + echo"[ ".$lang['adduser_info_back']." ]
    "; + } + 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&valider=1"; + if ( $_GET['mode'] == "modif" ) + { + $action.= "&mode=modif&user_id=".$_GET['user_id']; + } + echo"
    + + + + +
    + + + + + + + + + + + "; + echo" + + + + "; + echo" + + "; + echo " + + "; + echo" + + + + + + + +
    ".$lang['adduser_fill_form']."
     
    ".$lang['adduser_login'].""; + if ( $_GET['mode'] == "modif" ) + { + echo"$pseudo [".$lang['adduser_unmodify']."]"; + echo""; + } + else + { + echo""; + } + echo" +
    "; + if ( $_GET['mode'] == "modif" ) + { + echo $lang['new']." ".$lang['password'].""; + } + else + { + echo $lang['password']; + } + echo""; + echo"
    ".$lang['reg_mail_address']."
    ".$lang['adduser_status'].""; + if ( $pseudo == $conf['webmaster'] ) + { + echo "$status [".$lang['adduser_unmodify']."] + "; + } + else + { + echo" + "; + } + echo" +
    +
    +
    "; + if ( $_GET['mode'] == "modif" ) + { + echo ""; + } + } +} +?> \ 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 @@ +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&delete='.$_GET['delete']; + $yes_url.= '&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.= '&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&mode=modif&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&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&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 @@ + + + + + + + + + + "; + $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 " + + + + + + + + + "; + $i++; + } + echo " + + + "; + echo " +
    ".$lang['category']."".$lang['date']."".$lang['file']."".$lang['thumbnail']."".$lang['author']." 
    ".$cat_names[$row['cat_id']]['display_name']."".$lang['day'][date( "w", $row['date'] )].date( " j ", $row['date'] ).$lang['month'][date( "n", $row['date'] )].date( " Y G:i", $row['date'] )." + ".$row['file'].""; + if ( $row['tn_ext'] != "" ) + { + $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") ); + echo "".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext']; + } + else + { + echo " "; + } + echo " + + ".$row['username']." + + ".$lang['submit']." + ".$lang['delete']." +
    + "; +?> \ 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 @@ + * + * * + ***************************************************************************/ + +/*************************************************************************** + * * + * 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( '', ' ', $user['restrictions'], $page['tab_expand'] ); +// favorites cat +if ( !$user['is_the_guest'] ) +{ + $vtp->addSession( $handle, 'favorites' ); + $url = add_session_id('./category.php?cat=fav&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'. + '&expand='.$page['expand'] ); +$vtp->setGlobalVar( $handle, 'most_visited_url', $url ); +// recent pictures +$url = add_session_id( './category.php?cat=recent'. + '&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.= '&expand='.$page['expand']; + if ( $page['cat'] == 'search' ) + { + $url.= '&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'], '
    ', + 'font-style:italic;' ); + $vtp->setGlobalVar( $handle, "cat_title", $cat_title ); + } + else + { + if ( $page['cat'] == 'search' ) + { + $page['title'].= ' : '; + $page['title'].= $_GET['search'].""; + } + $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.= '&image_id='.$row['id'].'&expand='.$page['expand']; + if ( $page['cat'] == 'search' ) + { + $url_link.= '&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'].'"'; + if ( $cat_row['name'] != '' ) + { + $name.= $cat_row['name']; + } + else + { + $name.= $cat_row['dir']; + } + $name.= '"'; + + $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.= '&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'].'&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 @@ +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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 − +// - 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( " ", " ", $treatment ); + $treatment = str_replace( "-", "−", $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( " ", " ", $remaining ); + $treatment = str_replace( "-", "−", $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, "". + $search."", $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, "". + $search."", $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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 '
    '.$lang['access_forbiden'].'
    '; + echo ''; + echo $lang['thumbnails'].'
    '; + 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']."&expand=$expand"; + if ( $page['cat'] == 'search' ) + { + $url.= "&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', '>' ); + $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', '>' ); + 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'].'&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.'    ', + $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.= ''; + } + $output.= $array_cat_names[$i]; + if ( $style != "" ) + { + $output.= ""; + } + } + } + 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'].'&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'].= ' : '; + $page['title'].= $_GET['search'].""; + } + $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.= '&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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 = "&"; + 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 = "&"; + 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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 '
    '.$lang['only_members'].'
    '; + echo ''.$lang['ident_title'].'
    '; + 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 @@ + \ 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 @@ + * + * * + *************************************************************************** + + *************************************************************************** + * * + * 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 @@ + $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 @@ +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().
    " ; + 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().
    "; + 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.
    "; + 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.
    "; + 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 \'|\'.
    "; + 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.
    "; + break; + case 7: + $this->titre="Erreur de parsing n° $code"; + $this->msg = "Vous avez oublié de fermer la zone $arg.
    "; + break; + case 8: + $this->titre="Erreur de traitement n° $code"; + $this->msg = "Le fichier template $arg est introuvable.
    "; + 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.
    "; + break; + case 10: + $this->titre="Erreur de traitement n° $code"; + $this->msg = "Impossible de lire le fichier template $arg.
    "; + break; + case 11: + $this->titre="Erreur de traitement n° $code"; + $this->msg = "La zone $arg est introuvable.Vérifiez la syntaxe de cette zone.
    "; + break; + case 12: + $this->titre="Erreur de traitement n° $code"; + $this->msg = "La variable $arg est introuvable .Vérifiez la syntaxe de la variable.
    "; + 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.
    "; + 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.
    "; + 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.
    "; + break; + default: + $this->titre = "Erreur inconnue $code"; + $this->msg = "Veuillez le rapporter aux auteurs de la classe."; + } + $this->titre .= ":
    "; + if ($disp){ + $web = "Pour plus d'informations, consultez la doc en ligne"; + echo "$this->titre$this->msg$web

    "; + } + 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:
    "; + foreach ( $this->varlist as $vars ) + echo "$vars
    "; + } + + 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("()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("()sU",$code,$reg); + + return ($reg[0]!="") ? 0 : 1; + } + + function getSource($code,$nom,$type=0){ +// Retourne le source de la zone de nom $nom + + preg_match_all ("((.*))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 @@ + \ 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 @@ +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'] = "
    Information about PhpWebGallery
    +
      +
    • This website uses PhpWebGallery version 1.2. PhpWebGallery is a web application giving you the possibility to create an online images gallery easily.
    • +
    • Technicaly, PhpWebGallery is fully developped with PHP (the elePHPant) with a MySQL database (the SQuirreL).
    • +
    • If you have any suggestions or comments, please visit PhpWebGallery official site, and its dedicated forum.
    • +
    "; + $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
    - 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
    - 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
    - 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
    - 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
    - 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 \"forbidden access\" 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
    -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.
    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

    + For security reason, please delete file \"install.php\" in the directory \"admin\"
    + Once this file deleted , follow this instructions : +
      +
    • go to the identification page : [ identification ] and use the login/password given for webmaster
    • +
    • this login will enable you to access to the [ administration panel ] and to the instructions in order to place pictures in your directories
    • +
    "; + $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 @@ +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'] = '
    Informations sur le PhpWebGallery
    +
      +
    • Ce site utilise la version '.$conf['version'].' de PhpWebGallery. PhpWebGallery est une application web permettant de créer simplement une galerie d\'images en ligne.
    • +
    • 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).
    • +
    • Si vous avez des suggestions ou des commentaires, n\'hésitez pas à visiter le site de PhpWebGallery et son forum.
    • +
    '; +// 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
    - 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
    - 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
    - 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
    - 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.
    - 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 "accès interdit" à 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
    - 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.
    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

    +Par mesure de sécurité, merci de supprimer le fichier "install.php" du repertoire "admin"
    +Un fois ce fichier supprimé, veuillez suivre ces indications : +
      +
    • allez sur la page d\'identification : [ identification ] et connectez-vous avec le pseudo donné pour le webmaster
    • +
    • celui-ci vous permet d\'accéder à la [ partie administration ] et aux instructions pour placer les images dans les répertoires.
    • +
    '; + $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 @@ + + + PhpWebGallery + + + No access authorized + + \ 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 @@ +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'].'&cat='.$page['cat']; + $url_link.= '&expand='.$_GET['expand']; + if ( $page['cat'] == 'search' ) + { + $url_link.= '&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']."
    "; +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'].'&'; +$url_link.= 'num='.$page['num'].'&expand='.$_GET['expand']; +if ( $page['cat'] == 'search' ) +{ + $url_link.= "&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 = '[ '; + $content.= $original_width.'*'.$original_height.' ]'; + $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'].'&image_id='.$page['id']; + $url.= '&expand='.$_GET['expand'].'&add_fav=1'; + if ( $page['cat'] == 'search' ) + { + $url.= '&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'].'&image_id='.$page['id']; + $url.= '&expand='.$_GET['expand'].'&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&cat_id='.$page['cat']; + $url.= '&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'].'&cat='.$page['cat']; + $url_link.= '&expand='.$_GET['expand']; + if ( $page['cat'] == 'search' ) + { + $url_link.= "&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'].'&image_id='.$page['id']; + $url.= '&expand='.$_GET['expand']; + if ( $page['cat'] == 'search' ) + { + $url.= '&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.'&del='.$row['id'] ) ); + $vtp->closeSession( $handle, 'delete' ); + } + $vtp->closeSession( $handle, 'comment' ); + } + // form action + $action = str_replace( '&', '&', $_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 @@ +'.$lang['only_members'].'
    '; + echo ''.$lang['ident_title'].''; + 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 '
    '.$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'].'&expand='.$page['expand']; +if ( $page['cat'] == 'search' ) +{ + $url.= '&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 @@ +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 @@ + 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 @@ + + + {#page_style} + {#about_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#about_title}
    + {#frame_end} +
     
    + {#frame_start}50%{#frame_begin} + + {#frame_end} + +
    + php logo +
    +
    + + \ 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 @@ + + + {#page_title} + + + + + + + + + +
    + + + + + + + +
    {#menu_title}
    +
    + + {#indent}{#name}
    + +
    +
    +
    +
    {#title}
    +
    +
    + + + + +
    + {#sub} +
    +
    +
    + + \ 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 @@ + + + + <{#td} style="width:40%;text-align:left;"> + {#indent}> +  {#name} [ dir : {#dir} ] + {#invisible} + + <{#td} style="text-align:center;"> +
    {#nb_picture}
    + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + {#cat_edit} + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + + {#cat_up} + + + {#cat_up} + + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + + {#cat_down} + + + {#cat_down} + + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + + {#cat_image_info} + + + {#cat_image_info} + + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + {#cat_permission} + + <{#td} class="{#class}" + style="width:10%;white-space:nowrap;text-align:center;"> + + {#cat_update} + + + {#cat_update} + + + + +
    \ 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 @@ + +
    +
      + +
    • {#li}
    • + +
    +
    + + +
    {#conf_confirmation}
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {#name} + + + + + {#text} + + + + + + + {#option} + + + + + {#option} + + + {#def}
    {#title}
     
    {#conf_remote_site_title}
     
     {#delete} 
    {#url}{#conf_remote_site_delete_info}
     
    + +
    +
    \ 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 @@ + + + + + + + + + +
    {#listuser_confirm} "{#login}" ?
    {#yes}{#no}
    + + +
    {#info}
    + + +
    + + + + + + + + + + + + + + + + + + + + + +
    {#title}
    +
    + + + +
    +
    +
    {#login}
    +
    + + {#listuser_modify} + + + {#listuser_modify} + + + + {#listuser_permission} + + + {#listuser_permission} + + + + {#listuser_delete} + + + {#listuser_delete} + +
     
    + < + + + + + mailto:{#mail_address_start}... + +
    +
    + \ 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 @@ + + + {#style} + {#title} + + + {#header} + + + + + +
    + {#frame_start}100%{#frame_begin} +
    {#categories}
    + + {#frame_end} +
     
    + {#frame_start}100%{#frame_begin} +
    {#title_menu}
    + + {#frame_end} +
    + + + + + + + + + + +
    + {#frame_start}1%{#frame_begin} +
    {#cat_title}
    + {#frame_end} +
     
    + + + + + + + + + +
    + + {#alt}
    + {#name} +
    + {#icon} + +
    {#nb} comments + +
    + +
    + + + + + +
    {#cat_comment}
    + +
    + {#nb_image_category} "{#cat_name}" : {#cat_nb_images} + +
    {#upload_name} + +
    + +
    + {#frame_start}1%{#frame_begin} +
    + {#connected_user} {#pseudo}
    + {#recent_image} {#short_period} {#days} + {#icon_short}
    + {#recent_image} {#long_period} {#days} + {#icon_long}
    + {#send_mail} {#webmaster} +
    + {#frame_end} +
    +
    + + + + {#footer} + + \ 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 @@ +'; + } + 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 = ''; + } + 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.= ''.$lang['previous_page']; + $navigation_bar.= ''; + $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.= ' '.$i.' '; + } + else + { + $navigation_bar.= ' '.$i.' '; + } + } + // 3.une page suivante ? + if ( $nb_element > $nb_element_page + && $start + $nb_element_page < $nb_element ) + { + $next = $start + $nb_element_page; + $navigation_bar.= ' | '.$lang['next_page'].''; + } + } + return $navigation_bar; +} + +function get_frame_start() +{ + return ' + + + +
    '; +} + +function get_frame_end() +{ + return ' +
    '; +} +*/ +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 ';"> + + + + + + + + '; +} + +function get_frame_end() +{ + global $user; + $path = './theme/'.$user['theme'].'/'; + $size_08 = getimagesize( $path.'08.gif' ); + return ' + + + + + + + + + '; +} + +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 @@ + + + {#page_style} + {#ident_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#ident_title}
    + {#frame_end} +
     
    + {#frame_start}50%{#frame_begin} +
    +
    + + + + + + + + + + + + + + + + +
    +
    +
      + +
    • {#li}
    • + +
    +
    +
     
    + + + + + + +
    +
    + + + + +
    + + [ {#ident_guest_visit} ] + + +
    +
    + {#frame_end} +
    + + \ 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 @@ + + + {#page_style} + + + {#page_title} + + + + + + + + + + + + + +
    + + + {#alt} + + + +   + + + {#frame_start}1%{#frame_begin} +
    {#title}
    + {#frame_end} +
     
    + {#frame_start}1%{#frame_begin} + + {#picture_alt} + +
    {#picture_comment}
    + + + + +
    + + + + + + + +
    +
    + + + + + + + {#frame_end} +
    {#back}
    +
    + + + {#alt} + + + +   + +
    + {#frame_start}90%{#frame_begin} + + + + +
    +
    + [{#nb_comments}] {#comments_title} +
    +
    {#navigation_bar}
    + + + + + + + + + +
    +
    {#author}
    +
    +
    + {#date}[{#delete}] +
    +
    +
    {#content}
    +
    + +
    {#navigation_bar}
    +
    +
    + + + + +
    +
    {#comments_add}
    + + + + + + +
    + +
    +
    + {#frame_end} +
    + + \ 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 @@ + + + {#page_style} + {#customize_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#customize_title}
    + {#frame_end} +
    + {#frame_start}50%{#frame_begin} +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      + +
    • {#li}
    • + +
    +
    +
     
     
    + +
    +
    +
    + {#frame_end} +
    + + \ 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 @@ + + + {#page_style} + {#register_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#register_title}
    + {#frame_end} +
    + {#frame_start}50%{#frame_begin} +
    + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      + +
    • {#li}
    • + +
    +
    +
     
    + +
    + [ {#ident_guest_visit} ] +
    +
    + {#frame_end} +
    + + \ 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 @@ + + + {#page_style} + {#search_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#search_title}
    + {#frame_end} +
     
    + {#frame_start}50%{#frame_begin} +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      + +
    • {#li}
    • + +
    +
    +
    +
     
    +
    + +
    + [ {#search_return_main_page} ] +
    +
    +
    + {#frame_end} +
    + + \ 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 @@ + + 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; + } + '; \ 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 @@ + + + {#page_style} + {#upload_page_title} + + + + + + +
    + {#frame_start}1px{#frame_begin} +
    {#upload_title}
    + {#frame_end} +
     
    + {#frame_start}50%{#frame_begin} + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      + +
    • {#li}
    • + +
    +
    +
    + +
    + +
    + +
    + +
    +
    + + + {#upload_successful}
    + + + {#frame_end} +
    + + \ 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 @@ +".$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"
    ".$lang['upload_forbidden']."
    "; + echo "".$lang['thumbnails']."
    "; + 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'].'&expand='.$_GET['expand']; + if ( isset( $page['waiting_id'] ) ) + { + $url.= '&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'].'&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