2 # Main wiki script; see design.doc
4 $wgRequestTime = microtime();
6 session_cache_limiter( "private, must-revalidate" );
8 session_register( "wsUserID" );
9 session_register( "wsUserName" );
10 session_register( "wsUserPassword" );
11 session_register( "wsUploadFiles" );
14 ini_set( "allow_url_fopen", 0 ); # For security...
15 include_once( "./LocalSettings.php" );
17 # Windows requires ';' as separator, ':' for Unix
18 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
19 ini_set( "include_path", "$IP$sep$include_path" );
21 include_once( "Setup.php" );
23 wfProfileIn( "main-misc-setup" );
24 OutputPage::setEncodings(); # Not really used yet
27 wfDebug( "\nStart request\n" );
28 wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
29 $headers = getallheaders();
30 foreach ($headers as $name => $value) {
31 wfDebug( "$name: $value\n" );
37 global $action, $title, $search, $go, $target, $printable;
38 global $returnto, $diff, $oldid;
40 $action = strtolower( trim( $action ) );
41 if ( "" == $action ) { $action = "view"; }
42 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
44 if ( "" == $title && "delete" != $action ) {
45 $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
47 $wgTitle = Title::newFromURL( $title );
48 # if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
49 if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
50 $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
51 $wgOut->errorpage( "badtitle", "badtitletext" );
56 wfProfileOut( "main-misc-setup" );
58 if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
60 } else if ( "" != $search ) {
67 if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
68 $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
71 switch( $wgTitle->getNamespace() ) {
73 include_once( "ImagePage.php" );
74 $wgArticle = new ImagePage( $wgTitle );
77 $wgArticle = new Article( $wgTitle );
90 $wgArticle->$action();
97 include_once( "EditPage.php" );
98 $editor = new EditPage( $wgArticle );
102 $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
107 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }