Ignore:
Timestamp:
Jul 1, 2003, 11:27:20 AM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

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

    r19 r21  
    102102    delete_image( $row['id'] );
    103103  }
    104                
    105   // destruction of the restrictions linked to the category
    106   $query = 'DELETE FROM '.PREFIX_TABLE.'restrictions';
     104
     105  // destruction of the access linked to the category
     106  $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
    107107  $query.= ' WHERE cat_id = '.$id;
    108108  $query.= ';';
    109109  mysql_query( $query );
    110                
     110  $query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
     111  $query.= ' WHERE cat_id = '.$id;
     112  $query.= ';';
     113  mysql_query( $query );
     114
    111115  // destruction of the sub-categories
    112116  $query = 'SELECT id';
     
    119123    delete_category( $row['id'] );
    120124  }
    121                
     125
    122126  // destruction of the category
    123127  $query = 'DELETE FROM '.PREFIX_TABLE.'categories';
     
    157161// The delete_user function delete a user identified by the $user_id
    158162// It also deletes :
    159 //     - all the restrictions linked to this user
     163//     - all the access linked to this user
     164//     - all the links to any group
    160165//     - all the favorites linked to this user
     166//     - all sessions linked to this user
    161167function delete_user( $user_id )
    162168{
    163   // destruction of the restrictions linked to the user
    164   $query = 'DELETE FROM '.PREFIX_TABLE.'restrictions';
    165   $query.= ' WHERE user_id = '.$user_id;
    166   $query.= ';';
    167   mysql_query( $query );
    168                
     169  // destruction of the access linked to the user
     170  $query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
     171  $query.= ' WHERE user_id = '.$user_id;
     172  $query.= ';';
     173  mysql_query( $query );
     174
     175  // destruction of the group links for this user
     176  $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
     177  $query.= ' WHERE user_id = '.$user_id;
     178  $query.= ';';
     179  mysql_query( $query );
     180
    169181  // destruction of the favorites associated with the user
    170182  $query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
     183  $query.= ' WHERE user_id = '.$user_id;
     184  $query.= ';';
     185  mysql_query( $query );
     186
     187  // destruction of the sessions linked with the user
     188  $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
    171189  $query.= ' WHERE user_id = '.$user_id;
    172190  $query.= ';';
     
    179197  mysql_query( $query );
    180198}
    181        
     199
     200// delete_group deletes a group identified by its $group_id.
     201// It also deletes :
     202//     - all the access linked to this group
     203//     - all the links between this group and any user
     204function delete_group( $group_id )
     205{
     206  // destruction of the access linked to the group
     207  $query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
     208  $query.= ' WHERE group_id = '.$group_id;
     209  $query.= ';';
     210  mysql_query( $query );
     211
     212  // destruction of the group links for this group
     213  $query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
     214  $query.= ' WHERE group_id = '.$group_id;
     215  $query.= ';';
     216  mysql_query( $query );
     217
     218  // destruction of the group
     219  $query = 'DELETE FROM '.PREFIX_TABLE.'groups';
     220  $query.= ' WHERE id = '.$group_id;
     221  $query.= ';';
     222  mysql_query( $query );
     223}
     224
    182225// The check_favorites function deletes all the favorites of a user if he is
    183226// not allowed to see them (the category or an upper category is restricted
Note: See TracChangeset for help on using the changeset viewer.