aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/configuration.php287
-rw-r--r--admin/create_listing_file.php8
-rw-r--r--admin/edit_cat.php4
-rw-r--r--admin/include/functions.php2
-rw-r--r--admin/infos_images.php2
-rw-r--r--admin/install.php2
-rw-r--r--admin/thumbnail.php4
-rw-r--r--admin/update.php4
-rw-r--r--admin/waiting.php4
-rw-r--r--category.php2
-rw-r--r--include/config.inc.php28
-rw-r--r--include/functions_category.inc.php7
-rw-r--r--language/english.php2
-rw-r--r--language/francais.php1
-rw-r--r--picture.php4
-rw-r--r--search.php21
-rw-r--r--template/default/about.vtp6
-rw-r--r--template/default/admin/configuration.vtp2
-rw-r--r--template/default/admin/edit_cat.vtp17
-rw-r--r--template/default/search.vtp11
-rw-r--r--upload.php41
21 files changed, 208 insertions, 251 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 300466bb8..d814a3069 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -36,7 +36,7 @@ $Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A",
"ý" => "y", "ÿ" => "y");
//------------------------------ verification and registration of modifications
$conf_infos =
-array( 'prefixe_thumbnail','webmaster','mail_webmaster','acces',
+array( 'prefix_thumbnail','webmaster','mail_webmaster','access',
'session_id_size','session_time','session_keyword','max_user_listbox',
'show_comments','nb_comment_page','upload_available',
'upload_maxfilesize', 'upload_maxwidth','upload_maxheight',
@@ -46,126 +46,123 @@ 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 )
+if ( isset( $_POST['submit'] ) )
{
//purge de la table des session si demandé
if ( $_POST['empty_session_table'] == 1 )
{
- $query = 'delete from '.PREFIX_TABLE.'sessions';
- $query.= ' where expiration < '.time().';';
+ $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
+ $query.= ' WHERE expiration < '.time().';';
mysql_query( $query );
}
// deletion of site as asked
- $query = 'select id';
- $query.= ' from '.PREFIX_TABLE.'sites';
- $query.= " where galleries_url <> './galleries/';";
+ $query = 'SELECT id';
+ $query.= ' FROM '.PREFIX_TABLE.'sites';
+ $query.= " WHERE galleries_url <> './galleries/';";
$result = mysql_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$site = 'delete_site_'.$row['id'];
- if ( $_POST[$site] == 1 )
- {
- delete_site( $row['id'] );
- }
+ if ( $_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 )
+ // thumbnail prefix must not contain accentuated characters
+ $old_prefix = $_POST['prefix_thumbnail'];
+ $prefix = strtr( $_POST['prefix_thumbnail'], $Caracs );
+ if ( $old_prefix != $prefix )
{
- $error[$i++] = $lang['conf_err_prefixe'];
+ array_push( $error, $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'] ) )
+ // mail mail must be formatted as follows : name@server.com
+ $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
+ if ( !preg_match( $pattern, $_POST['mail_webmaster'] ) )
{
- $error[$i++] = $lang['conf_err_mail'];
+ array_push( $error, $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'] ) )
+ // periods must be integer values, they represents number of days
+ if ( !is_int( $_POST['short_period'] )
+ or !is_int( $_POST['long_period'] ) )
{
- $error[$i++] = $lang['err_periods'];
+ array_push( $error, $lang['err_periods'] );
}
else
{
- // la période longue doit être supérieure à la période courte
+ // long period must be longer than short period
if ( $_POST['long_period'] <= $_POST['short_period']
- || $_POST['short_period'] <= 0 )
+ or $_POST['short_period'] <= 0 )
{
- $error[$i++] = $lang['err_periods_2'];
+ array_push( $error, $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 )
+ // session_id size must be an integer between 4 and 50
+ if ( !is_int( $_POST['session_id_size'] )
+ or $_POST['session_id_size'] < 4
+ or $_POST['session_id_size'] > 50 )
{
- $error[$i++] = $lang['conf_err_sid_size'];
+ array_push( $error, $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 )
+ // session_time must be an integer between 5 and 60, in minutes
+ if ( !is_int( $_POST['session_time'] )
+ or $_POST['session_time'] < 5
+ or $_POST['session_time'] > 60 )
{
- $error[$i++] = $lang['conf_err_sid_time'];
+ array_push( $error, $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 )
+ // max_user_listbox must be an integer between 0 and 255 included
+ if ( !is_int( $_POST['max_user_listbox'] )
+ or $_POST['max_user_listbox'] < 0
+ or $_POST['max_user_listbox'] > 255 )
{
- $error[$i++] = $lang['conf_err_max_user_listbox'];
+ array_push( $error, $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 )
+ // the number of comments per page must be an integer between 5 and 50
+ // included
+ if ( !is_int( $_POST['nb_comment_page'] )
+ or $_POST['nb_comment_page'] < 5
+ or $_POST['nb_comment_page'] > 50 )
{
- $error[$i++] = $lang['conf_err_comment_number'];
+ array_push( $error, $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 )
+ // the maximum upload filesize must be an integer between 10 and 1000
+ if ( !is_int( $_POST['upload_maxfilesize'] )
+ or $_POST['upload_maxfilesize'] < 10
+ or $_POST['upload_maxfilesize'] > 1000 )
{
- $error[$i++] = $lang['conf_err_upload_maxfilesize'];
+ array_push( $error, $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 )
+ // the maximum width of uploaded pictures must be an integer superior to
+ // 10
+ if ( !is_int( $_POST['upload_maxwidth'] )
+ or $_POST['upload_maxwidth'] < 10 )
{
- $error[$i++] = $lang['conf_err_upload_maxwidth'];
+ array_push( $error, $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 )
+ // the maximum height of uploaded pictures must be an integer superior to
+ // 10
+ if ( !is_int( $_POST['upload_maxheight'] )
+ or $_POST['upload_maxheight'] < 10 )
{
- $error[$i++] = $lang['conf_err_upload_maxheight'];
+ array_push( $error, $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 )
+ // the maximum width of uploaded thumbnails must be an integer superior to
+ // 10
+ if ( !is_int( $_POST['upload_maxwidth_thumbnail'] )
+ or $_POST['upload_maxwidth_thumbnail'] < 10 )
{
- $error[$i++] = $lang['conf_err_upload_maxwidth_thumbnail'];
+ array_push( $error, $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 )
+ // the maximum width of uploaded thumbnails must be an integer superior to
+ // 10
+ if ( !is_int( $_POST['upload_maxheight_thumbnail'] )
+ or $_POST['upload_maxheight_thumbnail'] < 10 )
{
- $error[$i++] = $lang['conf_err_upload_maxheight_thumbnail'];
+ array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
}
+ $test = '';
+ if ( is_int( $test ) ) echo 'salut'; exit();
if ( $_POST['maxwidth'] != '' )
{
if ( !ereg( "^[0-9]{2,}$", $_POST['maxwidth'] )
- || $_POST['maxwidth'] < 50 )
+ or $_POST['maxwidth'] < 50 )
{
$error[$i++] = $lang['err_maxwidth'];
}
@@ -173,7 +170,7 @@ if ( $_GET['valider'] == 1 )
if ( $_POST['maxheight'] != '' )
{
if ( !ereg( "^[0-9]{2,}$", $_POST['maxheight'] )
- || $_POST['maxheight'] < 50 )
+ or $_POST['maxheight'] < 50 )
{
$error[$i++] = $lang['err_maxheight'];
}
@@ -185,31 +182,17 @@ if ( $_GET['valider'] == 1 )
mysql_query( 'delete from '.PREFIX_TABLE.'config;' );
$query = 'insert into '.PREFIX_TABLE.'config';
$query.= ' (';
- for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
- {
- if ( $i > 0 )
- {
- $query.= ',';
- }
- $query.= $conf_infos[$i];
+ foreach ( $conf_infos as $i => $conf_info ) {
+ if ( $i > 0 ) $query.= ',';
+ $query.= $conf_info;
}
$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]]."'";
- }
+ foreach ( $conf_infos as $i => $conf_info ) {
+ if ( $i > 0 ) $query.= ',';
+ if ( $_POST[$conf_info] == '' ) $query.= 'NULL';
+ else $query.= "'".$_POST[$conf_info]."'";
}
$query.= ')';
$query.= ';';
@@ -219,88 +202,61 @@ if ( $_GET['valider'] == 1 )
$tab_theme = explode( ' - ', $_POST['theme'] );
$_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
- $query = 'update '.PREFIX_TABLE.'users';
- $query.= ' set';
- for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
- {
- if ( $i > 0 )
- {
- $query.= ',';
- }
- else
- {
- $query.= ' ';
- }
- $query.= $default_user_infos[$i];
+ $query = 'UPDATE '.PREFIX_TABLE.'users';
+ $query.= ' SET';
+ foreach ( $default_user_infos as $i => $default_user_info ) {
+ if ( $i > 0 ) $query.= ',';
+ else $query.= ' ';
+ $query.= $default_user_info;
$query.= ' = ';
- if ( $_POST[$default_user_infos[$i]] == '' )
+ if ( $_POST[$default_user_info] == '' )
{
$query.= 'NULL';
}
else
{
- $query.= "'".$_POST[$default_user_infos[$i]]."'";
+ $query.= "'".$_POST[$default_user_info]."'";
}
}
- $query.= " where username = 'guest';";
+ $query.= " WHERE username = 'guest'";
+ $query.= ';';
mysql_query( $query );
}
//--------------------------------------------------------- data initialization
- for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
- {
- $$conf_infos[$i] = $_POST[$conf_infos[$i]];
+ foreach ( $conf_infos as $conf_info ) {
+ $$conf_info = $_POST[$conf_info];
}
- for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
- {
- $$default_user_infos[$i] = $_POST[$default_user_infos[$i]];
+ foreach ( $default_user_infos as $default_user_info ) {
+ $$default_user_info = $_POST[$default_user_info];
}
}
else
{
//--------------------------------------------------------- data initialization
- $query = 'select';
- for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
- {
- if ( $i > 0 )
- {
- $query.= ',';
- }
- else
- {
- $query.= ' ';
- }
- $query.= $conf_infos[$i];
+ $query = 'SELECT';
+ foreach ( $conf_infos as $i => $conf_info ) {
+ if ( $i > 0 ) $query.= ',';
+ else $query.= ' ';
+ $query.= $conf_info;
}
- $query .= ' from '.PREFIX_TABLE.'config;';
-
+ $query .= ' FROM '.PREFIX_TABLE.'config;';
$row = mysql_fetch_array( mysql_query( $query ) );
-
- for ( $i = 0; $i < sizeof( $conf_infos ); $i++ )
- {
- $$conf_infos[$i] = $row[$conf_infos[$i]];
+ foreach ( $conf_infos as $conf_info ) {
+ $$conf_info = $row[$conf_info];
}
- $query = 'select';
- for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ )
- {
- if ( $i > 0 )
- {
- $query.= ',';
- }
- else
- {
- $query.= ' ';
- }
- $query.= $default_user_infos[$i];
+
+ $query = 'SELECT';
+ foreach ( $default_user_infos as $i => $default_user_info ) {
+ if ( $i > 0 ) $query.= ',';
+ else $query.= ' ';
+ $query.= $default_user_info;
}
- $query .= ' from '.PREFIX_TABLE.'users';
- $query.= " where username = 'guest'";
+ $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= " WHERE username = 'guest'";
$query.= ';';
-
$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]];
+ foreach ( $default_user_infos as $default_user_info ) {
+ $$default_user_info = $row[$default_user_info];
}
}
//----------------------------------------------------- template initialization
@@ -326,13 +282,13 @@ if ( sizeof( $error ) != 0 )
$vtp->closeSession( $sub, 'errors' );
}
//-------------------------------------------------------- confirmation display
-if ( sizeof( $error ) == 0 && $_GET['valider'] == 1 )
+if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
{
$vtp->addSession( $sub, 'confirmation' );
$vtp->closeSession( $sub, 'confirmation' );
}
//----------------------------------------------------------------- form action
-$form_action = add_session_id( './admin.php?page=configuration&valider=1' );
+$form_action = add_session_id( './admin.php?page=configuration' );
$vtp->setVar( $sub, 'form_action', $form_action );
//------------------------------------------------------- general configuration
$vtp->addSession( $sub, 'line' );
@@ -385,22 +341,23 @@ $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.name', 'access' );
+$vtp->setVar( $sub, 'radio.value', 'free' );
$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
$checked = '';
-if ( $acces == 'libre' )
+echo $access.'<br />';
+if ( $access == 'free' )
{
$checked = ' checked="checked"';
}
$vtp->setVar( $sub, 'radio.checked', $checked );
$vtp->closeSession( $sub, 'radio' );
$vtp->addSession( $sub, 'radio' );
-$vtp->setVar( $sub, 'radio.name', 'acces' );
-$vtp->setVar( $sub, 'radio.value', 'restreint' );
+$vtp->setVar( $sub, 'radio.name', 'access' );
+$vtp->setVar( $sub, 'radio.value', 'restricted' );
$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
$checked = '';
-if ( $acces == 'restreint' )
+if ( $access == 'restricted' )
{
$checked = ' checked="checked"';
}
diff --git a/admin/create_listing_file.php b/admin/create_listing_file.php
index f3b816bbc..1a066a12e 100644
--- a/admin/create_listing_file.php
+++ b/admin/create_listing_file.php
@@ -1,5 +1,5 @@
<?php
-$prefixe_thumbnail = 'TN-';
+$prefix_thumbnail = 'TN-';
$conf['picture_ext'] = array ( 'jpg', 'gif', 'png', 'JPG', 'GIF', 'PNG' );
@@ -70,13 +70,13 @@ function is_image( $filename )
function TN_exists( $dir, $file )
{
- global $conf, $prefixe_thumbnail;
+ global $conf, $prefix_thumbnail;
$titre = get_filename_wo_extension( $file );
for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
{
- $base_tn_name = $dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.';
+ $base_tn_name = $dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.';
$ext = $conf['picture_ext'][$i];
if ( is_file( $base_tn_name.$ext ) )
{
@@ -84,7 +84,7 @@ function TN_exists( $dir, $file )
}
}
echo 'The thumbnail is missing for '.$dir.'/'.$file;
- echo '-> '.$dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.xxx';
+ echo '-> '.$dir.'/thumbnail/'.$prefix_thumbnail.$titre.'.xxx';
echo ' ("xxx" can be : ';
for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ )
{
diff --git a/admin/edit_cat.php b/admin/edit_cat.php
index 9075039cc..bcd78b751 100644
--- a/admin/edit_cat.php
+++ b/admin/edit_cat.php
@@ -1,6 +1,6 @@
<?php
/***************************************************************************
- * edit_cat.php is *
+ * edit_cat.php *
* ------------------- *
* application : PhpWebGallery 1.3 *
* author : Pierrick LE GALL <pierrick@z0rglub.com> *
@@ -91,7 +91,7 @@ foreach ( $options as $option ) {
$vtp->setVar( $sub, 'status_option.option', $option );
if ( $option == $row['status'] )
{
- $vtp->setVar( $sub, 'status_option.selected', ' selected="selected"' );
+ $vtp->setVar( $sub, 'status_option.checked', ' checked="checked"' );
}
$vtp->closeSession( $sub, 'status_option' );
}
diff --git a/admin/include/functions.php b/admin/include/functions.php
index ee7068c18..c6678caf0 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -53,7 +53,7 @@ function TN_exists( $dir, $file )
$filename = get_filename_wo_extension( $file );
foreach ( $conf['picture_ext'] as $ext ) {
- $test = $dir.'/thumbnail/'.$conf['prefixe_thumbnail'].$filename.'.'.$ext;
+ $test = $dir.'/thumbnail/'.$conf['prefix_thumbnail'].$filename.'.'.$ext;
if ( is_file ( $test ) )
{
return $ext;
diff --git a/admin/infos_images.php b/admin/infos_images.php
index 546234189..7735caba2 100644
--- a/admin/infos_images.php
+++ b/admin/infos_images.php
@@ -219,7 +219,7 @@ if ( isset( $page['cat'] ) )
$thumbnail_url = $cat['dir'];
}
$thumbnail_url.= 'thumbnail/';
- $thumbnail_url.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ $thumbnail_url.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
$vtp->setVar( $sub, 'picture.thumbnail_url', $thumbnail_url );
$vtp->closeSession( $sub, 'picture' );
}
diff --git a/admin/install.php b/admin/install.php
index 00058365f..91a235f7b 100644
--- a/admin/install.php
+++ b/admin/install.php
@@ -334,7 +334,7 @@ else if ( $HTTP_GET_VARS['step'] == 2 )
$query = "CREATE TABLE ".PREFIX_TABLE."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-',
+ prefix_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',
diff --git a/admin/thumbnail.php b/admin/thumbnail.php
index e68ee2407..72f384a45 100644
--- a/admin/thumbnail.php
+++ b/admin/thumbnail.php
@@ -159,7 +159,7 @@ function RatioResizeImg( $image, $newWidth, $newHeight, $path, $extension)
umask(0000);
mkdir( $path."thumbnail", 0777 );
}
- $dest_file = $path."thumbnail/".$conf['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension;
+ $dest_file = $path."thumbnail/".$conf['prefix_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension;
// création et sauvegarde de l'image finale
imagejpeg($destImage, $dest_file);
@@ -177,7 +177,7 @@ function RatioResizeImg( $image, $newWidth, $newHeight, $path, $extension)
'width' => $taille_image[0],
'height' => $taille_image[1],
'size' => $size,
- 'tn_name' => $conf['prefixe_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension,
+ 'tn_name' => $conf['prefix_thumbnail'].substr ( $image, 0, strrpos ( $image, ".") ).".".$extension,
'tn_width' => $tn_taille_image[0],
'tn_height' => $tn_taille_image[1],
'tn_size' => $tn_size
diff --git a/admin/update.php b/admin/update.php
index 8684660e1..bdd4d8a43 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -161,7 +161,7 @@ function insert_local_image( $rep, $category_id )
while ( $row = mysql_fetch_array( $result ) )
{
$lien_image = $rep.'/'.$row['file'];
- $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefixe_thumbnail'];
+ $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefix_thumbnail'];
$lien_thumbnail.= get_filename_wo_extension( $row['file'] );
$lien_thumbnail.= '.'.$row['tn_ext'];
@@ -229,7 +229,7 @@ function insert_local_image( $rep, $category_id )
$output.= '<span style="color:red;">';
$output.= $lang['update_missing_tn'].' : '.$file;
$output.= ' (<span style="font-weight:bold;">';
- $output.= $conf['prefixe_thumbnail'];
+ $output.= $conf['prefix_thumbnail'];
$output.= get_filename_wo_extension( $file ).'.XXX</span>';
$output.= ', XXX = ';
$output.= implode( ', ', $conf['picture_ext'] );
diff --git a/admin/waiting.php b/admin/waiting.php
index 927c976ae..2f1964266 100644
--- a/admin/waiting.php
+++ b/admin/waiting.php
@@ -39,7 +39,7 @@
if ( $row['tn_ext'] != "" )
{
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
- unlink( ".".$cat['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'] );
+ unlink( ".".$cat['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'] );
}
}
}
@@ -89,7 +89,7 @@
if ( $row['tn_ext'] != "" )
{
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
- echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ 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'];
}
else
{
diff --git a/category.php b/category.php
index c0b803528..e83c8bd95 100644
--- a/category.php
+++ b/category.php
@@ -186,7 +186,7 @@ $vtp->closeSession( $handle, 'summary' );
// about link
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.url',
- add_session_id( './about.php?expand='.$page['expand'] ) );
+ add_session_id( './about.php?'.$_SERVER['QUERY_STRING'] ) );
$vtp->setVar( $handle, 'summary.title', $lang['hint_about'] );
$vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) );
$vtp->closeSession( $handle, 'summary' );
diff --git a/include/config.inc.php b/include/config.inc.php
index 25566bd79..aabbd5ac0 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -53,7 +53,7 @@ database_connection();
// Each field becomes an information of the array $conf.
// Example :
// prefixe_thumbnail --> $conf['prefixe_thumbnail']
-$infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 'acces',
+$infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
'session_id_size', 'session_keyword', 'session_time',
'max_user_listbox', 'show_comments', 'nb_comment_page',
'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
@@ -61,32 +61,24 @@ $infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 'acces',
'upload_maxheight_thumbnail' );
$query = 'SELECT';
-for ( $i = 0; $i < sizeof( $infos ); $i++ )
-{
- if ( $i > 0 )
- {
- $query.= ',';
- }
- else
- {
- $query.= ' ';
- }
- $query.= $infos[$i];
+foreach ( $infos as $i => $info ) {
+ if ( $i > 0 ) $query.= ',';
+ else $query.= ' ';
+ $query.= $info;
}
-$query .= ' FROM '.PREFIX_TABLE.'config;';
+$query.= ' FROM '.PREFIX_TABLE.'config;';
$row = mysql_fetch_array( mysql_query( $query ) );
// affectation of each field of the table "config" to an information of the
// array $conf.
-for ( $i = 0; $i < sizeof( $infos ); $i++ )
-{
- $conf[$infos[$i]] = $row[$infos[$i]];
+foreach ( $infos as $info ) {
+ $conf[$info] = $row[$info];
// If the field is true or false, the variable is transformed into a boolean
// value.
- if ( $row[$infos[$i]] == 'true' || $row[$infos[$i]] == 'false' )
+ if ( $row[$info] == 'true' or $row[$info] == 'false' )
{
- $conf[$infos[$i]] = get_boolean( $row[$infos[$i]] );
+ $conf[$info] = get_boolean( $row[$info] );
}
}
$conf['log'] = false;
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index aa4e277dc..21de2ad71 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -405,6 +405,10 @@ function initialize_category( $calling_page = 'category' )
$words = explode( ',', $_GET['search'] );
$sql_search = array();
foreach ( $words as $i => $word ) {
+ // if the user searchs any of the words, the where statement must
+ // be :
+ // field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' ...
+ // OR field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' ...
if ( $_GET['mode'] == 'OR' )
{
if ( $i != 0 ) $page['where'].= ' OR';
@@ -413,6 +417,9 @@ function initialize_category( $calling_page = 'category' )
$page['where'].= ' '.$field." LIKE '%".$word."%'";
}
}
+ // if the user searchs all the words :
+ // ( field1 LIKE '%$word1%' OR field2 LIKE '%$word1%' )
+ // AND ( field1 LIKE '%$word2%' OR field2 LIKE '%$word2%' )
else if ( $_GET['mode'] == 'AND' )
{
if ( $i != 0 ) $page['where'].= ' AND';
diff --git a/language/english.php b/language/english.php
index bc4642ae3..10778b1a2 100644
--- a/language/english.php
+++ b/language/english.php
@@ -435,7 +435,7 @@
$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'][1] = "1. edit file \"create_listing_file.php\" (you will find it in the directory \"admin\"), by modifying the line \"$prefix_thumbnail = \"TN-\";\" if the prefix for your thumbnails is not \"TN-\".";
$lang['help_remote'][2] = "2. place file \"create_listing_file.php\" modified on your distant website, in the root directory of your directories of images (as the directory \"galleries\" of this website) by ftp.";
$lang['help_remote'][3] = "3. launch script using the url http://domaineDistant/repGalerie/create_listing_file.php, a file listing.xml has just been created.";
$lang['help_remote'][4] = "4. get back file listing.xml from your distant website to place it in directory \"admin\" of this website.";
diff --git a/language/francais.php b/language/francais.php
index b725f8698..9aefc4840 100644
--- a/language/francais.php
+++ b/language/francais.php
@@ -184,6 +184,7 @@ $lang['search_title'] = 'Recherche';
$lang['invalid_search'] = 'Les mots recherchés doivent comporter plus de 3 caractères et ne doivent pas inclure de caractères de ponctuation';
$lang['search_mode_or'] = 'au moins un mot';
$lang['search_mode_and'] = 'tous les mots';
+$lang['search_comments'] = 'espacer les différents mots avec un espace';
// end version 1.3
$lang['search_field_search'] = 'Rechercher';
$lang['search_return_main_page'] = 'Retour à la page des miniatures';
diff --git a/picture.php b/picture.php
index 76a0fdaa0..bcfbeeaa8 100644
--- a/picture.php
+++ b/picture.php
@@ -193,7 +193,7 @@ if ( $page['num'] >= 1 )
$file = substr ( $row['file'], 0, strrpos ( $row['file'], '.' ) );
$lien_thumbnail = $cat_directory.'/thumbnail/';
- $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
$prev_title = $lang['previous_image'].' : ';
$alt_thumbnaill = '';
@@ -442,7 +442,7 @@ if ( $page['num'] < $page['cat_nb_images']-1 )
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
$lien_thumbnail = $cat_directory."thumbnail/";
- $lien_thumbnail.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ $lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
if ( $row['name'] != "" )
{
diff --git a/search.php b/search.php
index 81d5d97f9..43f878ef9 100644
--- a/search.php
+++ b/search.php
@@ -52,19 +52,12 @@ if ( isset( $_POST['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() );
+$handle = $vtp->Open( './template/'.$user['template'].'/search.vtp' );
+initialize_template();
+
+$tpl = array( 'search_title','search_return_main_page','submit',
+ 'search_comments' );
+templatize_array( $tpl, 'lang', $handle );
//----------------------------------------------------------------- form action
$vtp->setGlobalVar( $handle, 'form_action', add_session_id( './search.php' ) );
//-------------------------------------------------------------- errors display
@@ -82,7 +75,7 @@ if ( sizeof( $error ) != 0 )
//------------------------------------------------------------------------ form
// search field
$vtp->addSession( $handle, 'line' );
-$vtp->setVar( $handle, 'line.name', $lang['search_field_search'] );
+$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' );
diff --git a/template/default/about.vtp b/template/default/about.vtp
index 6e55751a8..c5d374b10 100644
--- a/template/default/about.vtp
+++ b/template/default/about.vtp
@@ -1,9 +1,10 @@
<html>
<head>
- {#page_style}
+ {#style}
<title>{#about_page_title}</title>
</head>
<body>
+ {#header}
<table style="width:100%;height:100%">
<tr align="center" valign="middle">
<td>
@@ -17,7 +18,7 @@
</div>
{#frame_end}
<div style="text-align:center;margin:5px;">
- <a onclick="history.back()" style="font-style:italic;font-family:verdana,arial,sans-serif;font-size:12px;">{#about_return}</a>
+ <a href="{#back_url}">{#about_return}</a>
</div>
<div style="text-align:center;margin:5px;">
<img src="./images/php_sqreuil_artistes.gif" alt="php logo" />
@@ -25,5 +26,6 @@
</td>
</tr>
</table>
+ {#footer}
</body>
</html> \ No newline at end of file
diff --git a/template/default/admin/configuration.vtp b/template/default/admin/configuration.vtp
index 6c415660c..cf2e355a6 100644
--- a/template/default/admin/configuration.vtp
+++ b/template/default/admin/configuration.vtp
@@ -80,7 +80,7 @@
<!--/VTP_remote_sites-->
<tr>
<td colspan="3" align="center">
- <input type="submit" value="{#submit}">
+ <input type="submit" name="submit" value="{#submit}">
</td>
</tr>
</table>
diff --git a/template/default/admin/edit_cat.vtp b/template/default/admin/edit_cat.vtp
index 56ec99505..4bafd765b 100644
--- a/template/default/admin/edit_cat.vtp
+++ b/template/default/admin/edit_cat.vtp
@@ -28,11 +28,18 @@
<tr>
<td style="width:20%;">{#editcat_status}</td>
<td class="row2">
- <select name="status">
- <!--VTP_status_option-->
- <option{#selected}>{#option}</option>
- <!--/VTP_status_option-->
- </select>
+ <!--VTP_status_option-->
+ <input type="radio" name="status" value="{#option}"{#checked} />{#option}
+ <!--/VTP_status_option-->
+ {#editcat_status_info}
+ </td>
+ </tr>
+ <tr>
+ <td style="width:20%;">{#editcat_visible}</td>
+ <td class="row2">
+ <!--VTP_visible_option-->
+ <input type="radio" name="visible" value="{#option}"{#checked} />{#option}
+ <!--/VTP_visible_option-->
{#editcat_status_info}
</td>
</tr>
diff --git a/template/default/search.vtp b/template/default/search.vtp
index 8ba9039c7..cfbceadea 100644
--- a/template/default/search.vtp
+++ b/template/default/search.vtp
@@ -1,9 +1,10 @@
<html>
<head>
- {#page_style}
- <title>{#search_page_title}</title>
+ {#style}
+ <title>{#search_title}</title>
</head>
<body>
+ {#header}
<table style="width:100%;height:100%">
<tr align="center" valign="middle">
<td>
@@ -65,6 +66,11 @@
<a href="{#back_url}">[ {#search_return_main_page} ]</a>
</td>
</tr>
+ <tr>
+ <td colspan="2">
+ <div style="margin-top:10px;">* : {#search_comments}</div>
+ </td>
+ </tr>
</table>
</form>
</div>
@@ -72,5 +78,6 @@
</td>
</tr>
</table>
+ {#footer}
</body>
</html> \ No newline at end of file
diff --git a/upload.php b/upload.php
index e9e1c979f..b22432d6d 100644
--- a/upload.php
+++ b/upload.php
@@ -33,23 +33,22 @@ function validate_upload( $temp_name, $my_max_file_size,
$result = array();
$result['error'] = array();
- $i = 0;
//echo $_FILES['picture']['name']."<br />".$temp_name;
$extension = get_extension( $_FILES['picture']['name'] );
if ( $extension != 'gif' and $extension != 'jpg' and $extension != 'png' )
{
- $result['error'][$i++] = $lang['upload_advise_filetype'];
+ array_push( $result['error'], $lang['upload_advise_filetype'] );
return $result;
}
if ( !isset( $_FILES['picture'] ) )
{
// do we even have a file?
- $result['error'][$i++] = "You did not upload anything!";
+ array_push( $result['error'], "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';
+ array_push( $result['error'],
+ $lang['upload_advise_width'].$my_max_file_size.' KB' );
}
else
{
@@ -57,7 +56,7 @@ function validate_upload( $temp_name, $my_max_file_size,
// 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'];
+ array_push( $result['error'], $lang['upload_cannot_upload'] );
}
else
{
@@ -66,34 +65,26 @@ function validate_upload( $temp_name, $my_max_file_size,
and $image_max_width != ""
and $size[0] > $image_max_width )
{
- $result['error'][$i++] =
- $lang['upload_advise_width'].$image_max_width." px";
+ array_push( $result['error'],
+ $lang['upload_advise_width'].$image_max_width.' px' );
}
if ( isset( $image_max_height )
and $image_max_height != ""
and $size[1] > $image_max_height )
{
- $result['error'][$i++] =
- $lang['upload_advise_height'].$image_max_height." px";
+ array_push( $result['error'],
+ $lang['upload_advise_height'].$image_max_height.' px' );
}
// $size[2] == 1 means GIF
// $size[2] == 2 means JPG
// $size[2] == 3 means PNG
- if ( $size[2] != 1 and $size[2] != 2 and $size[2] != 3 )
+ switch ( $size[2] )
{
- $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;
- }
+ case 1 : $result['type'] = 'gif'; break;
+ case 2 : $result['type'] = 'jpg'; break;
+ case 3 : $result['type'] = 'png'; break;
+ default :
+ array_push( $result['error'], $lang['upload_advise_filetype'] );
}
}
}
@@ -126,7 +117,7 @@ if ( $access_forbidden == true
or $conf['upload_available'] == 'false' )
{
echo '<div style="text-align:center;">'.$lang['upload_forbidden'].'<br />';
- echo '<a href="'.add_session_id_to_url( './diapo.php' ).'">';
+ echo '<a href="'.add_session_id_to_url( './category.php' ).'">';
echo $lang['thumbnails'].'</a></div>';
exit();
}