Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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

common.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 5.85 KiB


001  <?php
002  /**
003  *
004  * @package phpBB3
005  * @version $Id$
006  * @copyright (c) 2005 phpBB Group
007  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
008  *
009  * Minimum Requirement: PHP 4.3.3
010  */
011   
012  /**
013  */
014  if (!defined('IN_PHPBB'))
015  {
016      exit;
017  }
018   
019  $starttime = explode(' ', microtime());
020  $starttime = $starttime[1] + $starttime[0];
021   
022  // Report all errors, except notices
023  error_reporting(E_ALL ^ E_NOTICE);
024   
025  /*
026  * Remove variables created by register_globals from the global scope
027  * Thanks to Matt Kavanagh
028  */
029  function deregister_globals()
030  {
031      $not_unset = array(
032          'GLOBALS'    => true,
033          '_GET'        => true,
034          '_POST'        => true,
035          '_COOKIE'    => true,
036          '_REQUEST'    => true,
037          '_SERVER'    => true,
038          '_SESSION'    => true,
039          '_ENV'        => true,
040          '_FILES'    => true,
041          'phpEx'        => true,
042          'phpbb_root_path'    => true
043      );
044   
045      // Not only will array_merge and array_keys give a warning if
046      // a parameter is not an array, array_merge will actually fail.
047      // So we check if _SESSION has been initialised.
048      if (!isset($_SESSION) || !is_array($_SESSION))
049      {
050          $_SESSION = array();
051      }
052   
053      // Merge all into one extremely huge array; unset this later
054      $input = array_merge(
055          array_keys($_GET),
056          array_keys($_POST),
057          array_keys($_COOKIE),
058          array_keys($_SERVER),
059          array_keys($_SESSION),
060          array_keys($_ENV),
061          array_keys($_FILES)
062      );
063   
064      foreach ($input as $varname)
065      {
066          if (isset($not_unset[$varname]))
067          {
068              // Hacking attempt. No point in continuing unless it's a COOKIE
069              if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS']))
070              {
071                  exit;
072              }
073              else
074              {
075                  $cookie = &$_COOKIE;
076                  while (isset($cookie['GLOBALS']))
077                  {
078                      foreach ($cookie['GLOBALS'] as $registered_var => $value)
079                      {
080                          if (!isset($not_unset[$registered_var]))
081                          {
082                              unset($GLOBALS[$registered_var]);
083                          }
084                      }
085                      $cookie = &$cookie['GLOBALS'];
086                  }
087              }
088          }
089   
090          unset($GLOBALS[$varname]);
091      }
092   
093      unset($input);
094  }
095   
096  // If we are on PHP >= 6.0.0 we do not need some code
097  if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
098  {
099      /**
100      * @ignore
101      */
102      define('STRIP', false);
103  }
104  else
105  {
106      set_magic_quotes_runtime(0);
107   
108      // Be paranoid with passed vars
109      if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get'))
110      {
111          deregister_globals();
112      }
113   
114      define('STRIP', (get_magic_quotes_gpc()) ? true : false);
115  }
116   
117  if (defined('IN_CRON'))
118  {
119      $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
120  }
121   
122  if (!file_exists($phpbb_root_path . 'config.' . $phpEx))
123  {
124      die("<p>The config.$phpEx file could not be found.</p><p><a href=\"{$phpbb_root_path}install/index.$phpEx\">Click here to install phpBB</a></p>");
125  }
126   
127  require($phpbb_root_path . 'config.' . $phpEx);
128   
129  if (!defined('PHPBB_INSTALLED'))
130  {
131      // Redirect the user to the installer
132      // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
133      // available as used by the redirect function
134      $server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME');
135      $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
136      $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
137   
138      $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
139      if (!$script_name)
140      {
141          $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
142      }
143   
144      // Replace any number of consecutive backslashes and/or slashes with a single slash
145      // (could happen on some proxy setups and/or Windows servers)
146      $script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx;
147      $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
148   
149      $url = (($secure) ? 'https://' : 'http://') . $server_name;
150   
151      if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
152      {
153          $url .= ':' . $server_port;
154      }
155   
156      $url .= $script_path;
157      header('Location: ' . $url);
158      exit;
159  }
160   
161  if (defined('DEBUG_EXTRA'))
162  {
163      $base_memory_usage = 0;
164      if (function_exists('memory_get_usage'))
165      {
166          $base_memory_usage = memory_get_usage();
167      }
168  }
169   
170  // Load Extensions
171  if (!empty($load_extensions))
172  {
173      $load_extensions = explode(',', $load_extensions);
174   
175      foreach ($load_extensions as $extension)
176      {
177          @dl(trim($extension));
178      }
179  }
180   
181  // Include files
182  require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
183  require($phpbb_root_path . 'includes/cache.' . $phpEx);
184  require($phpbb_root_path . 'includes/template.' . $phpEx);
185  require($phpbb_root_path . 'includes/session.' . $phpEx);
186  require($phpbb_root_path . 'includes/auth.' . $phpEx);
187   
188  require($phpbb_root_path . 'includes/functions.' . $phpEx);
189  require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
190   
191  require($phpbb_root_path . 'includes/constants.' . $phpEx);
192  require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
193  require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
194   
195  // Set PHP error handler to ours
196  set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
197   
198  // Instantiate some basic classes
199  $user        = new user();
200  $auth        = new auth();
201  $template    = new template();
202  $cache        = new cache();
203  $db            = new $sql_db();
204   
205  // Connect to DB
206  $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);
207   
208  // We do not need this any longer, unset for safety purposes
209  unset($dbpasswd);
210   
211  // Grab global variables, re-cache if necessary
212  $config = $cache->obtain_config();
213   
214  // Add own hook handler
215  require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
216  $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
217   
218  foreach ($cache->obtain_hooks() as $hook)
219  {
220      @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
221  }
222   
223  ?>