[9530] | 1 | <?php |
---|
| 2 | define('PHPWG_ROOT_PATH','../../'); |
---|
| 3 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
| 4 | $adult_content = get_plugin_data('adult_content'); |
---|
[9565] | 5 | if ( is_a_guest() or $user['username'] == '16' or $user['username'] == '18') |
---|
[9557] | 6 | { |
---|
| 7 | redirect(make_index_url()); |
---|
| 8 | } |
---|
[9565] | 9 | elseif ( isset($_POST['groupe']) and ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing') ) |
---|
[9530] | 10 | { |
---|
[9565] | 11 | ////////////anciennement lié à quoi///// |
---|
| 12 | $adult_content->fill_idgroups_user(); |
---|
| 13 | $adult_content->fill_idgroups_ad_c(); |
---|
| 14 | ////////////placer dans group//////////// |
---|
| 15 | $query = ' |
---|
| 16 | SELECT id FROM '.GROUPS_TABLE.' |
---|
| 17 | WHERE name IN (\''. $_POST['groupe'].'\') |
---|
| 18 | ;'; |
---|
| 19 | $data_group = mysql_fetch_array(pwg_query($query)); |
---|
| 20 | |
---|
| 21 | if (!$adult_content->is_in_ad_c_group()) |
---|
| 22 | { |
---|
| 23 | pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.$user['id'].'\', \''.$data_group['id'].'\' )' ); |
---|
| 24 | } |
---|
| 25 | else |
---|
| 26 | { |
---|
| 27 | 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().'\')' ); |
---|
| 28 | } |
---|
| 29 | $query = ' |
---|
| 30 | DELETE FROM '.USER_CACHE_TABLE.' |
---|
| 31 | WHERE user_id = '.$user['id']; |
---|
| 32 | pwg_query($query); |
---|
| 33 | log_user( $user['id'], false); |
---|
| 34 | redirect(make_index_url()); |
---|
| 35 | } |
---|
| 36 | elseif (!isset( $_POST['groupe'] )) |
---|
| 37 | { |
---|
[9530] | 38 | $title = 'Adult content'; |
---|
| 39 | $page['body_id'] = 'adult_content_page'; |
---|
| 40 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
| 41 | load_language('plugin.lang', $adult_content->plugin_path); |
---|
| 42 | |
---|
| 43 | $template->assign( |
---|
| 44 | array( |
---|
| 45 | 'PLUGIN_NAME' => $adult_content->plugin_name |
---|
| 46 | )); |
---|
[9564] | 47 | ////////////lié à quoi///// |
---|
| 48 | $adult_content->fill_idgroups_user(); |
---|
| 49 | $adult_content->fill_idgroups_ad_c(); |
---|
[9530] | 50 | |
---|
[9565] | 51 | if (!$adult_content->is_in_ad_c_group()) |
---|
[9564] | 52 | { |
---|
| 53 | $template->assign( |
---|
| 54 | array( |
---|
| 55 | 'EXPLIC' => $lang['ac_not_def'], |
---|
| 56 | 'MAIN' => $lang['ac_text_charte'], |
---|
| 57 | ) |
---|
| 58 | ); |
---|
| 59 | } |
---|
[9565] | 60 | elseif ($adult_content->is_in_ad_c_group() ) |
---|
[9564] | 61 | { |
---|
| 62 | $link=$adult_content->is_in_ad_c_group(); |
---|
| 63 | if ($link == $adult_content->idgroups_ad_c[0]) |
---|
| 64 | { |
---|
[9557] | 65 | $statut = $lang['ac_statut'].$lang['ac_user_text_18']; |
---|
[9564] | 66 | } |
---|
| 67 | if ($link == $adult_content->idgroups_ad_c[1]) |
---|
| 68 | { |
---|
[9557] | 69 | $statut = $lang['ac_statut'].$lang['ac_user_text_16']; |
---|
[9564] | 70 | } |
---|
| 71 | if ($link == $adult_content->idgroups_ad_c[2]) |
---|
| 72 | { |
---|
[9557] | 73 | $statut = $lang['ac_user_no']; |
---|
[9564] | 74 | } |
---|
[9530] | 75 | |
---|
| 76 | $main = '<p>'.$statut.'</p>' |
---|
| 77 | .'<p><a href="javascript:void(0)" OnClick="history.back()" >'.$lang['ac_retour_c'].'</a></p>'; |
---|
| 78 | $template->assign( |
---|
| 79 | array( |
---|
| 80 | 'EXPLIC' => $lang['ac_def'], |
---|
| 81 | 'MAIN' => $main, |
---|
| 82 | ) |
---|
| 83 | ); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | $template->set_filename('charte', $adult_content->plugin_path.'include/charte_user.tpl'); |
---|
| 87 | |
---|
| 88 | $template->parse('charte'); |
---|
| 89 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
| 90 | |
---|
| 91 | }//fin if !isset( $_POST['groupe'] ) |
---|
| 92 | else |
---|
| 93 | { |
---|
[9565] | 94 | redirect(make_index_url()); |
---|
[9530] | 95 | } |
---|
[3331] | 96 | ?> |
---|