phpBB
Statistics
| Revision:

root / tags / milestone_3 / phpBB / index.php

History | View | Annotate | Download (3.6 kB)

1
<?php
2
/** 
3
*
4
* @package phpBB3
5
* @version $Id: index.php 5247 2005-10-02 18:47:06Z acydburn $
6
* @copyright (c) 2005 phpBB Group 
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
8
*
9
*/
10
11
/**
12
*/
13
define('IN_PHPBB', true);
14
$phpbb_root_path = './';
15
$phpEx = substr(strrchr(__FILE__, '.'), 1);
16
include($phpbb_root_path . 'common.'.$phpEx);
17
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
18
19
// Start session management
20
$user->session_begin();
21
$auth->acl($user->data);
22
$user->setup();
23
24
display_forums('', $config['load_moderators']);
25
26
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
27
$total_posts = $config['num_posts'];
28
$total_topics = $config['num_topics'];
29
$total_users = $config['num_users'];
30
$newest_user = $config['newest_username'];
31
$newest_uid = $config['newest_user_id'];
32
33
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
34
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
35
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
36
37
// Grab group details for legend display
38
$sql = 'SELECT group_id, group_name, group_colour, group_type
39
        FROM ' . GROUPS_TABLE . '
40
        WHERE group_legend = 1
41
                AND group_type <> ' . GROUP_HIDDEN;
42
$result = $db->sql_query($sql);
43
44
$legend = '';
45
while ($row = $db->sql_fetchrow($result))
46
{
47
        $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . "{$phpbb_root_path}memberlist.$phpEx$SID" . '&amp;mode=group&amp;g=' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
48
}
49
$db->sql_freeresult($result);
50
51
52
// Generate birthday list if required ...
53
$birthday_list = '';
54
if ($config['load_birthdays'])
55
{
56
        $now = getdate();
57
        $sql = 'SELECT user_id, username, user_colour, user_birthday
58
                FROM ' . USERS_TABLE . "
59
                WHERE user_birthday LIKE '" . sprintf('%2d-%2d-', $now['mday'], $now['mon']) . "%'
60
                        AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
61
        $result = $db->sql_query($sql);
62
63
        while ($row = $db->sql_fetchrow($result))
64
        {
65
                $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : '';
66
                $birthday_list .= (($birthday_list != '') ? ', ' : '') . '<a' . $user_colour . " href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $row['username'] . '</a>';
67
68
                if ($age = (int)substr($row['user_birthday'], -4))
69
                {
70
                        $birthday_list .= ' (' . ($now['year'] - $age) . ')';
71
                }
72
        }
73
        $db->sql_freeresult($result);
74
}
75
76
// Assign index specific vars
77
$template->assign_vars(array(
78
        'TOTAL_POSTS'        => sprintf($user->lang[$l_total_post_s], $total_posts),
79
        'TOTAL_TOPICS'        => sprintf($user->lang[$l_total_topic_s], $total_topics),
80
        'TOTAL_USERS'        => sprintf($user->lang[$l_total_user_s], $total_users),
81
        'NEWEST_USER'        => sprintf($user->lang['NEWEST_USER'], "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$newest_uid \">", $newest_user, '</a>'),
82
        'LEGEND'                => $legend,
83
        'BIRTHDAY_LIST'        => $birthday_list,
84
85
        'FORUM_IMG'                        =>        $user->img('forum', 'NO_NEW_POSTS'),
86
        'FORUM_NEW_IMG'                =>        $user->img('forum_new', 'NEW_POSTS'),
87
        'FORUM_LOCKED_IMG'        =>        $user->img('forum_locked', 'NO_NEW_POSTS_LOCKED'),
88
89
        'S_LOGIN_ACTION'                        => "{$phpbb_root_path}ucp.$phpEx$SID&amp;mode=login",
90
        'S_DISPLAY_BIRTHDAY_LIST'        => ($config['load_birthdays']) ? true : false,
91
92
        'U_MARK_FORUMS' => "{$phpbb_root_path}index.$phpEx$SID&amp;mark=forums")
93
);
94
95
// Output page
96
page_header($user->lang['INDEX']);
97
98
$template->set_filenames(array(
99
        'body' => 'index_body.html')
100
);
101
102
page_footer();
103
104
?>