source: extensions/adult_content/stuffs_module/main.inc.php @ 21047

Last change on this file since 21047 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: 4.4 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5global $page, $conf;
6
7// RSS Feed only available in category or index gallery
8if (isset($page['section']) and $page['section'] == 'categories')
9{
10  include_once( AC_PATH.'/class.inc.php');
11  $conf_ad_c = unserialize($conf['ad_c_plugin']);
12
13  $adult_content = new Adultcontent(AC_NAME, AC_PATH);
14  set_plugin_data($adult_content->plugin_name, $adult_content);
15
16  if ( is_a_guest() and $conf_ad_c['menublock_for_guest']=='true')
17  {
18    load_language('plugin.lang', $adult_content->plugin_path);
19    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
20    $block['PLUGIN_NAME'] = $adult_content->plugin_name;
21    $block['AD_C_manage_what'] =  $conf_ad_c['manage_what'];
22    $block['TEMPLATE'] = realpath(AC_PATH.'/stuffs_module/disclaimer.tpl');
23    // from logon bloc
24    $block = array_merge($block, 
25      array(
26        'U_LOST_PASSWORD' => get_root_url().'password.php',
27        'F_LOGIN_ACTION' => get_root_url().'identification.php',
28        'authorize_remembering' => $conf['authorize_remembering'],
29        ));
30   
31    if ($conf['allow_user_registration'])
32    {
33      $block['U_REGISTER'] = get_root_url().'register.php';
34    }
35   
36    // Retirer le bloc identification rapide du menubar
37    add_event_handler('blockmanager_apply', 'stuffs_hide_identification');
38    function stuffs_hide_identification($menu_ref_arr)
39    {
40      $menu = & $menu_ref_arr[0];
41      $menu->hide_block('mbIdentification');
42    }
43  }
44  /*elseif ( isset($_POST['groupe']) and ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing') )
45  {
46  ////////////anciennement lié à quoi/////     
47        $adult_content->fill_idgroups_user();
48        $adult_content->fill_idgroups_ad_c();
49     ////////////placer dans group////////////
50        $query = '
51  SELECT id FROM '.GROUPS_TABLE.'
52    WHERE name IN (\''. $_POST['groupe'].'\')
53  ;';
54        $data_group = pwg_db_fetch_array(pwg_query($query));
55     
56        if (!$adult_content->is_in_ad_c_group())
57      {
58        pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.$user['id'].'\', \''.$data_group['id'].'\' )' );
59      }
60        else
61      {
62        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().'\')' );
63      }
64      $query = '
65  DELETE FROM '.USER_CACHE_TABLE.'
66    WHERE user_id = '.$user['id'];
67        pwg_query($query);
68        log_user( $user['id'], false);
69        redirect(make_index_url());
70  }
71  elseif (!isset( $_POST['groupe'] ))
72  {
73    $title = 'Adult content';
74    $page['body_id'] = 'adult_content_page';
75    include(PHPWG_ROOT_PATH.'include/page_header.php');
76    load_language('plugin.lang', $adult_content->plugin_path);
77    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
78    $template->assign(
79     array(
80       'PLUGIN_NAME' => $adult_content->plugin_name
81    ));
82  ////////////lié à quoi/////   
83    $adult_content->fill_idgroups_user();
84    $adult_content->fill_idgroups_ad_c();       
85 
86    if (!$adult_content->is_in_ad_c_group())
87    {
88       $template->assign(
89         array(
90           'EXPLIC' => $lang['ac_not_def'],
91           'MAIN'  => $lang['ac_text_charte'],
92            )
93         );
94    }
95    elseif ($adult_content->is_in_ad_c_group() )
96    {
97      $link=$adult_content->is_in_ad_c_group();
98      if ($link == $adult_content->idgroups_ad_c[0])
99      {
100         $statut = $lang['ac_statut'].$lang['ac_user_text_18'];
101      }
102      if ($link ==  $adult_content->idgroups_ad_c[1])
103      {
104         $statut = $lang['ac_statut'].$lang['ac_user_text_16'];
105      }
106      if ($link ==  $adult_content->idgroups_ad_c[2])
107      {
108         $statut = $lang['ac_user_no'];
109      }
110     
111      $main = '<p>'.$statut.'</p>'
112            .'<p><a href="javascript:void(0)" OnClick="history.back()" >'.$lang['ac_retour_c'].'</a></p>';
113      $template->assign(
114      array(
115        'EXPLIC' => $lang['ac_def'],
116        'MAIN'  => $main,
117      )
118      );
119     }
120      $template->assign(
121      array(
122        'AD_C_manage_what' => $conf_ad_c['manage_what'],
123      )
124      );
125 
126     $template->set_filename('charte', $adult_content->plugin_path.'include/charte_user.tpl');
127 
128     $template->parse('charte');
129     include(PHPWG_ROOT_PATH.'include/page_tail.php');
130 
131  }*///fin if !isset( $_POST['groupe'] )
132
133 
134}
135
136?>
Note: See TracBrowser for help on using the repository browser.