[ Index ]

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


Generated: Sun Feb 19 19:47:08 2017 Cross-referenced by PHPXref 0.7.1