45dbb07bad88409e7a65a7180c8a82bf9d73624f
[lhc/web/wiklou.git] / index.php
1 <?php
2 /**
3 * Main wiki script; see docs/design.txt
4 * @package MediaWiki
5 */
6 $wgRequestTime = microtime();
7
8 # getrusage() does not exist on the Microsoft Windows platforms, catching this
9 if ( function_exists ( 'getrusage' ) ) {
10 $wgRUstart = getrusage();
11 } else {
12 $wgRUstart = array();
13 }
14
15 unset( $IP );
16 @ini_set( 'allow_url_fopen', 0 ); # For security...
17
18 if ( isset( $_REQUEST['GLOBALS'] ) ) {
19 die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
20 }
21
22 # Valid web server entry point, enable includes.
23 # Please don't move this line to includes/Defines.php. This line essentially
24 # defines a valid entry point. If you put it in includes/Defines.php, then
25 # any script that includes it becomes an entry point, thereby defeating
26 # its purpose.
27 define( 'MEDIAWIKI', true );
28
29 # Load up some global defines.
30 require_once( './includes/Defines.php' );
31
32 # LocalSettings.php is the per site customization file. If it does not exit
33 # the wiki installer need to be launched or the generated file moved from
34 # ./config/ to ./
35 if( !file_exists( 'LocalSettings.php' ) ) {
36 $IP = '.';
37 require_once( 'includes/DefaultSettings.php' ); # used for printing the version
38 ?>
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
40 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
41 <head>
42 <title>MediaWiki <?php echo $wgVersion ?></title>
43 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
44 <style type='text/css' media='screen, projection'>
45 html, body {
46 color: #000;
47 background-color: #fff;
48 font-family: sans-serif;
49 text-align: center;
50 }
51
52 h1 {
53 font-size: 150%;
54 }
55 </style>
56 </head>
57 <body>
58 <img src='skins/common/images/mediawiki.png' alt='The MediaWiki logo' />
59
60 <h1>MediaWiki <?php echo $wgVersion ?></h1>
61 <div class='error'>
62 <?php
63 if ( file_exists( 'config/LocalSettings.php' ) ) {
64 echo( 'To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory.' );
65 } else {
66 echo( 'Please <a href="config/index.php" title="setup">setup the wiki</a> first.' );
67 }
68 ?>
69
70 </div>
71 </body>
72 </html>
73 <?php
74 die();
75 }
76
77 # Include this site setttings
78 require_once( './LocalSettings.php' );
79 # Prepare MediaWiki
80 require_once( 'includes/Setup.php' );
81
82 # Initialize MediaWiki base class
83 require_once( "includes/Wiki.php" );
84 $mediaWiki = new MediaWiki();
85
86 wfProfileIn( 'main-misc-setup' );
87 OutputPage::setEncodings(); # Not really used yet
88
89 # Query string fields
90 $action = $wgRequest->getVal( 'action', 'view' );
91 $title = $wgRequest->getVal( 'title' );
92
93 #
94 # Send Ajax requests to the Ajax dispatcher.
95 #
96 if ( $wgUseAjax && $action == 'ajax' ) {
97 require_once( 'ajax.php' );
98
99 $dispatcher = new AjaxDispatcher();
100 $dispatcher->performAction();
101
102 exit;
103 }
104
105 $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
106 if ($wgTitle == NULL) {
107 unset( $wgTitle );
108 }
109
110 wfProfileOut( 'main-misc-setup' );
111
112 # Setting global variables in mediaWiki
113 $mediaWiki->setVal( 'Server', $wgServer );
114 $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
115 $mediaWiki->setVal( 'action', $action );
116 $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
117 $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
118 $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
119 $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
120 $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
121 $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
122
123 $wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
124 $mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );
125
126 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
127 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
128
129 $mediaWiki->restInPeace( $wgLoadBalancer );
130 ?>