Darathor
Citation :
But : Permet à chaque membre de masquer certains forums ou catégories sur l'index pour l'alléger.
Prérequis :
- [Sous-MOD] Auto-included files (1.0)
- [Sous-MOD] Définitions CSS complémentaires (1.1)
- [Sous-MOD] Images utiles (1.0)
Auteur : Darathor (darathor@free.fr)
Version : 1.0 DEV - A (11/11/2006)
Compatibilité phpBB : 2.0.21
Requêtes SQL :
Code :
CREATE TABLE `phpbb_forum_mask` (
`user_id` MEDIUMINT( 8 ) NOT NULL ,
`forum_id` SMALLINT( 5 ) NOT NULL
);
CREATE TABLE `phpbb_categories_mask` (
`user_id` MEDIUMINT( 8 ) NOT NULL ,
`cat_id` SMALLINT( 5 ) NOT NULL
);
Dans "index.php" :
Code :
#
# Trouver
#
//
// End session management
//
#
# Ajouter après
#
// DEBUT MOD Forum mask
FoMa_perform_masking_operations();
$masked_cat = FoMa_get_masked_elements(FOMA_MASK_TYPE_CATEGORY, $userdata['user_id']);
$masked_forum = FoMa_get_masked_elements(FOMA_MASK_TYPE_FORUM, $userdata['user_id']);
// FIN MOD Forum mask
#
# Trouver
#
//
// Okay, let's build the index
#
# Ajouter avant
#
// DEBUT MOD Forum mask
if($userdata['user_id'] != ANONYMOUS)
{
$template->assign_block_vars('switch_mask', array());
}
// FIN MOD Forum mask
#
# Trouver
#
$template->assign_block_vars('catrow', array(
#
# Ajouter avant
#
// DEBUT MOD Forum mask
if($masked_cat[$cat_id])
{
$l_mask = $lang['FoMa_Cat_Unmask'];
$i_mask = $images['I_plus'];
$v_mask = 'cunmask';
}
else
{
$l_mask = $lang['FoMa_Cat_Mask'];
$i_mask = $images['I_moins'];
$v_mask = 'cmask';
}
// FIN MOD Forum mask
#
# Trouver
#
'CAT_DESC' => $category_rows[$i]['cat_title'],
#
# Ajouter après
#
// DEBUT MOD Forum mask
'L_MASKCAT' => $l_mask,
'MASK_IMG' => $i_mask,
'U_MASKCAT' => append_sid("index.$phpEx?$v_mask=$cat_id"),
// FIN MOD Forum mask
#
# Trouver
#
if ( $viewcat == $cat_id || $viewcat == -1 )
{
#
# Remplacer par
#
// DEBUT MOD Forum mask
// -- DEBUT enlevé
// if ( $viewcat == $cat_id || $viewcat == -1 )
// {
// -- FIN enlevé
if($userdata['user_id'] != ANONYMOUS)
{
$template->assign_block_vars('catrow.switch_mask', array());
}
if (( $viewcat == $cat_id || $viewcat == -1 ) && ( ! $masked_cat[$cat_id] ))
{
// FIN MOD Forum mask
#
# Trouver
# $template->assign_block_vars('catrow.forumrow', array(
#
# Ajouter avant
#
// DEBUT MOD Forum mask
if($masked_forum[$forum_id])
{
$template->assign_block_vars('catrow.maskrow', array(
'UNMASK_IMG' => $images['I_plus'],
'L_UNMASK' => sprintf($lang['FoMa_Unmask'], $forum_data[$j]['forum_name']),
'U_UNMASKFORUM' => append_sid("index.$phpEx?unmask=$forum_id"))
);
}
else
{
// FIN MOD Forum mask
#
# Trouver
#
'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")
#
# Ajouter avant
#
// DEBUT MOD Forum mask
'L_MASK' => $lang['FoMa_Mask'],
'MASK_IMG' => $images['I_moins'],
'U_MASKFORUM' => append_sid("index.$phpEx?mask=$forum_id"),
// FIN MOD Forum mask
#
# Trouver
#
'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
);
#
# Ajouter après
#
// DEBUT MOD Forum mask
if($userdata['user_id'] != ANONYMOUS)
{
$template->assign_block_vars('catrow.forumrow.switch_mask', array());
}
}
// FIN MOD Forum mask
Dans "subsilver/index_body.tpl" :
Code :
#
# Trouver
#
<th class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
#
# Ajouter après
#
<!-- BEGIN switch_mask -->
<th class="thCornerR" nowrap="nowrap"> </th>
<!-- END switch_mask -->
#
# Trouver
#
<td class="rowpic" colspan="3" align="right"> </td>
#
# Remplacer par
#
<td class="catLeft" colspan="3" height="28" align="right" valign="middle">
<!-- BEGIN maskrow -->
<a href="{catrow.maskrow.U_UNMASKFORUM}"><img src="{catrow.maskrow.UNMASK_IMG}" alt="{catrow.maskrow.L_UNMASK}" title="{catrow.maskrow.L_UNMASK}" /></a>
<!-- END maskrow -->
</td>
<!-- BEGIN switch_mask -->
<td class="cm catLeft"><a href="{catrow.U_MASKCAT}"><img src="{catrow.MASK_IMG}" alt="{catrow.L_MASKCAT}" title="{catrow.L_MASKCAT}" /></a></td>
<!-- END switch_mask -->
#
# Trouver
#
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
#
# Ajouter après
#
<!-- BEGIN switch_mask -->
<td class="cm row2"><a href="{catrow.forumrow.U_MASKFORUM}"><img src="{catrow.forumrow.MASK_IMG}" alt="{catrow.forumrow.L_MASK}" title="{catrow.forumrow.L_MASK}" /></a></td>
<!-- END switch_mask -->
Dans "admin/admin_forums.php" :
Code :
#
# Trouver
#
$sql = "DELETE FROM " . PRUNE_TABLE . "
WHERE forum_id = $from_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql);
}
#
# Ajouter après
#
// DEBUT MOD Forum mask
$sql = "DELETE FROM " . FORUM_MASK_TABLE . "
WHERE forum_id = $from_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete forum mask information!", "", __LINE__, __FILE__, $sql);
}
// FIN MOD Forum mask
#
# Trouver
#
$sql = "DELETE FROM " . CATEGORIES_TABLE ."
WHERE cat_id = $from_id";
#
# Ajouter avant
#
// DEBUT MOD Forum mask
$sql = "DELETE FROM " . CAT_MASK_TABLE . "
WHERE cat_id = $from_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete cat mask information!", "", __LINE__, __FILE__, $sql);
}
// FIN MOD Forum mask
Dans "admin/admin_users.php" :
Code :
#
# Trouver
#
$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_userid = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
}
#
# Ajouter après
#
// DEBUT MOD Forum mask
$sql = "DELETE FROM " . FORUM_MASK_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from forum mask table', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . CAT_MASK_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from category mask table', '', __LINE__, __FILE__, $sql);
}
// DEBUT MOD Forum mask
Uploader les fichiers de ce zip aux emplacements suivants :
- includes/functions_front/functions_front_forum_mask.php
- includes/constants/constants_forum_mask.php
- language/lang_french/lang_front/lang_front_forum_mask.php