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. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
common.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 * Minimum Requirement: PHP 7.2.0
016 */
017
018 if (!defined('IN_PHPBB'))
019 {
020 exit;
021 }
022
023 require($phpbb_root_path . 'includes/startup.' . $phpEx);
024 require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
025
026 $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
027 $phpbb_class_loader->register();
028
029 $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
030 extract($phpbb_config_php_file->get_all());
031
032 if (!defined('PHPBB_ENVIRONMENT'))
033 {
034 @define('PHPBB_ENVIRONMENT', 'production');
035 }
036
037 if (!defined('PHPBB_INSTALLED'))
038 {
039 // Redirect the user to the installer
040 require($phpbb_root_path . 'includes/functions.' . $phpEx);
041
042 // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
043 // available as used by the redirect function
044 $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
045 $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
046 $secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 1 : 0;
047
048 if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
049 {
050 $secure = 1;
051 $server_port = 443;
052 }
053
054 $script_path = phpbb_get_install_redirect($phpbb_root_path, $phpEx);
055
056 // Eliminate . and .. from the path
057 require($phpbb_root_path . 'phpbb/filesystem/filesystem.' . $phpEx);
058 $phpbb_filesystem = new phpbb\filesystem\filesystem();
059 $script_path = $phpbb_filesystem->clean_path($script_path);
060
061 $url = (($secure) ? 'https://' : 'http://') . $server_name;
062
063 if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
064 {
065 // HTTP HOST can carry a port number...
066 if (strpos($server_name, ':') === false)
067 {
068 $url .= ':' . $server_port;
069 }
070 }
071
072 $url .= $script_path;
073 header('Location: ' . $url);
074 exit;
075 }
076
077 // In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
078 $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
079 $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
080
081 // Include files
082 require($phpbb_root_path . 'includes/functions.' . $phpEx);
083 require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
084 include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx);
085
086 require($phpbb_root_path . 'includes/constants.' . $phpEx);
087 require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
088
089 // Registered before building the container so the development environment stay capable of intercepting
090 // the container builder exceptions.
091 if (PHPBB_ENVIRONMENT === 'development')
092 {
093 \phpbb\debug\debug::enable();
094 }
095 else
096 {
097 set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
098 }
099
100 $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
101 $phpbb_class_loader_ext->register();
102
103 // Set up container
104 try
105 {
106 $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
107
108 // Check that cache directory is writable before trying to build container
109 $cache_dir = $phpbb_container_builder->get_cache_dir();
110 if (file_exists($cache_dir) && !is_writable($phpbb_container_builder->get_cache_dir()))
111 {
112 die('Unable to write to the cache directory path "' . $cache_dir . '". Ensure that the web server user can write to the cache folder.');
113 }
114
115 $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container();
116 }
117 catch (InvalidArgumentException $e)
118 {
119 if (PHPBB_ENVIRONMENT !== 'development')
120 {
121 trigger_error(
122 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.',
123 E_USER_ERROR
124 );
125 }
126 else
127 {
128 throw $e;
129 }
130 }
131
132 if ($phpbb_container->getParameter('debug.error_handler'))
133 {
134 \phpbb\debug\debug::enable();
135 }
136
137 $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
138 $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
139
140 $phpbb_container->get('dbal.conn')->set_debug_sql_explain($phpbb_container->getParameter('debug.sql_explain'));
141 $phpbb_container->get('dbal.conn')->set_debug_load_time($phpbb_container->getParameter('debug.load_time'));
142 require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx);
143
144 register_compatibility_globals();
145
146 // Add own hook handler
147 require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
148 $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
149
150 /* @var $phpbb_hook_finder \phpbb\hook\finder */
151 $phpbb_hook_finder = $phpbb_container->get('hook_finder');
152
153 foreach ($phpbb_hook_finder->find() as $hook)
154 {
155 @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
156 }
157
158 /**
159 * Main event which is triggered on every page
160 *
161 * You can use this event to load function files and initiate objects
162 *
163 * NOTE: At this point the global session ($user) and permissions ($auth)
164 * do NOT exist yet. If you need to use the user object
165 * (f.e. to include language files) or need to check permissions,
166 * please use the core.user_setup event instead!
167 *
168 * @event core.common
169 * @since 3.1.0-a1
170 */
171 $phpbb_dispatcher->dispatch('core.common');
172