aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/index.php
blob: c6e834f94bd0842a2f649c8e28f3fcff6113cd16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/***************************************************************************  
 *                                index.php 
 *                            -------------------                         
 *   begin                : Saturday, Feb 13, 2001 
 *   copyright            : (C) 2001 The phpBB Group        
 *   email                : support@phpbb.com                           
 *                                                          
 *   $Id$                                                           
 *                                                            
 * 
 ***************************************************************************/ 


/***************************************************************************  
 *                                                     
 *   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.                      
 *                                                          
 * 
 ***************************************************************************/ 
include('extension.inc');
include('config.'.$phpEx);
include('template.inc');
include('functions/error.'.$phpEx);
include('functions/sessions.'.$phpEx);
include('functions/auth.'.$phpEx);
include('db.'.$phpEx);

$total_users = 10;
$total_posts = 55668;
$newest_user = "Dave";
$newest_uid = 10;
$users_browsing = "4 Users";

$pagetype = "index";
include('page_header.'.$phpEx);

$template->set_block("body", "catrow", "cats");
$template->set_block("catrow", "forumrow", "forums");

$sql = "SELECT * FROM $categories_table ORDER BY cat_order";
if(!$result = $db->sql_query($sql)) 
{
	error_die($db, QUERY_ERROR);
}
$total_rows = $db->sql_numrows();
if($total_rows)
{
	$rows = $db->sql_fetchrowset($result);
	for($x = 0; $x < $total_rows; $x++)
	{

		$template->set_var(array("CAT_ID" => $rows[$x]["cat_id"],
				 "PHP_SELF" => $PHP_SELF,
				 "CAT_DESC" => stripslashes($rows[$x]["cat_title"])));

	$sub_sql = "SELECT f.* FROM $forums_table f WHERE f.cat_id = '".$rows[$x]["cat_id"]."' ORDER BY forum_id";
	if(!$sub_result = $db->sql_query($sub_sql))
	  {
	     error_die($db, QUERY_ERROR);
	  }
	$total_forums = $db->sql_numrows($sub_result);
	$forum_rows = $db->sql_fetchrowset($sub_result);

	if($total_forums)
	  {
	     $template->parse("cats", "catrow", true);
	     for($y = 0; $y < $total_forums; $y++)
	       {
					 $folder_image = "<img src=\"images/folder.gif\">";
					 $posts = $forum_rows[$y]["forum_posts"];
					 $topics = $forum_rows[$y]["forum_topics"];
					 $last_post = $forum_rows[$y]["forum_last_post"];
					 $last_post = date($date_format, $last_post);
					 $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[$y]["forum_name"]),
																		"FORUM_ID" => $forum_rows[$y]["forum_id"],
																		"FORUM_DESC" => stripslashes($forum_rows[$y]["forum_desc"]),
																		"ROW_COLOR" => $row_color,
																		"PHPEX" => $phpEx,
																		"POSTS" => $posts,
																		"TOPICS" => $topics,
																		"LAST_POST" => $last_post,
																		"MODERATORS" => $moderators));
					 $template->parse("forums", "forumrow", true);
	       }
			$template->parse("cats", "forums", true);
			$template->set_var("forums", "");
	  }
	}
}
$template->pparse("output", "body");


include('page_tail.'.$phpEx);
?>