6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
17 define('IN_PHPBB', true);
18 if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './');
19 if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__
, '.'), 1));
20 include(PHPBB_ROOT_PATH
. 'common.' . PHP_EXT
);
21 include(PHPBB_ROOT_PATH
. 'includes/functions_display.' . PHP_EXT
);
23 // Start session management
24 phpbb
::$user->session_begin();
25 phpbb
::$acl->init(phpbb
::$user->data
);
26 phpbb
::$user->setup('viewforum');
28 display_forums('', phpbb
::$config['load_moderators']);
30 // Set some stats, get posts count from forums data if we... hum... retrieve all forums data
31 $total_posts = phpbb
::$config['num_posts'];
32 $total_topics = phpbb
::$config['num_topics'];
33 $total_users = phpbb
::$config['num_users'];
35 // Grab group details for legend display
36 if (phpbb
::$acl->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
38 $sql = 'SELECT group_id, group_name, group_colour, group_type
39 FROM ' . GROUPS_TABLE
. '
40 WHERE group_legend = 1
41 ORDER BY group_name ASC';
45 $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
46 FROM ' . GROUPS_TABLE
. ' g
47 LEFT JOIN ' . USER_GROUP_TABLE
. ' ug
49 g.group_id = ug.group_id
50 AND ug.user_id = ' . phpbb
::$user->data
['user_id'] . '
51 AND ug.user_pending = 0
53 WHERE g.group_legend = 1
54 AND (g.group_type <> ' . GROUP_HIDDEN
. ' OR ug.user_id = ' . phpbb
::$user->data
['user_id'] . ')
55 ORDER BY g.group_name ASC';
57 $result = phpbb
::$db->sql_query($sql);
60 while ($row = phpbb
::$db->sql_fetchrow($result))
62 $colour_text = ($row['group_colour']) ?
' style="color:#' . $row['group_colour'] . '"' : '';
63 $group_name = ($row['group_type'] == GROUP_SPECIAL
) ? phpbb
::$user->lang
['G_' . $row['group_name']] : $row['group_name'];
65 if ($row['group_name'] == 'BOTS' ||
(phpbb
::$user->data
['user_id'] != ANONYMOUS
&& !$auth->acl_get('u_viewprofile')))
67 $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
71 $legend[] = '<a' . $colour_text . ' href="' . phpbb
::$url->append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
74 phpbb
::$db->sql_freeresult($result);
76 $legend = implode(', ', $legend);
78 // Generate birthday list if required ...
80 if (phpbb
::$config['load_birthdays'] && phpbb
::$config['allow_birthdays'])
82 $now = getdate(time() + phpbb
::$user->timezone + phpbb
::$user->dst
- date('Z'));
83 $sql = 'SELECT user_id, username, user_colour, user_birthday
84 FROM ' . USERS_TABLE
. "
85 WHERE user_birthday LIKE '" . phpbb
::$db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
86 AND user_type IN (" . phpbb
::USER_NORMAL
. ', ' . phpbb
::USER_FOUNDER
. ')';
87 $result = phpbb
::$db->sql_query($sql);
89 while ($row = phpbb
::$db->sql_fetchrow($result))
91 $birthday_list .= (($birthday_list != '') ?
', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
93 if ($age = (int) substr($row['user_birthday'], -4))
95 $birthday_list .= ' (' . ($now['year'] - $age) . ')';
98 phpbb
::$db->sql_freeresult($result);
101 // Assign index specific vars
102 phpbb
::$template->assign_vars(array(
103 'TOTAL_POSTS' => phpbb
::$user->lang('TOTAL_POSTS_COUNT', $total_posts),
104 'TOTAL_TOPICS' => phpbb
::$user->lang('TOTAL_TOPICS_COUNT', $total_topics),
105 'TOTAL_USERS' => phpbb
::$user->lang('TOTAL_USERS_COUNT', $total_users),
106 'NEWEST_USER' => phpbb
::$user->lang('NEWEST_USER', get_username_string('full', phpbb
::$config['newest_user_id'], phpbb
::$config['newest_username'], phpbb
::$config['newest_user_colour'])),
109 'BIRTHDAY_LIST' => $birthday_list,
111 'FORUM_IMG' => phpbb
::$user->img('forum_read', 'NO_NEW_POSTS'),
112 'FORUM_NEW_IMG' => phpbb
::$user->img('forum_unread', 'NEW_POSTS'),
113 'FORUM_LOCKED_IMG' => phpbb
::$user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
114 'FORUM_NEW_LOCKED_IMG' => phpbb
::$user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
116 'S_LOGIN_ACTION' => phpbb
::$url->append_sid('ucp', 'mode=login'),
117 'S_DISPLAY_BIRTHDAY_LIST' => (phpbb
::$config['load_birthdays']) ?
true : false,
119 'U_MARK_FORUMS' => (phpbb
::$user->is_registered || phpbb
::$config['load_anon_lastread']) ?
append_sid('index', 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
120 'U_MCP' => (phpbb
::$acl->acl_get('m_') || phpbb
::$acl->acl_getf_global('m_')) ? phpbb
::$url->append_sid('mcp', 'i=main&mode=front', true, phpbb
::$user->session_id
) : '')
124 page_header(phpbb
::$user->lang
['INDEX']);
126 phpbb
::$template->set_filenames(array(
127 'body' => 'index_body.html')