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 wfDebug( "\nStart request\n" );
21 wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
22 $headers = getallheaders();
23 foreach ($headers as $name => $value) {
24 wfDebug( "$name: $value\n" );
30 global $action, $title, $search, $go, $target, $printable;
31 global $returnto, $diff, $oldid;
33 $action = strtolower( trim( $action ) );
34 if ( "" == $action ) { $action = "view"; }
35 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
37 if ( "" == $title && "delete" != $action ) {
38 $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
40 $wgTitle = Title::newFromURL( $title );
41 # if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
42 if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
43 $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
44 $wgOut->errorpage( "badtitle", "badtitletext" );
49 wfProfileOut( "main-misc-setup" );
51 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 );
83 $wgArticle->$action();
90 include_once( "EditPage.php" );
91 $editor = new EditPage( $wgArticle );
95 $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
100 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }