Add missing getMagicWords()
[mediawiki.git] / wiki.phtml
blobd30db092bef7bfe046c5e9d4b31f003720b12a59
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 "history":
78                 case "delete":
79                 case "revert":
80                 case "rollback":
81                 case "protect":
82                 case "unprotect":
83                         $wgArticle->$action();
84                         break;
85                 case "print":
86                         $wgArticle->view();
87                         break;
88                 case "edit":
89                 case "submit":
90                         include_once( "EditPage.php" );
91                         $editor = new EditPage( $wgArticle );
92                         $editor->$action();
93                         break;
94                 default:
95                         $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
96         }
99 $wgOut->output();
100 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }