2001-02-17 08:37:32 +00:00
< ? php
/***************************************************************************
2001-02-22 06:10:12 +00:00
* index . php
2001-02-17 08:37:32 +00:00
* -------------------
* begin : Saturday , Feb 13 , 2001
* copyright : ( C ) 2001 The phpBB Group
* email : support @ phpbb . com
*
2001-02-23 18:13:35 +00:00
* $Id $
2001-02-17 08:37:32 +00:00
*
*
***************************************************************************/
/***************************************************************************
*
* 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 .
*
*
***************************************************************************/
2001-02-22 06:10:12 +00:00
include ( 'extension.inc' );
include ( 'config.' . $phpEx );
include ( 'template.inc' );
include ( 'functions/error.' . $phpEx );
include ( 'functions/sessions.' . $phpEx );
include ( 'functions/auth.' . $phpEx );
2001-02-23 01:31:43 +00:00
include ( 'functions/functions.' . $phpEx );
2001-02-22 06:10:12 +00:00
include ( 'db.' . $phpEx );
2001-02-17 08:37:32 +00:00
2001-02-23 01:31:43 +00:00
$total_users = get_user_count ( $db , $users_table );
$total_posts = get_total_posts ( $db , $forums_table );
$newest_userdata = get_newest_user ( $db , $users_table );
$newest_user = $newest_userdata [ " username " ];
$newest_uid = $newest_userdata [ " user_id " ];
2001-02-22 06:10:12 +00:00
$users_browsing = " 4 Users " ;
2001-02-17 08:37:32 +00:00
2001-02-22 06:10:12 +00:00
$pagetype = " index " ;
include ( 'page_header.' . $phpEx );
2001-02-17 08:37:32 +00:00
2001-02-22 06:10:12 +00:00
$template -> set_block ( " body " , " catrow " , " cats " );
$template -> set_block ( " catrow " , " forumrow " , " forums " );
2001-02-23 18:13:35 +00:00
$sql = " SELECT c.* FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f WHERE f.cat_id=c.cat_id GROUP BY c.cat_id ORDER BY c.cat_order " ;
if ( ! $q_categories = $db -> sql_query ( $sql ))
2001-02-22 06:10:12 +00:00
{
2001-02-22 18:59:06 +00:00
error_die ( $db , QUERY_ERROR );
2001-02-22 06:10:12 +00:00
}
2001-02-23 18:13:35 +00:00
$total_categories = $db -> sql_numrows ();
if ( $total_categories )
2001-02-22 06:10:12 +00:00
{
2001-02-23 18:13:35 +00:00
$category_rows = $db -> sql_fetchrowset ( $q_categories );
$sql = " SELECT f.*, u.username, p.post_time FROM " . FORUMS_TABLE . " f LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ORDER BY f.forum_id " ;
if ( ! $q_forums = $db -> sql_query ( $sql ))
2001-02-22 18:59:06 +00:00
{
2001-02-23 18:13:35 +00:00
error_die ( $db , QUERY_ERROR );
}
$total_forums = $db -> sql_numrows ( $q_forums );
$forum_rows = $db -> sql_fetchrowset ( $q_forums );
2001-02-22 06:10:12 +00:00
2001-02-23 18:13:35 +00:00
for ( $i = 0 ; $i < $total_categories ; $i ++ )
{
$template -> set_var ( array ( " CAT_ID " => $category_rows [ $i ][ " cat_id " ],
" PHP_SELF " => $PHP_SELF ,
" CAT_DESC " => stripslashes ( $category_rows [ $i ][ " cat_title " ])));
$template -> parse ( " cats " , " catrow " , true );
2001-02-22 06:10:12 +00:00
2001-02-23 18:13:35 +00:00
for ( $j = 0 ; $j < $total_forums ; $j ++ )
{
if ( $forum_rows [ $j ][ " cat_id " ] == $category_rows [ $i ][ " cat_id " ])
{
$folder_image = " <img src= \" images/folder.gif \" > " ;
$posts = $forum_rows [ $j ][ " forum_posts " ];
$topics = $forum_rows [ $j ][ " forum_topics " ];
if ( $forum_rows [ $j ][ " username " ] != " " && $forum_rows [ $j ][ " post_time " ] > 0 ){
$last_post_user = $forum_rows [ $j ][ " username " ];
$last_post_time = date ( $date_format , $forum_rows [ $j ][ " post_time " ]);
$last_post = $last_post_time . " by " . $last_post_user ;
}
else
{
$last_post = " " ;
}
2001-02-22 06:10:12 +00:00
2001-02-23 18:13:35 +00:00
$moderators = " <a href= \" profile. $phpEx ?mode=viewprofile&user_id=1 \" >theFinn</a> " ;
if ( $row_color == " #DDDDDD " )
{
$row_color = " #CCCCCC " ;
}
else
{
$row_color = " #DDDDDD " ;
}
$template -> set_var ( array ( " FOLDER " => $folder_image ,
" FORUM_NAME " => stripslashes ( $forum_rows [ $j ][ " forum_name " ]),
" FORUM_ID " => $forum_rows [ $y ][ " forum_id " ],
" FORUM_DESC " => stripslashes ( $forum_rows [ $j ][ " forum_desc " ]),
" ROW_COLOR " => $row_color ,
" PHPEX " => $phpEx ,
" POSTS " => $posts ,
" TOPICS " => $topics ,
" LAST_POST " => $last_post ,
" MODERATORS " => $moderators ));
$template -> parse ( " forums " , " forumrow " , true );
} // if ... then
} // for total forums
$template -> parse ( " cats " , " forums " , true );
$template -> set_var ( " forums " , " " );
} // for ... categories
2001-02-23 01:31:43 +00:00
2001-02-23 18:13:35 +00:00
} // if ... total_categories
2001-02-22 06:10:12 +00:00
$template -> pparse ( " output " , " body " );
include ( 'page_tail.' . $phpEx );
2001-02-17 08:37:32 +00:00
?>