Merging resourceloader branch into trunk. Full documentation is at http://www.mediawi...
[lhc/web/wiklou.git] / load.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @author Roan Kattouw
19 * @author Trevor Parscal
20 *
21 */
22
23 /**
24 * @file
25 * This file is the entry point for the resource loader.
26 */
27
28 require ( dirname( __FILE__ ) . '/includes/WebStart.php' );
29 wfProfileIn( 'load.php' );
30
31 // URL safety checks
32 //
33 // See RawPage.php for details; summary is that MSIE can override the
34 // Content-Type if it sees a recognized extension on the URL, such as
35 // might be appended via PATH_INFO after 'load.php'.
36 //
37 // Some resources can contain HTML-like strings (e.g. in messages)
38 // which will end up triggering HTML detection and execution.
39 //
40 if ( $wgRequest->isPathInfoBad() ) {
41 wfHttpError( 403, 'Forbidden',
42 'Invalid file extension found in PATH_INFO. ' .
43 'The resource loader must be accessed through the primary script entry point.' );
44 return;
45 // FIXME: Doesn't this execute the rest of the request anyway?
46 // Was taken from api.php so I guess it's maybe OK but it doesn't look good.
47 }
48
49 // Respond to resource loading request
50 ResourceLoader::respond( new ResourceLoaderContext( $wgRequest, $wgServer . $wgScriptPath . '/load.php' ) );
51
52 wfProfileOut( 'load.php' );
53 wfLogProfilingData();
54
55 // Shut down the database
56 wfGetLBFactory()->shutdown();