-<?
-# Main wiki script; see design.doc
-#
-$wgRequestTime = microtime();
-
-unset( $IP );
-ini_set( "allow_url_fopen", 0 ); # For security...
-include_once( "./LocalSettings.php" );
-
-# Windows requires ';' as separator, ':' for Unix
-$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-ini_set( "include_path", "$IP$sep$include_path" );
-
-include_once( "Setup.php" );
-
-wfProfileIn( "main-misc-setup" );
-OutputPage::setEncodings(); # Not really used yet
-
-# Useful debug output
-if ( function_exists( "getallheaders" ) ) {
- wfDebug( "\nStart request\n" );
- wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
- $headers = getallheaders();
- foreach ($headers as $name => $value) {
- wfDebug( "$name: $value\n" );
- }
- wfDebug( "\n" );
-} else {
- wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
-}
-
-# Query string fields
-#
-global $action, $title, $search, $go, $target, $printable;
-global $returnto, $diff, $oldid;
-
-$action = strtolower( trim( $action ) );
-if ( "" == $action ) { $action = "view"; }
-if ( "yes" == $printable ) { $wgOut->setPrintable(); }
-
-if ( "" == $title && "delete" != $action ) {
- $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
-} else {
- $wgTitle = Title::newFromURL( $title );
-}
-wfProfileOut( "main-misc-setup" );
-
-if( !$wgTitle or $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
- $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
- $wgOut->errorpage( "badtitle", "badtitletext" );
-} else if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
- wfSpecialPage();
-} else if ( "" != $search ) {
- if($go) {
- wfGo( $search );
- } else {
- wfSearch( $search );
- }
-} else {
- if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
- $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
- }
-
- switch( $wgTitle->getNamespace() ) {
- case 6:
- include_once( "ImagePage.php" );
- $wgArticle = new ImagePage( $wgTitle );
- break;
- default:
- $wgArticle = new Article( $wgTitle );
- }
-
- switch( $action ) {
- case "view":
- case "watch":
- case "unwatch":
- case "delete":
- case "revert":
- case "rollback":
- case "protect":
- case "unprotect":
- $wgArticle->$action();
- break;
- case "print":
- $wgArticle->view();
- break;
- case "edit":
- case "submit":
- include_once( "EditPage.php" );
- $editor = new EditPage( $wgArticle );
- $editor->$action();
- break;
- case "history":
- include_once( "PageHistory.php" );
- $history = new PageHistory( $wgArticle );
- $history->history();
- break;
- default:
- $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
- }
-}
-
-$wgOut->output();
-foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
-logProfilingData();
-wfDebug( "Request ended normally\n" );
-?>