|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
*
|
|
|
ef5584 |
* @package phpBB3
|
|
|
ef5584 |
* @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
|
|
|
ef5584 |
* @copyright (c) 2005 phpBB Group
|
|
|
ef5584 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
ef5584 |
*
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @ignore
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
define('IN_PHPBB', true);
|
|
|
ef5584 |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
|
|
ef5584 |
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
|
ef5584 |
include($phpbb_root_path . 'common.' . $phpEx);
|
|
|
ef5584 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Start session management
|
|
|
ef5584 |
$user->session_begin();
|
|
|
ef5584 |
$auth->acl($user->data);
|
|
|
ef5584 |
$user->setup('viewforum');
|
|
|
ef5584 |
|
|
|
ef5584 |
display_forums('', $config['load_moderators']);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
|
|
|
ef5584 |
$total_posts = $config['num_posts'];
|
|
|
ef5584 |
$total_topics = $config['num_topics'];
|
|
|
ef5584 |
$total_users = $config['num_users'];
|
|
|
ef5584 |
|
|
|
ef5584 |
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
|
|
|
ef5584 |
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
|
|
|
ef5584 |
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab group details for legend display
|
|
|
ef5584 |
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . '
|
|
|
ef5584 |
WHERE group_legend = 1
|
|
|
ef5584 |
ORDER BY group_name ASC';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
|
|
ef5584 |
FROM ' . GROUPS_TABLE . ' g
|
|
|
ef5584 |
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
|
|
ef5584 |
ON (
|
|
|
ef5584 |
g.group_id = ug.group_id
|
|
|
ef5584 |
AND ug.user_id = ' . $user->data['user_id'] . '
|
|
|
ef5584 |
AND ug.user_pending = 0
|
|
|
ef5584 |
)
|
|
|
ef5584 |
WHERE g.group_legend = 1
|
|
|
ef5584 |
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
|
|
ef5584 |
ORDER BY g.group_name ASC';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
$legend = array();
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
|
|
|
ef5584 |
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$legend[] = '<span' . $colour_text . '>' . $group_name . '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
$legend = implode(', ', $legend);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Generate birthday list if required ...
|
|
|
ef5584 |
$birthday_list = '';
|
|
|
ef5584 |
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
|
|
ef5584 |
$sql = 'SELECT user_id, username, user_colour, user_birthday
|
|
|
ef5584 |
FROM ' . USERS_TABLE . "
|
|
|
ef5584 |
WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
|
|
ef5584 |
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
while ($row = $db->sql_fetchrow($result))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($age = (int) substr($row['user_birthday'], -4))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Assign index specific vars
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
|
|
ef5584 |
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
|
|
ef5584 |
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
|
|
ef5584 |
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
|
|
|
ef5584 |
|
|
|
ef5584 |
'LEGEND' => $legend,
|
|
|
ef5584 |
'BIRTHDAY_LIST' => $birthday_list,
|
|
|
ef5584 |
|
|
|
ef5584 |
'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'),
|
|
|
ef5584 |
'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
|
|
|
ef5584 |
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
|
|
|
ef5584 |
'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
|
|
|
ef5584 |
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
|
|
|
ef5584 |
|
|
|
ef5584 |
'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') : '',
|
|
|
ef5584 |
'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) : '')
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Output page
|
|
|
ef5584 |
page_header($user->lang['INDEX']);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->set_filenames(array(
|
|
|
ef5584 |
'body' => 'index_body.html')
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
page_footer();
|
|
|
ef5584 |
|
|
|
ef5584 |
?>
|