[ Index ]

PHP Cross Reference of phpBB-3.1.10-deutsch

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  */
  16  
  17  /**
  18  * @ignore
  19  */
  20  define('IN_PHPBB', true);
  21  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  22  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  23  include($phpbb_root_path . 'common.' . $phpEx);
  24  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  25  
  26  // Start session management
  27  $user->session_begin();
  28  $auth->acl($user->data);
  29  $user->setup('viewforum');
  30  
  31  // Mark notifications read
  32  if (($mark_notification = $request->variable('mark_notification', 0)))
  33  {
  34      if ($user->data['user_id'] == ANONYMOUS)
  35      {
  36          if ($request->is_ajax())
  37          {
  38              trigger_error('LOGIN_REQUIRED');
  39          }
  40          login_box('', $user->lang['LOGIN_REQUIRED']);
  41      }
  42  
  43      if (check_link_hash($request->variable('hash', ''), 'mark_notification_read'))
  44      {
  45          $phpbb_notifications = $phpbb_container->get('notification_manager');
  46  
  47          $notification = $phpbb_notifications->load_notifications(array(
  48              'notification_id'    => $mark_notification,
  49          ));
  50  
  51          if (isset($notification['notifications'][$mark_notification]))
  52          {
  53              $notification = $notification['notifications'][$mark_notification];
  54  
  55              $notification->mark_read();
  56  
  57              if ($request->is_ajax())
  58              {
  59                  $json_response = new \phpbb\json_response();
  60                  $json_response->send(array(
  61                      'success'    => true,
  62                  ));
  63              }
  64  
  65              if (($redirect = $request->variable('redirect', '')))
  66              {
  67                  redirect(append_sid($phpbb_root_path . $redirect));
  68              }
  69  
  70              redirect($notification->get_redirect_url());
  71          }
  72      }
  73  }
  74  
  75  display_forums('', $config['load_moderators']);
  76  
  77  $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
  78  // Grab group details for legend display
  79  if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
  80  {
  81      $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
  82          FROM ' . GROUPS_TABLE . '
  83          WHERE group_legend > 0
  84          ORDER BY ' . $order_legend . ' ASC';
  85  }
  86  else
  87  {
  88      $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
  89          FROM ' . GROUPS_TABLE . ' g
  90          LEFT JOIN ' . USER_GROUP_TABLE . ' ug
  91              ON (
  92                  g.group_id = ug.group_id
  93                  AND ug.user_id = ' . $user->data['user_id'] . '
  94                  AND ug.user_pending = 0
  95              )
  96          WHERE g.group_legend > 0
  97              AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
  98          ORDER BY g.' . $order_legend . ' ASC';
  99  }
 100  $result = $db->sql_query($sql);
 101  
 102  $legend = array();
 103  while ($row = $db->sql_fetchrow($result))
 104  {
 105      $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
 106      $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
 107  
 108      if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
 109      {
 110          $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
 111      }
 112      else
 113      {
 114          $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
 115      }
 116  }
 117  $db->sql_freeresult($result);
 118  
 119  $legend = implode($user->lang['COMMA_SEPARATOR'], $legend);
 120  
 121  // Generate birthday list if required ...
 122  $birthdays = $birthday_list = array();
 123  if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
 124  {
 125      $time = $user->create_datetime();
 126      $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
 127  
 128      // Display birthdays of 29th february on 28th february in non-leap-years
 129      $leap_year_birthdays = '';
 130      if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L'))
 131      {
 132          $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
 133      }
 134  
 135      $sql_ary = array(
 136          'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday',
 137          'FROM' => array(
 138              USERS_TABLE => 'u',
 139          ),
 140          'LEFT_JOIN' => array(
 141              array(
 142                  'FROM' => array(BANLIST_TABLE => 'b'),
 143                  'ON' => 'u.user_id = b.ban_userid',
 144              ),
 145          ),
 146          'WHERE' => "(b.ban_id IS NULL OR b.ban_exclude = 1)
 147              AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays)
 148              AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')',
 149      );
 150  
 151      /**
 152      * Event to modify the SQL query to get birthdays data
 153      *
 154      * @event core.index_modify_birthdays_sql
 155      * @var    array    now            The assoc array with the 'now' local timestamp data
 156      * @var    array    sql_ary        The SQL array to get the birthdays data
 157      * @var    object    time        The user related Datetime object
 158      * @since 3.1.7-RC1
 159      */
 160      $vars = array('now', 'sql_ary', 'time');
 161      extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_sql', compact($vars)));
 162  
 163      $sql = $db->sql_build_query('SELECT', $sql_ary);
 164      $result = $db->sql_query($sql);
 165      $rows = $db->sql_fetchrowset($result);
 166      $db->sql_freeresult($result);
 167  
 168      foreach ($rows as $row)
 169      {
 170          $birthday_username    = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
 171          $birthday_year        = (int) substr($row['user_birthday'], -4);
 172          $birthday_age        = ($birthday_year) ? max(0, $now['year'] - $birthday_year) : '';
 173  
 174          $birthdays[] = array(
 175              'USERNAME'    => $birthday_username,
 176              'AGE'        => $birthday_age,
 177          );
 178  
 179          // For 3.0 compatibility
 180          $birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : '');
 181      }
 182  
 183      /**
 184      * Event to modify the birthdays list
 185      *
 186      * @event core.index_modify_birthdays_list
 187      * @var    array    birthdays        Array with the users birthdays data
 188      * @var    array    rows            Array with the birthdays SQL query result
 189      * @since 3.1.7-RC1
 190      */
 191      $vars = array('birthdays', 'rows');
 192      extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_list', compact($vars)));
 193  
 194      $template->assign_block_vars_array('birthdays', $birthdays);
 195  }
 196  
 197  // Assign index specific vars
 198  $template->assign_vars(array(
 199      'TOTAL_POSTS'    => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']),
 200      'TOTAL_TOPICS'    => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']),
 201      'TOTAL_USERS'    => $user->lang('TOTAL_USERS', (int) $config['num_users']),
 202      'NEWEST_USER'    => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
 203  
 204      'LEGEND'        => $legend,
 205      'BIRTHDAY_LIST'    => (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list),
 206  
 207      'FORUM_IMG'                => $user->img('forum_read', 'NO_UNREAD_POSTS'),
 208      'FORUM_UNREAD_IMG'            => $user->img('forum_unread', 'UNREAD_POSTS'),
 209      'FORUM_LOCKED_IMG'        => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
 210      'FORUM_UNREAD_LOCKED_IMG'    => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),
 211  
 212      'S_LOGIN_ACTION'            => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
 213      'U_SEND_PASSWORD'           => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '',
 214      'S_DISPLAY_BIRTHDAY_LIST'    => ($config['load_birthdays']) ? true : false,
 215      'S_INDEX'                    => true,
 216  
 217      'U_MARK_FORUMS'        => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums&amp;mark_time=' . time()) : '',
 218      '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) : '')
 219  );
 220  
 221  $page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX'];
 222  
 223  /**
 224  * You can use this event to modify the page title and load data for the index
 225  *
 226  * @event core.index_modify_page_title
 227  * @var    string    page_title        Title of the index page
 228  * @since 3.1.0-a1
 229  */
 230  $vars = array('page_title');
 231  extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars)));
 232  
 233  // Output page
 234  page_header($page_title, true);
 235  
 236  $template->set_filenames(array(
 237      'body' => 'index_body.html')
 238  );
 239  
 240  page_footer();


Generated: Sun Feb 19 19:52:41 2017 Cross-referenced by PHPXref 0.7.1