Moving more stuff to Wiki.php
[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 Window$ platform, 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 defines
24 # a valid entry point. If you put it in includes/Defines.php, then any script that includes
25 # it becomes an entry point, thereby defeating its purpose.
26 define( 'MEDIAWIKI', true );
27 require_once( './includes/Defines.php' );
28
29 if( !file_exists( 'LocalSettings.php' ) ) {
30 $IP = ".";
31 require_once( 'includes/DefaultSettings.php' ); # used for printing the version
32 ?>
33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
34 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
35 <head>
36 <title>MediaWiki <?php echo $wgVersion ?></title>
37 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
38 <style type='text/css' media='screen, projection'>
39 html, body {
40 color: #000;
41 background-color: #fff;
42 font-family: sans-serif;
43 text-align: center;
44 }
45
46 h1 {
47 font-size: 150%;
48 }
49 </style>
50 </head>
51 <body>
52 <img src='skins/common/images/mediawiki.png' alt='The MediaWiki logo' />
53
54 <h1>MediaWiki <?php echo $wgVersion ?></h1>
55 <div class='error'>
56 <?php
57 if ( file_exists( 'config/LocalSettings.php' ) ) {
58 echo( "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory." );
59 } else {
60 echo( "Please <a href='config/index.php' title='setup'>setup the wiki</a> first." );
61 }
62 ?>
63
64 </div>
65 </body>
66 </html>
67 <?php
68 die();
69 }
70
71 require_once( './LocalSettings.php' );
72 require_once( 'includes/Setup.php' );
73
74
75 # Initialize MediaWiki base class
76 require_once( "includes/Wiki.php" );
77 $mediaWiki = new MediaWiki();
78
79 wfProfileIn( 'main-misc-setup' );
80 OutputPage::setEncodings(); # Not really used yet
81
82 # Query string fields
83 $action = $wgRequest->getVal( 'action', 'view' );
84 $title = $wgRequest->getVal( 'title' );
85
86 $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
87 if ($wgTitle == NULL) {
88 unset( $wgTitle );
89 }
90
91 wfProfileOut( 'main-misc-setup' );
92
93 # Setting global variables in mediaWiki
94 $mediaWiki->setVal( "Server", $wgServer );
95 $mediaWiki->setVal( "DisableInternalSearch", $wgDisableInternalSearch );
96 $mediaWiki->setVal( "action", $action );
97 $mediaWiki->setVal( "SquidMaxage", $wgSquidMaxage );
98 $mediaWiki->setVal( "EnableDublinCoreRdf", $wgEnableDublinCoreRdf );
99 $mediaWiki->setVal( "EnableCreativeCommonsRdf", $wgEnableCreativeCommonsRdf );
100 $mediaWiki->setVal( "CommandLineMode", $wgCommandLineMode );
101 $mediaWiki->setVal( "UseExternalEditor", $wgUseExternalEditor );
102 $mediaWiki->setVal( "DisabledActions", $wgDisabledActions );
103
104 $wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
105 $mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );
106
107 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
108 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
109
110 $mediaWiki->restInPeace( $wgLoadBalancer );
111 ?>