Changeset 19


Ignore:
Timestamp:
May 27, 2003, 10:56:13 PM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r17 r19  
    3737//------------------------------ verification and registration of modifications
    3838$conf_infos =
    39 array( 'prefixe_thumbnail','webmaster','mail_webmaster','acces',
     39array( 'prefix_thumbnail','webmaster','mail_webmaster','access',
    4040       'session_id_size','session_time','session_keyword','max_user_listbox',
    4141       'show_comments','nb_comment_page','upload_available',
     
    4747       'template' );
    4848$error = array();
    49 $i = 0;
    50 if ( $_GET['valider'] == 1 )
     49if ( isset( $_POST['submit'] ) )
    5150{
    5251  //purge de la table des session si demandé
    5352  if ( $_POST['empty_session_table'] == 1 )
    5453  {
    55     $query = 'delete from '.PREFIX_TABLE.'sessions';
    56     $query.= ' where expiration < '.time().';';
     54    $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
     55    $query.= ' WHERE expiration < '.time().';';
    5756    mysql_query( $query );
    5857  }
    5958  // deletion of site as asked
    60   $query = 'select id';
    61   $query.= ' from '.PREFIX_TABLE.'sites';
    62   $query.= " where galleries_url <> './galleries/';";
     59  $query = 'SELECT id';
     60  $query.= ' FROM '.PREFIX_TABLE.'sites';
     61  $query.= " WHERE galleries_url <> './galleries/';";
    6362  $result = mysql_query( $query );
    6463  while ( $row = mysql_fetch_array( $result ) )
    6564  {
    6665    $site = 'delete_site_'.$row['id'];
    67     if ( $_POST[$site] == 1 )
     66    if ( $_POST[$site] == 1 ) delete_site( $row['id'] );
     67  }
     68  // thumbnail prefix must not contain accentuated characters
     69  $old_prefix = $_POST['prefix_thumbnail'];
     70  $prefix = strtr( $_POST['prefix_thumbnail'], $Caracs );
     71  if ( $old_prefix != $prefix )
     72  {
     73    array_push( $error, $lang['conf_err_prefixe'] );
     74  }
     75  // mail mail must be formatted as follows : name@server.com
     76  $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
     77  if ( !preg_match( $pattern, $_POST['mail_webmaster'] ) )
     78  {
     79    array_push( $error, $lang['conf_err_mail'] );
     80  }
     81  // periods must be integer values, they represents number of days
     82  if ( !is_int( $_POST['short_period'] )
     83       or !is_int( $_POST['long_period'] ) )
     84  {
     85    array_push( $error, $lang['err_periods'] );
     86  }
     87  else
     88  {
     89    // long period must be longer than short period
     90    if ( $_POST['long_period'] <= $_POST['short_period']
     91         or $_POST['short_period'] <= 0 )
    6892    {
    69       delete_site( $row['id'] );
     93      array_push( $error, $lang['err_periods_2'] );
    7094    }
    7195  }
    72   // le préfixe des thumbnails ne doit pas comporter d'accent
    73   $ancien_prefixe = $_POST['prefixe_thumbnail'];
    74   $prefixe = strtr( $_POST['prefixe_thumbnail'], $Caracs );
    75   if ( $ancien_prefixe != $prefixe )
    76   {
    77     $error[$i++] = $lang['conf_err_prefixe'];
    78   }
    79   // le mail doit être conforme à qqch du type : nom@serveur.com
    80   if ( !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
    81               $_POST['mail_webmaster'] ) )
    82   {
    83     $error[$i++] = $lang['conf_err_mail'];
    84   }
    85   // les période doivent être des entiers, il représentent des nombres de jours
    86   if ( !ereg( "^[0-9]*$", $_POST['short_period'] )
    87        || !ereg("^[0-9]*$", $_POST['long_period'] ) )
    88   {
    89     $error[$i++] = $lang['err_periods'];
    90   }
    91   else
    92   {
    93     // la période longue doit être supérieure à la période courte
    94     if ( $_POST['long_period'] <= $_POST['short_period']
    95          || $_POST['short_period'] <= 0 )
    96     {
    97       $error[$i++] = $lang['err_periods_2'];
    98     }
    99   }
    100   //la taille de l'id de session doit être un entier entre 4 et 50
    101   if ( !ereg( "^[1-9][0-9]*$", $_POST['session_id_size'] )
    102        || $_POST['session_id_size'] < 4
    103        || $_POST['session_id_size'] > 50 )
    104   {
    105     $error[$i++] = $lang['conf_err_sid_size'];
    106   }
    107   // la durée de la session doit être un entier
    108   // supérieur à 5 et inférieur à 60 minutes
    109   if ( !ereg( "^[1-9][0-9]?$", $_POST['session_time'] )
    110        || $_POST['session_time'] < 5
    111        || $_POST['session_time'] > 60 )
    112   {
    113     $error[$i++] = $lang['conf_err_sid_time'];
    114   }
    115   // max_user_listbox doit être un entier compris entre 0 et 255 inclus
    116   if ( !ereg( "^[0-9]{0,3}$", $_POST['max_user_listbox'] )
    117        || $_POST['max_user_listbox'] < 0
    118        || $_POST['max_user_listbox'] > 255 )
    119   {
    120     $error[$i++] = $lang['conf_err_max_user_listbox'];
    121   }
    122   // le nombre de commentaires par page doit être compris entre 5 en 50 inclus
    123   if ( !ereg( "^[1-9][0-9]?$", $_POST['nb_comment_page'] )
    124        || $_POST['nb_comment_page'] < 5
    125        || $_POST['nb_comment_page'] > 50 )
    126   {
    127     $error[$i++] = $lang['conf_err_comment_number'];
    128   }
    129   // le poids maximum des fichiers uploadé doit être un entier,
    130   // compris entre 10 et 1000
    131   if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxfilesize'] )
    132        || $_POST['upload_maxfilesize'] < 10
    133        || $_POST['upload_maxfilesize'] > 1000 )
    134   {
    135     $error[$i++] = $lang['conf_err_upload_maxfilesize'];
    136   }
    137   // la largeur maximum des images uploadées doit être un entier,
    138   // supérieur à 10
    139   if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxwidth'] )
    140        || $_POST['upload_maxwidth'] < 10 )
    141   {
    142     $error[$i++] = $lang['conf_err_upload_maxwidth'];
    143   }
    144   // la hauteur maximum des images uploadées doit être un entier,
    145   // supérieur à 10
    146   if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxheight'] )
    147        || $_POST['upload_maxheight'] < 10 )
    148   {
    149     $error[$i++] = $lang['conf_err_upload_maxheight'];
    150   }
    151   // la largeur maximum des miniatures uploadées doit être un entier,
    152   // supérieur à 10
    153   if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxwidth_thumbnail'] )
    154        || $_POST['upload_maxwidth_thumbnail'] < 10 )
    155   {
    156     $error[$i++] = $lang['conf_err_upload_maxwidth_thumbnail'];
    157   }
    158   // la hauteur maximum des miniatures uploadées doit être un entier,
    159   // supérieur à 10
    160   if ( !ereg( "^[1-9][0-9]*$", $_POST['upload_maxheight_thumbnail'] )
    161        || $_POST['upload_maxheight_thumbnail'] < 10 )
    162   {
    163     $error[$i++] = $lang['conf_err_upload_maxheight_thumbnail'];
    164   }
     96  // session_id size must be an integer between 4 and 50
     97  if ( !is_int( $_POST['session_id_size'] )
     98       or $_POST['session_id_size'] < 4
     99       or $_POST['session_id_size'] > 50 )
     100  {
     101    array_push( $error, $lang['conf_err_sid_size'] );
     102  }
     103  // session_time must be an integer between 5 and 60, in minutes
     104  if ( !is_int( $_POST['session_time'] )
     105       or $_POST['session_time'] < 5
     106       or $_POST['session_time'] > 60 )
     107  {
     108    array_push( $error, $lang['conf_err_sid_time'] );
     109  }
     110  // max_user_listbox must be an integer between 0 and 255 included
     111  if ( !is_int( $_POST['max_user_listbox'] )
     112       or $_POST['max_user_listbox'] < 0
     113       or $_POST['max_user_listbox'] > 255 )
     114  {
     115    array_push( $error, $lang['conf_err_max_user_listbox'] );
     116  }
     117  // the number of comments per page must be an integer between 5 and 50
     118  // included
     119  if ( !is_int( $_POST['nb_comment_page'] )
     120       or $_POST['nb_comment_page'] < 5
     121       or $_POST['nb_comment_page'] > 50 )
     122  {
     123    array_push( $error, $lang['conf_err_comment_number'] );
     124  }
     125  // the maximum upload filesize must be an integer between 10 and 1000
     126  if ( !is_int( $_POST['upload_maxfilesize'] )
     127       or $_POST['upload_maxfilesize'] < 10
     128       or $_POST['upload_maxfilesize'] > 1000 )
     129  {
     130    array_push( $error, $lang['conf_err_upload_maxfilesize'] );
     131  }
     132  // the maximum width of uploaded pictures must be an integer superior to
     133  // 10
     134  if ( !is_int( $_POST['upload_maxwidth'] )
     135       or $_POST['upload_maxwidth'] < 10 )
     136  {
     137    array_push( $error, $lang['conf_err_upload_maxwidth'] );
     138  }
     139  // the maximum height  of uploaded pictures must be an integer superior to
     140  // 10
     141  if ( !is_int( $_POST['upload_maxheight'] )
     142       or $_POST['upload_maxheight'] < 10 )
     143  {
     144    array_push( $error, $lang['conf_err_upload_maxheight'] );
     145  }
     146  // the maximum width of uploaded thumbnails must be an integer superior to
     147  // 10
     148  if ( !is_int( $_POST['upload_maxwidth_thumbnail'] )
     149       or $_POST['upload_maxwidth_thumbnail'] < 10 )
     150  {
     151    array_push( $error, $lang['conf_err_upload_maxwidth_thumbnail'] );
     152  }
     153  // the maximum width of uploaded thumbnails must be an integer superior to
     154  // 10
     155  if ( !is_int( $_POST['upload_maxheight_thumbnail'] )
     156       or $_POST['upload_maxheight_thumbnail'] < 10 )
     157  {
     158    array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
     159  }
     160  $test = '';
     161  if ( is_int( $test ) ) echo 'salut'; exit();
    165162  if ( $_POST['maxwidth'] != '' )
    166163  {
    167164    if ( !ereg( "^[0-9]{2,}$", $_POST['maxwidth'] )
    168          || $_POST['maxwidth'] < 50 )
     165         or $_POST['maxwidth'] < 50 )
    169166    {
    170167      $error[$i++] = $lang['err_maxwidth'];
     
    174171  {
    175172    if ( !ereg( "^[0-9]{2,}$", $_POST['maxheight'] )
    176          || $_POST['maxheight'] < 50 )
     173         or $_POST['maxheight'] < 50 )
    177174    {
    178175      $error[$i++] = $lang['err_maxheight'];
     
    186183    $query = 'insert into '.PREFIX_TABLE.'config';
    187184    $query.= ' (';
    188     for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
    189     {
    190       if ( $i > 0 )
    191       {
    192         $query.= ',';
    193       }
    194       $query.= $conf_infos[$i];
     185    foreach ( $conf_infos as $i => $conf_info ) {
     186      if ( $i > 0 ) $query.= ',';
     187      $query.= $conf_info;
    195188    }
    196189    $query.= ')';
    197190    $query.= ' values';
    198191    $query.= ' (';
    199     for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
    200     {
    201       if ( $i > 0 )
    202       {
    203         $query.= ',';
    204       }
    205       if ( $_POST[$conf_infos[$i]] == '' )
     192    foreach ( $conf_infos as $i => $conf_info ) {
     193      if ( $i > 0 ) $query.= ',';
     194      if ( $_POST[$conf_info] == '' ) $query.= 'NULL';
     195      else                            $query.= "'".$_POST[$conf_info]."'";
     196    }
     197    $query.= ')';
     198    $query.= ';';
     199    echo $query;
     200    mysql_query( $query );
     201
     202    $tab_theme = explode( ' - ', $_POST['theme'] );
     203    $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
     204
     205    $query = 'UPDATE '.PREFIX_TABLE.'users';
     206    $query.= ' SET';
     207    foreach ( $default_user_infos as $i => $default_user_info ) {
     208      if ( $i > 0 ) $query.= ',';
     209      else          $query.= ' ';
     210      $query.= $default_user_info;
     211      $query.= ' = ';
     212      if ( $_POST[$default_user_info] == '' )
    206213      {
    207214        $query.= 'NULL';
     
    209216      else
    210217      {
    211         $query.= "'".$_POST[$conf_infos[$i]]."'";
     218        $query.= "'".$_POST[$default_user_info]."'";
    212219      }
    213220    }
    214     $query.= ')';
     221    $query.= " WHERE username = 'guest'";
    215222    $query.= ';';
    216     echo $query;
    217223    mysql_query( $query );
    218 
    219     $tab_theme = explode( ' - ', $_POST['theme'] );
    220     $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
    221 
    222     $query = 'update '.PREFIX_TABLE.'users';
    223     $query.= ' set';
    224     for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
    225     {
    226       if ( $i > 0 )
    227       {
    228         $query.= ',';
    229       }
    230       else
    231       {
    232         $query.= ' ';
    233       }
    234       $query.= $default_user_infos[$i];
    235       $query.= ' = ';
    236       if ( $_POST[$default_user_infos[$i]] == '' )
    237       {
    238         $query.= 'NULL';
    239       }
    240       else
    241       {
    242         $query.= "'".$_POST[$default_user_infos[$i]]."'";
    243       }
    244     }
    245     $query.= " where username = 'guest';";
    246     mysql_query( $query );
    247224  }
    248225//--------------------------------------------------------- data initialization
    249   for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
    250   {
    251     $$conf_infos[$i] = $_POST[$conf_infos[$i]];
    252   }
    253   for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
    254   {
    255     $$default_user_infos[$i] = $_POST[$default_user_infos[$i]];
     226  foreach ( $conf_infos as $conf_info ) {
     227    $$conf_info = $_POST[$conf_info];
     228  }
     229  foreach ( $default_user_infos as $default_user_info ) {
     230    $$default_user_info = $_POST[$default_user_info];
    256231  }
    257232}
     
    259234{
    260235//--------------------------------------------------------- data initialization
    261   $query  = 'select';
    262   for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
    263   {
    264     if ( $i > 0 )
    265     {
    266       $query.= ',';
    267     }
    268     else
    269     {
    270       $query.= ' ';
    271     }
    272     $query.= $conf_infos[$i];
    273   }
    274   $query .= ' from '.PREFIX_TABLE.'config;';
    275 
     236  $query  = 'SELECT';
     237  foreach ( $conf_infos as $i => $conf_info ) {
     238    if ( $i > 0 ) $query.= ',';
     239    else          $query.= ' ';
     240    $query.= $conf_info;
     241  }
     242  $query .= ' FROM '.PREFIX_TABLE.'config;';
    276243  $row = mysql_fetch_array( mysql_query( $query ) );
    277 
    278   for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
    279   {
    280     $$conf_infos[$i] = $row[$conf_infos[$i]];
    281   }
    282   $query  = 'select';
    283   for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
    284   {
    285     if ( $i > 0 )
    286     {
    287       $query.= ',';
    288     }
    289     else
    290     {
    291       $query.= ' ';
    292     }
    293     $query.= $default_user_infos[$i];
    294   }
    295   $query .= ' from '.PREFIX_TABLE.'users';
    296   $query.= " where username = 'guest'";
     244  foreach ( $conf_infos as $conf_info ) {
     245    $$conf_info = $row[$conf_info];
     246  }
     247
     248  $query  = 'SELECT';
     249  foreach ( $default_user_infos as $i => $default_user_info ) {
     250    if ( $i > 0 ) $query.= ',';
     251    else          $query.= ' ';
     252    $query.= $default_user_info;
     253  }
     254  $query.= ' FROM '.PREFIX_TABLE.'users';
     255  $query.= " WHERE username = 'guest'";
    297256  $query.= ';';
    298 
    299257  $row = mysql_fetch_array( mysql_query( $query ) );
    300 
    301   for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
    302   {
    303     $$default_user_infos[$i] = $row[$default_user_infos[$i]];
     258  foreach ( $default_user_infos as $default_user_info ) {
     259    $$default_user_info = $row[$default_user_info];
    304260  }
    305261}
     
    327283}
    328284//-------------------------------------------------------- confirmation display
    329 if ( sizeof( $error ) == 0 && $_GET['valider'] == 1 )
     285if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
    330286{
    331287  $vtp->addSession( $sub, 'confirmation' );
     
    333289}
    334290//----------------------------------------------------------------- form action
    335 $form_action = add_session_id( './admin.php?page=configuration&valider=1' );
     291$form_action = add_session_id( './admin.php?page=configuration' );
    336292$vtp->setVar( $sub, 'form_action', $form_action );
    337293//------------------------------------------------------- general configuration
     
    386342$vtp->addSession( $sub, 'group' );
    387343$vtp->addSession( $sub, 'radio' );
    388 $vtp->setVar( $sub, 'radio.name', 'acces' );
    389 $vtp->setVar( $sub, 'radio.value', 'libre' );
     344$vtp->setVar( $sub, 'radio.name', 'access' );
     345$vtp->setVar( $sub, 'radio.value', 'free' );
    390346$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
    391347$checked = '';
    392 if ( $acces == 'libre' )
    393 {
    394   $checked = ' checked="checked"';
    395 }
    396 $vtp->setVar( $sub, 'radio.checked', $checked );
    397 $vtp->closeSession( $sub, 'radio' );
    398 $vtp->addSession( $sub, 'radio' );
    399 $vtp->setVar( $sub, 'radio.name', 'acces' );
    400 $vtp->setVar( $sub, 'radio.value', 'restreint' );
     348echo $access.'<br />';
     349if ( $access == 'free' )
     350{
     351  $checked = ' checked="checked"';
     352}
     353$vtp->setVar( $sub, 'radio.checked', $checked );
     354$vtp->closeSession( $sub, 'radio' );
     355$vtp->addSession( $sub, 'radio' );
     356$vtp->setVar( $sub, 'radio.name', 'access' );
     357$vtp->setVar( $sub, 'radio.value', 'restricted' );
    401358$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
    402359$checked = '';
    403 if ( $acces == 'restreint' )
     360if ( $access == 'restricted' )
    404361{
    405362  $checked = ' checked="checked"';
  • trunk/admin/create_listing_file.php

    r10 r19  
    11<?php
    2 $prefixe_thumbnail = 'TN-';
     2$prefix_thumbnail = 'TN-';
    33       
    44$conf['picture_ext'] = array ( 'jpg', 'gif', 'png', 'JPG', 'GIF', 'PNG' );
     
    7171function TN_exists( $dir, $file )
    7272{
    73   global $conf, $prefixe_thumbnail;
     73  global $conf, $prefix_thumbnail;
    7474
    7575  $titre = get_filename_wo_extension( $file );
     
    7777  for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
    7878  {
    79     $base_tn_name = $dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.';
     79    $base_tn_name = $dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.';
    8080    $ext = $conf['picture_ext'][$i];
    8181    if ( is_file( $base_tn_name.$ext ) )
     
    8585  }
    8686  echo 'The thumbnail is missing for '.$dir.'/'.$file;
    87   echo '-> '.$dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.xxx';
     87  echo '-> '.$dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.xxx';
    8888  echo ' ("xxx" can be : ';
    8989  for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
  • trunk/admin/edit_cat.php

    r14 r19  
    11<?php
    22/***************************************************************************
    3  *                              edit_cat.php is                            *
     3 *                               edit_cat.php                              *
    44 *                            -------------------                          *
    55 *   application          : PhpWebGallery 1.3                              *
     
    9292  if ( $option == $row['status'] )
    9393  {
    94     $vtp->setVar( $sub, 'status_option.selected', ' selected="selected"' ); 
     94    $vtp->setVar( $sub, 'status_option.checked', ' checked="checked"' ); 
    9595  }
    9696  $vtp->closeSession( $sub, 'status_option' );
  • trunk/admin/include/functions.php

    r14 r19  
    5454  $filename = get_filename_wo_extension( $file );
    5555  foreach ( $conf['picture_ext'] as $ext ) {
    56     $test = $dir.'/thumbnail/'.$conf['prefixe_thumbnail'].$filename.'.'.$ext;
     56    $test = $dir.'/thumbnail/'.$conf['prefix_thumbnail'].$filename.'.'.$ext;
    5757    if ( is_file ( $test ) )
    5858    {
  • trunk/admin/infos_images.php

    r15 r19  
    220220    }
    221221    $thumbnail_url.= 'thumbnail/';
    222     $thumbnail_url.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
     222    $thumbnail_url.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
    223223    $vtp->setVar( $sub, 'picture.thumbnail_url', $thumbnail_url );
    224224    $vtp->closeSession( $sub, 'picture' );
  • trunk/admin/install.php

    r10 r19  
    335335                          periode_courte smallint(5) unsigned NOT NULL default '7',
    336336                          periode_longue smallint(5) unsigned NOT NULL default '14',
    337                           prefixe_thumbnail varchar(10) NOT NULL default 'TN-',
     337                          prefix_thumbnail varchar(10) NOT NULL default 'TN-',
    338338                          webmaster varchar(255) NOT NULL default '',
    339339                          mail_webmaster varchar(255) NOT NULL default '',
  • trunk/admin/thumbnail.php

    r2 r19  
    160160      mkdir( $path."thumbnail", 0777 );
    161161    }
    162     $dest_file  = $path."thumbnail/".$conf['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension;
     162    $dest_file  = $path."thumbnail/".$conf['prefix_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension;
    163163                       
    164164    // création et sauvegarde de l'image finale
     
    178178                        'height' => $taille_image[1],
    179179                        'size' => $size,
    180                         'tn_name' => $conf['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension,
     180                        'tn_name' => $conf['prefix_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension,
    181181                        'tn_width' => $tn_taille_image[0],
    182182                        'tn_height' => $tn_taille_image[1],
  • trunk/admin/update.php

    r10 r19  
    162162  {
    163163    $lien_image = $rep.'/'.$row['file'];
    164     $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefixe_thumbnail'];
     164    $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefix_thumbnail'];
    165165    $lien_thumbnail.= get_filename_wo_extension( $row['file'] );
    166166    $lien_thumbnail.= '.'.$row['tn_ext'];
     
    230230            $output.= $lang['update_missing_tn'].' : '.$file;
    231231            $output.= ' (<span style="font-weight:bold;">';
    232             $output.= $conf['prefixe_thumbnail'];
     232            $output.= $conf['prefix_thumbnail'];
    233233            $output.= get_filename_wo_extension( $file ).'.XXX</span>';
    234234            $output.= ', XXX = ';
  • trunk/admin/waiting.php

    r10 r19  
    4040                                        {
    4141                                                $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
    42                                                 unlink( ".".$cat['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'] );
     42                                                unlink( ".".$cat['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'] );
    4343                                        }
    4444                                }
     
    9090                {
    9191                        $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
    92                         echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
     92                        echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
    9393                }
    9494                else
  • trunk/category.php

    r17 r19  
    187187$vtp->addSession( $handle, 'summary' );
    188188$vtp->setVar( $handle, 'summary.url',
    189               add_session_id( './about.php?expand='.$page['expand'] ) );
     189              add_session_id( './about.php?'.$_SERVER['QUERY_STRING'] ) );
    190190$vtp->setVar( $handle, 'summary.title', $lang['hint_about'] );
    191191$vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) );
  • trunk/include/config.inc.php

    r17 r19  
    5454// Example :
    5555//            prefixe_thumbnail --> $conf['prefixe_thumbnail']
    56 $infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 'acces',
     56$infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
    5757                'session_id_size', 'session_keyword', 'session_time',
    5858                'max_user_listbox', 'show_comments', 'nb_comment_page',
     
    6262
    6363$query  = 'SELECT';
    64 for ( $i = 0; $i < sizeof( $infos ); $i++ )
    65 {
    66   if ( $i > 0 )
    67   {
    68     $query.= ',';
    69   }
    70   else
    71   {
    72     $query.= ' ';
    73   }
    74   $query.= $infos[$i];
     64foreach ( $infos as $i => $info ) {
     65  if ( $i > 0 ) $query.= ',';
     66  else          $query.= ' ';
     67  $query.= $info;
    7568}
    76 $query .= ' FROM '.PREFIX_TABLE.'config;';
     69$query.= ' FROM '.PREFIX_TABLE.'config;';
    7770
    7871$row = mysql_fetch_array( mysql_query( $query ) );
     
    8073// affectation of each field of the table "config" to an information of the
    8174// array $conf.
    82 for ( $i = 0; $i < sizeof( $infos ); $i++ )
    83 {
    84   $conf[$infos[$i]] = $row[$infos[$i]];
     75foreach ( $infos as $info ) {
     76  $conf[$info] = $row[$info];
    8577  // If the field is true or false, the variable is transformed into a boolean
    8678  // value.
    87   if ( $row[$infos[$i]] == 'true' || $row[$infos[$i]] == 'false' )
     79  if ( $row[$info] == 'true' or $row[$info] == 'false' )
    8880  {
    89     $conf[$infos[$i]] = get_boolean( $row[$infos[$i]] );
     81    $conf[$info] = get_boolean( $row[$info] );
    9082  }
    9183}
  • trunk/include/functions_category.inc.php

    r17 r19  
    406406        $sql_search = array();
    407407        foreach ( $words as $i => $word ) {
     408          // if the user searchs any of the words, the where statement must
     409          // be :
     410          // field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' ...
     411          // OR field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' ...
    408412          if ( $_GET['mode'] == 'OR' )
    409413          {
     
    414418            }
    415419          }
     420          // if the user searchs all the words :
     421          // ( field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' )
     422          // AND ( field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' )
    416423          else if ( $_GET['mode'] == 'AND' )
    417424          {
  • trunk/language/english.php

    r2 r19  
    436436                $lang['help_remote_title'] = "Remote site";
    437437                $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 : ";
    438                 $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-\".";
     438                $lang['help_remote'][1] = "1. edit file \"create_listing_file.php\" (you will find it in the directory \"admin\"), by modifying the line \"$prefix_thumbnail = \"TN-\";\" if the prefix for your thumbnails is not \"TN-\".";
    439439                $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.";
    440440                $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.";
  • trunk/language/francais.php

    r17 r19  
    185185$lang['search_mode_or'] = 'au moins un mot';
    186186$lang['search_mode_and'] = 'tous les mots';
     187$lang['search_comments'] = 'espacer les différents mots avec un espace';
    187188// end version 1.3
    188189$lang['search_field_search'] = 'Rechercher';
  • trunk/picture.php

    r17 r19  
    194194  $file = substr ( $row['file'], 0, strrpos ( $row['file'], '.' ) );
    195195  $lien_thumbnail = $cat_directory.'/thumbnail/';
    196   $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
     196  $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
    197197               
    198198  $prev_title = $lang['previous_image'].' : ';
     
    443443  $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
    444444  $lien_thumbnail = $cat_directory."thumbnail/";
    445   $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
     445  $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
    446446 
    447447  if ( $row['name'] != "" )
  • trunk/search.php

    r17 r19  
    5353//----------------------------------------------------- template initialization
    5454$vtp = new VTemplate;
    55 $handle = $vtp->Open( './template/default/search.vtp' );
    56 // language
    57 $vtp->setGlobalVar( $handle, 'search_page_title',$lang['search_title'] );
    58 $vtp->setGlobalVar( $handle, 'search_title',     $lang['search_title'] );
    59 $vtp->setGlobalVar( $handle, 'search_return_main_page',
    60                     $lang['search_return_main_page'] );
    61 $vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
    62 // user
    63 $vtp->setGlobalVar( $handle, 'page_style',       $user['style'] );
    64 // structure
    65 $vtp->setGlobalVar( $handle, 'frame_start',      get_frame_start() );
    66 $vtp->setGlobalVar( $handle, 'frame_begin',      get_frame_begin() );
    67 $vtp->setGlobalVar( $handle, 'frame_end',        get_frame_end() );
     55$handle = $vtp->Open( './template/'.$user['template'].'/search.vtp' );
     56initialize_template();
     57
     58$tpl = array( 'search_title','search_return_main_page','submit',
     59              'search_comments' );
     60templatize_array( $tpl, 'lang', $handle );
    6861//----------------------------------------------------------------- form action
    6962$vtp->setGlobalVar( $handle, 'form_action', add_session_id( './search.php' ) );
     
    8376// search field
    8477$vtp->addSession( $handle, 'line' );
    85 $vtp->setVar( $handle, 'line.name', $lang['search_field_search'] );
     78$vtp->setVar( $handle, 'line.name', $lang['search_field_search'].' *' );
    8679$vtp->addSession( $handle, 'text' );
    8780$vtp->setVar( $handle, 'text.size', '40' );
  • trunk/template/default/about.vtp

    r2 r19  
    11<html>
    22  <head>
    3     {#page_style}
     3    {#style}
    44    <title>{#about_page_title}</title>
    55  </head>
    66  <body>
     7    {#header}
    78    <table style="width:100%;height:100%">
    89      <tr align="center" valign="middle">
     
    1819          {#frame_end}
    1920          <div style="text-align:center;margin:5px;">
    20             <a onclick="history.back()" style="font-style:italic;font-family:verdana,arial,sans-serif;font-size:12px;">{#about_return}</a>
     21            <a href="{#back_url}">{#about_return}</a>
    2122          </div>
    2223          <div style="text-align:center;margin:5px;">
     
    2627      </tr>
    2728    </table>
     29    {#footer}
    2830  </body>
    2931</html>
  • trunk/template/default/admin/configuration.vtp

    r11 r19  
    8181    <tr>
    8282      <td colspan="3" align="center">
    83         <input type="submit" value="{#submit}">
     83        <input type="submit" name="submit" value="{#submit}">
    8484      </td>
    8585    </tr>
  • trunk/template/default/admin/edit_cat.vtp

    r15 r19  
    2929      <td style="width:20%;">{#editcat_status}</td>
    3030      <td class="row2">
    31         <select name="status">
    32           <!--VTP_status_option-->
    33           <option{#selected}>{#option}</option>
    34           <!--/VTP_status_option-->
    35         </select>
     31        <!--VTP_status_option-->
     32        <input type="radio" name="status" value="{#option}"{#checked} />{#option}
     33        <!--/VTP_status_option-->
     34        {#editcat_status_info}
     35      </td>
     36    </tr>
     37    <tr>
     38      <td style="width:20%;">{#editcat_visible}</td>
     39      <td class="row2">
     40        <!--VTP_visible_option-->
     41        <input type="radio" name="visible" value="{#option}"{#checked} />{#option}
     42        <!--/VTP_visible_option-->
    3643        {#editcat_status_info}
    3744      </td>
  • trunk/template/default/search.vtp

    r17 r19  
    11<html>
    22  <head>
    3     {#page_style}
    4     <title>{#search_page_title}</title>
     3    {#style}
     4    <title>{#search_title}</title>
    55  </head>
    66  <body>
     7    {#header}
    78    <table style="width:100%;height:100%">
    89      <tr align="center" valign="middle">
     
    6667                    </td>
    6768                  </tr>
     69                  <tr>
     70                    <td colspan="2">
     71                      <div style="margin-top:10px;">* : {#search_comments}</div>
     72                    </td>
     73                  </tr>
    6874                </table>
    6975              </form>
     
    7379      </tr>
    7480    </table>
     81    {#footer}
    7582  </body>
    7683</html>
  • trunk/upload.php

    r10 r19  
    3434  $result = array();
    3535  $result['error'] = array();
    36   $i = 0;
    3736  //echo $_FILES['picture']['name']."<br />".$temp_name;
    3837  $extension = get_extension( $_FILES['picture']['name'] );
    3938  if ( $extension != 'gif' and $extension != 'jpg' and $extension != 'png' )
    4039  {
    41     $result['error'][$i++] = $lang['upload_advise_filetype'];
     40    array_push( $result['error'], $lang['upload_advise_filetype'] );
    4241    return $result;
    4342  }
     
    4544  {
    4645    // do we even have a file?
    47     $result['error'][$i++] = "You did not upload anything!";
     46    array_push( $result['error'], "You did not upload anything!" );
    4847  }
    4948  else if ( $_FILES['picture']['size'] > $my_max_file_size * 1024 )
    5049  {
    51     $result['error'][$i++] =
    52       $lang['upload_advise_width'].$my_max_file_size.' KB';
     50    array_push( $result['error'],
     51                $lang['upload_advise_width'].$my_max_file_size.' KB' );
    5352  }
    5453  else
     
    5857    if ( !move_uploaded_file( $_FILES['picture']['tmp_name'], $temp_name ) )
    5958    {
    60       $result['error'][$i++] = $lang['upload_cannot_upload'];
     59      array_push( $result['error'], $lang['upload_cannot_upload'] );
    6160    }
    6261    else
     
    6766           and $size[0] > $image_max_width )
    6867      {
    69         $result['error'][$i++] =
    70           $lang['upload_advise_width'].$image_max_width." px";
     68        array_push( $result['error'],
     69                    $lang['upload_advise_width'].$image_max_width.' px' );
    7170      }
    7271      if ( isset( $image_max_height )
     
    7473           and $size[1] > $image_max_height )
    7574      {
    76         $result['error'][$i++] =
    77           $lang['upload_advise_height'].$image_max_height." px";
     75        array_push( $result['error'],
     76                    $lang['upload_advise_height'].$image_max_height.' px' );
    7877      }
    7978      // $size[2] == 1 means GIF
    8079      // $size[2] == 2 means JPG
    8180      // $size[2] == 3 means PNG
    82       if ( $size[2] != 1 and $size[2] != 2 and $size[2] != 3 )
     81      switch ( $size[2] )
    8382      {
    84         $result['error'][$i++] = $lang['upload_advise_filetype'];
    85       }
    86       else
    87       {
    88         switch ( $size[2] )
    89         {
    90         case 1 :
    91           $result['type'] = 'gif'; break;
    92         case 2 :
    93           $result['type'] = 'jpg'; break;
    94         case 3 :
    95           $result['type'] = 'png'; break;
    96         }
     83      case 1 : $result['type'] = 'gif'; break;
     84      case 2 : $result['type'] = 'jpg'; break;
     85      case 3 : $result['type'] = 'png'; break;
     86      default :
     87        array_push( $result['error'], $lang['upload_advise_filetype'] ); 
    9788      }
    9889    }
     
    127118{
    128119  echo '<div style="text-align:center;">'.$lang['upload_forbidden'].'<br />';
    129   echo '<a href="'.add_session_id_to_url( './diapo.php' ).'">';
     120  echo '<a href="'.add_session_id_to_url( './category.php' ).'">';
    130121  echo $lang['thumbnails'].'</a></div>';
    131122  exit();
Note: See TracChangeset for help on using the changeset viewer.