source: extensions/adult_content/charte_user.php @ 31945

Last change on this file since 31945 was 21047, checked in by flop25, 11 years ago

-compatibility 2.5 (only)
-changing config variables (assoc array)
-adding a pwg stuffs block

ToDo: enable the option for the block

File size: 3.0 KB
Line 
1<?php
2define('PHPWG_ROOT_PATH','../../');
3include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
4$conf_ad_c = unserialize($conf['ad_c_plugin']);
5$adult_content = get_plugin_data('adult_content');
6if ( is_a_guest() or $user['username'] == '16' or $user['username'] == '18')
7{
8        redirect(make_index_url());
9}
10elseif ( isset($_POST['groupe']) and ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing') )
11{
12////////////anciennement lié à quoi/////       
13                        $adult_content->fill_idgroups_user();
14                        $adult_content->fill_idgroups_ad_c();
15   ////////////placer dans group////////////
16      $query = '
17SELECT id FROM '.GROUPS_TABLE.'
18  WHERE name IN (\''. $_POST['groupe'].'\')
19;';
20      $data_group = pwg_db_fetch_array(pwg_query($query));
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 = '
31DELETE 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}
37elseif (!isset( $_POST['groupe'] ))
38{
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  ));
48////////////lié à quoi/////     
49  $adult_content->fill_idgroups_user();
50  $adult_content->fill_idgroups_ad_c(); 
51
52        if (!$adult_content->is_in_ad_c_group())
53        {
54                 $template->assign(
55                         array(
56                                 'EXPLIC' => $lang['ac_not_def'],
57                                 'MAIN'  => $lang['ac_text_charte'],
58                                        )
59                         );
60        }
61        elseif ($adult_content->is_in_ad_c_group() )
62        {
63                $link=$adult_content->is_in_ad_c_group();
64                if ($link == $adult_content->idgroups_ad_c[0])
65                {
66                         $statut = $lang['ac_statut'].$lang['ac_user_text_18'];
67                }
68                if ($link ==  $adult_content->idgroups_ad_c[1])
69                {
70                         $statut = $lang['ac_statut'].$lang['ac_user_text_16'];
71                }
72                if ($link ==  $adult_content->idgroups_ad_c[2])
73                {
74                         $statut = $lang['ac_user_no'];
75                }
76         
77    $main = '<p>'.$statut.'</p>'
78                .'<p><a href="javascript:void(0)" OnClick="history.back()" >'.$lang['ac_retour_c'].'</a></p>';
79    $template->assign(
80    array(
81      'EXPLIC' => $lang['ac_def'],
82      'MAIN'  => $main,
83    )
84    );
85   }
86    $template->assign(
87    array(
88      'AD_C_manage_what' => $conf_ad_c['manage_what'],
89    )
90    );
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'] )
98else
99{
100redirect(make_index_url());
101}
102?>
Note: See TracBrowser for help on using the repository browser.