- <?php
- include($phpbb_root_path . 'common.' . $phpEx);
- // Start session management
- // Basically, starts the session, allowing you to do user oritented stuff (like a login)
- $user->session_begin(false);
- $auth->acl($user->data);
- $user->setup();
- if($_GET['mode'] == 'logout')
- {
- $user->session_kill();
- }
- $online_users = obtain_users_online(0);
- $user_online_strings = obtain_users_online_string($online_users, 0);
- $online_userlist = $user_online_strings['online_userlist'];
- $template->set_custom_template($root_path . 'template', 'website');
- $template->assign_vars(array(
- 'COPYRIGHT' => "© NintendoLand 1998-".date("Y"),
- 'U_PROFILE' => append_sid($phpbb_root_path . 'memberlist.php', "mode=viewprofile&u=" . $user->data['user_id']),
- 'U_ACTION' => append_sid($phpbb_root_path . 'ucp.php', 'mode=login'),
- 'U_REGISTER' => append_sid($phpbb_root_path . 'ucp.php', 'mode=register'),
- 'IS_REGISTERED' => $user->data['is_registered'],
- 'USERNAME' => $user->data['username'],
- 'U_LOGOUT' => append_sid($phpbb_root_path . 'ucp.php', 'mode=logout'),
- 'U_USER_CP' => append_sid($phpbb_root_path . 'ucp.php'),
- 'ONLINE_USERS' => $online_userlist,
- 'GUEST_ONLINE' => $online_users['guests_online'],
- ));
- // Start Recent Posts
- $search_limit = 5;
- $posts_ary = array(
- 'SELECT' => 'p.*, t.*, u.username, u.user_colour',
- 'FROM' => array(POSTS_TABLE => 'p',),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(USERS_TABLE => 'u'),
- 'ON' => 'u.user_id = p.poster_id'
- ),
- array(
- 'FROM' => array(TOPICS_TABLE => 't'),
- 'ON' => 'p.topic_id = t.topic_id'
- ),
- ),
- 'WHERE' => $db->sql_in_set('t.forum_id', array_keys($auth->acl_getf('f_read'))) . '
- AND t.topic_status <> ' . ITEM_MOVED . '
- AND t.topic_approved = 1',
- 'ORDER_BY' => 'p.post_id DESC',
- );
- $posts = $db->sql_build_query('SELECT', $posts_ary);
- $posts_result = $db->sql_query_limit($posts, $search_limit);
- $count = 0;
- while( $posts_row = $db->sql_fetchrow($posts_result) )
- {
- $count++;
- $post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']);
- $post_date = $user->format_date($posts_row['post_time']);
- $post_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&t=' . $posts_row['topic_id'] . '&p=' . $posts_row['post_id']) . '#p' . $posts_row['post_id'];
- $template->assign_block_vars('new_posts', array(
- 'POST_TITLE' => $posts_row['topic_title'],
- 'POST_AUTHOR' => $post_author,
- 'POST_DATE' => $post_date,
- 'U_POST' => $post_link,
- ));
- }
- // End Recent Posts
- ?>
