<?php

// $Id: bb_fnc_showtopics.php,v 1.5 2001/03/16 04:31:03 nick Exp $
// $Log: bb_fnc_showtopics.php,v $
// Revision 1.5  2001/03/16 04:31:03  nick
// Changed file suffices to .php rather than .php4
//
// Revision 1.4  2001/03/07 03:21:34  nick
// Changes for section moderators, adding topics, etc.
//
// Revision 1.3  2001/03/06 20:59:28  nick
// Further enhancements
//
// Revision 1.2  2001/03/04 22:49:12  nick
// Further bug fixes following production testing
//

// contents of function ShowTopics

/*

Copyright © 2001 Nick Gammon.

  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, 
  or (at your option) any later version. 

  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. 
  See the GNU General Public License for more details. 

*/

  global $bbsection_id, $THIS_PAGE, $headingrow, $FORUM_URL, $foruminfo;
  
  if ($headingrow ['section_description'])
    echo "<p>" .  htmlspecialchars ($headingrow ['section_description']) . "</p>\n";
  echo $headingrow ['section_motd'];
  echo "<hr>\n";
  
  echo "<h4>Topics</h4>";  
  $query = "SELECT bbtopic_id, topic_name, topic_description AS excerpt "
         . "FROM  bbtopic "
         . "WHERE bbsection_id = $bbsection_id ORDER BY topic_name";
  ShowList ($query, "bbtopic_id", "", "topic_name", false,
            "<UL>", "</UL>", "<LI>", "</LI>", $THIS_PAGE);   
 

  $query = "SELECT * "
         . "FROM bbuser "
         . "WHERE (blocked IS NULL OR blocked = 0) "
         . "  AND moderator_section = $bbsection_id "
         . "ORDER BY username";

  $count = ShowList ($query, "bbuser_id", "", "username", false,
                     "<hr><h4>Moderators</h4><UL>", "</UL>", "<LI>", "</LI>", $FORUM_URL . "bbshowbio.php");   
 
  if ($foruminfo ['admin'] ||
      $foruminfo ['moderator_section'] == $bbsection_id) 
        hLink ("<p align=left><font size=1>Add another topic</font></p>", 
              "bbupdatetopic.php", "bbsection_id=$bbsection_id", false);
 
  echo "<hr>\n";

    
  
 ?>