source: extensions/adult_content/charte_user.php @ 9530

Last change on this file since 9530 was 9530, checked in by flop25, 13 years ago

[adult_content]
bug:0001900

admin page added, the menu block can be disabled just for guest or for all.
translation needed

File size: 2.9 KB
Line 
1<?php
2define('PHPWG_ROOT_PATH','../../');
3include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
4$adult_content = get_plugin_data('adult_content');
5
6if (!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 (isset($_GET['etat']) and $_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 (isset($_GET['etat']) and $_GET['etat'] == 'defined')
30   {
31         $query = '
32SELECT 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 = '
37SELECT 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'] )
75elseif ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing')
76{
77
78   ////////////placer dans group////////////
79      $query = '
80SELECT 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 = '
94DELETE 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}
100else
101{
102die('Hacking attempt!');
103}
104?>
Note: See TracBrowser for help on using the repository browser.