1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/index.php Wed Mar 07 16:41:10 2012 +0400
1.3 @@ -0,0 +1,147 @@
1.4 +<?php
1.5 +/**
1.6 +*
1.7 +* @package phpBB3
1.8 +* @version $Id$
1.9 +* @copyright (c) 2005 phpBB Group
1.10 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
1.11 +*
1.12 +*/
1.13 +
1.14 +/**
1.15 +*/
1.16 +
1.17 +/**
1.18 +* @ignore
1.19 +*/
1.20 +define('IN_PHPBB', true);
1.21 +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
1.22 +$phpEx = substr(strrchr(__FILE__, '.'), 1);
1.23 +include($phpbb_root_path . 'common.' . $phpEx);
1.24 +include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
1.25 +
1.26 +// Start session management
1.27 +$user->session_begin();
1.28 +$auth->acl($user->data);
1.29 +$user->setup('viewforum');
1.30 +
1.31 +display_forums('', $config['load_moderators']);
1.32 +
1.33 +// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
1.34 +$total_posts = $config['num_posts'];
1.35 +$total_topics = $config['num_topics'];
1.36 +$total_users = $config['num_users'];
1.37 +
1.38 +$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
1.39 +$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
1.40 +$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
1.41 +
1.42 +// Grab group details for legend display
1.43 +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
1.44 +{
1.45 + $sql = 'SELECT group_id, group_name, group_colour, group_type
1.46 + FROM ' . GROUPS_TABLE . '
1.47 + WHERE group_legend = 1
1.48 + ORDER BY group_name ASC';
1.49 +}
1.50 +else
1.51 +{
1.52 + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
1.53 + FROM ' . GROUPS_TABLE . ' g
1.54 + LEFT JOIN ' . USER_GROUP_TABLE . ' ug
1.55 + ON (
1.56 + g.group_id = ug.group_id
1.57 + AND ug.user_id = ' . $user->data['user_id'] . '
1.58 + AND ug.user_pending = 0
1.59 + )
1.60 + WHERE g.group_legend = 1
1.61 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
1.62 + ORDER BY g.group_name ASC';
1.63 +}
1.64 +$result = $db->sql_query($sql);
1.65 +
1.66 +$legend = array();
1.67 +while ($row = $db->sql_fetchrow($result))
1.68 +{
1.69 + $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
1.70 + $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
1.71 +
1.72 + if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
1.73 + {
1.74 + $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
1.75 + }
1.76 + else
1.77 + {
1.78 + $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
1.79 + }
1.80 +}
1.81 +$db->sql_freeresult($result);
1.82 +
1.83 +$legend = implode(', ', $legend);
1.84 +
1.85 +// Generate birthday list if required ...
1.86 +$birthday_list = '';
1.87 +if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
1.88 +{
1.89 + $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
1.90 +
1.91 + // Display birthdays of 29th february on 28th february in non-leap-years
1.92 + $leap_year_birthdays = '';
1.93 + if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L'))
1.94 + {
1.95 + $leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
1.96 + }
1.97 +
1.98 + $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
1.99 + FROM ' . USERS_TABLE . ' u
1.100 + LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
1.101 + WHERE (b.ban_id IS NULL
1.102 + OR b.ban_exclude = 1)
1.103 + AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays)
1.104 + AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
1.105 + $result = $db->sql_query($sql);
1.106 +
1.107 + while ($row = $db->sql_fetchrow($result))
1.108 + {
1.109 + $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
1.110 +
1.111 + if ($age = (int) substr($row['user_birthday'], -4))
1.112 + {
1.113 + $birthday_list .= ' (' . max(0, $now['year'] - $age) . ')';
1.114 + }
1.115 + }
1.116 + $db->sql_freeresult($result);
1.117 +}
1.118 +
1.119 +// Assign index specific vars
1.120 +$template->assign_vars(array(
1.121 + 'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
1.122 + 'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
1.123 + 'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
1.124 + 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
1.125 +
1.126 + 'LEGEND' => $legend,
1.127 + 'BIRTHDAY_LIST' => $birthday_list,
1.128 +
1.129 + 'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'),
1.130 + 'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'),
1.131 + 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
1.132 + 'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),
1.133 +
1.134 + 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
1.135 + 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
1.136 +
1.137 + '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') : '',
1.138 + '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) : '')
1.139 +);
1.140 +
1.141 +// Output page
1.142 +page_header($user->lang['INDEX']);
1.143 +
1.144 +$template->set_filenames(array(
1.145 + 'body' => 'index_body.html')
1.146 +);
1.147 +
1.148 +page_footer();
1.149 +
1.150 +?>
1.151 \ No newline at end of file