[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/ -> common.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * Minimum Requirement: PHP 5.3.3
  16  */
  17  
  18  if (!defined('IN_PHPBB'))
  19  {
  20      exit;
  21  }
  22  
  23  require($phpbb_root_path . 'includes/startup.' . $phpEx);
  24  require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
  25  
  26  $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
  27  $phpbb_class_loader->register();
  28  
  29  $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
  30  extract($phpbb_config_php_file->get_all());
  31  
  32  if (!defined('PHPBB_INSTALLED'))
  33  {
  34      // Redirect the user to the installer
  35      require($phpbb_root_path . 'includes/functions.' . $phpEx);
  36  
  37      // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
  38      // available as used by the redirect function
  39      $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
  40      $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
  41      $secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 1 : 0;
  42  
  43      if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
  44      {
  45          $secure = 1;
  46          $server_port = 443;
  47      }
  48  
  49      $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
  50      if (!$script_name)
  51      {
  52          $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
  53      }
  54  
  55      // $phpbb_root_path accounts for redirects from e.g. /adm
  56      $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx;
  57      // Replace any number of consecutive backslashes and/or slashes with a single slash
  58      // (could happen on some proxy setups and/or Windows servers)
  59      $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
  60  
  61      // Eliminate . and .. from the path
  62      require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
  63      $phpbb_filesystem = new phpbb\filesystem();
  64      $script_path = $phpbb_filesystem->clean_path($script_path);
  65  
  66      $url = (($secure) ? 'https://' : 'http://') . $server_name;
  67  
  68      if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
  69      {
  70          // HTTP HOST can carry a port number...
  71          if (strpos($server_name, ':') === false)
  72          {
  73              $url .= ':' . $server_port;
  74          }
  75      }
  76  
  77      $url .= $script_path;
  78      header('Location: ' . $url);
  79      exit;
  80  }
  81  
  82  // In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
  83  $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
  84  $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
  85  
  86  // Include files
  87  require($phpbb_root_path . 'includes/functions.' . $phpEx);
  88  require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
  89  include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx);
  90  
  91  require($phpbb_root_path . 'includes/constants.' . $phpEx);
  92  require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
  93  
  94  // Set PHP error handler to ours
  95  set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
  96  
  97  $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
  98  $phpbb_class_loader_ext->register();
  99  
 100  phpbb_load_extensions_autoloaders($phpbb_root_path);
 101  
 102  // Set up container
 103  $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
 104  $phpbb_container = $phpbb_container_builder->get_container();
 105  
 106  $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
 107  $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
 108  
 109  require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx);
 110  
 111  // Add own hook handler
 112  require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
 113  $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
 114  $phpbb_hook_finder = $phpbb_container->get('hook_finder');
 115  
 116  foreach ($phpbb_hook_finder->find() as $hook)
 117  {
 118      @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
 119  }
 120  
 121  /**
 122  * Main event which is triggered on every page
 123  *
 124  * You can use this event to load function files and initiate objects
 125  *
 126  * NOTE:    At this point the global session ($user) and permissions ($auth)
 127  *        do NOT exist yet. If you need to use the user object
 128  *        (f.e. to include language files) or need to check permissions,
 129  *        please use the core.user_setup event instead!
 130  *
 131  * @event core.common
 132  * @since 3.1.0-a1
 133  */
 134  $phpbb_dispatcher->dispatch('core.common');


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1