Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 17th, 2010 | Syntax: None | Size: 2.82 KB | Hits: 36 | Expires: Never
Copy text to clipboard
  1. <?php
  2. include($phpbb_root_path . 'common.' . $phpEx);
  3.  
  4. // Start session management
  5. // Basically, starts the session, allowing you to do user oritented stuff (like a login)
  6. $user->session_begin(false);
  7. $auth->acl($user->data);
  8. $user->setup();
  9.  
  10. if($_GET['mode'] == 'logout')
  11. {
  12. $user->session_kill();
  13. }
  14.  
  15. $online_users = obtain_users_online(0);
  16. $user_online_strings = obtain_users_online_string($online_users, 0);
  17. $online_userlist = $user_online_strings['online_userlist'];
  18.  
  19. $template->set_custom_template($root_path . 'template', 'website');
  20. $template->assign_vars(array(
  21.         'COPYRIGHT'               => "&copy; NintendoLand 1998-".date("Y"),
  22.         'U_PROFILE'           => append_sid($phpbb_root_path . 'memberlist.php', "mode=viewprofile&amp;u=" . $user->data['user_id']),
  23.         'U_ACTION'            => append_sid($phpbb_root_path . 'ucp.php', 'mode=login'),
  24.         'U_REGISTER'          => append_sid($phpbb_root_path . 'ucp.php', 'mode=register'),
  25.         'IS_REGISTERED'       => $user->data['is_registered'],
  26.         'USERNAME'            => $user->data['username'],
  27.         'U_LOGOUT'            => append_sid($phpbb_root_path . 'ucp.php', 'mode=logout'),
  28.         'U_USER_CP'           => append_sid($phpbb_root_path . 'ucp.php'),
  29.         'ONLINE_USERS'        => $online_userlist,
  30.         'GUEST_ONLINE'        => $online_users['guests_online'],
  31. ));
  32.  
  33.  
  34. // Start Recent Posts
  35. $search_limit = 5;
  36.  
  37. $posts_ary = array(
  38.    'SELECT'    => 'p.*, t.*, u.username, u.user_colour',
  39.    'FROM'      => array(POSTS_TABLE     => 'p',),
  40.  
  41.    'LEFT_JOIN' => array(
  42.       array(
  43.          'FROM'  => array(USERS_TABLE => 'u'),
  44.          'ON'    => 'u.user_id = p.poster_id'
  45.       ),
  46.       array(
  47.             'FROM'  => array(TOPICS_TABLE => 't'),
  48.             'ON'    => 'p.topic_id = t.topic_id'
  49.       ),
  50.    ),
  51.  
  52.    'WHERE' => $db->sql_in_set('t.forum_id', array_keys($auth->acl_getf('f_read'))) . '
  53.       AND t.topic_status <> ' . ITEM_MOVED . '
  54.       AND t.topic_approved = 1',
  55.  
  56.    'ORDER_BY'  => 'p.post_id DESC',
  57. );
  58.  
  59. $posts = $db->sql_build_query('SELECT', $posts_ary);
  60. $posts_result = $db->sql_query_limit($posts, $search_limit);
  61.  
  62. $count = 0;
  63.  
  64. while( $posts_row = $db->sql_fetchrow($posts_result) )
  65. {
  66.    $count++;
  67.    $post_author       = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']);
  68.    $post_date          = $user->format_date($posts_row['post_time']);
  69.    $post_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&amp;t=' . $posts_row['topic_id'] . '&amp;p=' . $posts_row['post_id']) . '#p' . $posts_row['post_id'];
  70.  
  71.    $template->assign_block_vars('new_posts', array(
  72.       'POST_TITLE'          => $posts_row['topic_title'],
  73.       'POST_AUTHOR'          => $post_author,
  74.       'POST_DATE'          => $post_date,
  75.       'U_POST'          => $post_link,
  76.    ));
  77. }
  78. // End Recent Posts
  79. ?>