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