aboutsummaryrefslogtreecommitdiffstats
path: root/wiki.phtml
blob: cd2a88066a9c634cb6e0d825818232a7a9d9d673 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?
# Main wiki script; see design.doc
#
$wgRequestTime = microtime();

session_cache_limiter( "private, must-revalidate" );
session_start();
session_register( "wsUserID" );
session_register( "wsUserName" );
session_register( "wsUserPassword" );
session_register( "wsUploadFiles" );

global $IP;
include_once( "./LocalSettings.php" );
include_once( "$IP/Setup.php" );

wfProfileIn( "main-misc-setup" );
OutputPage::setEncodings(); # Not really used yet

# Useful debug output
wfDebug( "\nStart request\n" );
wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
$headers = getallheaders();
foreach ($headers as $name => $value) {
	wfDebug( "$name: $value\n" );
}

# Query string fields
#
global $action, $title, $search, $go, $target, $printable;
global $returnto, $diff, $oldid;

$action = strtolower( trim( $action ) );
if ( "" == $action ) { $action = "view"; }
if ( "yes" == $printable ) { $wgOut->setPrintable(); }

if ( "" == $title && "delete" != $action ) {
	$wgTitle = Title::newFromText( wfMsg( "mainpage" ) );
} else {
	$wgTitle = Title::newFromURL( $title );
#	if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" or strncmp($wgTitle->getDBkey(),"_",1) == 0 ) {
	if( $wgTitle->getInterwiki() != "" or $wgTitle->getDBkey() == "" ) {
		$wgOut->errorpage( "badtitle", "badtitletext" );
		$wgOut->output();
		exit;
	}
}
wfProfileOut();
if ( -1 == $wgTitle->getNamespace() ) {
	wfSpecialPage();
} else if ( "" != $search ) {
	if($go) {
	
		wfGo ($search);
	
	} else {
	
		wfSearch( $search );
		
	}
		
} else {
	switch( $wgTitle->getNamespace() ) {
	case 6:
		include_once( "$IP/ImagePage.php" );
		$wgArticle = new ImagePage( $wgTitle );
		break;
	default:
		$wgArticle = new Article( $wgTitle );
	}

	switch( $action ) {
		case "view":
		case "watch":
		case "unwatch":
		case "history":
		case "delete":
		case "revert":
		case "rollback":
		case "protect":
		case "unprotect":
			$wgArticle->$action();
			break;
		case "print":
			$wgArticle->view();
			break;
		case "edit":
		case "submit":
			include_once( "$IP/EditPage.php" );
			$editor = new EditPage( $wgArticle );
			$editor->$action();
			break;
		default:
			$wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
	}
}

$wgOut->output();
foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }

?>