Autoblocker privacy protection
[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 # 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" );
25 }
26
27 # Query string fields
28 #
29 global $action, $title, $search, $go, $target, $printable;
30 global $returnto, $diff, $oldid;
31
32 $action = strtolower( trim( $action ) );
33 if ( "" == $action ) { $action = "view"; }
34 if ( "yes" == $printable ) { $wgOut->setPrintable(); }
35
36 if ( "" == $title && "delete" != $action ) {
37 $wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
38 } else {
39 $wgTitle = Title::newFromURL( $title );
40 # if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
41 if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
42 $wgOut->errorpage( "badtitle", "badtitletext" );
43 $wgOut->output();
44 exit;
45 }
46 }
47 wfProfileOut();
48 if ( -1 == $wgTitle->getNamespace() ) {
49 wfSpecialPage();
50 } else if ( "" != $search ) {
51 if($go) {
52
53 wfGo ($search);
54
55 } else {
56
57 wfSearch( $search );
58
59 }
60
61 } else {
62 switch( $wgTitle->getNamespace() ) {
63 case 6:
64 include_once( "$IP/ImagePage.php" );
65 $wgArticle = new ImagePage( $wgTitle );
66 break;
67 default:
68 $wgArticle = new Article( $wgTitle );
69 }
70
71 switch( $action ) {
72 case "view":
73 case "watch":
74 case "unwatch":
75 case "history":
76 case "delete":
77 case "revert":
78 case "rollback":
79 case "protect":
80 case "unprotect":
81 $wgArticle->$action();
82 break;
83 case "print":
84 $wgArticle->view();
85 break;
86 case "edit":
87 case "submit":
88 include_once( "$IP/EditPage.php" );
89 $editor = new EditPage( $wgArticle );
90 $editor->$action();
91 break;
92 default:
93 $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
94 }
95 }
96
97 $wgOut->output();
98 foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
99
100 ?>