[ Index ]

PHP Cross Reference of phpBB 3.0 Beta 3

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /** 
   3  *
   4  * @package phpBB3
   5  * @version $Id: index.php,v 1.164 2006/09/23 19:30:01 grahamje Exp $
   6  * @copyright (c) 2005 phpBB Group 
   7  * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
   8  *
   9  */
  10  
  11  /**
  12  * @ignore
  13  */
  14  define('IN_PHPBB', true);
  15  $phpbb_root_path = './';
  16  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  17  include($phpbb_root_path . 'common.' . $phpEx);
  18  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  19  
  20  // Start session management
  21  $user->session_begin();
  22  $auth->acl($user->data);
  23  $user->setup('viewforum');
  24  
  25  display_forums('', $config['load_moderators']);
  26  
  27  // Set some stats, get posts count from forums data if we... hum... retrieve all forums data
  28  $total_posts    = $config['num_posts'];
  29  $total_topics    = $config['num_topics'];
  30  $total_users    = $config['num_users'];
  31  $newest_user    = $config['newest_username'];
  32  $newest_uid        = $config['newest_user_id'];
  33  
  34  $l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
  35  $l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
  36  $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
  37  
  38  // Grab group details for legend display
  39  $sql = 'SELECT group_id, group_name, group_colour, group_type
  40      FROM ' . GROUPS_TABLE . '
  41      WHERE group_legend = 1
  42          AND group_type <> ' . GROUP_HIDDEN . '
  43      ORDER BY group_name ASC';
  44  $result = $db->sql_query($sql);
  45  
  46  $legend = '';
  47  while ($row = $db->sql_fetchrow($result))
  48  {
  49      if ($row['group_name'] == 'BOTS')
  50      {
  51          $legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . $user->lang['G_BOTS'] . '</span>';
  52      }
  53      else
  54      {
  55          $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
  56      }
  57  }
  58  $db->sql_freeresult($result);
  59  
  60  // Generate birthday list if required ...
  61  $birthday_list = '';
  62  if ($config['load_birthdays'])
  63  {
  64      $now = getdate(time() + $user->timezone + $user->dst - (date('H', time()) - gmdate('H', time())) * 3600);
  65      $sql = 'SELECT user_id, username, user_colour, user_birthday
  66          FROM ' . USERS_TABLE . "
  67          WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
  68              AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
  69      $result = $db->sql_query($sql);
  70  
  71      while ($row = $db->sql_fetchrow($result))
  72      {
  73          $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : '';
  74          $birthday_list .= (($birthday_list != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $row['user_id']) . '">' . $row['username'] . '</a>';
  75  
  76          if ($age = (int) substr($row['user_birthday'], -4))
  77          {
  78              $birthday_list .= ' (' . ($now['year'] - $age) . ')';
  79          }
  80      }
  81      $db->sql_freeresult($result);
  82  }
  83  
  84  // Assign index specific vars
  85  $template->assign_vars(array(
  86      'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], $total_posts),
  87      'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], $total_topics),
  88      'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], $total_users),
  89      'NEWEST_USER'    => sprintf($user->lang['NEWEST_USER'], '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $newest_uid) . '">', $newest_user, '</a>'),
  90      'LEGEND'        => $legend,
  91      'BIRTHDAY_LIST'    => $birthday_list,
  92  
  93      'FORUM_IMG'                => $user->img('forum_read', 'NO_NEW_POSTS'),
  94      'FORUM_NEW_IMG'            => $user->img('forum_unread', 'NEW_POSTS'),
  95      'FORUM_LOCKED_IMG'        => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
  96      'FORUM_NEW_LOCKED_IMG'    => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
  97  
  98      'S_LOGIN_ACTION'            => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
  99      'S_DISPLAY_BIRTHDAY_LIST'    => ($config['load_birthdays']) ? true : false,
 100  
 101      'U_MARK_FORUMS'        => append_sid("{$phpbb_root_path}index.$phpEx", 'mark=forums'),
 102      'U_MCP'                => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
 103  );
 104  
 105  // Output page
 106  page_header($user->lang['INDEX']);
 107  
 108  $template->set_filenames(array(
 109      'body' => 'index_body.html')
 110  );
 111  
 112  page_footer();
 113  
 114  ?>


Generated: Wed Nov 22 00:35:05 2006 Cross-referenced by PHPXref 0.6