aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/admin/index.php
blob: 466e803895e8641f25c18f2ae45c2568d3c7b5aa (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/***************************************************************************  
 *                                 
 *                            -------------------                         
 *   begin                : Saturday, Feb 13, 2001 
 *   copyright            : (C) 2001 The phpBB Group        
 *   email                : support@phpbb.com                           
 *                                                          
 *   $Id$                                                           
 *                                                            
 * 
 ***************************************************************************/ 


/***************************************************************************  
 *                                                     
 *   This program is free software; you can redistribute it and/or modify    
 *   it under the terms of the GNU General Public License as published by   
 *   the Free Software Foundation; either version 2 of the License, or  
 *   (at your option) any later version.                      
 *                                                          
 * 
 ***************************************************************************/ 

$phpbb_root_path = "./../";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
// 
// End session management
//

//
// Is user logged in? If yes are they an admin?
//
if( !$userdata['session_logged_in'] )
{
	header("Location: ../login.$phpEx?forward_page=/admin/");
}
else if( $userdata['user_level'] != ADMIN )
{
	message_die(GENERAL_MESSAGE, "You are not authorised to administer this board");
}

//
// Generate relevant output
//
if( $HTTP_GET_VARS['pane'] == 'top' )
{

	$template_header = "admin/overall_header.tpl";
	include('page_header_admin.'.$phpEx);

}
elseif( $HTTP_GET_VARS['pane'] == 'left' )
{
	$dir = opendir(".");

	$setmodules = 1;
	while($file = readdir($dir))
	{
		if(preg_match("/^admin_.*/", $file))
		{
			include($file);
		}
	}

	$template_header = "admin/page_header.tpl";
	include('page_header_admin.'.$phpEx);

	$template->set_filenames(array(
		"body" => "admin/navigate.tpl")
	);
	
	while( list($cat, $action_array) = each($module) )
	{
		$template->assign_block_vars("catrow", array(
			"CATNAME" => $cat)
		);
		while( list($action, $file)	= each($action_array) )
		{
			$template->assign_block_vars("catrow.actionrow", array(
				"ACTIONNAME" => $action,
				"FILE" => $file)
			);
		}
	}
	//var_dump($module);

	$template->pparse("body");

	$setmodules = 0;
}
elseif( $HTTP_GET_VARS['pane'] == 'right' )
{

	$template_header = "admin/page_header.tpl";
	include('page_header_admin.'.$phpEx);

	include('page_footer_admin.'.$phpEx);

}
else
{ 
	//
	// Generate frameset
	//
	$template->set_filenames(array(
		"body" => "admin/index_frameset.tpl")
	);

	$template->assign_vars(array(
		"S_FRAME_HEADER" => "index.$phpEx?pane=top",
		"S_FRAME_NAV" => "index.$phpEx?pane=left",
		"S_FRAME_MAIN" => "index.$phpEx?pane=right")
	);

	$template->pparse("body");
	
	exit;

}

?>