Pages vues depuis 25/05/2001 : 108 479 544
Index du forum »» Version future »» une fonction pour le forum
<?PHP
/************************************************************************/
/* NPDS : Nuke Permanent Double-Side Web Portal System CentralBoard */
/* =========================== */
/* From CentralBoard version 1.0 pour myPHPNuke 1.8 */
/* Copyright © 2001, Hervé LAINE */
/* webmaster@clubados.com - http://www.clubados.com */
/* */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve) */
/* http://phpnuke.org */
/* */
/* This version name NPDS Copyright (c) 2001 by Philippe Brunier */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if(!IsSet($mainfile)) { !include! ("mainfile.php"); }
// !include! cache manager classe
!include!_once('cache.class.php');
// P. Brunier Permanent double-side theme
global $pdsts;
$pdst="1";
!include! ("modules/$ModPath/CentralBoard.conf.php");
!include! ("modules/$ModPath/CentralBoard.lang.php");
!include! ("modules/$ModPath/cache.timings.php");
function writeblock($title, $go, $corps, $foot, $statik){
global $site_font,$bgcolor2,$textcolor1, $bgcolorblock,$textcolorrouge ;
// Ajout gilles pub perso
//!include! ("static/facebook_jaime_compte_vivrenu_ferme.html");
//!include! ("static/facebook_jaime.html");
echo "<table width=100% align=left valign=top border=0 cellpading=0 cellsapcing=5 bgcolor=$bgcolorblock><tr><td align=left>";
echo "<font size=2 face=\"tahoma,$site_font\" color=$textcolor1>$title</font></td>";
echo "<td align=right><font size=2 face=\"tahoma,$site_font\" color=$textcolor1>$go</font></td></tr>";
echo "<tr><td colspan=2> ";
echo "<table align=center border=0 bgcolor=$bgcolor2 cellpadding=1 cellspacing=0 Width=100%><tr><td>";
echo "<table align=center border=0 bgcolor=$bgcolorblock cellpadding=5 cellspacing=0 Width=100%>";
echo "<tr><td>";
echo "<font size=2 face=\"tahoma,$site_font\" color=$textcolor1> " ;
if ($statik){
!include!($corps);
} else{
echo $corps ;
}
echo "</font></td></tr></table>";
echo "</td></tr></table>";
echo "</td></tr>";
echo "<tr><td colspan=2> " ;
echo "<font size=2 face=\"tahoma,$site_font\" color=$textcolor1>$foot</td></tr></table> " ;
}
function LastTopicsForum(){
global $bgcolorblock,$bgcolor4, $bgcolor3, $bgcolor2, $bgcolor1;
global $maxcount, $textcolor1 ;
global $user ;
$foot = "<a href=\"forum.php\">[Voir tous les forums Thématiques]</a>";
$go="";
// recherche du numéro user ($userdata[0]) et du code user ($userdata[1]).
$userX=base_64_decode($user);
$userdata=explode(":",$userX);
//rajouté par gilles (modele marc)
$corps = "";
searchblockcorps();
// fin ajout
// affichage du code user ($userdata[1]).
$corps .= "<table width=\"100%\" border=0 bordercolor=$bgcolor4 cellpadding=2 cellspacing=0 bgcolor=$bgcolorblock>";
$corps .= "<tr align=center bgcolor=$bgcolor2>";
$corps .= "<td width=3%>&nbsp;</td>";
$corps .= "<td width=64%><font size=2><b>Sujet</b></font></td>";
$corps .= "<td width=5%><font size=2><b>Rép.</b></font></td>";
$corps .= "<td width=15%><font size=2><b>Dernier message</b></font></td></tr>";
$groupes="'Z'";
// Controle du User pour voir s'il appartient au Groupe 7 (membres confirmés)
$affichgroup7=false;
$tab_groupe=valid_group($user);
for ($i=0; $i<=9; $i++) {
$groupes .=",'$tab_groupe[$i]'";
if ($tab_groupe[$i]==7) {
$affichgroup7=true;
}
}
// Controle du User pour voir s'il appartient au Groupe 35 (membres inscrits)
$affichgroup35=false;
$tab_groupe=valid_group($user);
for ($i=0; $i<=40; $i++) {
$groupes .=",'$tab_groupe[$i]'";
if ($tab_groupe[$i]==35) {
$affichgroup7=true;
}
}
// Controle du User pour voir s'il appartient au Groupe 6 (redacteur/moderateur/admin)
$affichgroup6=false;
$tab_groupe=valid_group($user);
for ($i=0; $i<=9; $i++) {
if ($tab_groupe[$i]==6) {
$affichgroup6=true;
break;
}
}
// Controle du User pour voir s'il appartient au Groupe 12 (Club ANO d'EURONAT)
$affichgroup12=false;
$tab_groupe=valid_group($user);
for ($i=0; $i<=9; $i++) {
if ($tab_groupe[$i]==12) {
$affichgroup12=true;
break;
}
}
// Début des modifications Grunt 1.03
if ($affichgroup7) // Groupe des confirmés
{
// Afficher les forums Type Public ou (Type 9 et forum 23) ou (Type 7 et (Groupes))
$conditions_acces =" (f.forum_type = 0) ";
$conditions_acces .=" or (f.forum_type=9 and (f.forum_id = '23'))";
$conditions_acces .=" or (f.forum_type=7 and (f.forum_pass in ($groupes)))";
}
else
{
$conditions_acces =" (f.forum_type='0' and forum_access<'2') ";
}
$query ="select t.topic_id, t.topic_title, t.forum_id, t.topic_poster, t.topic_time, f.forum_type, f.forum_name";
$query .=" from forumtopics t, forums f";
$query .=" where (t.forum_id=f.forum_id)";
$query .=" and ( ";
$query .= $conditions_acces;
$query .=" )";
$query .=" order by topic_time desc limit $maxcount";
// Fin des modifications Grunt 1.03
$result = mysql_query($query);
if (!$count) {
$count=mysql_num_rows($result);
}
if ($count>$maxcount){$count=$maxcount;}
$ibid=0;
$forum_limit=0;
// --- Début Ajout Grunt 1/3: pour correction dernières contributions. ---
// Déclarations récupérées de viewtopic.php
settype($start,"integer");
settype($posts_per_page,"integer");
// $posts_per_page est une constante pré-établie, je suppose: elle doit venir d'un !include!. Sinon:
$posts_per_page=30;
echo("<!-- Marquage: Cette version du site a été modifiée par Grunt. 1.02 -->");
// --- Fin Ajout Grunt 1/3: pour correction dernières contributions. ---
while ($forum_limit<$count){
list($topic_id, $topic_title, $forum_id, $poster_id, $topic_time, $forum_type, $forum_name) = mysql_fetch_row($result);
$topic_title=stripslashes($topic_title);
$forum_limit++; // topic_title
$query ="select post_time, poster_id, post_aff from posts where topic_id='$topic_id' order by post_id desc limit 0,1";
$result_P = mysql_query($query);
list($post_time, $poster_id, $post_aff) = mysql_fetch_row($result_P);
$post_time_mmjjhh=substr($post_time,5,11);
// Auteur
if ($poster_id!=0) {
list($uname) = mysql_fetch_row(mysql_query("select uname from users where uid=$poster_id"));
}
if ($ibid==0) {
$ibid=1;
$bcolor=$bgcolor1;
} else {
$ibid=0;
$bcolor=$bgcolor3;
}
$corps .= "<tr align=center bgcolor=$bcolor>" ;
// if ($ibid=theme_image("forum/icons/hot_red_folder.gif")) {$imgtmpHR=$ibid;} else {$imgtmpHR="images/forum/icons/hot_red_folder.gif";}
$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";}
$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";}
$imgtmpR="images/forum/icons/red_folder.gif";
// if ($ibid=theme_image("forum/icons/folder.gif")) {$imgtmpF=$ibid;} else {$imgtmpF="images/forum/icons/folder.gif";}
$imgtmpF="images/forum/icons/folder.gif";
// if ($ibid=theme_image("forum/icons/lock.gif")) {$imgtmpL=$ibid;} else {$imgtmpL="images/forum/icons/lock.gif";}
$imgtmpL="images/forum/icons/lock.gif";
// if ($ibid=theme_image("forum/icons/lock.gif")) {$imgtmpL=$ibid;} else {$imgtmpL="images/forum/icons/lock.gif";}
$imgtmpRi="images/download/right.gif";
// if ($ibid=theme_image("forum/icons/posticon.gif")) {$imgtmpP=$ibid;} else {$imgtmpP="images/forum/icons/posticon.gif";}
// if ($ibid=theme_image("box/right.gif")) {$imgtmpRi=$ibid;} else {$imgtmpRi="images/download/right.gif";}
// $replys = get_total_posts($forum_id, $myrow[$topic_id], "topic", $Mmod);
$replys = get_total_posts($forum_id, $topic_id, "topic", $Mmod);
$replys--;
$sqlR = "select rid from forum_read where forum_id='$forum_id' and uid='$userdata[0]' and topicid='$topic_id' and status!='0'";
$hot_threshold=20;
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] == 1)
$image = $imgtmpL;
$textcolor_aff = $textcolor1;
if ($post_aff==0) {
$textcolor_aff = "0000FF#";
}
if ($post_aff==1) {
$post_aff = " ";
}
// --- Début Ajout Grunt 2/3: pour correction dernières contributions. ---
// Nous faisons le calcul sauvage d'un start avec les moyens du bord.
// ($replys / $posts_per_page) fait une division au résulat entier et perd le reste.
// en remultipliant par $posts_per_page, on attend un multiple de $posts_per_page: 0,20,40,60...
$start=$replys / $posts_per_page;
settype($start,"integer");
$start=$start * $posts_per_page;
// --- Fin Ajout Grunt 2/3: pour correction dernières contributions. ---
$corps .= "<td align=center><img src=$image></td>";
$corps .= "<td align=left><font size=2 face=\"tahoma,$site_font\" color=$textcolor_aff>$post_aff&nbsp;<a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\"><b>$topic_title</b></a></font>";
$corps .= "<font size=1 face=\"tahoma,$site_font\" color=$textcolor1>&nbsp;[<a href=\"viewforum.php?forum=$forum_id\">$forum_name</a>]</font></td>";
// --- Début Modification Grunt 3/3: pour correction dernières contributions. ---
$corps .= "<td align=right><font size=1 face=\"tahoma,$site_font\" color=$textcolor1><a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\" title=\"Premières contributions\" >$replys</a></font>&nbsp;<a href=\"viewtopic.php?topic=$topic_id&start=$start&forum=$forum_id#last-post\" ><img src=\"$imgtmpRi\" border=\"0\" align=\"middle\" alt=\"".translate("Last Posts")."\" /></a>&nbsp;</td> " ;
// $corps .= "<td align=right><font size=1 face=\"tahoma,$site_font\" color=$textcolor1><a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\" title=\"Premières contributions\" >$replys</a></font>&nbsp;<a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id#last-post\" ><img src=\"$imgtmpRi\" border=\"0\" align=\"middle\" alt=\"".translate("Last Posts")."\" /></a>&nbsp;</td> ";
// --- Fin Modification Grunt 3/3: pour correction dernières contributions. ---
$corps .= "<td align=center><font size=1 face=\"tahoma,$site_font\" color=$textcolor1>$post_time_mmjjhh <a href=\"user.php?op=userinfo&uname=$uname\">$uname</a></font></td></tr>";
}
$corps .="</table>";
//ajout marc
searchblock();
//fin ajout marc
WriteBlock($title,$go,$corps,$foot,false);
}
function main($op){
global $catid_b1,$catid_b5;
// bloc N°4 - Le forums
echo "<table width=100% border=0 cellspacing=5 cellpading=0><tr><td>";
LastTopicsForum();
echo "</td></tr></table>";
!include!("footer.php");
}
//ajouté par marc
function searchblock(){
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"4\" border=\"0\">
<form action=\"searchbb.php\" method=\"post\"><tr><td nowrap class=\"HEADER\">
<input type=\"hidden\" name=\"addterm\" value=\"any\">
<input type=\"hidden\" name=\"sortby\" value=\"p.post_id\">";
//ajouté par gilles
echo "<center><b>
<a href=\"viewtopic.php?topic=2132&forum=10\">[Centres naturistes à 100% ]</a>&nbsp;
<a href=\"forum.php\">[Tous les Forums ]</a>&nbsp;&nbsp;&nbsp;".translate('Search')."</b>&nbsp;&nbsp;<input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"term\" size=\"10\">&nbsp;&nbsp;<input class=\"BOUTON_STANDARD\" type=\"submit\" name=\"submit\" Value=\"".translate("Submit")."\"></center>";
echo "</td></tr></form></table>";
}
function searchblockcorps(){
$corps .= "<br /><table width=\"100%\" cellspacing=\"0\" cellpadding=\"4\" border=\"0\">";
$corps .= "<form action=\"searchbb.php\" method=\"post\"><tr><td nowrap class=\"HEADER\">";
$corps .= "<input type=\"hidden\" name=\"addterm\" value=\"any\">";
$corps .= "<input type=\"hidden\" name=\"sortby\" value=\"p.post_id\">";
$corps .= "<center><b>".translate('Search')."</b>&nbsp;&nbsp;<input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"term\" size=\"50\">&nbsp;&nbsp;<input class=\"BOUTON_STANDARD\" type=\"submit\" name=\"submit\" Value=\"".translate("Submit")."\"></center>";
$corps .= "</td></tr></form></table><br />";
}
// !include!('functions.php');
function get_total_posts($fid, $tid, $type, $Mmod) {
if ($Mmod) {
$post_aff="";
} else {
$post_aff=" and post_aff='1'";
}
switch($type) {
case 'forum':
$sql = "SELECT count(*) AS total FROM posts WHERE forum_id='$fid'$post_aff";
break;
case 'topic':
$sql = "SELECT count(*) AS total FROM posts WHERE topic_id='$tid'$post_aff";
break;
case 'user':
forumerror(0031);
}
if (!$result = mysql_query($sql))
return("ERROR");
if (!$myrow = mysql_fetch_array($result))
return("0");
mysql_free_result($result);
return($myrow[total]);
}
// fin ajout marc
// début programme principal
!include!("header.php");
switch ($op) {
case "edito":
write_edito($txtname);
main($op);
break;
default:
main($op);
break;
}
?>