Changeset 9530


Ignore:
Timestamp:
Mar 4, 2011, 5:57:52 PM (13 years ago)
Author:
flop25
Message:

[adult_content]
bug:0001900

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

Location:
extensions/adult_content
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/adult_content/admin/admin.php

    r4078 r9530  
    77global $prefixeTable;
    88load_language('plugin.lang', $ad_c->plugin_path);
     9$conf_ad_c = explode("," , $conf['ad_c_plugin']);
     10
    911
    1012$page['infos'] = array();
    1113
     14if (isset($_POST['option_ad_c']))
     15{
     16        $newconf_plugin = array(
     17                $_POST['menublock_for_guest'],
     18                $_POST['block_on_index'],
     19        );
     20        $newconf_plugin = implode ("," , $newconf_plugin);
     21        $query = '
     22                UPDATE '.CONFIG_TABLE.'
     23                SET value="'.$newconf_plugin.'"
     24                WHERE param="ad_c_plugin"
     25                LIMIT 1';
     26        pwg_query($query);
     27                               
     28        array_push($page['infos'], l10n('ad_c_msg_admin_1'));
     29}
    1230
     31load_conf_from_db();
     32$conf_ad_c = explode("," , $conf['ad_c_plugin']);
     33
     34$check='checked="checked"';
     35if ($conf_ad_c[0]=='true') { $menublock=$check; } else { $menublock=NULL; }
     36if ($conf_ad_c[1]=='true') { $index=$check; } else { $index=NULL; }
     37$disabled='disabled="disabled"';
     38        $template->assign(
     39                array(
     40                  'AD_C_menublock_for_guest' => $menublock,
     41                  'AD_C_block_on_index' => $index,
     42                  'AD_C_block_on_index_disabled' => $disabled,
     43                )
     44          );
     45
     46$template->set_filename('plugin_admin_content', $ad_c->plugin_path.'admin/admin.tpl');
     47$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    1348?>
  • extensions/adult_content/charte_user.php

    r6984 r9530  
    1717       ));
    1818
    19    if ($_GET['etat'] == 'not_defined')
     19   if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined')
    2020   {
    2121       $template->assign(
     
    2727         );
    2828   }
    29    elseif ($_GET['etat'] == 'defined')
     29   elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined')
    3030   {
    3131         $query = '
  • extensions/adult_content/class.inc.php

    r6940 r9530  
    124124///////////////////////[début du plug]////////////////////
    125125    $this->loading_lang();
    126     global $user, $conf, $page;
    127         global $template;
    128 
     126    global $user, $conf, $page, $template;
    129127    $menu = & $menu_ref_arr[0];
    130        
    131 $template->assign(
    132   array(
    133     'AC_NAME' => AC_NAME
    134     ));
     128                $conf_plugin = explode("," , $conf['ad_c_plugin']);
     129                $template->assign(
     130                        array(
     131                                'AC_NAME' => AC_NAME
     132                                ));
    135133
    136134
    137135    //include($this->var_template());
    138     if (is_a_guest())
     136    if (is_a_guest() and $conf_plugin[0]=='true')
    139137        {
    140138       
     
    181179///////////////////////[FIN fermer/ouvert]////////////////////
    182180    }//fin if guest
     181    elseif (is_a_guest() and $conf_plugin[0]!='true')
     182    { 
     183                  $menu->hide_block('mbAdultContent');
     184    }
    183185    elseif ($user['username'] == '18')
    184186    { 
     
    244246                        ));
    245247                $menu = & $menu_ref_arr[0];
    246                 $block = $menu->get_block( 'mbAdultContent' );
    247                 $block->set_title(l10n('ac_title_choose'));
    248                 $block->template = $this->get_template('choose.tpl');
     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        }
    249252
    250253          }
     
    279282                        ));
    280283                $menu = & $menu_ref_arr[0];
    281                 $block = $menu->get_block( 'mbAdultContent' );
    282                 $block->set_title(l10n('ac_title_menu_statut'));
    283                 $block->template = $this->get_template('choose.tpl');
     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                }
    284288
    285289          }
  • extensions/adult_content/language/fr_FR/plugin.lang.php

    r6984 r9530  
    3838$lang['ac_def'] = 'Voulez-vous changez votre statut ?';
    3939
     40$lang['ad_c_menublock_for_guest'] = 'Permettre aux visiteurs non-enregistrés de sélectionner leur âge ?';
     41$lang['ad_c_block_on_index'] = 'Afficher un encart sur la page d\'accueil ? (Nécessite le plugin PWG Stuffs)';
     42//$lang['ad_c_block_on_index_error'] = 'PWG Stuffs dans une version supérieure à 2.1.l est nécessaire';
     43$lang['ad_c_block_on_index_error'] = 'fonction non disponible pour l\'instant';
     44$lang['ad_c_send'] = 'Enregistrer les changements';
     45$lang['ad_c_msg_admin_1'] = 'Configuration du plugin mise à jour avec succès !';
     46
     47
    4048?>
  • extensions/adult_content/main.inc.php

    r7269 r9530  
    2121
    2222include_once(dirname(__FILE__).'/class.inc.php');
    23 //add_event_handler('get_admin_plugin_menu_links', array(&$adult_content, 'ac_lien_menu') );
     23add_event_handler('get_admin_plugin_menu_links', array(&$adult_content, 'ac_lien_menu') );
    2424add_event_handler('register_user', array(&$adult_content, 'on_register') );
    2525// Ajout une entrée dans le menubar
     
    2727add_event_handler('blockmanager_apply', array(&$adult_content, 'placer_identification'));
    2828//block on index
    29 //add_event_handler('loc_begin_index', array(&$adult_content, 'set_block_on_index'));
    3029
     30/*
     31global $conf;
     32add_event_handler('loc_begin_index', array(&$adult_content, 'set_block_on_index'));
     33*/
    3134
    3235add_event_handler('loc_end_picture', 'comment_manage');
  • extensions/adult_content/maintain.inc.php

    r6922 r9530  
    4141  $data_group = mysql_fetch_array($result);
    4242          pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
     43
     44/////////////Config plugin
     45    $q = '
     46INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     47        VALUES
     48        ("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
     49    pwg_query($q);
    4350
    4451}
     
    181188        pwg_query($query);
    182189
     190//////////// Check Config
     191   $query = '
     192SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.'
     193  WHERE param IN (\'ad_c_plugin\')
     194;';
     195   $data_table = mysql_fetch_array(pwg_query($query));
     196   $exist = $data_table['result'];
     197   if ( $exist == 0 )
     198   {
     199    $q = '
     200INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     201        VALUES
     202        ("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
     203    pwg_query($q);
     204   }
     205   else {
     206      $query = '
     207SELECT value FROM '.CONFIG_TABLE.'
     208  WHERE param IN (\'ad_c_plugin\')
     209;';
     210   $data_conf = mysql_fetch_array(pwg_query($query));
     211   $conf=explode(',', $data_conf['value']);
     212   $nbr=count($conf);
     213   
     214     if ($nbr!=2)
     215     {
     216      pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'ad_c_plugin\')');
     217      pwg_query($q);
     218    $q = '
     219INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     220        VALUES
     221        ("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
     222    pwg_query($q);
     223     }
     224   }
     225
    183226}//fin active
    184227
     
    236279  pwg_query($query);
    237280
     281//////////////// Delete config
     282  pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'ad_c_plugin\')');
    238283}//fin uninstall
    239284
Note: See TracChangeset for help on using the changeset viewer.