Hide undelete link for existing articles with an undelete history, unless in history...
[mediawiki.git] / wiki.phtml
blob98895a2c16499626965a51a569b9fa78465e44e0
1 <?
2 # Main wiki script; see design.doc
4 $wgRequestTime = microtime();
6 session_cache_limiter( "private, must-revalidate" );
7 session_start();
8 session_register( "wsUserID" );
9 session_register( "wsUserName" );
10 session_register( "wsUserPassword" );
12 global $IP;
13 include_once( "./LocalSettings.php" );
14 include_once( "$IP/Setup.php" );
16 wfProfileIn( "main-misc-setup" );
17 OutputPage::setEncodings(); # Not really used yet
19 # Query string fields
21 global $action, $title, $search, $go, $target, $printable;
22 global $returnto, $diff, $oldid;
24 $action = strtolower( trim( $action ) );
25 if ( "" == $action ) { $action = "view"; }
26 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
28 if ( "" == $title && "delete" != $action ) {
29         $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
30 } else {
31         $wgTitle = Title::newFromURL( $title );
32 #       if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
33         if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
34                 $wgOut->errorpage( "badtitle", "badtitletext" );
35                 $wgOut->output();
36                 exit;
37         }
39 wfProfileOut();
40 if ( -1 == $wgTitle->getNamespace() ) {
41         wfSpecialPage();
42 } else if ( "" != $search ) {
43         if($go) {
44         
45                 wfGo ($search);
46         
47         } else {
48         
49                 wfSearch( $search );
50                 
51         }
52                 
53 } else {
54         $wgArticle = new Article();
56         switch( $action ) {
57                 case "view":
58                 case "watch":
59                 case "unwatch":
60                 case "history":
61                 case "delete":
62                 case "revert":
63                 case "rollback":
64                 case "protect":
65                 case "unprotect":
66                         $wgArticle->$action();
67                         break;
68                 case "print":
69                         $wgArticle->view();
70                         break;
71                 case "edit":
72                 case "submit":
73                         include_once( "$IP/EditPage.php" );
74                         $editor = new EditPage( $wgArticle );
75                         $editor->$action();
76                         break;
77                 default:
78                         $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
79         }
82 $wgOut->output();
83 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }