2001-02-17 08:37:32 +00:00
|
|
|
<?php
|
2007-10-05 14:30:11 +00:00
|
|
|
/**
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
|
|
|
* @package phpBB3
|
|
|
|
* @version $Id$
|
2007-10-05 14:30:11 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2001-08-30 22:20:23 +00:00
|
|
|
|
2007-10-05 14:30:11 +00:00
|
|
|
/**
|
|
|
|
*/
|
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
2006-05-05 17:56:33 +00:00
|
|
|
* @ignore
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2002-03-18 13:35:43 +00:00
|
|
|
define('IN_PHPBB', true);
|
2007-07-26 15:51:11 +00:00
|
|
|
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
2003-09-07 13:46:51 +00:00
|
|
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
2006-06-06 20:53:46 +00:00
|
|
|
include($phpbb_root_path . 'common.' . $phpEx);
|
2005-10-02 18:47:06 +00:00
|
|
|
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
2001-02-17 08:37:32 +00:00
|
|
|
|
2001-04-15 14:14:56 +00:00
|
|
|
// Start session management
|
2005-10-02 18:47:06 +00:00
|
|
|
$user->session_begin();
|
2002-10-20 19:19:07 +00:00
|
|
|
$auth->acl($user->data);
|
2006-05-12 16:05:07 +00:00
|
|
|
$user->setup('viewforum');
|
2003-05-02 15:50:11 +00:00
|
|
|
|
2004-10-08 10:59:23 +00:00
|
|
|
display_forums('', $config['load_moderators']);
|
2003-11-05 18:49:01 +00:00
|
|
|
|
2002-10-01 21:41:57 +00:00
|
|
|
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
|
2006-06-06 20:53:46 +00:00
|
|
|
$total_posts = $config['num_posts'];
|
|
|
|
$total_topics = $config['num_topics'];
|
|
|
|
$total_users = $config['num_users'];
|
2001-05-17 14:48:39 +00:00
|
|
|
|
2003-11-05 18:49:01 +00:00
|
|
|
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
|
|
|
|
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
|
|
|
|
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
|
2003-03-08 22:10:24 +00:00
|
|
|
|
2011-02-09 21:06:37 +01:00
|
|
|
$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
|
2003-03-10 17:48:08 +00:00
|
|
|
// Grab group details for legend display
|
2007-04-30 13:32:18 +00:00
|
|
|
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
|
|
|
{
|
2011-02-09 21:06:37 +01:00
|
|
|
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
|
2007-04-30 13:32:18 +00:00
|
|
|
FROM ' . GROUPS_TABLE . '
|
2011-02-09 21:06:37 +01:00
|
|
|
WHERE group_legend > 0
|
|
|
|
ORDER BY ' . $order_legend . ' ASC';
|
2007-04-30 13:32:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-09 21:06:37 +01:00
|
|
|
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
|
2007-04-30 13:32:18 +00:00
|
|
|
FROM ' . GROUPS_TABLE . ' g
|
|
|
|
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
|
|
|
ON (
|
|
|
|
g.group_id = ug.group_id
|
|
|
|
AND ug.user_id = ' . $user->data['user_id'] . '
|
|
|
|
AND ug.user_pending = 0
|
|
|
|
)
|
2011-02-09 21:06:37 +01:00
|
|
|
WHERE g.group_legend > 0
|
2007-04-30 13:32:18 +00:00
|
|
|
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
2011-02-09 21:06:37 +01:00
|
|
|
ORDER BY g.' . $order_legend . ' ASC';
|
2007-04-30 13:32:18 +00:00
|
|
|
}
|
2003-03-10 18:22:12 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2003-03-08 22:10:24 +00:00
|
|
|
|
2008-10-09 14:17:02 +00:00
|
|
|
$legend = array();
|
2003-03-10 17:48:08 +00:00
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2007-02-05 16:24:15 +00:00
|
|
|
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
|
2008-10-09 14:17:02 +00:00
|
|
|
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
2007-02-05 16:24:15 +00:00
|
|
|
|
2008-10-09 14:17:02 +00:00
|
|
|
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
|
2006-09-23 19:30:01 +00:00
|
|
|
{
|
2008-10-09 14:17:02 +00:00
|
|
|
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
|
2006-09-23 19:30:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-09 14:17:02 +00:00
|
|
|
$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
|
2006-09-23 19:30:01 +00:00
|
|
|
}
|
2003-03-10 17:48:08 +00:00
|
|
|
}
|
2003-05-20 23:57:08 +00:00
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
2008-10-09 14:17:02 +00:00
|
|
|
$legend = implode(', ', $legend);
|
|
|
|
|
2003-05-20 23:57:08 +00:00
|
|
|
// Generate birthday list if required ...
|
2011-05-08 16:41:55 +02:00
|
|
|
$birthday_list = array();
|
2007-07-19 20:38:38 +00:00
|
|
|
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
2003-05-20 23:57:08 +00:00
|
|
|
{
|
2006-12-10 17:44:45 +00:00
|
|
|
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
2009-06-18 11:04:54 +00:00
|
|
|
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
2009-06-17 10:01:54 +00:00
|
|
|
FROM ' . USERS_TABLE . ' u
|
|
|
|
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
|
2009-06-18 11:04:54 +00:00
|
|
|
WHERE (b.ban_id IS NULL
|
|
|
|
OR b.ban_exclude = 1)
|
2009-06-17 10:01:54 +00:00
|
|
|
AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
|
|
|
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
2003-05-20 23:57:08 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2011-05-08 16:41:55 +02:00
|
|
|
$birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
|
|
|
|
$birthday_year = (int) substr($row['user_birthday'], -4);
|
|
|
|
$birthday_age = $now['year'] - $birthday_year;
|
2011-05-08 15:24:03 +02:00
|
|
|
|
|
|
|
$template->assign_block_vars('birthdays', array(
|
|
|
|
'USERNAME' => $birthday_username,
|
|
|
|
'AGE' => ($birthday_year) ? $birthday_age : '',
|
|
|
|
));
|
2011-05-08 16:41:55 +02:00
|
|
|
|
|
|
|
// For 3.0 compatibility
|
|
|
|
$birthday_list[] = $birthday_username . (($birthday_year) ? ' (' . $birthday_age . ')' : '');
|
2003-05-20 23:57:08 +00:00
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
}
|
2003-03-08 22:10:24 +00:00
|
|
|
|
2003-03-10 17:48:08 +00:00
|
|
|
// Assign index specific vars
|
2002-10-01 21:41:57 +00:00
|
|
|
$template->assign_vars(array(
|
2003-11-05 18:49:01 +00:00
|
|
|
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
|
|
|
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
|
|
|
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
2007-07-15 13:47:01 +00:00
|
|
|
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
|
|
|
|
|
2004-09-01 15:55:41 +00:00
|
|
|
'LEGEND' => $legend,
|
2011-05-08 16:41:55 +02:00
|
|
|
'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode(', ', $birthday_list),
|
2002-10-20 19:19:07 +00:00
|
|
|
|
2010-07-02 09:08:46 +02:00
|
|
|
'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'),
|
|
|
|
'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'),
|
|
|
|
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
|
|
|
|
'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),
|
2002-10-01 21:41:57 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
|
2004-09-01 15:55:41 +00:00
|
|
|
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
2003-03-20 02:28:30 +00:00
|
|
|
|
2008-09-22 13:25:28 +00:00
|
|
|
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
|
2006-06-06 20:53:46 +00:00
|
|
|
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
|
2002-10-01 21:41:57 +00:00
|
|
|
);
|
2001-07-13 16:14:37 +00:00
|
|
|
|
2003-03-10 17:48:08 +00:00
|
|
|
// Output page
|
2003-05-03 23:58:45 +00:00
|
|
|
page_header($user->lang['INDEX']);
|
2003-05-02 15:50:11 +00:00
|
|
|
|
2002-07-14 14:45:26 +00:00
|
|
|
$template->set_filenames(array(
|
2003-05-02 15:50:11 +00:00
|
|
|
'body' => 'index_body.html')
|
|
|
|
);
|
|
|
|
|
2003-05-03 23:58:45 +00:00
|
|
|
page_footer();
|