[ Index ]

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


Generated: Sat Oct 26 11:28:42 2019 Cross-referenced by PHPXref 0.7.1