2 # Main wiki script; see design.doc
4 $wgRequestTime = microtime();
7 ini_set( "allow_url_fopen", 0 ); # For security...
8 include_once( "./LocalSettings.php" );
10 # Windows requires ';' as separator, ':' for Unix
11 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
12 ini_set( "include_path", "$IP$sep$include_path" );
14 include_once( "Setup.php" );
16 wfProfileIn( "main-misc-setup" );
17 OutputPage::setEncodings(); # Not really used yet
20 if ( function_exists( "getallheaders" ) ) {
21 wfDebug( "\nStart request\n" );
22 wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
23 $headers = getallheaders();
24 foreach ($headers as $name => $value) {
25 wfDebug( "$name: $value\n" );
29 wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
34 global $action, $title, $search, $go, $target, $printable;
35 global $returnto, $diff, $oldid;
37 $action = strtolower( trim( $action ) );
38 if ( "" == $action ) { $action = "view"; }
39 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
41 if ( "" == $title && "delete" != $action ) {
42 $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
44 $wgTitle = Title::newFromURL( $title );
46 wfProfileOut( "main-misc-setup" );
48 if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
49 $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
50 $wgOut->errorpage( "badtitle", "badtitletext" );
51 } else if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
53 } else if ( "" != $search ) {
60 if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
61 $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
64 switch( $wgTitle->getNamespace() ) {
66 include_once( "ImagePage.php" );
67 $wgArticle = new ImagePage( $wgTitle );
70 $wgArticle = new Article( $wgTitle );
82 $wgArticle->$action();
89 include_once( "EditPage.php" );
90 $editor = new EditPage( $wgArticle );
94 include_once( "PageHistory.php" );
95 $history = new PageHistory( $wgArticle );
99 $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
104 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
106 wfDebug( "Request ended normally\n" );