<?php
$admin = 2;
$file = __FILE__;
include ("../inc/inc_common.php");
include ("../inc/inc_connect.php");
include ("../inc/inc_admincheck.php");
include ("../inc/inc_getdate.php");
include ("../inc/inc_forumname.php");
$page = "Admin - Set Up Forums";
$pagelink = $file;
include("../inc/inc_setonline.php");
$title = "$name1 Admin - $gfcookie[1] - Set Up Forums";
include ("../inc/inc_head.php");
include ("../inc/inc_body.php");
$title = "Set Up Forums";
include ("../inc/inc_title.php");

$result = mysql_query( "SELECT * FROM $grouptable" );
$num_rows = mysql_num_rows( $result );
//Dispay records
while ( $a_row = mysql_fetch_object( $result ) )
{
    if ( ! $a_row->strGrimforumName == "" )
    {
        $grimforumname = $a_row->strGrimforumName;
    }
}

if ( $grimforumname == "" )
{
    $grimforumname = "Click Here To Set Forum Name";
}

print "<table border=1 cellpadding=0 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=80% bgcolor=$fgcolour>
  <tr>
    <td width=100%>
    <font size=2 face=$font><center>
    <br><b>Current Forum Setup:</b><br><br>";

print "
<table border=1 cellpadding=2 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=90% bgcolor=$fgcolour>
  <tr><td width=100%>
  <a OnClick=\"return confirm('Stop Being Silly!')\" href=\"#bob\"><img border=0 src=\"../images/delete_icon.gif\"></a>
  <font face=$font size=4>
  <b><a href=\"admin_changeforumtitle.php?titleb=$grimforumname\">
  $grimforumname
  </a></td></tr></table>";

$result = mysql_query( "SELECT * FROM $grouptable WHERE ynGroupMaster = '1' ORDER BY intGroupOrder" );
$num_rows = mysql_num_rows( $result );

//Dispay records
while ( $a_row = mysql_fetch_object( $result ) )
{
    print "<table border=1 cellpadding=2 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=90% bgcolor=$fgcolour>
    <tr><td width=100%>
    <a OnClick=\"return confirm('Are you sure you want to delete this forum and all of its contents?')\" href=\"admin_deleteforum.php?id=$a_row->intId&titleb=$a_row->strName\"><img border=0 src=\"../images/delete_icon.gif\"></a>
    <font face=$font size=3>&nbsp;<b>
    <a href=\"admin_changesubtitle.php?titleb=$a_row->strName&id=$a_row->intId\">
    $a_row->strName</a>
    &nbsp;&nbsp;&nbsp;List Order:
    <a href=\"admin_changelistorder.php?id=$a_row->intId&list=$a_row->intGroupOrder\">
    $a_row->intGroupOrder</a>
    </td></tr>
    </table>";

    $groupid = $a_row->intGroupId;

    print "<table border=1 cellpadding=2 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=90% bgcolor=$fgcolour>";

    $resultb = mysql_query( "SELECT * FROM $grouptable WHERE ynGroupMaster = '0' ORDER BY strName" );
    $num_rowsb = mysql_num_rows( $resultb );

    while ( $b_row = mysql_fetch_object( $resultb ) )
        {
            if ( $b_row->intGroupId == "$groupid" )
            {
                $comment = $b_row->strComments;
                if ( $b_row->strComments == "" )
                {
                    $comment = "<font color=#aaaaaa><i>No Comment</i></font>";
                }

                print "<tr><td width = 30% bgcolor=$bgcolour>
                <a title=\"Delete this subforum\" OnClick=\"return confirm('Are you sure you want to delete this subforum?')\" href=\"admin_deleteforum.php?id=$b_row->intId&titleb=$b_row->strName\"><img border=0 src=\"../images/delete_icon.gif\"></a>&nbsp;
                <a title=\"Configure The Password For This Forum\" href=\"admin_addpassword.php?password=$b_row->strPassword&id=$b_row->intId\"><image src=\"../images/forum_no_entry_icon.gif\" border=0></a>


                <font face=$font size=2>&nbsp;<b>
                <a href=\"admin_changesubtitle.php?titleb=$b_row->strName&id=$b_row->intId\">
                $b_row->strName
                </a>
                </b>
                </td>
                <td bgcolor=$bgcolour>
                <font face=$font size=2>&nbsp;
                <a href=\"admin_changecomments.php?titleb=$b_row->strComments&id=$b_row->intId&maintitle=$b_row->strName\">
                $comment</a>&nbsp;";

                if ( $b_row->strPassword == "NONE" )
                {
                    // May do something in the future
                }
                else
                {
                    print "&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>Password = '$b_row->strPassword'";
                }

                print "</td><td bgcolor=$bgcolour><font face=$font size=2>&nbsp;&nbsp;<a href=\"admin_forumsettings.php?id=$b_row->intId\">Change Forum Settings</a></td></tr>";

            }


        }
            print "<tr><td bgcolor=$bgcolour width=20%><font face=$font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><a href=\"admin_newsubforum.php?id=$groupid\">New Subforum</a></b></td><td bgcolor=$bgcolour><font face=$font size=2>&nbsp;&nbsp;Add a new subforum to this forum group...</td><td bgcolor=$bgcolour><font size=2>&nbsp;</td></tr>";
    print "</table>";

    }

print "<table border=1 cellpadding=2 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=90% bgcolor=$fgcolour>
    <tr><td width=100%><font face=$font size=2>&nbsp;&nbsp;&nbsp;&nbsp;
    <font face=$font size=3>&nbsp;<b>
    <a href=\"admin_newforum.php\">Add A New Forum</a>
    </td></tr>
    </table>

<br><br>Click on something to change it...<br><br></tr></td></table>";


include ("../inc/inc_footer.php");
?>