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 $include_path = ini_get( "include_path" );
18 # Windows requires ';' as separator, ':' for Unix
19 if( strchr( $include_path, ";" ) ) $sep = ";"; else $sep = ":";
20 ini_set( "include_path", $IP . $sep . ini_get( "include_path" ) );
22 include_once( "Setup.php" );
24 wfProfileIn( "main-misc-setup" );
25 OutputPage::setEncodings(); # Not really used yet
28 wfDebug( "\nStart request\n" );
29 wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
30 $headers = getallheaders();
31 foreach ($headers as $name => $value) {
32 wfDebug( "$name: $value\n" );
38 global $action, $title, $search, $go, $target, $printable;
39 global $returnto, $diff, $oldid;
41 $action = strtolower( trim( $action ) );
42 if ( "" == $action ) { $action = "view"; }
43 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
45 if ( "" == $title && "delete" != $action ) {
46 $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
48 $wgTitle = Title::newFromURL( $title );
49 # if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
50 if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
51 $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
52 $wgOut->errorpage( "badtitle", "badtitletext" );
57 wfProfileOut( "main-misc-setup" );
59 if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
61 } else if ( "" != $search ) {
68 if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
69 $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
72 switch( $wgTitle->getNamespace() ) {
74 include_once( "ImagePage.php" );
75 $wgArticle = new ImagePage( $wgTitle );
78 $wgArticle = new Article( $wgTitle );
91 $wgArticle->$action();
98 include_once( "EditPage.php" );
99 $editor = new EditPage( $wgArticle );
103 $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
108 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }