98895a2c16499626965a51a569b9fa78465e44e0
[lhc/web/wiklou.git] / wiki.phtml
1 <?
2 # Main wiki script; see design.doc
3 #
4 $wgRequestTime = microtime();
5
6 session_cache_limiter( "private, must-revalidate" );
7 session_start();
8 session_register( "wsUserID" );
9 session_register( "wsUserName" );
10 session_register( "wsUserPassword" );
11
12 global $IP;
13 include_once( "./LocalSettings.php" );
14 include_once( "$IP/Setup.php" );
15
16 wfProfileIn( "main-misc-setup" );
17 OutputPage::setEncodings(); # Not really used yet
18
19 # Query string fields
20 #
21 global $action, $title, $search, $go, $target, $printable;
22 global $returnto, $diff, $oldid;
23
24 $action = strtolower( trim( $action ) );
25 if ( "" == $action ) { $action = "view"; }
26 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
27
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 }
38 }
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();
55
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 }
80 }
81
82 $wgOut->output();
83 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
84
85 ?>