API:
[lhc/web/wiklou.git] / index.php
1 <?php
2
3 /**
4 * This is the main web entry point for MediaWiki.
5 *
6 * If you are reading this in your web browser, your server is probably
7 * not configured correctly to run PHP applications!
8 *
9 * See the README, INSTALL, and UPGRADE files for basic setup instructions
10 * and pointers to the online documentation.
11 *
12 * http://www.mediawiki.org/
13 *
14 * ----------
15 *
16 * Copyright (C) 2001-2007 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
17 * Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
18 * Niklas Laxström, Domas Mituzas, Rob Church and others.
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 * http://www.gnu.org/copyleft/gpl.html
34 */
35
36
37 # Initialise common code
38 require_once( './includes/WebStart.php' );
39
40 # Initialize MediaWiki base class
41 require_once( "includes/Wiki.php" );
42 $mediaWiki = new MediaWiki();
43
44 wfProfileIn( 'main-misc-setup' );
45 OutputPage::setEncodings(); # Not really used yet
46
47 $maxLag = $wgRequest->getVal( 'maxlag' );
48 if ( !is_null( $maxLag ) ) {
49 if ( !$mediaWiki->checkMaxLag( $maxLag ) ) {
50 exit;
51 }
52 }
53
54 # Query string fields
55 $action = $wgRequest->getVal( 'action', 'view' );
56 $title = $wgRequest->getVal( 'title' );
57
58 $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
59 if ($wgTitle == NULL) {
60 unset( $wgTitle );
61 }
62
63 #
64 # Send Ajax requests to the Ajax dispatcher.
65 #
66 if ( $wgUseAjax && $action == 'ajax' ) {
67 require_once( $IP . '/includes/AjaxDispatcher.php' );
68
69 $dispatcher = new AjaxDispatcher();
70 $dispatcher->performAction();
71 $mediaWiki->restInPeace( $wgLoadBalancer );
72 exit;
73 }
74
75
76 wfProfileOut( 'main-misc-setup' );
77
78 # Setting global variables in mediaWiki
79 $mediaWiki->setVal( 'Server', $wgServer );
80 $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
81 $mediaWiki->setVal( 'action', $action );
82 $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
83 $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
84 $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
85 $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
86 $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
87 $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
88
89 $wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
90 $mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );
91
92 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
93 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
94
95 $mediaWiki->restInPeace( $wgLoadBalancer );
96