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 |
startup.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 /** @ignore */
015 if (!defined('IN_PHPBB') || !defined('IN_INSTALL'))
016 {
017 exit;
018 }
019
020 function phpbb_require_updated($path, $phpbb_root_path, $optional = false)
021 {
022 $new_path = $phpbb_root_path . 'install/update/new/' . $path;
023 $old_path = $phpbb_root_path . $path;
024
025 if (file_exists($new_path))
026 {
027 require($new_path);
028 }
029 else if (!$optional || file_exists($old_path))
030 {
031 require($old_path);
032 }
033 }
034
035 function phpbb_include_updated($path, $phpbb_root_path, $optional = false)
036 {
037 $new_path = $phpbb_root_path . 'install/update/new/' . $path;
038 $old_path = $phpbb_root_path . $path;
039
040 if (file_exists($new_path))
041 {
042 include($new_path);
043 }
044 else if (!$optional || file_exists($old_path))
045 {
046 include($old_path);
047 }
048 }
049
050 function installer_msg_handler($errno, $msg_text, $errfile, $errline)
051 {
052 global $phpbb_installer_container, $msg_long_text;
053
054 // Acording to https://www.php.net/manual/en/language.operators.errorcontrol.php
055 // error_reporting() return a different error code inside the error handler after php 8.0
056 $suppresed = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
057 if (PHP_VERSION_ID < 80000)
058 {
059 $suppresed = 0;
060 }
061
062 if (error_reporting() == $suppresed)
063 {
064 return true;
065 }
066
067 // If the message handler is stripping text, fallback to the long version if available
068 if (!$msg_text && !empty($msg_long_text))
069 {
070 $msg_text = $msg_long_text;
071 }
072
073 switch ($errno)
074 {
075 case E_NOTICE:
076 case E_WARNING:
077 case E_USER_WARNING:
078 case E_USER_NOTICE:
079 $msg = '[phpBB Debug] "' . $msg_text . '" in file ' . $errfile . ' on line ' . $errline;
080
081 if (!empty($phpbb_installer_container))
082 {
083 try
084 {
085 /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
086 $iohandler = $phpbb_installer_container->get('installer.helper.iohandler');
087 $iohandler->add_warning_message($msg);
088 }
089 catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e)
090 {
091 print($msg);
092 }
093 }
094 else
095 {
096 print($msg);
097 }
098
099 return;
100 break;
101 case E_USER_ERROR:
102 $msg = '<b>General Error:</b><br>' . $msg_text . '<br> in file ' . $errfile . ' on line ' . $errline . '<br><br>';
103
104 if (!empty($phpbb_installer_container))
105 {
106 try
107 {
108 /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
109 $iohandler = $phpbb_installer_container->get('installer.helper.iohandler');
110 $iohandler->add_error_message($msg);
111 $iohandler->send_response(true);
112 exit();
113 }
114 catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e)
115 {
116 throw new \phpbb\exception\runtime_exception($msg);
117 }
118 }
119 throw new \phpbb\exception\runtime_exception($msg);
120 break;
121 case E_DEPRECATED:
122 return true;
123 break;
124 }
125
126 return false;
127 }
128
129 /**
130 * Register class loaders for installer
131 *
132 * @param string $phpbb_root_path phpBB root path
133 * @param string $phpEx PHP file extension
134 */
135 function installer_class_loader($phpbb_root_path, $phpEx)
136 {
137 $phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
138 $phpbb_class_loader_new->register();
139 $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
140 $phpbb_class_loader->register();
141 $phpbb_class_loader = new \phpbb\class_loader('phpbb\\convert\\', "{$phpbb_root_path}install/convert/", $phpEx);
142 $phpbb_class_loader->register();
143 $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
144 $phpbb_class_loader_ext->register();
145 }
146
147 /**
148 * Installer shutdown function. Tries to resolve errors that might have occured
149 * during execution of installer
150 *
151 * @param int $display_errors Original display errors value
152 */
153 function installer_shutdown_function($display_errors)
154 {
155 $error = error_get_last();
156
157 if ($error)
158 {
159 // Restore original display errors value
160 @ini_set('display_errors', $display_errors);
161
162 // Manually define phpBB root path and phpEx. These will not be passed
163 // on from app.php
164 $phpbb_root_path = __DIR__ . '/../';
165 $phpEx = 'php';
166
167 installer_class_loader($phpbb_root_path, $phpEx);
168 $supported_error_levels = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED;
169
170 $cache = new \phpbb\cache\driver\file(__DIR__ . '/../cache/installer/');
171 $filesystem = new \phpbb\filesystem\filesystem();
172 if (strpos($error['file'], $filesystem->realpath($cache->cache_dir)) !== false && is_writable($cache->cache_dir))
173 {
174 $file_age = @filemtime($error['file']);
175
176 if ($file_age !== false && ($file_age + 60) < time())
177 {
178 $cache->purge();
179
180 $symfony_request = new \phpbb\symfony_request(new \phpbb\request\request(new \phpbb\request\type_cast_helper()));
181
182 header('Location: ' . $symfony_request->getRequestUri());
183 exit();
184 }
185 else
186 {
187 // Language system is not available
188 die('The installer has detected an issue with a cached file. Try reloading the page and/or manually clearing the cache to resolve the issue. If you require further assistance, please visit the <a href="https://www.phpbb.com/community/" target="_blank">phpBB support forums</a>.');
189 }
190 }
191 else if ($error['type'] & $supported_error_levels)
192 {
193 // Convert core errors to user warnings for trigger_error()
194 if ($error['type'] == E_CORE_ERROR || $error['type'] == E_COMPILE_ERROR)
195 {
196 $error['type'] = E_USER_ERROR;
197 }
198 else if ($error['type'] == E_CORE_WARNING)
199 {
200 $error['type'] = E_USER_WARNING;
201 }
202
203 try
204 {
205 installer_msg_handler($error['type'], $error['message'], $error['file'], $error['line']);
206 }
207 catch (\phpbb\exception\runtime_exception $exception)
208 {
209 echo '<!DOCTYPE html>';
210 echo '<html dir="ltr">';
211 echo '<head>';
212 echo '<meta charset="utf-8">';
213 echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
214 echo '<title>General Error</title>';
215 echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
216 echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
217 echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } ';
218 echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } ';
219 echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } ';
220 echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } ';
221 echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } ';
222 echo "\n" . '/* ]]> */' . "\n";
223 echo '</style>';
224 echo '</head>';
225 echo '<body id="errorpage">';
226 echo '<div id="wrap">';
227 echo ' <div id="acp">';
228 echo ' <div class="panel">';
229 echo ' <div id="content">';
230 echo ' <h1>General Error</h1>';
231
232 echo ' <div>' . $exception->getMessage() . '</div>';
233
234 echo ' </div>';
235 echo ' </div>';
236 echo ' </div>';
237 echo ' <div id="page-footer">';
238 echo ' Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited';
239 echo ' </div>';
240 echo '</div>';
241 echo '</body>';
242 echo '</html>';
243 }
244 }
245 }
246 }
247
248 phpbb_require_updated('includes/startup.' . $phpEx, $phpbb_root_path);
249 phpbb_require_updated('phpbb/class_loader.' . $phpEx, $phpbb_root_path);
250
251 installer_class_loader($phpbb_root_path, $phpEx);
252
253 // In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
254 $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
255 $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
256
257 // Include files
258 phpbb_require_updated('includes/compatibility_globals.' . $phpEx, $phpbb_root_path);
259 phpbb_require_updated('includes/functions.' . $phpEx, $phpbb_root_path);
260 phpbb_require_updated('includes/functions_content.' . $phpEx, $phpbb_root_path);
261 phpbb_include_updated('includes/functions_compatibility.' . $phpEx, $phpbb_root_path);
262 phpbb_require_updated('includes/functions_user.' . $phpEx, $phpbb_root_path);
263 phpbb_require_updated('includes/utf/utf_tools.' . $phpEx, $phpbb_root_path);
264
265 // Set PHP error handler to ours
266 set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'installer_msg_handler');
267 $php_ini = new \bantu\IniGetWrapper\IniGetWrapper();
268
269 $ini_display_errors = $php_ini->getNumeric('display_errors');
270 register_shutdown_function('installer_shutdown_function', $ini_display_errors);
271 // Suppress errors until we have created the containers
272 @ini_set('display_errors', 0);
273
274 $phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
275 $phpbb_installer_container_builder
276 ->with_environment('installer')
277 ->without_extensions();
278
279 $other_config_path = $phpbb_root_path . 'install/update/new/config';
280 $config_path = (file_exists($other_config_path . '/installer/config.yml')) ? $other_config_path : $phpbb_root_path . 'config';
281
282 $phpbb_installer_container = $phpbb_installer_container_builder
283 ->with_config_path($config_path)
284 ->with_custom_parameters(array('cache.driver.class' => 'phpbb\cache\driver\file'))
285 ->get_container();
286
287 @ini_set('display_errors', $ini_display_errors);
288