Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

index.php

Zuletzt modifiziert: 02.04.2025, 15:01 - Dateigröße: 8.42 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  /**
015  */
016   
017  /**
018  * @ignore
019  */
020  define('IN_PHPBB', true);
021  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
022  $phpEx = substr(strrchr(__FILE__, '.'), 1);
023  include($phpbb_root_path . 'common.' . $phpEx);
024  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
025   
026  // Start session management
027  $user->session_begin();
028  $auth->acl($user->data);
029  $user->setup('viewforum');
030   
031  // Mark notifications read
032  if (($mark_notification = $request->variable('mark_notification', 0)))
033  {
034      if ($user->data['user_id'] == ANONYMOUS)
035      {
036          if ($request->is_ajax())
037          {
038              trigger_error('LOGIN_REQUIRED');
039          }
040          login_box('', $user->lang['LOGIN_REQUIRED']);
041      }
042   
043      if (check_link_hash($request->variable('hash', ''), 'mark_notification_read'))
044      {
045          /* @var $phpbb_notifications \phpbb\notification\manager */
046          $phpbb_notifications = $phpbb_container->get('notification_manager');
047   
048          $notification = $phpbb_notifications->load_notifications('notification.method.board', array(
049              'notification_id'    => $mark_notification,
050          ));
051   
052          if (isset($notification['notifications'][$mark_notification]))
053          {
054              $notification = $notification['notifications'][$mark_notification];
055   
056              $notification->mark_read();
057   
058              /**
059              * You can use this event to perform additional tasks or redirect user elsewhere.
060              *
061              * @event core.index_mark_notification_after
062              * @var    int                                        mark_notification    Notification ID
063              * @var    \phpbb\notification\type\type_interface    notification        Notification instance
064              * @since 3.2.6-RC1
065              */
066              $vars = array('mark_notification', 'notification');
067              extract($phpbb_dispatcher->trigger_event('core.index_mark_notification_after', compact($vars)));
068   
069              if ($request->is_ajax())
070              {
071                  $json_response = new \phpbb\json_response();
072                  $json_response->send(array(
073                      'success'    => true,
074                  ));
075              }
076   
077              if (($redirect = $request->variable('redirect', '')))
078              {
079                  redirect(append_sid($phpbb_root_path . $redirect));
080              }
081   
082              redirect($notification->get_redirect_url());
083          }
084      }
085  }
086   
087  display_forums('', $config['load_moderators']);
088   
089  $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
090  // Grab group details for legend display
091  if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
092  {
093      $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
094          FROM ' . GROUPS_TABLE . '
095          WHERE group_legend > 0
096          ORDER BY ' . $order_legend . ' ASC';
097  }
098  else
099  {
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  $controller_helper = $phpbb_container->get('controller.helper');
215  // Assign index specific vars
216  $template->assign_vars(array(
217      'TOTAL_POSTS'    => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']),
218      'TOTAL_TOPICS'    => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']),
219      'TOTAL_USERS'    => $user->lang('TOTAL_USERS', (int) $config['num_users']),
220      'NEWEST_USER'    => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
221   
222      'LEGEND'        => $legend,
223      'BIRTHDAY_LIST'    => (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list),
224   
225      'S_LOGIN_ACTION'            => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
226      'U_SEND_PASSWORD'           => ($config['email_enable'] && $config['allow_password_reset']) ? $controller_helper->route('phpbb_ucp_forgot_password_controller') : '',
227      'S_DISPLAY_BIRTHDAY_LIST'    => $show_birthdays,
228      'S_INDEX'                    => true,
229   
230      'U_CANONICAL'        => generate_board_url() . '/',
231      '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()) : '',
232      '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) : '')
233  );
234   
235  $page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX'];
236   
237  /**
238  * You can use this event to modify the page title and load data for the index
239  *
240  * @event core.index_modify_page_title
241  * @var    string    page_title        Title of the index page
242  * @since 3.1.0-a1
243  */
244  $vars = array('page_title');
245  extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars)));
246   
247  // Output page
248  page_header($page_title, true);
249   
250  $template->set_filenames(array(
251      'body' => 'index_body.html')
252  );
253   
254  page_footer();
255