| 13 | | // handler |
| 14 | | // $this->initialize_event_handler(); |
| 15 | | } |
| 16 | | |
| 17 | | function get_link_icon($main_link, $action) |
| | 14 | } |
| | 15 | function fill_idgroups_user() |
| | 16 | { |
| | 17 | global $user; |
| | 18 | |
| | 19 | $query = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user['id'] . ';'; |
| | 20 | $result = pwg_query($query); |
| | 21 | while ($row = mysql_fetch_assoc($result)) |
| | 22 | { |
| | 23 | array_push($this->idgroups_user, $row['group_id']); |
| | 24 | } |
| | 25 | } |
| | 26 | function fill_idgroups_ad_c() |
| | 27 | { |
| | 28 | global $user; |
| | 29 | |
| | 30 | $query = 'SELECT id FROM ' . GROUPS_TABLE . ' WHERE name IN (\'+18\', \'16-17\', \'nothing\') ORDER BY id'; |
| | 31 | $result = pwg_query($query); |
| | 32 | while ($row = mysql_fetch_assoc($result)) |
| | 33 | { |
| | 34 | array_push($this->idgroups_ad_c, $row['id']); |
| | 35 | } |
| | 36 | } |
| | 37 | function is_in_ad_c_group() |
| | 38 | { |
| | 39 | foreach( $this->idgroups_ad_c as $id ) |
| | 40 | { |
| | 41 | if ( in_array($id, $this->idgroups_user)) |
| | 42 | { |
| | 43 | return $id; |
| | 44 | exit; |
| | 45 | } |
| | 46 | } |
| | 47 | return false; |
| | 48 | } |
| | 49 | function get_link_icon($main_link, $action) |
| 218 | | $query = ' |
| 219 | | SELECT id FROM '.GROUPS_TABLE.' |
| 220 | | WHERE name IN (\'+18\') |
| 221 | | ;'; |
| 222 | | $data_18 = mysql_fetch_array(pwg_query($query)); |
| 223 | | $query = ' |
| 224 | | SELECT id FROM '.GROUPS_TABLE.' |
| 225 | | WHERE name IN (\'16-17\') |
| 226 | | ;'; |
| 227 | | $data_16 = mysql_fetch_array(pwg_query($query)); |
| 228 | | $query = ' |
| 229 | | SELECT id FROM '.GROUPS_TABLE.' |
| 230 | | WHERE name IN (\'nothing\') |
| 231 | | ;'; |
| 232 | | $data_no = mysql_fetch_array(pwg_query($query)); |
| 233 | | $n_query = ' |
| 234 | | SELECT COUNT(*) AS result FROM '.USER_GROUP_TABLE.' |
| 235 | | WHERE group_id IN (\''.$data_18['id'].'\',\''.$data_16['id'].'\',\''.$data_no['id'].'\') AND user_id IN (\''.$user['id'].'\') |
| 236 | | ;'; |
| 237 | | $data_user = mysql_fetch_array(pwg_query($n_query)); |
| 238 | | $is_grouped = $data_user['result']; |
| 239 | | |
| 240 | | if ( $is_grouped == 0 ) |
| 241 | | { |
| 242 | | $template->assign( |
| 243 | | array( |
| 244 | | 'AC_ETAT' => 'not_defined', |
| 245 | | 'AC_MSG' => l10n('ac_charte_user_not') |
| 246 | | )); |
| 247 | | $menu = & $menu_ref_arr[0]; |
| 248 | | if (($block = $menu->get_block( 'mbAdultContent' )) != null) { |
| 249 | | $block->set_title(l10n('ac_title_choose')); |
| 250 | | $block->template = $this->get_template('choose.tpl'); |
| 251 | | } |
| 252 | | |
| 253 | | } |
| 254 | | else |
| 255 | | { |
| 256 | | $query = ' |
| 257 | | SELECT group_id FROM '.USER_GROUP_TABLE.' |
| 258 | | WHERE user_id IN (\''.$user['id'].'\') |
| 259 | | ;'; |
| 260 | | $data_group = mysql_fetch_array(pwg_query($query)); |
| 261 | | $query = ' |
| 262 | | SELECT name FROM '.GROUPS_TABLE.' |
| 263 | | WHERE id IN (\''.$data_group['group_id'].'\') |
| 264 | | ;'; |
| 265 | | $data_group_n = mysql_fetch_array(pwg_query($query)); |
| 266 | | if ($data_group_n['name'] == '+18') |
| 267 | | { |
| 268 | | $statut = l10n('ac_user_text_18'); |
| 269 | | } |
| 270 | | if ($data_group_n['name'] == '16-17') |
| 271 | | { |
| 272 | | $statut = l10n('ac_user_text_16'); |
| 273 | | } |
| 274 | | if ($data_group_n['name'] == 'nothing') |
| 275 | | { |
| 276 | | $statut = l10n('ac_user_no_s'); |
| 277 | | } |
| 278 | | $template->assign( |
| 279 | | array( |
| 280 | | 'AC_ETAT' => 'defined', |
| 281 | | 'AC_MSG' => $statut.". ".l10n('ac_charte_user_def') |
| 282 | | )); |
| 283 | | $menu = & $menu_ref_arr[0]; |
| 284 | | if (($block = $menu->get_block( 'mbAdultContent' )) != null) { |
| 285 | | $block->set_title(l10n('ac_title_menu_statut')); |
| 286 | | $block->template = $this->get_template('choose.tpl'); |
| 287 | | } |
| | 249 | $this->fill_idgroups_user(); |
| | 250 | $this->fill_idgroups_ad_c(); |
| | 251 | |
| | 252 | if ( !$this->is_in_ad_c_group() ) |
| | 253 | { |
| | 254 | $template->assign( |
| | 255 | array( |
| | 256 | 'AC_MSG' => l10n('ac_charte_user_not') |
| | 257 | )); |
| | 258 | $menu = & $menu_ref_arr[0]; |
| | 259 | if (($block = $menu->get_block( 'mbAdultContent' )) != null) { |
| | 260 | $block->set_title(l10n('ac_title_choose')); |
| | 261 | $block->template = $this->get_template('choose.tpl'); |
| | 262 | } |
| | 263 | } |
| | 264 | else |
| | 265 | { |
| | 266 | $link=$this->is_in_ad_c_group(); |
| | 267 | if ($link == $this->idgroups_ad_c[0]) |
| | 268 | { |
| | 269 | $statut = l10n('ac_user_text_18'); |
| | 270 | } |
| | 271 | if ($link == $this->idgroups_ad_c[1]) |
| | 272 | { |
| | 273 | $statut = l10n('ac_user_text_16'); |
| | 274 | } |
| | 275 | if ($link == $this->idgroups_ad_c[2]) |
| | 276 | { |
| | 277 | $statut = l10n('ac_user_no_s'); |
| | 278 | } |
| | 279 | $template->assign( |
| | 280 | array( |
| | 281 | 'AC_MSG' => $statut.". ".l10n('ac_charte_user_def') |
| | 282 | )); |
| | 283 | $menu = & $menu_ref_arr[0]; |
| | 284 | if (($block = $menu->get_block( 'mbAdultContent' )) != null) { |
| | 285 | $block->set_title(l10n('ac_title_menu_statut')); |
| | 286 | $block->template = $this->get_template('choose.tpl'); |
| | 287 | } |