MediaWiki  1.23.14
WebStart.php
Go to the documentation of this file.
1 <?php
29 # Protect against register_globals
30 # This must be done before any globals are set by the code
31 if ( ini_get( 'register_globals' ) ) {
32  if ( isset( $_REQUEST['GLOBALS'] ) || isset( $_FILES['GLOBALS'] ) ) {
33  die( '<a href="http://www.hardened-php.net/globals-problem">$GLOBALS overwrite vulnerability</a>' );
34  }
35  $verboten = array(
36  'GLOBALS',
37  '_SERVER',
38  'HTTP_SERVER_VARS',
39  '_GET',
40  'HTTP_GET_VARS',
41  '_POST',
42  'HTTP_POST_VARS',
43  '_COOKIE',
44  'HTTP_COOKIE_VARS',
45  '_FILES',
46  'HTTP_POST_FILES',
47  '_ENV',
48  'HTTP_ENV_VARS',
49  '_REQUEST',
50  '_SESSION',
51  'HTTP_SESSION_VARS'
52  );
53  foreach ( $_REQUEST as $name => $value ) {
54  if ( in_array( $name, $verboten ) ) {
55  header( "HTTP/1.1 500 Internal Server Error" );
56  echo "register_globals security paranoia: trying to overwrite superglobals, aborting.";
57  die( -1 );
58  }
59  unset( $GLOBALS[$name] );
60  }
61 }
62 
63 if ( ini_get( 'mbstring.func_overload' ) ) {
64  die( 'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
65 }
66 
67 # bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this
68 # We're adding it here so that it's *always* set, even for alternate entry
69 # points and when $wgOut gets disabled or overridden.
70 header( 'X-Content-Type-Options: nosniff' );
71 
72 $wgRequestTime = microtime( true );
73 # getrusage() does not exist on the Microsoft Windows platforms, catching this
74 if ( function_exists ( 'getrusage' ) ) {
75  $wgRUstart = getrusage();
76 } else {
77  $wgRUstart = array();
78 }
79 unset( $IP );
80 
81 # Valid web server entry point, enable includes.
82 # Please don't move this line to includes/Defines.php. This line essentially
83 # defines a valid entry point. If you put it in includes/Defines.php, then
84 # any script that includes it becomes an entry point, thereby defeating
85 # its purpose.
86 define( 'MEDIAWIKI', true );
87 
88 # Full path to working directory.
89 # Makes it possible to for example to have effective exclude path in apc.
90 # __DIR__ breaks symlinked includes, but realpath() returns false
91 # if we don't have permissions on parent directories.
92 $IP = getenv( 'MW_INSTALL_PATH' );
93 if ( $IP === false ) {
94  if ( realpath( '.' ) ) {
95  $IP = realpath( '.' );
96  } else {
97  $IP = dirname( __DIR__ );
98  }
99 }
100 
101 # Start the autoloader, so that extensions can derive classes from core files
102 require_once "$IP/includes/AutoLoader.php";
103 
104 # Load global functions
105 require_once "$IP/includes/GlobalFunctions.php";
106 
107 # Load the profiler
108 require_once "$IP/includes/profiler/Profiler.php";
109 
110 # Load up some global defines.
111 require_once "$IP/includes/Defines.php";
112 
113 # Start the profiler
115 if ( file_exists( "$IP/StartProfiler.php" ) ) {
116  require "$IP/StartProfiler.php";
117 }
118 
119 wfProfileIn( 'WebStart.php-conf' );
120 
121 # Load default settings
122 require_once "$IP/includes/DefaultSettings.php";
123 
124 # Load composer's autoloader if present
125 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
126  require_once "$IP/vendor/autoload.php";
127 }
128 
129 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
130  # Use a callback function to configure MediaWiki
131  call_user_func( MW_CONFIG_CALLBACK );
132 } else {
133  if ( !defined( 'MW_CONFIG_FILE' ) ) {
134  define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
135  }
136 
137  # LocalSettings.php is the per site customization file. If it does not exist
138  # the wiki installer needs to be launched or the generated file uploaded to
139  # the root wiki directory. Give a hint, if it is not readable by the server.
140  if ( !is_readable( MW_CONFIG_FILE ) ) {
141  require_once "$IP/includes/templates/NoLocalSettings.php";
142  die();
143  }
144 
145  # Include site settings. $IP may be changed (hopefully before the AutoLoader is invoked)
146  require_once MW_CONFIG_FILE;
147 }
148 
149 wfProfileOut( 'WebStart.php-conf' );
150 
151 wfProfileIn( 'WebStart.php-ob_start' );
152 # Initialise output buffering
153 # Check that there is no previous output or previously set up buffers, because
154 # that would cause us to potentially mix gzip and non-gzip output, creating a
155 # big mess.
156 if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ob_get_level() == 0 ) {
157  require_once "$IP/includes/OutputHandler.php";
158  ob_start( 'wfOutputHandler' );
159 }
160 wfProfileOut( 'WebStart.php-ob_start' );
161 
162 if ( !defined( 'MW_NO_SETUP' ) ) {
163  require_once "$IP/includes/Setup.php";
164 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
MW_CONFIG_CALLBACK
const MW_CONFIG_CALLBACK(!function_exists( 'version_compare')||(version_compare(phpversion(), '5.3.2')< 0))
Definition: install.php:29
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
$wgRequestTime
$wgRequestTime
Definition: WebStart.php:72
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$value
$value
Definition: styleTest.css.php:45
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$wgProfiler
$wgProfiler
Definition: WebStart.php:114
$IP
$IP
Definition: WebStart.php:92
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6