| 1 |
2 |
thefinn |
<?php
|
| 2 |
8146 |
acydburn |
/**
|
| 3 |
5114 |
acydburn |
*
|
| 4 |
5114 |
acydburn |
* @package phpBB3
|
| 5 |
5114 |
acydburn |
* @version $Id$
|
| 6 |
8146 |
acydburn |
* @copyright (c) 2005 phpBB Group
|
| 7 |
8146 |
acydburn |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
| 8 |
5114 |
acydburn |
*
|
| 9 |
5114 |
acydburn |
*/
|
| 10 |
2 |
thefinn |
|
| 11 |
5114 |
acydburn |
/**
|
| 12 |
8146 |
acydburn |
*/
|
| 13 |
8146 |
acydburn |
|
| 14 |
8146 |
acydburn |
/**
|
| 15 |
5883 |
acydburn |
* @ignore
|
| 16 |
5114 |
acydburn |
*/
|
| 17 |
2305 |
psotfx |
define('IN_PHPBB', true);
|
| 18 |
8572 |
acydburn |
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './');
|
| 19 |
8572 |
acydburn |
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
|
| 20 |
8572 |
acydburn |
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
|
| 21 |
8572 |
acydburn |
include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
|
| 22 |
2 |
thefinn |
|
| 23 |
143 |
psotfx |
// Start session management
|
| 24 |
5247 |
acydburn |
$user->session_begin();
|
| 25 |
4261 |
psotfx |
$auth->acl($user->data);
|
| 26 |
5895 |
acydburn |
$user->setup('viewforum');
|
| 27 |
143 |
psotfx |
|
| 28 |
4995 |
acydburn |
display_forums('', $config['load_moderators']);
|
| 29 |
4644 |
psotfx |
|
| 30 |
2912 |
ludovic_arnaud |
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
|
| 31 |
6015 |
acydburn |
$total_posts = $config['num_posts'];
|
| 32 |
6015 |
acydburn |
$total_topics = $config['num_topics'];
|
| 33 |
6015 |
acydburn |
$total_users = $config['num_users'];
|
| 34 |
2 |
thefinn |
|
| 35 |
4644 |
psotfx |
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
|
| 36 |
4644 |
psotfx |
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
|
| 37 |
4644 |
psotfx |
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
|
| 38 |
1702 |
psotfx |
|
| 39 |
3628 |
psotfx |
// Grab group details for legend display
|
| 40 |
7433 |
acydburn |
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
| 41 |
7433 |
acydburn |
{
|
| 42 |
7433 |
acydburn |
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
| 43 |
7433 |
acydburn |
FROM ' . GROUPS_TABLE . '
|
| 44 |
7433 |
acydburn |
WHERE group_legend = 1
|
| 45 |
7433 |
acydburn |
ORDER BY group_name ASC';
|
| 46 |
7433 |
acydburn |
}
|
| 47 |
7433 |
acydburn |
else
|
| 48 |
7433 |
acydburn |
{
|
| 49 |
7433 |
acydburn |
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
| 50 |
7433 |
acydburn |
FROM ' . GROUPS_TABLE . ' g
|
| 51 |
7433 |
acydburn |
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
| 52 |
7433 |
acydburn |
ON (
|
| 53 |
7433 |
acydburn |
g.group_id = ug.group_id
|
| 54 |
7433 |
acydburn |
AND ug.user_id = ' . $user->data['user_id'] . '
|
| 55 |
7433 |
acydburn |
AND ug.user_pending = 0
|
| 56 |
7433 |
acydburn |
)
|
| 57 |
7433 |
acydburn |
WHERE g.group_legend = 1
|
| 58 |
7433 |
acydburn |
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
| 59 |
7433 |
acydburn |
ORDER BY g.group_name ASC';
|
| 60 |
7433 |
acydburn |
}
|
| 61 |
3630 |
psotfx |
$result = $db->sql_query($sql);
|
| 62 |
3612 |
psotfx |
|
| 63 |
8988 |
acydburn |
$legend = array();
|
| 64 |
3628 |
psotfx |
while ($row = $db->sql_fetchrow($result))
|
| 65 |
3628 |
psotfx |
{
|
| 66 |
6969 |
acydburn |
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
|
| 67 |
8988 |
acydburn |
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
| 68 |
6969 |
acydburn |
|
| 69 |
8988 |
acydburn |
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
|
| 70 |
6398 |
grahamje |
{
|
| 71 |
8988 |
acydburn |
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
|
| 72 |
6398 |
grahamje |
}
|
| 73 |
6398 |
grahamje |
else
|
| 74 |
6398 |
grahamje |
{
|
| 75 |
8988 |
acydburn |
$legend[] = '<a' . $colour_text . ' href="' . append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
|
| 76 |
6398 |
grahamje |
}
|
| 77 |
3628 |
psotfx |
}
|
| 78 |
4034 |
psotfx |
$db->sql_freeresult($result);
|
| 79 |
3612 |
psotfx |
|
| 80 |
8988 |
acydburn |
$legend = implode(', ', $legend);
|
| 81 |
8988 |
acydburn |
|
| 82 |
4034 |
psotfx |
// Generate birthday list if required ...
|
| 83 |
4034 |
psotfx |
$birthday_list = '';
|
| 84 |
7909 |
acydburn |
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
| 85 |
4034 |
psotfx |
{
|
| 86 |
6740 |
naderman |
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
| 87 |
4972 |
psotfx |
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
| 88 |
4972 |
psotfx |
FROM ' . USERS_TABLE . "
|
| 89 |
6015 |
acydburn |
WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
| 90 |
5108 |
acydburn |
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
| 91 |
4034 |
psotfx |
$result = $db->sql_query($sql);
|
| 92 |
4034 |
psotfx |
|
| 93 |
4034 |
psotfx |
while ($row = $db->sql_fetchrow($result))
|
| 94 |
4034 |
psotfx |
{
|
| 95 |
7889 |
acydburn |
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
|
| 96 |
4972 |
psotfx |
|
| 97 |
6015 |
acydburn |
if ($age = (int) substr($row['user_birthday'], -4))
|
| 98 |
4034 |
psotfx |
{
|
| 99 |
4034 |
psotfx |
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
|
| 100 |
4034 |
psotfx |
}
|
| 101 |
4034 |
psotfx |
}
|
| 102 |
4034 |
psotfx |
$db->sql_freeresult($result);
|
| 103 |
4034 |
psotfx |
}
|
| 104 |
4034 |
psotfx |
|
| 105 |
3628 |
psotfx |
// Assign index specific vars
|
| 106 |
2912 |
ludovic_arnaud |
$template->assign_vars(array(
|
| 107 |
4644 |
psotfx |
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
| 108 |
4644 |
psotfx |
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
| 109 |
4644 |
psotfx |
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
| 110 |
7889 |
acydburn |
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
|
| 111 |
7889 |
acydburn |
|
| 112 |
4972 |
psotfx |
'LEGEND' => $legend,
|
| 113 |
4972 |
psotfx |
'BIRTHDAY_LIST' => $birthday_list,
|
| 114 |
2850 |
psotfx |
|
| 115 |
6366 |
acydburn |
'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'),
|
| 116 |
6366 |
acydburn |
'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
|
| 117 |
6366 |
acydburn |
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
|
| 118 |
6237 |
acydburn |
'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
|
| 119 |
2850 |
psotfx |
|
| 120 |
8572 |
acydburn |
'S_LOGIN_ACTION' => append_sid('ucp', 'mode=login'),
|
| 121 |
4972 |
psotfx |
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
| 122 |
3693 |
psotfx |
|
| 123 |
8905 |
Kellanved |
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid('index', 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
|
| 124 |
8572 |
acydburn |
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid('mcp', 'i=main&mode=front', true, $user->session_id) : '')
|
| 125 |
2912 |
ludovic_arnaud |
);
|
| 126 |
2912 |
ludovic_arnaud |
|
| 127 |
3628 |
psotfx |
// Output page
|
| 128 |
3969 |
psotfx |
page_header($user->lang['INDEX']);
|
| 129 |
13 |
thefinn |
|
| 130 |
2673 |
psotfx |
$template->set_filenames(array(
|
| 131 |
3961 |
psotfx |
'body' => 'index_body.html')
|
| 132 |
3961 |
psotfx |
);
|
| 133 |
2673 |
psotfx |
|
| 134 |
3969 |
psotfx |
page_footer();
|
| 135 |
3961 |
psotfx |
|
| 136 |
3317 |
ludovic_arnaud |
?> |