Changeset 650 for trunk/admin


Ignore:
Timestamp:
Dec 20, 2004, 8:26:43 PM (19 years ago)
Author:
plg
Message:
  • replacement of PREFIX_TABLE constant in delete_user function
  • deletion of $isadmin variable, replaced by constant IN_ADMIN
  • small refactoring
  • in include/common.inc.php, deletion of useless part "Obtain and encode users IP" and corresponding functions encode_ip and decode_ip
  • definition of $confdefault_language deleted from include/config.inc.php : it is already present in database table config
  • function init_userprefs deleted (useless), all its content moved to include/user.inc.php
  • admin.lang.php and faq.lang.php are loaded only if current user is in administrative section
Location:
trunk/admin/include
Files:
2 edited

Legend:

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

    r647 r650  
    331331//     - all sessions linked to this user
    332332//     - all categories informations linked to this user
    333 function delete_user( $user_id )
     333function delete_user($user_id)
    334334{
    335335  // destruction of the access linked to the user
    336   $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
    337   $query.= ' WHERE user_id = '.$user_id;
    338   $query.= ';';
    339   pwg_query( $query );
     336  $query = '
     337DELETE FROM '.USER_ACCESS_TABLE.'
     338  WHERE user_id = '.$user_id.'
     339;';
     340  pwg_query($query);
    340341
    341342  // destruction of the group links for this user
    342   $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
    343   $query.= ' WHERE user_id = '.$user_id;
    344   $query.= ';';
    345   pwg_query( $query );
     343  $query = '
     344DELETE FROM '.USER_GROUP_TABLE.'
     345  WHERE user_id = '.$user_id.'
     346;';
     347  pwg_query($query);
    346348
    347349  // destruction of the favorites associated with the user
    348   $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
    349   $query.= ' WHERE user_id = '.$user_id;
    350   $query.= ';';
    351   pwg_query( $query );
     350  $query = '
     351DELETE FROM '.FAVORITES_TABLE.'
     352  WHERE user_id = '.$user_id.'
     353;';
     354  pwg_query($query);
    352355
    353356  // destruction of the sessions linked with the user
    354   $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
    355   $query.= ' WHERE user_id = '.$user_id;
    356   $query.= ';';
    357   pwg_query( $query );
     357  $query = '
     358DELETE FROM '.SESSIONS_TABLE.'
     359  WHERE user_id = '.$user_id.'
     360;';
     361  pwg_query($query);
    358362
    359363  // destruction of the user
    360   $query = 'DELETE FROM '.USERS_TABLE;
    361   $query.= ' WHERE id = '.$user_id;
    362   $query.= ';';
    363   pwg_query( $query );
     364  $query = '
     365DELETE FROM '.USERS_TABLE.'
     366  WHERE id = '.$user_id.'
     367;';
     368  pwg_query($query);
    364369}
    365370
  • trunk/admin/include/isadmin.inc.php

    r593 r650  
    2828include( PHPWG_ROOT_PATH.'admin/include/functions.php' );
    2929
    30 $isadmin = true;
    31 if ( $user['status'] != 'admin' )
     30if ($user['status'] != 'admin')
    3231{
    3332  echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
Note: See TracChangeset for help on using the changeset viewer.