Ignore:
Timestamp:
Mar 7, 2011, 4:09:40 PM (13 years ago)
Author:
flop25
Message:

bug:1901
lots of bugs will be solved now, because the plugin were not able to manage users with multiple groups (the groups with an id inferior than the groups of Adultcontent caused bugs).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/adult_content/charte_user.php

    r9557 r9564  
    1212   $page['body_id'] = 'adult_content_page';
    1313   include(PHPWG_ROOT_PATH.'include/page_header.php');
    14    //include(get_language_filepath('plugin.lang.php', $adult_content->plugin_path));
    1514   load_language('plugin.lang', $adult_content->plugin_path);
    1615
     
    1918       'PLUGIN_NAME' => $adult_content->plugin_name
    2019       ));
     20////////////lié à quoi/////     
     21                        $adult_content->fill_idgroups_user();
     22                        $adult_content->fill_idgroups_ad_c();   
    2123
    22    if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined' and !is_a_guest() )
    23    {
    24        $template->assign(
    25          array(
    26            'EXPLIC' => $lang['ac_not_def'],
    27            'MAIN'  => $lang['ac_text_charte'],
    28            'ETAT'  => $_GET['etat'],
    29             )
    30          );
    31    }
    32    elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined' and !is_a_guest() )
    33    {
    34          $query = '
    35 SELECT group_id FROM '.USER_GROUP_TABLE.'
    36   WHERE user_id IN (\''.$user['id'].'\')
    37 ;';
    38      $data_group = mysql_fetch_array(pwg_query($query));
    39          $query = '
    40 SELECT name FROM '.GROUPS_TABLE.'
    41   WHERE id IN (\''.$data_group['group_id'].'\')
    42 ;';
    43      $data_group_n = mysql_fetch_array(pwg_query($query));
    44                  if ($data_group_n['name'] == '+18')
    45                  {
     24        if (!is_a_guest() and !$adult_content->is_in_ad_c_group())
     25        {
     26                 $template->assign(
     27                         array(
     28                                 'EXPLIC' => $lang['ac_not_def'],
     29                                 'MAIN'  => $lang['ac_text_charte'],
     30                                        )
     31                         );
     32        }
     33        elseif (!is_a_guest()  and $adult_content->is_in_ad_c_group() )
     34        {
     35                $link=$adult_content->is_in_ad_c_group();
     36                if ($link == $adult_content->idgroups_ad_c[0])
     37                {
    4638                         $statut = $lang['ac_statut'].$lang['ac_user_text_18'];
    47                  }
    48                  if ($data_group_n['name'] == '16-17')
    49                  {
     39                }
     40                if ($link ==  $adult_content->idgroups_ad_c[1])
     41                {
    5042                         $statut = $lang['ac_statut'].$lang['ac_user_text_16'];
    51                  }
    52                  if ($data_group_n['name'] == 'nothing')
    53                  {
     43                }
     44                if ($link ==  $adult_content->idgroups_ad_c[2])
     45                {
    5446                         $statut = $lang['ac_user_no'];
    55                  }
     47                }
    5648         
    5749     $main = '<p>'.$statut.'</p>'
     
    6153           'EXPLIC' => $lang['ac_def'],
    6254           'MAIN'  => $main,
    63            'ETAT'  => $_GET['etat'],
    6455            )
    6556         );
     
    7869elseif ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing')
    7970{
    80 
     71////////////anciennement lié à quoi/////       
     72                        $adult_content->fill_idgroups_user();
     73                        $adult_content->fill_idgroups_ad_c();
    8174   ////////////placer dans group////////////
    8275      $query = '
     
    8679      $data_group = mysql_fetch_array(pwg_query($query));
    8780         
    88       if ($_POST['etat'] == 'not_defined')
     81      if (!$adult_content->is_in_ad_c_group())
    8982          {
    9083      pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.$user['id'].'\', \''.$data_group['id'].'\' )' );
    9184          }
    92       elseif ($_POST['etat'] == 'defined')
     85      else
    9386          {
    94       pwg_query('UPDATE '.USER_GROUP_TABLE.' SET group_id=\''.$data_group['id'].'\' WHERE user_id IN (\''.$user['id'].'\')' );
     87      pwg_query('UPDATE '.USER_GROUP_TABLE.' SET group_id=\''.$data_group['id'].'\' WHERE user_id IN (\''.$user['id'].'\') AND group_id IN (\''.$adult_content->is_in_ad_c_group().'\')' );
    9588          }
    9689          $query = '
Note: See TracChangeset for help on using the changeset viewer.