FluxBB.fr

Le site des utilisateurs francophones de FluxBB.

Recherche rapide

Vous n'êtes pas identifié(e).

Version 1.4.13 : [.tar.gz][.zip] (maj 20/10/2014)
Pack langue française pour 1.4.x : [.zip] (maj 06/01/2012)

Branche 1.5.x : fluxbb.org
Pack langue française pour 1.5.x : [.zip] (maj 14/01/2016)

Ancienne Version 1.2.24 fr : [.zip] (maj 26/08/2011)

Vous avez un problème ?
Avant de poser votre question sur les forums d'entraide nous vous invitons à consulter :

#1 13-10-2016 23:55:23

akira_87
Habitué
Lieu : Limoges
Inscription : 05-06-2010
Messages : 139
Site Web

[Astuce] Trois niveaux d'épinglage : Annoncer global, Annoncer et épingler

Cette astuce est basé sur l'astuce de fanf73 et Fredy qui permettait d'avoir deux niveaux "d'épinglage". cette fois nous allons ajouté un troixieme niveau et Les topics seront placés en "Annonce global, Annonce, Épinglé, et les postes normals"

Une astuce propre...

Footer.php
Chercher ligne 51

if ($cur_topic['sticky'] == '1')
    echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang_common['Unstick topic'].'</a></span></dd>'."\n";
else
    echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang_common['Stick topic'].'</a></span></dd>'."\n";

Remplacer par

if ($cur_topic['sticky'] == '1')
{
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announce='.$id.'">'.$lang_common['Announce topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announceg='.$id.'">'.$lang_common['Announce_g topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang_common['Unstick topic'].'</a></span></dd>'."\n";
}
else if ($cur_topic['sticky'] == '2')
{
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang_common['Stick topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announceg='.$id.'">'.$lang_common['Announce_g topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang_common['Unstick topic'].'</a></span></dd>'."\n";
}
else if ($cur_topic['sticky'] == '3')
{
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang_common['Stick topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announce='.$id.'">'.$lang_common['Announce topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang_common['Unstick topic'].'</a></span></dd>'."\n";
} 
else
{
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang_common['Stick topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announce='.$id.'">'.$lang_common['Announce topic'].'</a></span></dd>'."\n";
     echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;announceg='.$id.'">'.$lang_common['Announce_g topic'].'</a></span></dd>'."\n";
}

Moderate.php

Chercher

// Stick a topic
else if (isset($_GET['stick']))
{
    confirm_referrer('viewtopic.php');

    $stick = intval($_GET['stick']);
    if ($stick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'1\' WHERE id='.$stick.' AND forum_id='.$fid) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']);
}

Ajouter après

// Announce a topic
else if (isset($_GET['announce']))
{
    confirm_referrer('viewtopic.php');

    $stick = intval($_GET['announce']);
    if ($stick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'2\' WHERE id='.$stick.' AND forum_id='.$fid) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']);
}

// Announcement global a topic
else if (isset($_GET['announceg']))
{
    confirm_referrer('viewtopic.php');

    $stick = intval($_GET['announceg']);
    if ($stick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'3\' WHERE id='.$stick.' AND forum_id='.$fid) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']);
}

Viewforum.php

Chercher

$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.'

Ajouter après

OR sticky = 3 

Chercher

WHERE t.forum_id='.$id.' 

Ajouter après

OR t.sticky = 3 

Chercher et Supprimé ce bout de code

<div id="vf" class="blocktable">
	<h2><span><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></span></h2>
	<div class="box">
		<div class="inbox">
			<table>
			<thead>
				<tr>
					<th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
					<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
<?php if ($pun_config['o_topic_views'] == '1'): ?>					<th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
<?php endif; ?>					<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
				</tr>
			</thead>

Chercher

$topic_count = 0;

Ajouter après

$cur_category = 0; 
$isset_announce = 0;
$cat_annonce = 0;
$cat_normal = 0;

Chercher

while ($cur_topic = $db->fetch_assoc($result))
{

Ajouter après

$category =  ($cur_topic['sticky'] == 3) ? '1' : '0';
			
if ($category != $cur_category || $category == $cur_category)
{
	if ($category == $cur_category)
	{
		if ($isset_announce == 1)
			echo '</tbody></table></div></div></div>';
		$isset_announce = '0';
	}
			
	if ($cat_annonce == 0 && $category != $cur_category || $cat_normal == 0 && $category == $cur_category)
	{	
		?>				
			<div id="vf<?php echo ($category != $cur_category ? 'announce' : '') ?>" class="blocktable">
				<h2><span><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></span></h2>
				<div class="box">
					<div class="inbox">
						<table>
							<thead>
								<tr>
									<th class="tcl" scope="col"><?php echo ($category != $cur_category ? $lang_common['Global Announcement'] : $lang_common['Topic']) ?></th>
									<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
									<?php if ($pun_config['o_topic_views'] == '1'): ?>
                                              	                               <th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
									<?php endif; ?>
									<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
								</tr>
							</thead>
							<tbody>				
		<?php
			if ($cat_annonce == 0 && $category != $cur_category)
				$cat_annonce = 1;
					
			if ($cat_normal == 0 && $category == $cur_category)
				$cat_normal = 1;	
	}

	if ($category != $cur_category)			
		$isset_announce = 1;			
}

Chercher

if ($cur_topic['sticky'] == '1')
{
    $item_status .= ' isticky';
    $status_text[] = '<span class="stickytext">'.$lang_forum['Sticky'].'</span>';
}

Ajouter après

if ($cur_topic['sticky'] == '2')
{
    $item_status .= ' iannounce';
    $status_text[] = '<span class="announceytext">'.$lang_forum['Announce'].'</span>';
}

if ($cur_topic['sticky'] == '3')
{
    $status_text[] = '<span class="iannouncetext">'.$lang_common['Global Announcement'].' : </span>';
    $item_status .= ' iannounceg';
}

Chercher

<tr class="rowodd inone">
	<td class="tcl" colspan="<?php echo $colspan ?>">
		<div class="t-icon inone"><div class="nosize"><!-- --></div></div>
		<div class="tclcon">
			<div>
				<strong><?php echo $lang_forum['Empty forum'] ?></strong>
			</div>
		</div>
	</td>
</tr>

Remplacer par

<div id="vf" class="blocktable">
	<h2><span><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></span></h2>
	<div class="box">
		<div class="inbox">
			<table>
			<thead>
				<tr>
					<th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
					<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
<?php if ($pun_config['o_topic_views'] == '1'): ?>					<th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
<?php endif; ?>					<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
				</tr>
			</thead>
			<tbody>
				<tr class="rowodd inone">
					<td class="tcl" colspan="<?php echo $colspan ?>">
						<div class="t-icon inone"><div class="nosize"><!-- --></div></div>
						<div class="tclcon">
							<div>
								<strong><?php echo $lang_forum['Empty forum'] ?></strong>
							</div>
						</div>
					</td>
				</tr>

Edit.php

Chercher

$stick_topic = isset($_POST['stick_topic']) ? '1' : '0';

Remplacer par

$stick_topic = isset($_POST['stick_topic']) && $is_admmod ? ($_POST['stick_topic'] == '1' ? '1' : ($_POST['stick_topic'] == '2' ? '2' : ($_POST['stick_topic'] == '3' ? '3' : '0'))) : '0';

Chercher

$checkboxes = array();
if ($can_edit_subject && $is_admmod)
{
	if (isset($_POST['stick_topic']) || $cur_post['sticky'] == '1')
		$checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" checked="checked" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>';
	else
		$checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>';
}

Remplacer par

$checkboxes = array();

$checkboxes[] = '<label><input type="radio" name="stick_topic" value="0" '.(isset($_POST['stick_topic']) || $cur_post['sticky'] == '0' ? 'checked="checked"' : '').' tabindex="'.($cur_index++).'" />Normal message<br /></label>';
if ($can_edit_subject && $is_admmod)
{
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="1" '.(isset($_POST['stick_topic']) || $cur_post['sticky'] == '1' ? 'checked="checked"' : '').' tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>';
	
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="2" '.(isset($_POST['stick_topic']) || $cur_post['sticky'] == '2' ? 'checked="checked"' : '').' tabindex="'.($cur_index++).'" />'.$lang_common['Announcement'].'<br /></label>';
	
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="3" '.(isset($_POST['stick_topic']) || $cur_post['sticky'] == '3' ? 'checked="checked"' : '').' tabindex="'.($cur_index++).'" />'.$lang_common['Global Announcement'].'<br /></label>';
		
}

post.php

Chercher

$stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0';

Remplacer par

$stick_topic = isset($_POST['stick_topic']) && $is_admmod ? ($_POST['stick_topic'] == '1' ? '1' : ($_POST['stick_topic'] == '2' ? '2' : ($_POST['stick_topic'] == '3' ? '3' : '0'))) : '0';

Chercher

$checkboxes = array();
if ($fid && $is_admmod)
	$checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['stick_topic']) ? ' checked="checked"' : '').' />'.$lang_common['Stick topic'].'<br /></label>';

Remplacer par

$checkboxes = array();
if ($fid && $is_admmod)
{
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['stick_topic']) ? ' checked="checked"' : '').' />'.$lang_common['Stick topic'].'</label>';
	
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="2" tabindex="'.($cur_index++).'"'.(isset($_POST['stick_topic']) && $_POST['stick_topic'] == "2" ? ' checked="checked"' : '').' />'.$lang_common['Announcement'].'</label>';
	$checkboxes[] = '<label><input type="radio" name="stick_topic" value="3" tabindex="'.($cur_index++).'"'.(isset($_POST['stick_topic']) && $_POST['stick_topic'] == "3" ? ' checked="checked"' : '').' />'.$lang_common['Global Announcement'].'</label>';
}

lang/French/common.php

Chercher

'Stick topic'            =>      'Épingler la discussion',

Ajouter après

'Announce topic'          =>      'Annoncer la discussion',
'Announce_g topic'       =>      'Annoncer globale la discussion',

Chercher

'Sticky'						=>	'Sticky',

Ajouter après

'Global Announcement'				=>	'Global Announcement',

style/[Votre style].css

Chercher

.pun #vf td.tcl span.stickytext, .pun #vf td.tcl span.closedtext {
    font-size: 1em;
    font-weight: bold;
}

Remplacer par

.pun #vf td.tcl span.stickytext, .pun #vf td.tcl span.closedtext, .pun #vf td.tcl span.announcetext, .pun #vfannounce td.tcl span.iannouncetext {
    font-size: 1em;
    font-weight: bold;
}

Chercher

.pun .blocktable td.tcl span.stickytext {
    color: #000;
}

Remplacer par

.pun .blocktable td.tcl span.stickytext, .pun .blocktable td.tcl span.announcetext, .pun .blocktable td.tcl span.iannouncetext {
    color: #3399CC;
}

voila
N'hésitez pas si vous avez des remarques ou si vous trouver des bugs

Dernière modification par akira_87 (13-10-2016 23:57:07)


function j_ai_besoin() {
     if (ça existe) j'utilise;
     if (ça existe mais c'est incomplet) j'améliore et je partage;
     if (ça n'existe pas) je développe et je partage;
     if (je réclame) exit;
    Return "code amélioré" or "developpeur satisfait" or die;}

Hors ligne

Pied de page des forums