aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/include/functions.php5
-rw-r--r--include/functions_category.inc.php2
-rw-r--r--include/functions_group.inc.php9
-rw-r--r--include/functions_user.inc.php36
-rw-r--r--language/en_UK.iso-8859-1/common.lang.php32
-rw-r--r--language/fr_FR.iso-8859-1/common.lang.php33
-rw-r--r--profile.php86
-rw-r--r--template/default/profile.tpl56
-rw-r--r--template/default/search.tpl1
9 files changed, 125 insertions, 135 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 9df0303c0..5b113d9ce 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -409,8 +409,7 @@ function check_favorites( $user_id )
$restricted_cat = array();
// retrieving all the favorites for this user and comparing their
// categories to the restricted categories
- $query = 'SELECT image_id';
- $query.= ' FROM '.PREFIX_TABLE.'favorites';
+ $query = 'SELECT image_id FROM '.FAVORITES_TABLE;
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
$result = pwg_query ( $query );
@@ -432,7 +431,7 @@ function check_favorites( $user_id )
}
if ( count( array_diff( $picture_cat, $restricted_cat ) ) == 0 )
{
- $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
+ $query = 'DELETE FROM '.FAVORITES_TABLE;
$query.= ' WHERE image_id = '.$row['image_id'];
$query.= ' AND user_id = '.$user_id;
$query.= ';';
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index d2e3b44ad..34025a704 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -546,7 +546,7 @@ SELECT COUNT(DISTINCT(id)) AS nb_total_images
$query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images';
$query.= ' FROM '.IMAGES_TABLE;
- $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category AS ic';
+ $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.'AS ic';
$query.= ' ON id = ic.image_id';
$query.= $page['where'];
$query.= ';';
diff --git a/include/functions_group.inc.php b/include/functions_group.inc.php
index 8fc6408ad..b02b005f1 100644
--- a/include/functions_group.inc.php
+++ b/include/functions_group.inc.php
@@ -30,8 +30,7 @@
function get_group_restrictions( $group_id )
{
// 1. retrieving ids of private categories
- $query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE status = 'private'";
$query.= ';';
$result = pwg_query( $query );
@@ -42,8 +41,7 @@ function get_group_restrictions( $group_id )
}
// 2. retrieving all authorized categories for the group
$authorized = array();
- $query = 'SELECT cat_id';
- $query.= ' FROM '.PREFIX_TABLE.'group_access';
+ $query = 'SELECT cat_id FROM '.GROUP_ACCESS_TABLE;
$query.= ' WHERE group_id = '.$group_id;
$query.= ';';
$result = pwg_query( $query );
@@ -88,8 +86,7 @@ function is_group_allowed( $category_id, $restrictions )
$is_root = false;
while ( !$is_root and !in_array( $category_id, $restrictions ) )
{
- $query = 'SELECT id_uppercat';
- $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query = 'SELECT id_uppercat FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$category_id;
$query.= ';';
$row = mysql_fetch_array( pwg_query( $query ) );
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 9befa6596..1ac224c31 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -116,42 +116,6 @@ function register_user( $login, $password, $password_conf,
}
$query.= ');';
pwg_query( $query );
- // 3. retrieving the id of the newly created user
- $query = 'SELECT id';
- $query.= ' FROM '.USERS_TABLE;
- $query.= " WHERE username = '".$login."';";
- $row = mysql_fetch_array( pwg_query( $query ) );
- $user_id = $row['id'];
- // 4. adding access to the new user, the same as the user "guest"
- $query = 'SELECT cat_id';
- $query.= ' FROM '.PREFIX_TABLE.'user_access as ua';
- $query.= ','.PREFIX_TABLE.'users as u ';
- $query.= ' where u.id = ua.user_id';
- $query.= " and u.username = 'guest';";
- $result = pwg_query( $query );
- while( $row = mysql_fetch_array( $result ) )
- {
- $query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
- $query.= ' (user_id,cat_id) VALUES';
- $query.= ' ('.$user_id.','.$row['cat_id'].');';
- pwg_query ( $query );
- }
- // 5. associate new user to the same groups that the guest
- $query = 'SELECT group_id';
- $query.= ' FROM '.PREFIX_TABLE.'user_group AS ug';
- $query.= ', '.PREFIX_TABLE.'users AS u';
- $query.= " WHERE u.username = 'guest'";
- $query.= ' AND ug.user_id = u.id';
- $query.= ';';
- $result = pwg_query( $query );
- while( $row = mysql_fetch_array( $result ) )
- {
- $query = 'INSERT INTO '.PREFIX_TABLE.'user_group';
- $query.= ' (user_id,group_id) VALUES';
- $query.= ' ('.$user_id.','.$row['group_id'].')';
- $query.= ';';
- pwg_query ( $query );
- }
}
return $error;
}
diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php
index 55e950d93..606248234 100644
--- a/language/en_UK.iso-8859-1/common.lang.php
+++ b/language/en_UK.iso-8859-1/common.lang.php
@@ -122,8 +122,14 @@ $lang['days'] = 'days';
$lang['today']='Today';
// Customization
-$lang['customize_page_title'] = 'Customization';
+$lang['customize_page_title'] = 'Your Gallery Customization ';
$lang['customize_title'] = 'Customization';
+$lang['preferences'] = 'Preferences';
+$lang['mail_address'] = 'E-mail address';
+$lang['password_hint'] = 'You only have to give your password if you wish to change your e-mail';
+$lang['new_password'] = 'New password';
+$lang['new_password_hint'] = 'You only have to give a password if you wish to change it.';
+$lang['confirm_password_hint'] = 'You only have to confirm your new password if you wish to change it.';
$lang['nb_image_per_row'] = 'Number of images per row';
$lang['nb_row_per_page'] = 'Number of rows per page';
$lang['maxwidth'] = 'Maximum width of the pictures';
@@ -135,8 +141,18 @@ $lang['auto_expand'] = 'Expand all categories';
$lang['show_nb_comments'] = 'Show number of comments';
$lang['recent_period'] = 'Recent period';
$lang['periods_error'] = 'Recent period must be a positive integer value';
-$lang['create_cookie'] = 'Create a cookie';
+// Registration
+$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 password';
+$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
// search
$lang['search_title'] = 'Search';
@@ -225,16 +241,7 @@ $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';
-$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_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
+
$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';
@@ -251,7 +258,6 @@ $lang['upload_username'] = 'Username';
$lang['upload_successful'] = 'Picture uploaded with success, an administrator will validate it as soon as possible';
$lang['guest'] = 'guest';
-$lang['mail_address'] = 'mail address';
$lang['add'] = 'add';
$lang['dissociate'] = 'dissociate';
$lang['mandatory'] = 'obligatory';
diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php
index 4d4b14516..3ca61d27f 100644
--- a/language/fr_FR.iso-8859-1/common.lang.php
+++ b/language/fr_FR.iso-8859-1/common.lang.php
@@ -123,8 +123,13 @@ $lang['today']='Aujourd\'hui';
// Customization
-$lang['customize_page_title'] = 'Personnalisation';
+$lang['customize_page_title'] = 'Personnalisation de votre galerie';
$lang['customize_title'] = 'Personnalisation';
+$lang['preferences'] = 'Préférences';
+$lang['password_hint'] = 'Vous devez confirmer votre mot de passe si vous souhaitez modifier votre adresse e-mail';
+$lang['new_password'] = 'Nouveau mot de passe';
+$lang['new_password_hint'] = 'Vous avez seulement besoin de fournir un mot de passe si vous voulez le changer';
+$lang['confirm_password_hint'] = 'Vous avez seulement besoin de confirmer votre mot de passe si vous l\'avez changé ci-dessus';
$lang['nb_image_per_row'] = 'Nombre d\'images par ligne';
$lang['nb_row_per_page'] = 'Nombre de lignes par page';
$lang['language'] = 'Langue';
@@ -133,13 +138,24 @@ $lang['maxheight'] = 'Hauteur maximum des images';
$lang['auto_expand'] = 'Développer toutes les catégories';
$lang['show_nb_comments'] = 'Montrer le nombre de commentaires';
$lang['recent_period'] = 'Durée de nouveauté';
-$lang['create_cookie'] = 'Créer un cookie';
$lang['theme'] = 'Thème de l\'interface';
-$lang['mail_address'] = 'Adresse mail';
+$lang['mail_address'] = 'Adresse e-mail';
$lang['periods_error'] = 'La période doit être entière.';
$lang['maxwidth_error'] = 'La largeur maximum des images doit être un entier supérieur à 50';
$lang['maxheight_error'] = 'La hauteur maximum des images doit être un entier supérieur à 50';
+// 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 le mot de passe';
+$lang['reg_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
+
// search
$lang['search_title'] = 'Rechercher';
$lang['search_options'] = 'Options de recherche';
@@ -224,16 +240,7 @@ $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';
-$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_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
+
$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';
diff --git a/profile.php b/profile.php
index f7a22b293..71a964d80 100644
--- a/profile.php
+++ b/profile.php
@@ -67,11 +67,30 @@ if ( isset( $_POST['submit'] ) )
{
array_push( $errors, $lang['periods_error'] );
}
- $mail_error = validate_mail_address( $_POST['mail_address'] );
- if ( $mail_error != '' ) array_push( $errors, $mail_error );
+
+ if ( $_POST['mail_address']!= $user['mail_address'])
+ {
+ if (!empty($_POST['password']))
+ array_push( $errors, $lang['reg_err_pass'] );
+ else
+ {
+ // retrieving the encrypted password of the login submitted
+ $query = 'SELECT password FROM '.USERS_TABLE.'
+ WHERE username = \''.$user['username'].'\';';
+ $row = mysql_fetch_array(pwg_query($query));
+ if ($row['password'] == md5($_POST['password']))
+ {
+ $mail_error = validate_mail_address( $_POST['mail_address'] );
+ if ( !empty($mail_error)) array_push( $errors, $mail_error );
+ }
+ else
+ array_push( $errors, $lang['reg_err_pass'] );
+ }
+ }
+
// password must be the same as its confirmation
if ( isset( $_POST['use_new_pwd'] )
- and $_POST['password'] != $_POST['passwordConf'] )
+ and $_POST['use_new_pwd'] != $_POST['passwordConf'] )
array_push( $errors, $lang['reg_err_pass'] );
if ( count( $errors ) == 0 )
@@ -92,26 +111,14 @@ if ( isset( $_POST['submit'] ) )
if ( isset( $_POST['use_new_pwd'] ) )
{
$query = 'UPDATE '.USERS_TABLE;
- $query.= " SET password = '".md5( $_POST['password'] )."'";
+ $query.= " SET password = '".md5( $_POST['use_new_pwd'] )."'";
$query.= ' WHERE id = '.$user['id'];
$query.= ';';
pwg_query( $query );
}
- if ( isset( $_POST['create_cookie'] ) )
- {
- setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
- cookie_path() );
- // update the expiration date of the session
- $query = 'UPDATE '.SESSIONS_TABLE;
- $query.= ' SET expiration = '.$_POST['cookie_expiration'];
- $query.= " WHERE id = '".$page['session_id']."'";
- $query.= ';';
- pwg_query( $query );
- }
+
// redirection
- $url = 'category.php';
- if ( !isset($_POST['create_cookie']) ) $url = add_session_id( $url,true );
- redirect( $url );
+ redirect(add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']));
}
}
//----------------------------------------------------- template initialization
@@ -124,20 +131,30 @@ include(PHPWG_ROOT_PATH.'include/page_header.php');
$template->set_filenames(array('profile'=>'profile.tpl'));
$template->assign_vars(array(
+ 'USERNAME'=>$user['username'],
+ 'EMAIL'=>$user['mail_address'],
'LANG_SELECT'=>language_select($user['language'], 'language'),
'NB_IMAGE_LINE'=>$user['nb_image_line'],
'NB_ROW_PAGE'=>$user['nb_line_page'],
'STYLE_SELECT'=>style_select($user['template'], 'template'),
'RECENT_PERIOD'=>$user['recent_period'],
+ 'MAXWIDTH'=>$user['maxwidth'],
+ 'MAXHEIGHT'=>$user['maxheight'],
$expand=>'checked="checked"',
$nb_comments=>'checked="checked"',
'L_TITLE' => $lang['customize_title'],
- 'L_PASSWORD' => $lang['password'],
- 'L_NEW' => $lang['new'],
- 'L_CONFIRM' => $lang['reg_confirm'],
- 'L_COOKIE' => $lang['create_cookie'],
+ 'L_REGISTRATION_INFO' => $lang['register_title'],
+ 'L_PREFERENCES' => $lang['preferences'],
+ 'L_USERNAME' => $lang['login'],
+ 'L_EMAIL' => $lang['mail_address'],
+ 'L_CURRENT_PASSWORD' => $lang['password'],
+ 'L_CURRENT_PASSWORD_HINT' => $lang['password_hint'],
+ 'L_NEW_PASSWORD' => $lang['new_password'],
+ 'L_NEW_PASSWORD_HINT' => $lang['new_password_hint'],
+ 'L_CONFIRM_PASSWORD' => $lang['reg_confirm'],
+ 'L_CONFIRM_PASSWORD_HINT' => $lang['confirm_password_hint'],
'L_LANG_SELECT'=>$lang['language'],
'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'],
'L_NB_ROW_PAGE'=>$lang['nb_row_per_page'],
@@ -145,15 +162,19 @@ $template->assign_vars(array(
'L_RECENT_PERIOD'=>$lang['recent_period'],
'L_EXPAND_TREE'=>$lang['auto_expand'],
'L_NB_COMMENTS'=>$lang['show_nb_comments'],
+ 'L_MAXWIDTH'=>$lang['maxwidth'],
+ 'L_MAXHEIGHT'=>$lang['maxheight'],
'L_YES'=>$lang['yes'],
'L_NO'=>$lang['no'],
'L_SUBMIT'=>$lang['submit'],
+ 'L_RETURN' => $lang['home'],
+ 'L_RETURN_HINT' => $lang['home_hint'],
'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'profile.php'),
'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'])
));
-
+
//-------------------------------------------------------------- errors display
if ( sizeof( $errors ) != 0 )
{
@@ -163,25 +184,6 @@ if ( sizeof( $errors ) != 0 )
$template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
}
}
-
-$template->assign_block_vars('text',array(
- 'F_LABEL'=>$lang['maxwidth'],
- 'F_NAME'=>'maxwidth',
- 'F_VALUE'=>$user['maxwidth']
- ));
-
-$template->assign_block_vars('text',array(
- 'F_LABEL'=>$lang['maxheight'],
- 'F_NAME'=>'maxheight',
- 'F_VALUE'=>$user['maxheight']
- ));
-
-$template->assign_block_vars('text',array(
- 'F_LABEL'=>$lang['mail_address'],
- 'F_NAME'=>'mail_address',
- 'F_VALUE'=>$user['mail_address']
- ));
-
//----------------------------------------------------------- html code display
$template->pparse('profile');
include(PHPWG_ROOT_PATH.'include/page_tail.php');
diff --git a/template/default/profile.tpl b/template/default/profile.tpl
index a3045f795..1c0aa9edb 100644
--- a/template/default/profile.tpl
+++ b/template/default/profile.tpl
@@ -10,6 +10,32 @@
</div>
<!-- END errors -->
<table width="70%" align="center">
+ <tr class="admin">
+ <th colspan="2">{L_REGISTRATION_INFO}</th>
+ </tr>
+ <tr>
+ <td width="50%">{L_USERNAME}</td>
+ <td><input type="text" name="username" value="{USERNAME}" /></td>
+ </tr>
+ <tr>
+ <td>{L_EMAIL}</td>
+ <td><input type="text" name="mail_address" value="{EMAIL}" /></td>
+ </tr>
+ <tr>
+ <td>{L_CURRENT_PASSWORD} : <br /><span class="small">{L_CURRENT_PASSWORD_HINT}</span></td>
+ <td><input type="password" name="password" value="" /></td>
+ </tr>
+ <tr>
+ <td>{L_NEW_PASSWORD} : <br /><span class="small">{L_NEW_PASSWORD_HINT}</span></td>
+ <td><input type="password" name="use_new_pwd" value="" /></td>
+ </tr>
+ <tr>
+ <td>{L_CONFIRM_PASSWORD} : <br /><span class="small">{L_CONFIRM_PASSWORD_HINT}</span></td>
+ <td><input type="password" name="passwordConf" value="" /></td>
+ </tr>
+ <tr class="admin">
+ <th colspan="2">{L_PREFERENCES}</th>
+ </tr>
<tr>
<td width="60%">{L_NB_IMAGE_LINE}</td>
<td width="40%"><input type="text" size="3" maxlength="2" name="nb_image_line" value="{NB_IMAGE_LINE}" /></td>
@@ -40,32 +66,22 @@
<td><input type="radio" class="radio" name="show_nb_comments" value="true" {NB_COMMENTS_YES} />{L_YES}&nbsp;&nbsp;
<input type="radio" class="radio" name="show_nb_comments" value="false" {NB_COMMENTS_NO} />{L_NO}</td>
</tr>
- <!-- BEGIN text -->
- <tr>
- <td>{text.F_LABEL}</td>
- <td>
- <input type="text" name="{text.F_NAME}" value="{text.F_VALUE}" />
+ <tr>
+ <td>{L_MAXWIDTH}</td>
+ <td><input type="text" size="4" maxlength="4" name="maxwidth" value="{MAXWIDTH}" />
</td>
</tr>
- <!-- END text -->
- <tr>
- <td colspan="2">&nbsp;</td>
- </tr>
- <tr>
- <td>{L_NEW} {L_PASSWORD} <input type="checkbox" name="use_new_pwd" value="1" /></td>
- <td><input type="password" name="password" value="" /></td>
- </tr>
- <tr>
- <td>{L_CONFIRM}</td>
- <td><input type="password" name="passwordConf" value="" /></td>
- </tr>
- <tr>
- <td colspan="2">&nbsp;</td>
+ <tr>
+ <td>{L_MAXHEIGHT}</td>
+ <td><input type="text" size="4" maxlength="4" name="maxheight" value="{MAXHEIGHT}" />
+ </td>
</tr>
- <tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" />
</td>
</tr>
</table>
</form>
+<div style="text-align:center;margin:5px;">
+<a href="{U_RETURN}" title="{L_RETURN_HINT}">[{L_RETURN}]</a>
+</div> \ No newline at end of file
diff --git a/template/default/search.tpl b/template/default/search.tpl
index b93d4f758..6cdb0b924 100644
--- a/template/default/search.tpl
+++ b/template/default/search.tpl
@@ -1,5 +1,4 @@
<div class="titrePage">{L_SEARCH_TITLE}</div>
-<br />
<form method="post" name="post" action="{S_SEARCH_ACTION}">
<!-- BEGIN errors -->
<div class="errors">