Pages vues depuis 25/05/2001 : 108 452 301
Index du forum »» Questions »» Les dix derniers posts affichés en accueil.
global $cookie,$parse, $user, $bgcolor1, $bgcolor2, $bgcolor3,$bgcolor4, $bgcolor5, $bgcolor6;
$maxcount=10;//Nbre de messages
$mbid = mysql_fetch_row(mysql_query("SELECT uid FROM users WHERE uname='$cookie[1]'"));
$rowcolor=tablos();
$boxstuff="<table cellspacing=\"3\" cellpadding=\"1\" class=\"cadre_mi\" width=\"100%\" border=\"0\"><tr align=\"center\" bgcolor=$bgcolor4>" ;
$boxstuff.="<td><b>Etat</b></td><td width=\"15%\"><b>Forum</b></td><td width=\"55%\"><b>Sujet</b></td><td width=\"20%\"><b>Date</b></td><td width=\"25%\"><b>Dernier Auteur</b></td></tr>";
$result = mysql_query("select distinct topic_id from posts order by post_id desc limit $maxcount");
if (!$count) $count = mysql_num_rows($result);
if ($count>$maxcount)$count=$maxcount;
$ibid=0;
$forum_limit=0;
while ($forum_limit<$count){
$classe = tablos();
list($topic_id) = mysql_fetch_row($result);
list($post_id, $forum_id, $poster_id, $time) = mysql_fetch_row(mysql_query("select post_id, forum_id, poster_id, post_time from posts where topic_id = $topic_id order by post_id desc limit 1"));
$forum_limit++;
if ($topic_id!=0) list($topic_title) = mysql_fetch_row(mysql_query("select topic_title,forum_id from forumtopics where topic_id=$topic_id"));
if ($forum_id!=0) list($forum_name,$forum_type,$forum_pass) = mysql_fetch_row(mysql_query("select forum_name,forum_type,forum_pass from forums where forum_id=$forum_id"));
if (($forum_type == "5") or ($forum_type == "7")) {
$ok_affich=false;
$tab_groupe=valid_group($user);
$ok_affich=groupe_forum($forum_pass, $tab_groupe);
} else {
$ok_affich=true;
}
if ($ok_affich) {
if ($poster_id!=0) list($uname) = mysql_fetch_row(mysql_query("select uname from users where uid=$poster_id"));
$boxstuff.="<tr $rowcolor>";
if ($ibid=theme_image("forum/icons/hot_red_folder.gif")) {$imgtmpHR=$ibid;} else {$imgtmpHR="images/forum/icons/hot_red_folder.gif";}
if ($ibid=theme_image("forum/icons/hot_folder.gif")) {$imgtmpH=$ibid;} else {$imgtmpH="images/forum/icons/hot_folder.gif";}
if ($ibid=theme_image("forum/icons/red_folder.gif")) {$imgtmpR=$ibid;} else {$imgtmpR="images/forum/icons/red_folder.gif";}
if ($ibid=theme_image("forum/icons/folder.gif")) {$imgtmpF=$ibid;} else {$imgtmpF="images/forum/icons/folder.gif";};
$sqlR = "SELECT rid FROM forum_read WHERE topicid='$topic_id' and uid='$mbid[0]' and topicid='$topic_id' and status!='0'";
$TableRep=mysql_query("SELECT * FROM posts WHERE topic_id='$topic_id'");
$replys=mysql_NumRows($TableRep);
$hot_threshold=10;//Nbres sujets chauds
if ($replys >= $hot_threshold) {
if (mysql_num_rows(mysql_query($sqlR))==0)
$image = $imgtmpHR;
else
$image = $imgtmpH;
} else {
if (mysql_num_rows(mysql_query($sqlR))==0)
$image = $imgtmpR;
else
$image = $imgtmpF;
}
if ($myrow[topic_status]!=0)
$image = $imgtmpL;
$boxstuff.="<td align=\"center\"><img src=\"$image\"></td><td>$forum_name</td><td align=\"left\">";
$boxstuff.="<a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\">$topic_title</a></td>";
$boxstuff.="<td align=\"center\">$time</td> " ;
$boxstuff.="<td><a href=\"user.php?op=userinfo&uname=$uname\">$uname</a></td>\n";
}
}
$boxstuff.="</tr></table>";
return ($boxstuff);
$max_caracteres=30;//Nbres de caractères pour le titre
if (strlen($topic_title)>$max_caracteres)
{
$topic_title = substr($topic_title, 0, $max_caracteres);
$topic_title = $topic_title."...";
}
$boxstuff.="<a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\">$topic_title</a></td>";
function MM_dernierCommentaires($nbCommentaire = 10, $maLimite = 80) {
global $NPDS_Prefix;
$nbCommentaire = arg_filter($nbCommentaire);
$maLimite = arg_filter($maLimite);
$sqlSelect = 'SELECT '.$NPDS_Prefix.'posts.topic_id, '.$NPDS_Prefix.'posts.poster_id, '.$NPDS_Prefix.'posts.post_text, '.$NPDS_Prefix.'users.name, '.$NPDS_Prefix.'stories.title
FROM '.$NPDS_Prefix.'posts
INNER JOIN '.$NPDS_Prefix.'users ON '.$NPDS_Prefix.'posts.poster_id = '.$NPDS_Prefix.'users.uid
INNER JOIN '.$NPDS_Prefix.'stories ON '.$NPDS_Prefix.'posts.topic_id = '.$NPDS_Prefix.'stories.sid
WHERE forum_id = -1
ORDER BY post_id DESC
LIMIT '.$nbCommentaire;
$execSqlSelect = sql_query($sqlSelect);
$content .= '<ul id="dernierCommentaire">';
while($dernierCommentaires = sql_fetch_row($execSqlSelect)) {
$dernierComment = strip_tags($dernierCommentaires[2]);
if(strlen($dernierComment) >= $maLimite) {
while($dernierComment[$maLimite - 1] != " ") {
$maLimite++;
}
$dernierComment = substr($dernierComment, 0, $maLimite);
$dernierComment .= ' ...';
}
$remplaceNPDS = str_replace('NPDS', 'npds', $dernierCommentaires[4]);
$content .= $dernierCommentaires[1] == 1 ? '<li>Anonyme : <a title="'.stripslashes($remplaceNPDS).'" href="article.php?sid='.$dernierCommentaires[0].'">'.stripslashes($dernierComment).'</a></li>' : '<li><a href="user.php?op=userinfo&uname='.$dernierCommentaires[3].'">'.stripslashes($dernierCommentaires[3]).'</a> : <a title="'.stripslashes($remplaceNPDS).'" href="article.php?sid='.$dernierCommentaires[0].'">'.stripslashes($dernierComment).'</a></li>';
}
$content .= '</ul>';
return($content);
}