<?php
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//   Copyright (C) 2000  Phorum Development Team                              //
//   http://www.phorum.org                                                    //
//                                                                            //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of the Phorum License Version 1.0.                    //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////
include("../config.php3");
include($BIB."bib_games.php3");
require "./common.php";
 

  
  if($ActiveForums==1){
    $sSQL="Select id, folder from $pho_main where active=1";
    $q->query($DB, $sSQL);
    $rec=$q->getrow();
    if($rec["folder"]==0){
      header("Location: $forum_url/$list_page.$ext?f=$rec[id]$GetVars");
      exit();
    }
  }
 
  $title = $lForumList;
  if(file_exists("$include_path/header_$ForumConfigSuffix.php")){
    include "$include_path/header_$ForumConfigSuffix.php";
  }
  else{
    include "$include_path/header.php";
    
  }

  


  if($f!=0){
    $level='';
    if($ForumParent!=0){
      $level="f=$ForumParent";
    }
    $table_width=$ForumTableWidth;
    $table_header_color=$ForumTableHeaderColor;
    $table_header_font_color=$ForumTableHeaderFontColor;
    $table_body_color_1=$default_green_body_color;
    $table_body_font_color_1=$ForumTableBodyFontColor1;


?>



<table width="<?php echo $table_width; ?>" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td <?php echo bgcolor($nav_color); ?> valign="TOP" nowrap><a class=smallWhiteLink href="<?php echo $sess->link3($FORUM_URL.$forum_page.".".$ext,$level.$GetVars); ?>"><?php echo $lUpLevel; ?></a></td>
  </tr>
</table>
<?php
  }
  else{
    $table_width=$default_table_width;
    $table_header_color=$default_table_header_color;
    $table_header_font_color=$default_table_header_font_color;
    $table_body_color_1=$default_table_body_color_1;
    $table_body_font_color_1=$default_table_body_font_color_1;
  }
?>


<?php 
table_ktf_up( $lAvailableForums, "100%", 'green',1,'','','#FFFFFF' ); 



?>
<div class="smallDark">
Cet espace vous permet d’apporter votre contribution aux thèmes de discussion que nous 
vous proposons. Toutes les données qui y figurent ne peuvent être collectées ou utilisées à d’autres fins.
<br><br>
</div>
	<br>
	<table cellpadding=5 cellspacing=0 width=100% border=0>
	<tr>
			<td width=100% align=center valign=top><?php include($ARCHIVES_DIR."tag_468x60_bookmaker.html");?></td>
	</tr>
	</table>
	<br>

<table width=100% cellspacing="0" cellpadding="5" border="0">

<?php
	
  
  $coutForum = 1;
  
  if(isset($q)){
    $sSQL="Select id, name, table_name, parent, folder, description from ".$pho_main." where active=1 and parent=$f";
    if($SortForums) $sSQL.=" order by name";
    $q->query($DB, $sSQL);
    $rec=$q->getrow();
  } 
  else 
  {
    $rec = "";
  }
  
  
  if(is_array($rec))
  {
    while(is_array($rec))
	{
		if(($coutForum % 2) == 0)
			$mybgcolor = $default_table_header_font_color; 
		else 
			$mybgcolor = $default_green_body_color;
			
		
		$coutForum++;
	  
	  $empty=false;
      $name=$rec["name"];
      $num=$rec["id"];
      if(!$rec["folder"])
	  {
        $sSQL="select count(*) as posts from $rec[table_name] where approved='Y'";
        $tq = new query($DB, $sSQL);
        if($tq->numrows())
		{
          $trec=$tq->getrow();
          $num_posts=$trec["posts"];
          
         //echo $sSQL;
        }
        else
		{
          $num_posts='0';
        }
        $sSQL="select count(*) as posts from $rec[table_name] where approved='Y' AND TO_DAYS(NOW())-TO_DAYS(datestamp) < 7 ";
        $tq = new query($DB, $sSQL);
        if($tq->numrows()){
          $trec=$tq->getrow();
          $num_posts_week=$trec["posts"];
          
         //echo $sSQL;
        }
        else{
          $num_posts='0';
        }
        
        
        $sSQL="select max(datestamp) as max_date from $rec[table_name] where approved='Y'";
        $tq->query($DB, $sSQL);
        $trec=$tq->getrow();
        if(empty($trec["max_date"]))
		{
          $last_post_date="";
        }
        else
		{
          $last_post_date=old_date_format($trec["max_date"]);
        }
      }
      echo "<tr bgcolor='$mybgcolor'><td width=\"50%\">";
      if($rec["folder"]){
        echo "<b>&nbsp;<img src=\"".$IMAGES_DIR."triangleorange.gif\">&nbsp;<a class=boldLink href=\"".$sess->link3($FORUM_URL.$forum_page.".".$ext,"f=".$num.$GetVars)."\">$name</a></b></td>";

        echo "<td  width=\"50%\"  class=forumInfodesc>&nbsp;&nbsp;$lForumFolder</td></tr>";
      }
      else{
        echo "<b>&nbsp;<img src=\"".$IMAGES_DIR."triangleorange.gif\">&nbsp;<a class=boldLink href=\"".$sess->link3($FORUM_URL.$list_page.".".$ext,"f=".$num.$GetVars)."\">$name</a></b></font></div></td>";
        echo "<td class=smallDark  width=\"50%\">$lNumPosts: <b>$num_posts</b><br>$lNumPostsWeek: <b>$num_posts_week</b><br>$lLastPostDate: <b>$last_post_date</b></td></tr>";
      }
      echo "<tr bgcolor='$mybgcolor' ><td width=50%  class=forumInfodesc align=right colspan=2>";
      echo "&nbsp;";
      echo $rec["description"];
      echo "</td></tr>\n";
	  
	  
	  $rec=$q->getrow();

	  	
	 /*
	     if ($rec)
		echo "<tr><td width=100% colspan=2 bgcolor=#FFFFFF height=6 class=verysmallDark>&nbsp;</td></tr>";*/
		
    }
?>
<?php
  }
  else{
?>
<tr>
    <td width="100%" colspan=2 <?php echo bgcolor($table_body_color_1); ?>><FONT color="<?php echo $table_body_font_color_1; ?>">&nbsp;<?php echo $lNoActiveForums;?></font></td>
</tr>
<?php
  }
?>
</table>

<?php
table_ktf_down( '', 1 ); 


  if(file_exists("$include_path/footer_$ForumConfigSuffix.php")){
    include "$include_path/footer_$ForumConfigSuffix.php";
  }
  else{
    include "$include_path/footer.php";
  }
?>