Darathor
Requêtes SQL :
Dans "include/constant.php" :
Dans "lang_main.php" :
Dans "subsilver/subsilver.cfg" :
Dans "index.php" :
Dans "subsilver/index_body.tpl" :
Dans "admin/admin_forums.php" :
Dans "admin/admin_users.php" :
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 "include/constant.php" :
Code :
#
# Trouver
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
# Ajouter après
#
// DEBUT MOD Forum mask
define('FORUM_MASK_TABLE', $table_prefix.'forum_mask');
define('CAT_MASK_TABLE', $table_prefix.'categories_mask');
// FIN MOD Forum mask
Dans "lang_main.php" :
Code :
#
# Trouver
#
?>
#
# Ajouter avant
#
// DEBUT MOD Forum mask
$lang['FoMa_Cat_Unmask'] = 'Démasquer cette catégorie';
$lang['FoMa_Cat_Mask'] = 'Masquer cette catégorie';
$lang['FoMa_Unmask'] = 'Démasquer le forum -%s-';
$lang['FoMa_Mask'] = 'Masquer ce forum';
// FIN MOD Forum mask
Dans "subsilver/subsilver.cfg" :
Code :
#
# Trouver
#
?>
#
# Ajouter avant
#
// DEBUT MOD Forum mask
$images['FoMa_Unmask'] = "$current_template_images/icon_mini_unmask.gif";
$images['FoMa_Mask'] = "$current_template_images/icon_mini_mask.gif";
// FIN MOD Forum mask
Dans "index.php" :
Code :
#
# Trouver
#
//
// End session management
//
#
# Ajouter après
#
// DEBUT MOD Forum mask
// Catégories
if( isset($HTTP_GET_VARS['cmask']) && ($userdata['user_id'] != -1))
{
$mask_id = intval($HTTP_GET_VARS['cmask']);
// Teste si la catégorie existe
$sql = "SELECT cat_id FROM " . CATEGORIES_TABLE . "
WHERE cat_id = $mask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query categories information', '', __LINE__, __FILE__, $sql);
}
if($db->sql_fetchrow($result))
{
// La catégorie existe bien, on verifie que ce masque n'est pas déjà positionné
$sql = "SELECT cat_id FROM " . CAT_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
AND cat_id = $mask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query category mask information', '', __LINE__, __FILE__, $sql);
}
if(!$db->sql_fetchrow($result))
{
// Le forum existe et le masque n'est pas encore positionné => on le positionne
$sql = "INSERT INTO " . CAT_MASK_TABLE . "
(user_id, cat_id) VALUES (" . $userdata['user_id'] . ", $mask_id)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query catagory mask information', '', __LINE__, __FILE__, $sql);
}
}
}
}
// Démasquage
if( isset($HTTP_GET_VARS['cunmask']) && ($userdata['user_id'] != -1))
{
$unmask_id = intval($HTTP_GET_VARS['cunmask']);
$sql = "DELETE FROM " . CAT_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
AND cat_id = $unmask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query category mask information', '', __LINE__, __FILE__, $sql);
}
}
// Forums
// Masquage
if( isset($HTTP_GET_VARS['mask']) && ($userdata['user_id'] != -1))
{
$mask_id = intval($HTTP_GET_VARS['mask']);
// test si le forum existe
$sql = "SELECT forum_id FROM " . FORUMS_TABLE . "
WHERE forum_id = $mask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum information', '', __LINE__, __FILE__, $sql);
}
if($db->sql_fetchrow($result))
{
// Le forum existe bien, on verifie que ce masque n'est pas déjà positionné
$sql = "SELECT forum_id FROM " . FORUM_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
AND forum_id = $mask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum mask information', '', __LINE__, __FILE__, $sql);
}
if(!$db->sql_fetchrow($result))
{
// Le forum existe et le masque n'est pas encore positionné => on le positionne
$sql = "INSERT INTO " . FORUM_MASK_TABLE . "
(user_id, forum_id) VALUES (" . $userdata['user_id'] . ", $mask_id)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum mask information', '', __LINE__, __FILE__, $sql);
}
}
}
}
// Démasquage
if( isset($HTTP_GET_VARS['unmask']) && ($userdata['user_id'] != -1))
{
$unmask_id = intval($HTTP_GET_VARS['unmask']);
$sql = "DELETE FROM " . FORUM_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
AND forum_id = $unmask_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum mask information', '', __LINE__, __FILE__, $sql);
}
}
// FIN MOD Forum mask
#
# Trouver
#
//
// Find which forums are visible for this user
#
# Ajouter avant
#
// DEBUT MOD Forum mask
if($userdata['user_id'] != -1)
{
// Récupération des catégories masquées
$sql = "SELECT * FROM " . CAT_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
ORDER BY cat_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query category masks information', '', __LINE__, __FILE__, $sql);
}
$masked_cat = array();
while( $row = $db->sql_fetchrow($result) )
{
$masked_cat[$row['cat_id']] = true;
}
// Récupération des forums masqués
$sql = "SELECT * FROM " . FORUM_MASK_TABLE . "
WHERE user_id = " . $userdata['user_id'] . "
ORDER BY forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum masks information', '', __LINE__, __FILE__, $sql);
}
$masked_forum = array();
while( $row = $db->sql_fetchrow($result) )
{
$masked_forum[$row['forum_id']] = true;
}
}
else
{
$masked_cat = 0;
$masked_forum = 0;
}
// FIN MOD Forum mask
#
# Trouver
#
//
// Okay, let's build the index
#
# Ajouter avant
#
// DEBUT MOD Forum mask
if($userdata['user_id'] != -1)
{
$template->assign_block_vars('switch_mask', array());
}
// FIN MOD Forum mask
#
# Trouver
#
$display_forums = false;
#
# Ajouter après
#
// DEBUT MOD Forum mask
$display_masked_forums = false;
// FIN MOD Forum mask
#
# Trouver
#
$display_forums = true;
#
# Ajouter après
#
// DEBUT MOD Forum mask
if($masked_forum[$forum_data[$j]['forum_id']]) { $display_masked_forums = true; }
// 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['FoMa_Unmask'];
$v_mask = 'cunmask';
}
else
{
$l_mask = $lang['FoMa_Cat_Mask'];
$i_mask = $images['FoMa_Mask'];
$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
if($userdata['user_id'] != -1)
{
$template->assign_block_vars('catrow.switch_mask', array());
}
// -- DEBUT enlevé
// if ( $viewcat == $cat_id || $viewcat == -1 )
// {
// -- FIN enlevé
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['FoMa_Unmask'],
'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['FoMa_Mask'],
'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'] != -1)
{
$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
#
<!-- DEBUT MOD Forum mask -->
<!-- BEGIN switch_mask -->
<th class="thCornerR" nowrap="nowrap"> </th>
<!-- END switch_mask -->
<!-- FIN MOD Forum mask -->
#
# Trouver
#
<td class="rowpic" colspan="3" align="right"> </td>
#
# Remplacer par
#
<!-- DEBUT MOD Forum mask -->
<td class="catLeft" colspan="3" height="28" align="right" valign="middle">
<!-- BEGIN maskrow -->
<a href="{catrow.maskrow.U_UNMASKFORUM}" title="{catrow.maskrow.L_UNMASK}"><img src="{catrow.maskrow.UNMASK_IMG}" border="0" /></a>
<!-- END maskrow -->
</td>
<!-- BEGIN switch_mask -->
<td class="catLeft" height="28" align="center" valign="middle"><a href="{catrow.U_MASKCAT}" title="{catrow.L_MASKCAT}"><img src="{catrow.MASK_IMG}" border="0" /></a></td>
<!-- END switch_mask -->
<!-- FIN MOD Forum 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
#
<!-- DEBUT MOD Forum mask -->
<!-- BEGIN switch_mask -->
<td class="row2" align="center" valign="middle"><a href="{catrow.forumrow.U_MASKFORUM}" title="{catrow.forumrow.L_MASK}"><img src="{catrow.forumrow.MASK_IMG}" border="0" /></a></td>
<!-- END switch_mask -->
<!-- FIN MOD Forum 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