Changeset 630


Ignore:
Timestamp:
Dec 2, 2004, 4:42:57 PM (20 years ago)
Author:
gweltas
Message:

Update of the user preferences panel.
Deletion of some PREFIX_TABLE occurences

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r625 r630  
    410410  // retrieving all the favorites for this user and comparing their
    411411  // categories to the restricted categories
    412   $query = 'SELECT image_id';
    413   $query.= ' FROM '.PREFIX_TABLE.'favorites';
     412  $query = 'SELECT image_id FROM '.FAVORITES_TABLE;
    414413  $query.= ' WHERE user_id = '.$user_id;
    415414  $query.= ';';
     
    433432    if ( count( array_diff( $picture_cat, $restricted_cat ) ) == 0 )
    434433    {
    435       $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
     434      $query = 'DELETE FROM '.FAVORITES_TABLE;
    436435      $query.= ' WHERE image_id = '.$row['image_id'];
    437436      $query.= ' AND user_id = '.$user_id;
  • trunk/include/functions_category.inc.php

    r629 r630  
    547547        $query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images';
    548548        $query.= ' FROM '.IMAGES_TABLE;
    549         $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category AS ic';
     549        $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.'AS ic';
    550550        $query.= ' ON id = ic.image_id';
    551551        $query.= $page['where'];
  • trunk/include/functions_group.inc.php

    r593 r630  
    3131{
    3232  // 1. retrieving ids of private categories
    33   $query = 'SELECT id';
    34   $query.= ' FROM '.PREFIX_TABLE.'categories';
     33  $query = 'SELECT id FROM '.CATEGORIES_TABLE;
    3534  $query.= " WHERE status = 'private'";
    3635  $query.= ';';
     
    4342  // 2. retrieving all authorized categories for the group
    4443  $authorized = array();
    45   $query = 'SELECT cat_id';
    46   $query.= ' FROM '.PREFIX_TABLE.'group_access';
     44  $query = 'SELECT cat_id FROM '.GROUP_ACCESS_TABLE;
    4745  $query.= ' WHERE group_id = '.$group_id;
    4846  $query.= ';';
     
    8987  while ( !$is_root and !in_array( $category_id, $restrictions ) )
    9088  {
    91     $query = 'SELECT id_uppercat';
    92     $query.= ' FROM '.PREFIX_TABLE.'categories';
     89    $query = 'SELECT id_uppercat FROM '.CATEGORIES_TABLE;
    9390    $query.= ' WHERE id = '.$category_id;
    9491    $query.= ';';
  • trunk/include/functions_user.inc.php

    r593 r630  
    117117    $query.= ');';
    118118    pwg_query( $query );
    119     // 3. retrieving the id of the newly created user
    120     $query = 'SELECT id';
    121     $query.= ' FROM '.USERS_TABLE;
    122     $query.= " WHERE username = '".$login."';";
    123     $row = mysql_fetch_array( pwg_query( $query ) );
    124     $user_id = $row['id'];
    125     // 4. adding access to the new user, the same as the user "guest"
    126     $query = 'SELECT cat_id';
    127     $query.= ' FROM '.PREFIX_TABLE.'user_access as ua';
    128     $query.=      ','.PREFIX_TABLE.'users as u ';
    129     $query.= ' where u.id = ua.user_id';
    130     $query.= " and u.username = 'guest';";
    131     $result = pwg_query( $query );
    132     while( $row = mysql_fetch_array( $result ) )
    133     {
    134       $query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
    135       $query.= ' (user_id,cat_id) VALUES';
    136       $query.= ' ('.$user_id.','.$row['cat_id'].');';
    137       pwg_query ( $query );
    138     }
    139     // 5. associate new user to the same groups that the guest
    140     $query = 'SELECT group_id';
    141     $query.= ' FROM '.PREFIX_TABLE.'user_group AS ug';
    142     $query.= ',     '.PREFIX_TABLE.'users      AS u';
    143     $query.= " WHERE u.username = 'guest'";
    144     $query.= ' AND ug.user_id = u.id';
    145     $query.= ';';
    146     $result = pwg_query( $query );
    147     while( $row = mysql_fetch_array( $result ) )
    148     {
    149       $query = 'INSERT INTO '.PREFIX_TABLE.'user_group';
    150       $query.= ' (user_id,group_id) VALUES';
    151       $query.= ' ('.$user_id.','.$row['group_id'].')';
    152       $query.= ';';
    153       pwg_query ( $query );
    154     }
    155119  }
    156120  return $error;
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r629 r630  
    123123
    124124// Customization
    125 $lang['customize_page_title'] = 'Customization';
     125$lang['customize_page_title'] = 'Your Gallery Customization ';
    126126$lang['customize_title'] = 'Customization';
     127$lang['preferences'] = 'Preferences';
     128$lang['mail_address'] = 'E-mail address';
     129$lang['password_hint'] = 'You only have to give your password if you wish to change your e-mail';
     130$lang['new_password'] = 'New password';
     131$lang['new_password_hint'] = 'You only have to give a password if you wish to change it.';
     132$lang['confirm_password_hint'] = 'You only have to confirm your new password if you wish to change it.';
    127133$lang['nb_image_per_row'] = 'Number of images per row';
    128134$lang['nb_row_per_page'] = 'Number of rows per page';
     
    136142$lang['recent_period'] = 'Recent period';
    137143$lang['periods_error'] = 'Recent period must be a positive integer value';
    138 $lang['create_cookie'] = 'Create a cookie';
    139 
     144
     145// Registration
     146$lang['register_page_title'] = 'Registration';
     147$lang['register_title'] = 'Registration';
     148$lang['reg_err_login1'] = 'Please, enter a login';
     149$lang['reg_err_login2'] = 'login mustn\'t end with a space character';
     150$lang['reg_err_login3'] = 'login mustn\'t start with a space character';
     151$lang['reg_err_login4'] = 'login mustn\'t contain characters " and \'';
     152$lang['reg_err_login5'] = 'this login is already used';
     153$lang['reg_err_pass'] = 'please enter your password again';
     154$lang['reg_confirm'] = 'Confirm password';
     155$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
    140156
    141157// search
     
    226242$lang['del_favorites_alt'] = 'Delete from favorites';
    227243$lang['del_favorites_hint'] = 'Delete this picture from your favorites';
    228 $lang['register_page_title'] = 'Registration';
    229 $lang['register_title'] = 'Registration';
    230 $lang['reg_err_login1'] = 'Please, enter a login';
    231 $lang['reg_err_login2'] = 'login mustn\'t end with a space character';
    232 $lang['reg_err_login3'] = 'login mustn\'t start with a space character';
    233 $lang['reg_err_login4'] = 'login mustn\'t contain characters " and \'';
    234 $lang['reg_err_login5'] = 'this login is already used';
    235 $lang['reg_err_pass'] = 'please enter your password again';
    236 $lang['reg_confirm'] = 'confirm';
    237 $lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
     244
    238245$lang['upload_forbidden'] = 'You can\'t upload pictures in this category';
    239246$lang['upload_file_exists'] = 'A picture\'s name already used';
     
    252259
    253260$lang['guest'] = 'guest';
    254 $lang['mail_address'] = 'mail address';
    255261$lang['add'] = 'add';
    256262$lang['dissociate'] = 'dissociate';
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r629 r630  
    124124
    125125// Customization
    126 $lang['customize_page_title'] = 'Personnalisation';
     126$lang['customize_page_title'] = 'Personnalisation de votre galerie';
    127127$lang['customize_title'] = 'Personnalisation';
     128$lang['preferences'] = 'Préférences';
     129$lang['password_hint'] = 'Vous devez confirmer votre mot de passe si vous souhaitez modifier votre adresse e-mail';
     130$lang['new_password'] = 'Nouveau mot de passe';
     131$lang['new_password_hint'] = 'Vous avez seulement besoin de fournir un mot de passe si vous voulez le changer';
     132$lang['confirm_password_hint'] = 'Vous avez seulement besoin de confirmer votre mot de passe si vous l\'avez changé ci-dessus';
    128133$lang['nb_image_per_row'] = 'Nombre d\'images par ligne';
    129134$lang['nb_row_per_page'] = 'Nombre de lignes par page';
     
    134139$lang['show_nb_comments'] = 'Montrer le nombre de commentaires';
    135140$lang['recent_period'] = 'Durée de nouveauté';
    136 $lang['create_cookie'] = 'Créer un cookie';
    137141$lang['theme'] = 'Thème de l\'interface';
    138 $lang['mail_address'] = 'Adresse mail';
     142$lang['mail_address'] = 'Adresse e-mail';
    139143$lang['periods_error'] = 'La période doit être entière.';
    140144$lang['maxwidth_error'] = 'La largeur maximum des images doit être un entier supérieur à 50';
    141145$lang['maxheight_error'] = 'La hauteur maximum des images doit être un entier supérieur à 50';
     146
     147// Register
     148$lang['register_page_title'] = 'Enregistrement';
     149$lang['register_title'] = 'Enregistrement';
     150$lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
     151$lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
     152$lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
     153$lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
     154$lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
     155$lang['reg_err_pass'] = 'veuillez retaper le mot de passe';
     156$lang['reg_confirm'] = 'Confirmer le mot de passe';
     157$lang['reg_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
    142158
    143159// search
     
    225241$lang['del_favorites_alt'] = 'Retirer des favoris';
    226242$lang['del_favorites_hint'] = 'supprimer cette image de vos favoris';
    227 $lang['register_page_title'] = 'Enregistrement';
    228 $lang['register_title'] = 'Enregistrement';
    229 $lang['reg_err_login1'] = 'veuillez rentrer un pseudo';
    230 $lang['reg_err_login2'] = 'le pseudo ne doit pas se terminer par un espace';
    231 $lang['reg_err_login3'] = 'le pseudo ne doit pas commencer par un espace';
    232 $lang['reg_err_login4'] = 'le pseudo ne doit pas comporter les caractère " et \'';
    233 $lang['reg_err_login5'] = 'ce pseudo est déjà utilisé';
    234 $lang['reg_err_pass'] = 'veuillez retaper le mot de passe';
    235 $lang['reg_confirm'] = 'confirmer';
    236 $lang['reg_err_mail_address'] = 'l\'adresse mail doit être de la forme xxx@yyy.eee (exemple : jack@altern.org)';
     243
    237244$lang['upload_forbidden'] = 'On ne peut pas ajouter d\'image dans cette catégorie';
    238245$lang['upload_file_exists'] = 'Une image du même nom existe déjà';
  • trunk/profile.php

    r593 r630  
    6868    array_push( $errors, $lang['periods_error'] );
    6969  }
    70   $mail_error = validate_mail_address( $_POST['mail_address'] );
    71   if ( $mail_error != '' ) array_push( $errors, $mail_error );
     70       
     71  if ( $_POST['mail_address']!= $user['mail_address'])
     72  {
     73    if (!empty($_POST['password']))
     74                  array_push( $errors, $lang['reg_err_pass'] );
     75                else
     76                {
     77                // retrieving the encrypted password of the login submitted
     78    $query = 'SELECT password FROM '.USERS_TABLE.'
     79              WHERE username = \''.$user['username'].'\';';
     80    $row = mysql_fetch_array(pwg_query($query));
     81    if ($row['password'] == md5($_POST['password']))
     82    {
     83      $mail_error = validate_mail_address( $_POST['mail_address'] );
     84      if ( !empty($mail_error)) array_push( $errors, $mail_error );
     85    }
     86    else
     87      array_push( $errors, $lang['reg_err_pass'] );
     88          }
     89  }
     90 
    7291  // password must be the same as its confirmation
    7392  if ( isset( $_POST['use_new_pwd'] )
    74        and $_POST['password'] != $_POST['passwordConf'] )
     93       and $_POST['use_new_pwd'] != $_POST['passwordConf'] )
    7594    array_push( $errors, $lang['reg_err_pass'] );
    7695 
     
    93112    {
    94113      $query = 'UPDATE '.USERS_TABLE;
    95       $query.= " SET password = '".md5( $_POST['password'] )."'";
     114      $query.= " SET password = '".md5( $_POST['use_new_pwd'] )."'";
    96115      $query.= ' WHERE id = '.$user['id'];
    97116      $query.= ';';
    98117      pwg_query( $query );
    99118    }
    100     if ( isset( $_POST['create_cookie'] ) )
    101     {
    102       setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
    103                  cookie_path() );
    104       // update the expiration date of the session
    105       $query = 'UPDATE '.SESSIONS_TABLE;
    106       $query.= ' SET expiration = '.$_POST['cookie_expiration'];
    107       $query.= " WHERE id = '".$page['session_id']."'";
    108       $query.= ';';
    109       pwg_query( $query );
    110     }
     119
    111120    // redirection
    112     $url = 'category.php';
    113     if ( !isset($_POST['create_cookie']) ) $url = add_session_id( $url,true );
    114     redirect( $url );
     121    redirect(add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']));
    115122  }
    116123}
     
    125132
    126133$template->assign_vars(array(
     134  'USERNAME'=>$user['username'],
     135  'EMAIL'=>$user['mail_address'],
    127136  'LANG_SELECT'=>language_select($user['language'], 'language'),
    128137  'NB_IMAGE_LINE'=>$user['nb_image_line'],
     
    130139  'STYLE_SELECT'=>style_select($user['template'], 'template'),
    131140  'RECENT_PERIOD'=>$user['recent_period'],
     141  'MAXWIDTH'=>$user['maxwidth'],
     142  'MAXHEIGHT'=>$user['maxheight'],
    132143 
    133144  $expand=>'checked="checked"',
     
    135146 
    136147  'L_TITLE' => $lang['customize_title'],
    137   'L_PASSWORD' => $lang['password'],
    138   'L_NEW' =>  $lang['new'],
    139   'L_CONFIRM' =>  $lang['reg_confirm'],
    140   'L_COOKIE' =>  $lang['create_cookie'],
     148  'L_REGISTRATION_INFO' => $lang['register_title'],
     149  'L_PREFERENCES' => $lang['preferences'],
     150  'L_USERNAME' => $lang['login'],
     151  'L_EMAIL' => $lang['mail_address'],
     152  'L_CURRENT_PASSWORD' => $lang['password'],
     153  'L_CURRENT_PASSWORD_HINT' => $lang['password_hint'],
     154  'L_NEW_PASSWORD' =>  $lang['new_password'],
     155  'L_NEW_PASSWORD_HINT' => $lang['new_password_hint'],
     156  'L_CONFIRM_PASSWORD' =>  $lang['reg_confirm'],
     157  'L_CONFIRM_PASSWORD_HINT' => $lang['confirm_password_hint'],
    141158  'L_LANG_SELECT'=>$lang['language'],
    142159  'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'],
     
    146163  'L_EXPAND_TREE'=>$lang['auto_expand'],
    147164  'L_NB_COMMENTS'=>$lang['show_nb_comments'],
     165  'L_MAXWIDTH'=>$lang['maxwidth'],
     166  'L_MAXHEIGHT'=>$lang['maxheight'],
    148167  'L_YES'=>$lang['yes'],
    149168  'L_NO'=>$lang['no'],
    150169  'L_SUBMIT'=>$lang['submit'],
     170  'L_RETURN' =>  $lang['home'],
     171  'L_RETURN_HINT' =>  $lang['home_hint'], 
    151172 
    152173  'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'profile.php'),
     
    154175  'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'])
    155176  ));
    156        
     177 
    157178//-------------------------------------------------------------- errors display
    158179if ( sizeof( $errors ) != 0 )
     
    164185  }
    165186}
    166 
    167 $template->assign_block_vars('text',array(
    168   'F_LABEL'=>$lang['maxwidth'],
    169   'F_NAME'=>'maxwidth',
    170   'F_VALUE'=>$user['maxwidth']
    171   ));
    172 
    173 $template->assign_block_vars('text',array(
    174   'F_LABEL'=>$lang['maxheight'],
    175   'F_NAME'=>'maxheight',
    176   'F_VALUE'=>$user['maxheight']
    177   ));
    178 
    179 $template->assign_block_vars('text',array(
    180   'F_LABEL'=>$lang['mail_address'],
    181   'F_NAME'=>'mail_address',
    182   'F_VALUE'=>$user['mail_address']
    183   ));
    184 
    185187//----------------------------------------------------------- html code display
    186188$template->pparse('profile');
  • trunk/template/default/profile.tpl

    r452 r630  
    1111<!-- END errors -->
    1212<table width="70%" align="center">
     13  <tr class="admin">
     14    <th colspan="2">{L_REGISTRATION_INFO}</th>
     15  </tr>
     16        <tr>
     17          <td width="50%">{L_USERNAME}</td>
     18          <td><input type="text" name="username" value="{USERNAME}" /></td>
     19  </tr>
     20        <tr>
     21          <td>{L_EMAIL}</td>
     22          <td><input type="text" name="mail_address" value="{EMAIL}" /></td>
     23  </tr>
     24  <tr>
     25        <td>{L_CURRENT_PASSWORD} : <br /><span class="small">{L_CURRENT_PASSWORD_HINT}</span></td>
     26        <td><input type="password" name="password" value="" /></td>
     27  </tr>
     28        <tr>
     29        <td>{L_NEW_PASSWORD} : <br /><span class="small">{L_NEW_PASSWORD_HINT}</span></td>
     30        <td><input type="password" name="use_new_pwd" value="" /></td>
     31  </tr>
     32  <tr>
     33        <td>{L_CONFIRM_PASSWORD} : <br /><span class="small">{L_CONFIRM_PASSWORD_HINT}</span></td>
     34        <td><input type="password" name="passwordConf" value="" /></td>
     35  </tr>
     36  <tr class="admin">
     37    <th colspan="2">{L_PREFERENCES}</th>
     38  </tr>
    1339  <tr>
    1440    <td width="60%">{L_NB_IMAGE_LINE}</td>
     
    4167        <input type="radio" class="radio" name="show_nb_comments" value="false" {NB_COMMENTS_NO} />{L_NO}</td>
    4268  </tr>
    43   <!-- BEGIN text -->
    44   <tr>
    45         <td>{text.F_LABEL}</td>
    46         <td>
    47           <input type="text" name="{text.F_NAME}" value="{text.F_VALUE}" />
     69        <tr>
     70    <td>{L_MAXWIDTH}</td>
     71        <td><input type="text" size="4" maxlength="4" name="maxwidth" value="{MAXWIDTH}" />
    4872        </td>
    4973  </tr>
    50   <!-- END text -->
    51   <tr>
    52         <td colspan="2">&nbsp;</td>
     74        <tr>
     75    <td>{L_MAXHEIGHT}</td>
     76        <td><input type="text" size="4" maxlength="4" name="maxheight" value="{MAXHEIGHT}" />
     77        </td>
    5378  </tr>
    54   <tr>
    55         <td>{L_NEW} {L_PASSWORD} <input type="checkbox" name="use_new_pwd" value="1" /></td>
    56         <td><input type="password" name="password" value="" /></td>
    57   </tr>
    58   <tr>
    59         <td>{L_CONFIRM}</td>
    60         <td><input type="password" name="passwordConf" value="" /></td>
    61   </tr>
    62   <tr>
    63         <td colspan="2">&nbsp;</td>
    64   </tr>
    65   <tr>
    6679        <td colspan="2" align="center">
    6780          <input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" />
     
    7083</table>
    7184</form>
     85<div style="text-align:center;margin:5px;">
     86<a href="{U_RETURN}" title="{L_RETURN_HINT}">[{L_RETURN}]</a>
     87</div>
  • trunk/template/default/search.tpl

    r629 r630  
    11<div class="titrePage">{L_SEARCH_TITLE}</div>
    2 <br />
    32<form method="post" name="post" action="{S_SEARCH_ACTION}">
    43<!-- BEGIN errors -->
Note: See TracChangeset for help on using the changeset viewer.