1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package start
|
6
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.x
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: index.php 1562 2012-01-05 21:35:49Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/start/index.php $
|
14
|
* @lastmodified $Date: 2012-01-05 22:35:49 +0100 (Thu, 05 Jan 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
require('../../config.php');
|
19
|
require_once(WB_PATH.'/framework/class.admin.php');
|
20
|
$admin = new admin('Start','start');
|
21
|
// ---------------------------------------
|
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
|
if($database->query($sql)) { }
|
53
|
}
|
54
|
// ---------------------------------------
|
55
|
$msg = '';
|
56
|
// check if it is neccessary to start the uograde-script
|
57
|
if(($admin->get_user_id()==1) && file_exists(WB_PATH.'/upgrade-script.php')) {
|
58
|
// check if it is neccessary to start the uograde-script
|
59
|
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\'';
|
60
|
if($wb_revision=$database->get_one($sql)) {
|
61
|
if (version_compare($wb_revision, REVISION ) < 0) {
|
62
|
if(!headers_sent()) {
|
63
|
header('Location: '.WB_URL.'/upgrade-script.php');
|
64
|
exit;
|
65
|
} else {
|
66
|
echo "<p style=\"text-align:center;\"> The <strong>upgrade script</strong> could not be start automatically.\n" .
|
67
|
"Please click <a style=\"font-weight:bold;\" " .
|
68
|
"href=\"".WB_URL."/upgrade-script.php\">on this link</a> to start the script!</p>\n";
|
69
|
exit;
|
70
|
}
|
71
|
} else {
|
72
|
$msg .= (file_exists(WB_PATH.'/upgrade-script.php') ? '<br />'.$MESSAGE['START_UPGRADE_SCRIPT_EXISTS'] : '');
|
73
|
}
|
74
|
}
|
75
|
}
|
76
|
|
77
|
// Setup template object, parse vars to it, then parse it
|
78
|
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('start.htt'));
|
79
|
// Create new template object
|
80
|
$template = new Template($ThemePath);
|
81
|
$template->set_file('page', 'start.htt');
|
82
|
$template->set_block('page', 'main_block', 'main');
|
83
|
|
84
|
// Insert values into the template object
|
85
|
$template->set_var(array(
|
86
|
'WELCOME_MESSAGE' => $MESSAGE['START']['WELCOME_MESSAGE'],
|
87
|
'CURRENT_USER' => $MESSAGE['START']['CURRENT_USER'],
|
88
|
'DISPLAY_NAME' => $admin->get_display_name(),
|
89
|
'ADMIN_URL' => ADMIN_URL,
|
90
|
'WB_URL' => WB_URL,
|
91
|
'THEME_URL' => THEME_URL,
|
92
|
'WB_VERSION' => WB_VERSION
|
93
|
)
|
94
|
);
|
95
|
|
96
|
// Insert permission values into the template object
|
97
|
if($admin->get_permission('pages') != true)
|
98
|
{
|
99
|
$template->set_var('DISPLAY_PAGES', 'display:none;');
|
100
|
}
|
101
|
if($admin->get_permission('media') != true)
|
102
|
{
|
103
|
$template->set_var('DISPLAY_MEDIA', 'display:none;');
|
104
|
}
|
105
|
if($admin->get_permission('addons') != true)
|
106
|
{
|
107
|
$template->set_var('DISPLAY_ADDONS', 'display:none;');
|
108
|
}
|
109
|
if($admin->get_permission('access') != true)
|
110
|
{
|
111
|
$template->set_var('DISPLAY_ACCESS', 'display:none;');
|
112
|
}
|
113
|
if($admin->get_permission('settings') != true)
|
114
|
{
|
115
|
$template->set_var('DISPLAY_SETTINGS', 'display:none;');
|
116
|
}
|
117
|
if($admin->get_permission('admintools') != true)
|
118
|
{
|
119
|
$template->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
|
120
|
}
|
121
|
|
122
|
$msg .= (file_exists(WB_PATH.'/install/')) ? $MESSAGE['START']['INSTALL_DIR_EXISTS'] : '';
|
123
|
|
124
|
// Check if installation directory still exists
|
125
|
if(file_exists(WB_PATH.'/install/') || file_exists(WB_PATH.'/upgrade-script.php') ) {
|
126
|
// Check if user is part of Adminstrators group
|
127
|
if(in_array(1, $admin->get_groups_id()))
|
128
|
{
|
129
|
$template->set_var('WARNING', $msg );
|
130
|
} else {
|
131
|
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
132
|
}
|
133
|
} else {
|
134
|
$template->set_var('DISPLAY_WARNING', 'display:none;');
|
135
|
}
|
136
|
|
137
|
// Insert "Add-ons" section overview (pretty complex compared to normal)
|
138
|
$addons_overview = $TEXT['MANAGE'].' ';
|
139
|
$addons_count = 0;
|
140
|
if($admin->get_permission('modules') == true)
|
141
|
{
|
142
|
$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$MENU['MODULES'].'</a>';
|
143
|
$addons_count = 1;
|
144
|
}
|
145
|
if($admin->get_permission('templates') == true)
|
146
|
{
|
147
|
if($addons_count == 1) { $addons_overview .= ', '; }
|
148
|
$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$MENU['TEMPLATES'].'</a>';
|
149
|
$addons_count = 1;
|
150
|
}
|
151
|
if($admin->get_permission('languages') == true)
|
152
|
{
|
153
|
if($addons_count == 1) { $addons_overview .= ', '; }
|
154
|
$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$MENU['LANGUAGES'].'</a>';
|
155
|
}
|
156
|
|
157
|
// Insert "Access" section overview (pretty complex compared to normal)
|
158
|
$access_overview = $TEXT['MANAGE'].' ';
|
159
|
$access_count = 0;
|
160
|
if($admin->get_permission('users') == true) {
|
161
|
$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$MENU['USERS'].'</a>';
|
162
|
$access_count = 1;
|
163
|
}
|
164
|
if($admin->get_permission('groups') == true) {
|
165
|
if($access_count == 1) { $access_overview .= ', '; }
|
166
|
$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$MENU['GROUPS'].'</a>';
|
167
|
$access_count = 1;
|
168
|
}
|
169
|
|
170
|
// Insert section names and descriptions
|
171
|
$template->set_var(array(
|
172
|
'PAGES' => $MENU['PAGES'],
|
173
|
'MEDIA' => $MENU['MEDIA'],
|
174
|
'ADDONS' => $MENU['ADDONS'],
|
175
|
'ACCESS' => $MENU['ACCESS'],
|
176
|
'PREFERENCES' => $MENU['PREFERENCES'],
|
177
|
'SETTINGS' => $MENU['SETTINGS'],
|
178
|
'ADMINTOOLS' => $MENU['ADMINTOOLS'],
|
179
|
'HOME_OVERVIEW' => $OVERVIEW['START'],
|
180
|
'PAGES_OVERVIEW' => $OVERVIEW['PAGES'],
|
181
|
'MEDIA_OVERVIEW' => $OVERVIEW['MEDIA'],
|
182
|
'ADDONS_OVERVIEW' => $addons_overview,
|
183
|
'ACCESS_OVERVIEW' => $access_overview,
|
184
|
'PREFERENCES_OVERVIEW' => $OVERVIEW['PREFERENCES'],
|
185
|
'SETTINGS_OVERVIEW' => $OVERVIEW['SETTINGS'],
|
186
|
'ADMINTOOLS_OVERVIEW' => $OVERVIEW['ADMINTOOLS']
|
187
|
)
|
188
|
);
|
189
|
|
190
|
// Parse template object
|
191
|
$template->parse('main', 'main_block', false);
|
192
|
$template->pparse('output', 'page');
|
193
|
|
194
|
// Print admin footer
|
195
|
$admin->print_footer();
|