Changeset 9564
- Timestamp:
- Mar 7, 2011, 4:09:40 PM (13 years ago)
- Location:
- extensions/adult_content
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/adult_content/charte_user.php
r9557 r9564 12 12 $page['body_id'] = 'adult_content_page'; 13 13 include(PHPWG_ROOT_PATH.'include/page_header.php'); 14 //include(get_language_filepath('plugin.lang.php', $adult_content->plugin_path));15 14 load_language('plugin.lang', $adult_content->plugin_path); 16 15 … … 19 18 'PLUGIN_NAME' => $adult_content->plugin_name 20 19 )); 20 ////////////lié à quoi///// 21 $adult_content->fill_idgroups_user(); 22 $adult_content->fill_idgroups_ad_c(); 21 23 22 if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined' and !is_a_guest() ) 23 { 24 $template->assign( 25 array( 26 'EXPLIC' => $lang['ac_not_def'], 27 'MAIN' => $lang['ac_text_charte'], 28 'ETAT' => $_GET['etat'], 29 ) 30 ); 31 } 32 elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined' and !is_a_guest() ) 33 { 34 $query = ' 35 SELECT group_id FROM '.USER_GROUP_TABLE.' 36 WHERE user_id IN (\''.$user['id'].'\') 37 ;'; 38 $data_group = mysql_fetch_array(pwg_query($query)); 39 $query = ' 40 SELECT name FROM '.GROUPS_TABLE.' 41 WHERE id IN (\''.$data_group['group_id'].'\') 42 ;'; 43 $data_group_n = mysql_fetch_array(pwg_query($query)); 44 if ($data_group_n['name'] == '+18') 45 { 24 if (!is_a_guest() and !$adult_content->is_in_ad_c_group()) 25 { 26 $template->assign( 27 array( 28 'EXPLIC' => $lang['ac_not_def'], 29 'MAIN' => $lang['ac_text_charte'], 30 ) 31 ); 32 } 33 elseif (!is_a_guest() and $adult_content->is_in_ad_c_group() ) 34 { 35 $link=$adult_content->is_in_ad_c_group(); 36 if ($link == $adult_content->idgroups_ad_c[0]) 37 { 46 38 $statut = $lang['ac_statut'].$lang['ac_user_text_18']; 47 48 if ($data_group_n['name'] == '16-17')49 39 } 40 if ($link == $adult_content->idgroups_ad_c[1]) 41 { 50 42 $statut = $lang['ac_statut'].$lang['ac_user_text_16']; 51 52 if ($data_group_n['name'] == 'nothing')53 43 } 44 if ($link == $adult_content->idgroups_ad_c[2]) 45 { 54 46 $statut = $lang['ac_user_no']; 55 47 } 56 48 57 49 $main = '<p>'.$statut.'</p>' … … 61 53 'EXPLIC' => $lang['ac_def'], 62 54 'MAIN' => $main, 63 'ETAT' => $_GET['etat'],64 55 ) 65 56 ); … … 78 69 elseif ( $_POST['groupe'] == '+18' or $_POST['groupe'] == '16-17' or $_POST['groupe'] == 'nothing') 79 70 { 80 71 ////////////anciennement lié à quoi///// 72 $adult_content->fill_idgroups_user(); 73 $adult_content->fill_idgroups_ad_c(); 81 74 ////////////placer dans group//////////// 82 75 $query = ' … … 86 79 $data_group = mysql_fetch_array(pwg_query($query)); 87 80 88 if ( $_POST['etat'] == 'not_defined')81 if (!$adult_content->is_in_ad_c_group()) 89 82 { 90 83 pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.$user['id'].'\', \''.$data_group['id'].'\' )' ); 91 84 } 92 else if ($_POST['etat'] == 'defined')85 else 93 86 { 94 pwg_query('UPDATE '.USER_GROUP_TABLE.' SET group_id=\''.$data_group['id'].'\' WHERE user_id IN (\''.$user['id'].'\') ' );87 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().'\')' ); 95 88 } 96 89 $query = ' -
extensions/adult_content/class.inc.php
r9530 r9564 5 5 { 6 6 var $plugin_name, $plugin_path; 7 7 var $idgroups_user = array(); 8 var $idgroups_ad_c = array();// 0=+18 1=16 2=nothing 8 9 function Adultcontent($plugin_name, $plugin_path) 9 10 { … … 11 12 $this->plugin_name = $plugin_name; 12 13 $this->plugin_path = $plugin_path; 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) 18 50 { 19 51 $link_url = add_url_params($main_link, array('ad' => $action)); … … 24 56 { 25 57 global $lang; 26 load_language('plugin.lang', $this->plugin_path);58 load_language('plugin.lang', $this->plugin_path); 27 59 } 28 60 function var_template() … … 55 87 { 56 88 global $user, $template; 57 $r_theme_file=array();58 $dir = $this->plugin_path.'template/';59 $r_theme_file=($template->smarty->template_dir);89 $r_theme_file=array(); 90 $dir = $this->plugin_path.'template/'; 91 $r_theme_file=($template->smarty->template_dir); 60 92 foreach( $r_theme_file as $style) 61 93 { … … 214 246 elseif (!is_admin()) 215 247 { 216 217 248 ////////////lié à quoi///// 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 } 288 288 289 289 } … … 296 296 $user_id = get_userid($_POST['login']); 297 297 log_user( $user_id, false); 298 redirect(PHPWG_ROOT_PATH.'plugins/adult_content/charte_user.php ?etat=not_defined');298 redirect(PHPWG_ROOT_PATH.'plugins/adult_content/charte_user.php'); 299 299 } 300 300 }//fin class -
extensions/adult_content/include/charte_user.tpl
r3494 r9564 1 {html_head}<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/{$PLUGIN_NAME}/include/charte.css">{/html_head} 2 1 {html_head} 2 <link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/{$PLUGIN_NAME}/include/charte.css"> 3 {/html_head} 3 4 <div id="content"> 4 <div class="titrePage">5 5 <div class="titrePage"> 6 <ul class="categoryActions"> 6 7 <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li> 7 8 </ul> 8 <h2>Adult content config</h2> 9 <h2>Adult content config</h2> 10 </div> 11 <div id="autre_content"> 12 <p>{$EXPLIC}</p> 13 <p>{$MAIN}</p> 14 <fieldset> 15 <form method="post" action="{$pwg_root}charte_user.php" > 16 <input type="hidden" name="groupe" value="+18"/> 17 <input class="submit" type="submit" name="login" value="{'ac_button_activ_18'|@translate}"/> 18 {'ac_text_activ_18'|@translate} 19 </form> 20 </fieldset> 21 <fieldset> 22 <form method="post" action="{$pwg_root}charte_user.php"> 23 <input type="hidden" name="groupe" value="16-17"/> 24 <input class="submit" type="submit" name="login" value="{'ac_button_activ_16'|@translate}"/> 25 {'ac_text_activ_16'|@translate} 26 </form> 27 </fieldset> 28 <fieldset> 29 <form method="post" action="{$pwg_root}charte_user.php"> 30 <input type="hidden" name="groupe" value="nothing"/> 31 <input class="submit" type="submit" name="Annuler" value="{'ac_retour_b'|@translate}"/> 32 </form> 33 </fieldset> 34 </div> 9 35 </div> 10 <div id="autre_content">11 <p>{$EXPLIC}</p>12 <p>{$MAIN}</p>13 <fieldset>14 <form method="post" action="{$pwg_root}charte_user.php" >15 <input type="hidden" name="groupe" value="+18"/>16 <input type="hidden" name="etat" value="{$ETAT}"/>17 <input class="submit" type="submit" name="login" value="{'ac_button_activ_18'|@translate}"/>18 {'ac_text_activ_18'|@translate}19 20 </form>21 </fieldset>22 <fieldset>23 <form method="post" action="{$pwg_root}charte_user.php">24 <input type="hidden" name="groupe" value="16-17"/>25 <input type="hidden" name="etat" value="{$ETAT}"/>26 <input class="submit" type="submit" name="login" value="{'ac_button_activ_16'|@translate}"/>27 {'ac_text_activ_16'|@translate}28 </form>29 </fieldset>30 <fieldset>31 <form method="post" action="{$pwg_root}charte_user.php">32 <input type="hidden" name="groupe" value="nothing"/>33 <input type="hidden" name="etat" value="{$ETAT}"/>34 <input class="submit" type="submit" name="Annuler" value="{'ac_retour_b'|@translate}"/>35 </form>36 </fieldset>37 </div>38 </div> -
extensions/adult_content/template/OS_default/choose.tpl
r6940 r9564 3 3 <ul> 4 4 <li> 5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php ?etat={$AC_ETAT}">{$AC_MSG}</a>5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php">{$AC_MSG}</a> 6 6 </li> 7 7 </ul> -
extensions/adult_content/template/Pure_default/choose.tpl
r6940 r9564 3 3 <ul> 4 4 <li> 5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php ?etat={$AC_ETAT}">{$AC_MSG}</a>5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php">{$AC_MSG}</a> 6 6 </li> 7 7 </ul> -
extensions/adult_content/template/default/choose.tpl
r6940 r9564 3 3 <ul> 4 4 <li> 5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php ?etat={$AC_ETAT}">{$AC_MSG}</a>5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php">{$AC_MSG}</a> 6 6 </li> 7 7 </ul> -
extensions/adult_content/template/flop_mauve/choose.tpl
r6940 r9564 3 3 <ul> 4 4 <li> 5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php ?etat={$AC_ETAT}">{$AC_MSG}</a>5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php">{$AC_MSG}</a> 6 6 </li> 7 7 </ul> -
extensions/adult_content/template/gally-default/choose.tpl
r6940 r9564 3 3 <ul> 4 4 <li> 5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php ?etat={$AC_ETAT}">{$AC_MSG}</a>5 <a href="{$pwg_root}plugins/{$AC_NAME}/charte_user.php">{$AC_MSG}</a> 6 6 </li> 7 7 </ul>
Note: See TracChangeset
for help on using the changeset viewer.