Changeset 3494


Ignore:
Timestamp:
Jul 2, 2009, 1:38:55 PM (15 years ago)
Author:
flop25
Message:

update for pwg 2

Location:
extensions/adult_content
Files:
8 added
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/adult_content/class.inc.php

    r3331 r3494  
    2424  {
    2525    global $lang;
    26     //include(get_language_filepath('plugin.lang.php', $this->plugin_path));
    2726        load_language('plugin.lang', $this->plugin_path);
    2827  } 
    29   /*
    30   function remove_code($tlp_handle, $str_begin, $str_end)
    31   {
    32       global $template;
    33  
    34       $template->loadfile($tlp_handle);
    35  
    36       $p_beg = strpos($template->uncompiled_code[$tlp_handle], $str_begin);
    37       $p_end = strpos($template->uncompiled_code[$tlp_handle], $str_end) + strlen($str_end);
    38       $s = substr($template->uncompiled_code[$tlp_handle], $p_beg, $p_end - $p_beg);
    39  
    40       $template->uncompiled_code[$tlp_handle] =
    41       substr_replace($template->uncompiled_code[$tlp_handle], '', $p_beg, $p_end - $p_beg);
    42  
    43       return $s;
    44   }
    45  
    46   function add_before_code($tlp_handle, $insert_before, $code)
    47   {
    48       global $template;
    49  
    50       $template->loadfile($tlp_handle);
    51       $template->uncompiled_code[$tlp_handle] = str_replace($insert_before, $code.$insert_before, $template->uncompiled_code[$tlp_handle]);
    52   }
    53   function add_after_code($tlp_handle, $insert_after, $code)
    54   {
    55     global $template;
    56  
    57     $template->loadfile($tlp_handle);
    58     $template->uncompiled_code[$tlp_handle] = str_replace($insert_after, $insert_after.$code, $template->uncompiled_code[$tlp_handle]);
    59   }*/
    6028  function var_template()
    6129  {
     
    7038    }
    7139   return $r;
    72   }
    73   function link_charte_user($etat)
    74   {
    75   global $user, $lang;
    76   include($this->var_template());
    77   if ($etat == 'not_defined')
    78   {
    79       /*$s = $this->remove_code('menubar',$begin_ident ,$end_ident);
    80       $this->add_before_code('menubar','<!-- BEGIN links -->',$s);       
    81       $this->add_after_code('menubar','<!-- END hello -->
    82     <ul>','<a href="'.get_root_url().'plugins/'.$this->plugin_name.'/charte_user.php?etat='.$etat.'">{lang:ac_charte_user_not}</a>');*/
    83   }
    84   elseif ($etat == 'defined')
    85   {
    86       $query = '
    87 SELECT group_id FROM '.USER_GROUP_TABLE.'
    88   WHERE user_id IN (\''.$user['id'].'\')
    89 ;';
    90      $data_group = mysql_fetch_array(pwg_query($query));
    91          $query = '
    92 SELECT name FROM '.GROUPS_TABLE.'
    93   WHERE id IN (\''.$data_group['group_id'].'\')
    94 ;';
    95      $data_group_n = mysql_fetch_array(pwg_query($query));
    96          if ($data_group_n['name'] == '+18')
    97          {
    98          $statut = $lang['ac_user_text_18'];
    99          }
    100          if ($data_group_n['name'] == '16-17')
    101          {
    102          $statut = $lang['ac_user_text_16'];
    103          }
    104          if ($data_group_n['name'] == 'nothing')
    105          {
    106          $statut = $lang['ac_user_no_s'];
    107          }
    108 
    109           /*$this->add_after_code('menubar','<!-- END hello -->
    110     <ul>',''.$statut.' <a href="'.get_root_url().'plugins/'.$this->plugin_name.'/charte_user.php?etat='.$etat.'">{lang:ac_logout}</a>');*/
    111   }
    112      
    113 
    11440  }
    11541
     
    14571              if ( !isset( $_COOKIE['pwg_adult_content'] ) or $_COOKIE['pwg_adult_content'] == 'open' )
    14672              {
    147                 //$this->add_before_code('menubar','<!-- BEGIN links -->', $msg_opened);
    14873                        $template->assign(array(  'LINK' => $this->get_link_icon(duplicate_index_url(), 'closed')    ));
    14974            if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
     
    15479          elseif ( $_COOKIE['pwg_adult_content'] == 'closed' )
    15580              {
    156                 //$this->add_before_code('menubar','<!-- BEGIN links -->', $msg_closed);
    15781            $template->assign(array(  'LINK' => $this->get_link_icon(duplicate_index_url(), 'open')    ));
    15882                        if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
     
    16589          elseif (  $_GET['ad'] == 'closed' )
    16690          {
    167             //$this->add_before_code('menubar','<!-- BEGIN links -->', $msg_closed);
    16891        $template->assign(array(  'LINK' => $this->get_link_icon(duplicate_index_url(), 'open')    ));
    16992                setcookie( 'pwg_adult_content', 'closed', time()+60*60*24*30, cookie_path() );   
     
    17598          elseif (  $_GET['ad'] == 'open' )
    17699          {
    177             //$this->add_before_code('menubar','<!-- BEGIN links -->', $msg_opened);
    178100            $template->assign(array(  'LINK' => $this->get_link_icon(duplicate_index_url(), 'closed')    ));
    179101                        if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
     
    188110    elseif ($user['username'] == '18')
    189111    { 
    190       $this->remove_code('menubar', '<dl id="mbIdentification">', '<!-- END quickconnect -->
    191 
    192   </dd>
    193 </dl>');
    194  
    195       $this->add_before_code('menubar','<!-- BEGIN tags -->',$msg_18);
     112                $menu->hide_block('mbIdentification');
     113                $template->assign(
     114                  array(
     115                        'AC_MSG' => l10n('ac_user_text_18')
     116                        ));
     117                if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
     118               $block->set_title(l10n('ac_title_menu'));
     119               $block->template = $this->plugin_path.'template/'.$user['template'].'/msg.tpl';
     120        }
    196121         
    197122          $_SESSION['age']="18";
     
    201126    elseif ($user['username'] == '16')
    202127    {
    203       $this->remove_code('menubar', '<dl id="mbIdentification">', '<!-- END quickconnect -->
    204 
    205   </dd>
    206 </dl>');
    207  
    208       $this->add_before_code('menubar','<!-- BEGIN tags -->',$msg_16);
     128                $menu->hide_block('mbIdentification');
     129                $template->assign(
     130                  array(
     131                        'AC_MSG' => l10n('ac_user_text_16')
     132                        ));
     133                if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
     134               $block->set_title(l10n('ac_title_menu'));
     135               $block->template = $this->plugin_path.'template/'.$user['template'].'/msg.tpl';
     136        }
    209137
    210138    }//fin if 16-17 ans
     
    237165          if ( $is_grouped == 0 )
    238166          {
    239           $this->link_charte_user('not_defined');
     167                $template->assign(
     168                  array(
     169                        'AC_ETAT' => 'not_defined',
     170                        'AC_MSG' => l10n('ac_charte_user_not')
     171                        ));
     172                $menu = & $menu_ref_arr[0];
     173                $block = $menu->get_block( 'mbAdultContent' );
     174                $block->set_title(l10n('ac_title_choose'));
     175                $block->template = $this->plugin_path.'template/'.$user['template'].'/choose.tpl';
     176
    240177          }
    241178          else
    242179          {       
    243           $this->link_charte_user('defined');
     180                        $query = '
     181          SELECT group_id FROM '.USER_GROUP_TABLE.'
     182                WHERE user_id IN (\''.$user['id'].'\')
     183          ;';
     184                   $data_group = mysql_fetch_array(pwg_query($query));
     185                   $query = '
     186          SELECT name FROM '.GROUPS_TABLE.'
     187                WHERE id IN (\''.$data_group['group_id'].'\')
     188          ;';
     189                   $data_group_n = mysql_fetch_array(pwg_query($query));
     190                   if ($data_group_n['name'] == '+18')
     191                   {
     192                   $statut = l10n('ac_user_text_18');
     193                   }
     194                   if ($data_group_n['name'] == '16-17')
     195                   {
     196                   $statut = l10n('ac_user_text_16');
     197                   }
     198                   if ($data_group_n['name'] == 'nothing')
     199                   {
     200                   $statut = l10n('ac_user_no_s');
     201                   }
     202                $template->assign(
     203                  array(
     204                        'AC_ETAT' => 'defined',
     205                        'AC_MSG' => $statut.". ".l10n('ac_charte_user_def')
     206                        ));
     207                $menu = & $menu_ref_arr[0];
     208                $block = $menu->get_block( 'mbAdultContent' );
     209                $block->set_title(l10n('ac_title_menu_statut'));
     210                $block->template = $this->plugin_path.'template/'.$user['template'].'/choose.tpl';
     211
    244212          }
    245213        }
  • extensions/adult_content/include

    • Property svn:ignore set to
      _notes
  • extensions/adult_content/include/charte.css

    r3331 r3494  
    66{
    77  padding:1em;
     8  text-align:center;
    89  }
     10#content form {
     11        text-align:left;
     12  }
  • extensions/adult_content/include/charte.tpl

    r3331 r3494  
    1 {html_head}<link rel="stylesheet" type="text/css" href="{$pwg_root}plugins/{$PLUGIN_NAME}/include/charte.css">{/html_head}
     1{html_head}<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/{$PLUGIN_NAME}/include/charte.css">{/html_head}
    22<div id="content">
    33<div class="titrePage">
     
    99
    1010<fieldset>
    11 <form method="post" action="{$pwg_root}identification.php" >
     11<form method="post" action="{$ROOT_URL}identification.php" >
    1212    <input type="hidden" name="username" size="15" value="18"/>
    1313    <input type="hidden" name="password" size="15" value="adult_content"/>
     
    1818</fieldset>
    1919<fieldset>
    20 <form method="post" action="{$pwg_root}identification.php" id="quickconnect">
     20<form method="post" action="{$ROOT_URL}identification.php" id="quickconnect">
    2121    <input type="hidden" name="username" size="15" value="16"/>
    2222    <input type="hidden" name="password" size="15" value="adult_content"/>
  • extensions/adult_content/include/charte_user.tpl

    r3331 r3494  
    1 <link rel="stylesheet" type="text/css" href="{$pwg_root}plugins/{$PLUGIN_NAME}/include/charte.css">
     1{html_head}<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/{$PLUGIN_NAME}/include/charte.css">{/html_head}
    22
    33<div id="content">
    44<div class="titrePage">
    55      <ul class="categoryActions">
    6       <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li>
     6      <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>
    77    </ul>
    88  <h2>Adult content config</h2>
  • extensions/adult_content/language

    • Property svn:ignore set to
      _notes
  • extensions/adult_content/language/en_UK

    • Property svn:ignore set to
      _notes
  • extensions/adult_content/language/fr_FR

    • Property svn:ignore set to
      _notes
  • extensions/adult_content/language/fr_FR/plugin.lang.php

    r3331 r3494  
    11<?php
    22$lang['ac_title_menu'] = 'Attention';
     3$lang['ac_title_menu_statut'] ='Information';
    34$lang['ac_text'] = 'Cette galerie contient des images s\'addressant à des personnes matures et/ou majeurs';
    45$lang['ac_lien'] = 'enlever la protection';
  • extensions/adult_content/main.inc.php

    r3331 r3494  
    2424         
    2525                  // Ajout une entrée dans le menubar
     26          add_event_handler('blockmanager_register_blocks', array(&$adult_content, 'register_ac_menubar_blocks'));
    2627          add_event_handler('blockmanager_apply', array(&$adult_content, 'placer_identification'));
    27           add_event_handler('blockmanager_register_blocks', array(&$adult_content, 'register_ac_menubar_blocks'));
    2828
    2929
Note: See TracChangeset for help on using the changeset viewer.