$wgUseBetterLinksUpdate no longer needed, removed, doDumbUpdate removed
[mediawiki.git] / wiki.phtml
blob962a97efb5056a40b0404d00d881a8d6ad4eb799
1 <?
2 # Main wiki script; see design.doc
4 $wgRequestTime = microtime();
6 unset( $IP );
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
19 # Useful debug output
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" );
26 wfDebug( "\n" );
28 # Query string fields
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" ) );
39 } else {
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" );
45                 $wgOut->output();
46                 exit;
47         }
49 wfProfileOut( "main-misc-setup" );
51 if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
52         wfSpecialPage();
53 } else if ( "" != $search ) {
54         if($go) {
55                 wfGo( $search );
56         } else {
57                 wfSearch( $search );
58         }
59 } else {
60         if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
61                 $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
62         }       
63         
64         switch( $wgTitle->getNamespace() ) {
65         case 6:
66                 include_once( "ImagePage.php" );
67                 $wgArticle = new ImagePage( $wgTitle );
68                 break;
69         default:
70                 $wgArticle = new Article( $wgTitle );
71         }
73         switch( $action ) {
74                 case "view":
75                 case "watch":
76                 case "unwatch":
77                 case "delete":
78                 case "revert":
79                 case "rollback":
80                 case "protect":
81                 case "unprotect":
82                         $wgArticle->$action();
83                         break;
84                 case "print":
85                         $wgArticle->view();
86                         break;
87                 case "edit":
88                 case "submit":
89                         include_once( "EditPage.php" );
90                         $editor = new EditPage( $wgArticle );
91                         $editor->$action();
92                         break;
93                 case "history":
94                         include_once( "PageHistory.php" );
95                         $history = new PageHistory( $wgArticle );
96                         $history->history();
97                         break;
98                 default:
99                         $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
100         }
103 $wgOut->output();
104 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
105 logProfilingData();
106 wfDebug( "Request ended normally\n" );