Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
index.php
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 if ($request->is_ajax())
059 {
060 $json_response = new \phpbb\json_response();
061 $json_response->send(array(
062 'success' => true,
063 ));
064 }
065
066 if (($redirect = $request->variable('redirect', '')))
067 {
068 redirect(append_sid($phpbb_root_path . $redirect));
069 }
070
071 redirect($notification->get_redirect_url());
072 }
073 }
074 }
075
076 display_forums('', $config['load_moderators']);
077
078 $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
079 // Grab group details for legend display
080 if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
081 {
082 $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
083 FROM ' . GROUPS_TABLE . '
084 WHERE group_legend > 0
085 ORDER BY ' . $order_legend . ' ASC';
086 }
087 else
088 {
089 $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
090 FROM ' . GROUPS_TABLE . ' g
091 LEFT JOIN ' . USER_GROUP_TABLE . ' ug
092 ON (
093 g.group_id = ug.group_id
094 AND ug.user_id = ' . $user->data['user_id'] . '
095 AND ug.user_pending = 0
096 )
097 WHERE g.group_legend > 0
098 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
099 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&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') . '&mark=forums&mark_time=' . time()) : '',
222 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&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();
245