1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package start
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2004-2009, Ryan Djurovich
|
8
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9
|
* @link http://www.websitebaker2.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.x
|
12
|
* @requirements PHP 5.2.2 and higher
|
13
|
* @version $Id: index.php 1479 2011-07-25 00:42:10Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/start/index.php $
|
15
|
* @lastmodified $Date: 2011-07-25 02:42:10 +0200 (Mon, 25 Jul 2011) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
require('../../config.php');
|
20
|
require_once(WB_PATH.'/framework/class.admin.php');
|
21
|
$admin = new admin('Start','start');
|
22
|
// ---------------------------------------
|
23
|
if(defined('FINALIZE_SETUP')) {
|
24
|
require_once(WB_PATH.'/framework/functions.php');
|
25
|
$dirs = array( 'modules' => WB_PATH.'/modules/',
|
26
|
'templates' => WB_PATH.'/templates/',
|
27
|
'languages' => WB_PATH.'/languages/'
|
28
|
);
|
29
|
foreach($dirs AS $type => $dir) {
|
30
|
if( ($handle = opendir($dir)) ) {
|
31
|
while(false !== ($file = readdir($handle))) {
|
32
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
|
33
|
// Get addon type
|
34
|
if($type == 'modules') {
|
35
|
load_module($dir.'/'.$file, true);
|
36
|
// Pretty ugly hack to let modules run $admin->set_error
|
37
|
// See dummy class definition admin_dummy above
|
38
|
if(isset($admin->error) && $admin->error != '') {
|
39
|
$admin->print_error($admin->error);
|
40
|
}
|
41
|
} elseif($type == 'templates') {
|
42
|
load_template($dir.'/'.$file);
|
43
|
} elseif($type == 'languages') {
|
44
|
load_language($dir.'/'.$file);
|
45
|
}
|
46
|
}
|
47
|
}
|
48
|
closedir($handle);
|
49
|
}
|
50
|
}
|
51
|
$sql = 'DELETE FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'FINALIZE_SETUP\'';
|
52
|
$database->query($sql);
|
53
|
}
|
54
|
// ---------------------------------------
|
55
|
// Setup template object
|
56
|
$template = new Template(THEME_PATH.'/templates');
|
57
|
$template->set_file('page', 'start.htt');
|
58
|
$template->set_block('page', 'main_block', 'main');
|
59
|
|
60
|
// Insert values into the template object
|
61
|
$template->set_var(array(
|
62
|
'WELCOME_MESSAGE' => $MESSAGE['START']['WELCOME_MESSAGE'],
|
63
|
'CURRENT_USER' => $MESSAGE['START']['CURRENT_USER'],
|
64
|
'DISPLAY_NAME' => $admin->get_display_name(),
|
65
|
'ADMIN_URL' => ADMIN_URL,
|
66
|
'WB_URL' => WB_URL,
|
67
|
'THEME_URL' => THEME_URL,
|
68
|
'WB_VERSION' => WB_VERSION
|
69
|
)
|
70
|
);
|
71
|
|
72
|
// Insert permission values into the template object
|
73
|
if($admin->get_permission('pages') != true)
|
74
|
{
|
75
|
$template->set_var('DISPLAY_PAGES', 'display:none;');
|
76
|
}
|
77
|
if($admin->get_permission('media') != true)
|
78
|
{
|
79
|
$template->set_var('DISPLAY_MEDIA', 'display:none;');
|
80
|
}
|
81
|
if($admin->get_permission('addons') != true)
|
82
|
{
|
83
|
$template->set_var('DISPLAY_ADDONS', 'display:none;');
|
84
|
}
|
85
|
if($admin->get_permission('access') != true)
|
86
|
{
|
87
|
$template->set_var('DISPLAY_ACCESS', 'display:none;');
|
88
|
}
|
89
|
if($admin->get_permission('settings') != true)
|
90
|
{
|
91
|
$template->set_var('DISPLAY_SETTINGS', 'display:none;');
|
92
|
}
|
93
|
if($admin->get_permission('admintools') != true)
|
94
|
{
|
95
|
$template->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
|
96
|
}
|
97
|
|
98
|
$msg = (file_exists(WB_PATH.'/install/')) ? $MESSAGE['START']['INSTALL_DIR_EXISTS'] : '';
|
99
|
$msg .= (file_exists(WB_PATH.'/upgrade-script.php')) ? '<br />'.$MESSAGE['START_UPGRADE_SCRIPT_EXISTS'] : '';
|
100
|
|
101
|
// Check if installation directory still exists
|
102
|
if(file_exists(WB_PATH.'/install/') || file_exists(WB_PATH.'/upgrade-script.php') ) {
|
103
|
// Check if user is part of Adminstrators group
|
104
|
if(in_array(1, $admin->get_groups_id()))
|
105
|
{
|
106
|
$template->set_var('WARNING', $msg );
|
107
|
} else {
|
108
|
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
109
|
}
|
110
|
} else {
|
111
|
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
112
|
}
|
113
|
|
114
|
// Insert "Add-ons" section overview (pretty complex compared to normal)
|
115
|
$addons_overview = $TEXT['MANAGE'].' ';
|
116
|
$addons_count = 0;
|
117
|
if($admin->get_permission('modules') == true)
|
118
|
{
|
119
|
$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$MENU['MODULES'].'</a>';
|
120
|
$addons_count = 1;
|
121
|
}
|
122
|
if($admin->get_permission('templates') == true)
|
123
|
{
|
124
|
if($addons_count == 1) { $addons_overview .= ', '; }
|
125
|
$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$MENU['TEMPLATES'].'</a>';
|
126
|
$addons_count = 1;
|
127
|
}
|
128
|
if($admin->get_permission('languages') == true)
|
129
|
{
|
130
|
if($addons_count == 1) { $addons_overview .= ', '; }
|
131
|
$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$MENU['LANGUAGES'].'</a>';
|
132
|
}
|
133
|
|
134
|
// Insert "Access" section overview (pretty complex compared to normal)
|
135
|
$access_overview = $TEXT['MANAGE'].' ';
|
136
|
$access_count = 0;
|
137
|
if($admin->get_permission('users') == true) {
|
138
|
$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$MENU['USERS'].'</a>';
|
139
|
$access_count = 1;
|
140
|
}
|
141
|
if($admin->get_permission('groups') == true) {
|
142
|
if($access_count == 1) { $access_overview .= ', '; }
|
143
|
$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$MENU['GROUPS'].'</a>';
|
144
|
$access_count = 1;
|
145
|
}
|
146
|
|
147
|
// Insert section names and descriptions
|
148
|
$template->set_var(array(
|
149
|
'PAGES' => $MENU['PAGES'],
|
150
|
'MEDIA' => $MENU['MEDIA'],
|
151
|
'ADDONS' => $MENU['ADDONS'],
|
152
|
'ACCESS' => $MENU['ACCESS'],
|
153
|
'PREFERENCES' => $MENU['PREFERENCES'],
|
154
|
'SETTINGS' => $MENU['SETTINGS'],
|
155
|
'ADMINTOOLS' => $MENU['ADMINTOOLS'],
|
156
|
'HOME_OVERVIEW' => $OVERVIEW['START'],
|
157
|
'PAGES_OVERVIEW' => $OVERVIEW['PAGES'],
|
158
|
'MEDIA_OVERVIEW' => $OVERVIEW['MEDIA'],
|
159
|
'ADDONS_OVERVIEW' => $addons_overview,
|
160
|
'ACCESS_OVERVIEW' => $access_overview,
|
161
|
'PREFERENCES_OVERVIEW' => $OVERVIEW['PREFERENCES'],
|
162
|
'SETTINGS_OVERVIEW' => $OVERVIEW['SETTINGS'],
|
163
|
'ADMINTOOLS_OVERVIEW' => $OVERVIEW['ADMINTOOLS']
|
164
|
)
|
165
|
);
|
166
|
|
167
|
// Parse template object
|
168
|
$template->parse('main', 'main_block', false);
|
169
|
$template->pparse('output', 'page');
|
170
|
|
171
|
// Print admin footer
|
172
|
$admin->print_footer();
|