root / branches / phpBB-3_0_0 / phpBB / index.php
History | View | Annotate | Download (4.8 KB)
| 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 | 7954 | acydburn | $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; |
| 19 | 4473 | psotfx | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 20 | 6015 | acydburn | include($phpbb_root_path . 'common.' . $phpEx); |
| 21 | 5247 | acydburn | include($phpbb_root_path . 'includes/functions_display.' . $phpEx); |
| 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 | 8987 | 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 | 8987 | acydburn | $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; |
| 68 | 6969 | acydburn | |
| 69 | 8987 | acydburn | if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) |
| 70 | 6398 | grahamje | {
|
| 71 | 8987 | acydburn | $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>'; |
| 72 | 6398 | grahamje | } |
| 73 | 6398 | grahamje | else
|
| 74 | 6398 | grahamje | {
|
| 75 | 8987 | acydburn | $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", '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 | 8987 | acydburn | $legend = implode(', ', $legend);
|
| 81 | 8987 | 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 | 9614 | nickvergessen | $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
| 88 | 9604 | nickvergessen | FROM ' . USERS_TABLE . ' u |
| 89 | 9604 | nickvergessen | LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid) |
| 90 | 9614 | nickvergessen | WHERE (b.ban_id IS NULL |
| 91 | 9614 | nickvergessen | OR b.ban_exclude = 1) |
| 92 | 9604 | nickvergessen | AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' |
| 93 | 9604 | nickvergessen | AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; |
| 94 | 4034 | psotfx | $result = $db->sql_query($sql); |
| 95 | 4034 | psotfx | |
| 96 | 4034 | psotfx | while ($row = $db->sql_fetchrow($result))
|
| 97 | 4034 | psotfx | {
|
| 98 | 7889 | acydburn | $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); |
| 99 | 4972 | psotfx | |
| 100 | 6015 | acydburn | if ($age = (int) substr($row['user_birthday'], -4)) |
| 101 | 4034 | psotfx | {
|
| 102 | 4034 | psotfx | $birthday_list .= ' (' . ($now['year'] - $age) . ')'; |
| 103 | 4034 | psotfx | } |
| 104 | 4034 | psotfx | } |
| 105 | 4034 | psotfx | $db->sql_freeresult($result); |
| 106 | 4034 | psotfx | } |
| 107 | 4034 | psotfx | |
| 108 | 3628 | psotfx | // Assign index specific vars
|
| 109 | 2912 | ludovic_arnaud | $template->assign_vars(array(
|
| 110 | 4644 | psotfx | 'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
| 111 | 4644 | psotfx | 'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
| 112 | 4644 | psotfx | 'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
| 113 | 7889 | acydburn | 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), |
| 114 | 7889 | acydburn | |
| 115 | 4972 | psotfx | 'LEGEND' => $legend,
|
| 116 | 4972 | psotfx | 'BIRTHDAY_LIST' => $birthday_list,
|
| 117 | 2850 | psotfx | |
| 118 | 6366 | acydburn | 'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'), |
| 119 | 6366 | acydburn | 'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'), |
| 120 | 6366 | acydburn | 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'), |
| 121 | 6237 | acydburn | 'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'), |
| 122 | 2850 | psotfx | |
| 123 | 6015 | acydburn | 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), |
| 124 | 4972 | psotfx | 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, |
| 125 | 3693 | psotfx | |
| 126 | 8904 | Kellanved | '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') : '', |
| 127 | 6015 | acydburn | '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) : '') |
| 128 | 2912 | ludovic_arnaud | ); |
| 129 | 2912 | ludovic_arnaud | |
| 130 | 3628 | psotfx | // Output page
|
| 131 | 3969 | psotfx | page_header($user->lang['INDEX']);
|
| 132 | 13 | thefinn | |
| 133 | 2673 | psotfx | $template->set_filenames(array(
|
| 134 | 3961 | psotfx | 'body' => 'index_body.html') |
| 135 | 3961 | psotfx | ); |
| 136 | 2673 | psotfx | |
| 137 | 3969 | psotfx | page_footer(); |
| 138 | 3961 | psotfx | |
| 139 | 3317 | ludovic_arnaud | ?> |