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