Revision 2098
Added by darkviper over 11 years ago
| index.php | ||
|---|---|---|
| 15 | 15 |
* |
| 16 | 16 |
*/ |
| 17 | 17 |
|
| 18 |
$config_file = realpath('../../config.php');
|
|
| 19 |
if(file_exists($config_file) && !defined('WB_URL'))
|
|
| 20 |
{
|
|
| 21 |
require_once($config_file); |
|
| 18 |
if (!defined('WB_URL')) {
|
|
| 19 |
require_once('../../config.php');
|
|
| 22 | 20 |
} |
| 23 |
|
|
| 24 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
|
|
| 25 |
|
|
| 21 |
$oDb = WbDatabase::getInstance(); |
|
| 22 |
$oTrans = Translate::getInstance(); |
|
| 23 |
$oTrans->enableAddon('admin\\start');
|
|
| 24 |
//$template->set_var($oTrans->getLangArray()); |
|
| 26 | 25 |
$admin = new admin('Start','start');
|
| 27 | 26 |
// --------------------------------------- |
| 28 | 27 |
// $database = WbDatabase::getInstance(); |
| ... | ... | |
| 55 | 54 |
closedir($handle); |
| 56 | 55 |
} |
| 57 | 56 |
} |
| 58 |
$sql = 'DELETE FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'FINALIZE_SETUP\'';
|
|
| 59 |
if($database->query($sql)) { }
|
|
| 57 |
$sql = 'DELETE FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'FINALIZE_SETUP\'';
|
|
| 58 |
$oDb->doQuery($sql);
|
|
| 60 | 59 |
} |
| 61 | 60 |
// --------------------------------------- |
| 62 | 61 |
// check if it is neccessary to start the uograde-script |
| 63 | 62 |
|
| 64 | 63 |
$msg = ''; |
| 65 |
$msg .= (is_readable(WB_PATH.'/install/')) ? $MESSAGE['START_INSTALL_DIR_EXISTS'].'<br />' : $msg;
|
|
| 64 |
$msg .= (is_readable(WB_PATH.'/install/')) ? $oTrans->MESSAGE_START_INSTALL_DIR_EXISTS.'<br />' : $msg;
|
|
| 66 | 65 |
$aReplace =array( |
| 67 | 66 |
'file' => '<a style="font-weight:bold;" href="'.WB_URL.'/upgrade-script.php">upgrade-script.php</a>' |
| 68 | 67 |
); |
| 69 |
$msg .= (is_readable(WB_PATH.'/upgrade-script.php') ? replace_vars($MESSAGE['START_UPGRADE_SCRIPT_EXISTS'].'<br />',$aReplace) : ''); |
|
| 70 |
//$msg .= ''.$MESSAGE['START_UPGRADE_SCRIPT_EXISTS'].'<br />'; |
|
| 68 |
$msg .= (is_readable(WB_PATH.'/upgrade-script.php') ? replace_vars($oTrans->MESSAGE_START_UPGRADE_SCRIPT_EXISTS.'<br />',$aReplace) : ''); |
|
| 71 | 69 |
|
| 72 | 70 |
// --------------------------------------- |
| 73 | 71 |
// check if it is neccessary to start the uograde-script |
| 74 | 72 |
// --------------------------------------- |
| 75 | 73 |
if(($admin->get_user_id()==1) && file_exists(WB_PATH.'/upgrade-script.php')) {
|
| 76 | 74 |
// check if it is neccessary to start the uograde-script |
| 77 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\''; |
|
| 78 |
if($wb_revision=$database->get_one($sql)) {
|
|
| 79 |
} |
|
| 75 |
$sql = 'SELECT `value` FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'wb_revision\''; |
|
| 76 |
$wb_revision = $oDb->getOne($sql); |
|
| 80 | 77 |
if (version_compare($wb_revision, REVISION ) < 0) {
|
| 81 | 78 |
echo "<p style=\"text-align:center;\"> If the <strong>upgrade script</strong> could not be start automatically.\n" . |
| 82 | 79 |
"Please click <a style=\"font-weight:bold;\" " . |
| ... | ... | |
| 105 | 102 |
// --------------------------------------- |
| 106 | 103 |
// workout to upgrade the groups system_permissions |
| 107 | 104 |
// --------------------------------------- |
| 108 |
if( ($admin->get_user_id()==1) && |
|
| 109 |
file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && !defined('GROUPS_UPDATED') )
|
|
| 105 |
if( ($admin->get_user_id()==1) && file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && !defined('GROUPS_UPDATED') )
|
|
| 110 | 106 |
{
|
| 111 | 107 |
// check if it is neccessary to start the uograde-script |
| 112 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\''; |
|
| 113 |
if($wb_revision = $database->get_one($sql)) {
|
|
| 114 |
|
|
| 115 |
} |
|
| 116 |
|
|
| 108 |
$sql = 'SELECT `value` FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'wb_revision\''; |
|
| 109 |
$wb_revision = $database->get_one($sql); |
|
| 117 | 110 |
if ((version_compare($wb_revision, '1800' ) < 0)&& !defined('GROUPS_UPDATED')) {
|
| 118 | 111 |
require_once (ADMIN_PATH.'/groups/upgradePermissions.php'); |
| 119 | 112 |
// build new or changed $sTempPermissions |
| ... | ... | |
| 140 | 133 |
/** |
| 141 | 134 |
* delete Outdated Confirmations |
| 142 | 135 |
*/ |
| 143 |
$sql = 'DELETE FROM `'.TABLE_PREFIX.'users` WHERE `confirm_timeout` BETWEEN 1 AND '.time();
|
|
| 144 |
WbDatabase::getInstance()->query($sql);
|
|
| 136 |
$sql = 'DELETE FROM `'.$oDb-TablePrefix.'users` WHERE `confirm_timeout` BETWEEN 1 AND '.time();
|
|
| 137 |
$oDb->doQuery($sql);
|
|
| 145 | 138 |
|
| 146 | 139 |
/** |
| 147 | 140 |
* delete stored ip adresses default after 60 days |
| 148 | 141 |
*/ |
| 149 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` SET `login_ip` = \'\' WHERE `login_when` < '.(time()-(60*84600));
|
|
| 150 |
WbDatabase::getInstance()->query($sql);
|
|
| 142 |
$sql = 'UPDATE `'.$oDb-TablePrefix.'users` SET `login_ip` = \'\' WHERE `login_when` < '.(time()-(60*84600));
|
|
| 143 |
$oDb->doQuery($sql);
|
|
| 151 | 144 |
|
| 152 | 145 |
// --------------------------------------- |
| 153 | 146 |
// Setup template object, parse vars to it, then parse it |
| ... | ... | |
| 155 | 148 |
$oTpl = new Template(dirname($admin->correct_theme_source('start.htt')),'keep');
|
| 156 | 149 |
$oTpl->set_file('page', 'start.htt');
|
| 157 | 150 |
$oTpl->set_block('page', 'main_block', 'main');
|
| 158 |
|
|
| 151 |
$oTpl->set_var($oTrans->getLangArray()); |
|
| 159 | 152 |
// Insert values into the template object |
| 160 | 153 |
$oTpl->set_var(array( |
| 161 |
'WELCOME_MESSAGE' => $MESSAGE['START_WELCOME_MESSAGE'],
|
|
| 162 |
'CURRENT_USER' => $MESSAGE['START_CURRENT_USER'],
|
|
| 163 |
'DISPLAY_NAME' => $admin->get_display_name(), |
|
| 154 |
'WELCOME_MESSAGE' => $oTrans->MESSAGE_START_WELCOME_MESSAGE,
|
|
| 155 |
'CURRENT_USER' => $oTrans->MESSAGE_START_CURRENT_USER,
|
|
| 156 |
'DISPLAY_NAME' => $admin->get_display_name(),
|
|
| 164 | 157 |
'DISPLAY_WARNING' => '', |
| 165 |
'WARNING' => '', |
|
| 166 |
'ADMIN_URL' => ADMIN_URL, |
|
| 167 |
'WB_URL' => WB_URL, |
|
| 168 |
'THEME_URL' => THEME_URL, |
|
| 169 |
'WB_VERSION' => WB_VERSION, |
|
| 170 |
'NO_CONTENT' => '' |
|
| 158 |
'WARNING' => '',
|
|
| 159 |
'ADMIN_URL' => ADMIN_URL,
|
|
| 160 |
'WB_URL' => WB_URL,
|
|
| 161 |
'THEME_URL' => THEME_URL,
|
|
| 162 |
'WB_VERSION' => WB_VERSION,
|
|
| 163 |
'NO_CONTENT' => ''
|
|
| 171 | 164 |
) |
| 172 | 165 |
); |
| 173 | 166 |
|
| ... | ... | |
| 228 | 221 |
$oTpl->parse('show_preferences', 'show_preferences_block', true);
|
| 229 | 222 |
} |
| 230 | 223 |
|
| 231 |
|
|
| 232 |
/* |
|
| 233 |
if($admin->get_permission('pages') != true)
|
|
| 234 |
{
|
|
| 235 |
$oTpl->set_var('DISPLAY_PAGES', 'display:none;');
|
|
| 236 |
} |
|
| 237 |
if($admin->get_permission('media') != true)
|
|
| 238 |
{
|
|
| 239 |
$oTpl->set_var('DISPLAY_MEDIA', 'display:none;');
|
|
| 240 |
} |
|
| 241 |
if($admin->get_permission('addons') != true)
|
|
| 242 |
{
|
|
| 243 |
$oTpl->set_var('DISPLAY_ADDONS', 'display:none;');
|
|
| 244 |
} |
|
| 245 |
if($admin->get_permission('access') != true)
|
|
| 246 |
{
|
|
| 247 |
$oTpl->set_var('DISPLAY_ACCESS', 'display:none;');
|
|
| 248 |
} |
|
| 249 |
if($admin->get_permission('settings') != true)
|
|
| 250 |
{
|
|
| 251 |
$oTpl->set_var('DISPLAY_SETTINGS', 'display:none;');
|
|
| 252 |
} |
|
| 253 |
if($admin->get_permission('admintools') != true)
|
|
| 254 |
{
|
|
| 255 |
$oTpl->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
|
|
| 256 |
} |
|
| 257 |
*/ |
|
| 258 |
|
|
| 259 |
|
|
| 260 | 224 |
$oTpl->set_block('main_block', 'show_install_block', 'show_install');
|
| 261 | 225 |
if($admin->get_user_id() != 1) |
| 262 | 226 |
{
|
| ... | ... | |
| 280 | 244 |
} |
| 281 | 245 |
|
| 282 | 246 |
// Insert "Add-ons" section overview (pretty complex compared to normal) |
| 283 |
$addons_overview = $TEXT['MANAGE'].' ';
|
|
| 247 |
$addons_overview = $oTrans->TEXT_MANAGE.' ';
|
|
| 284 | 248 |
$addons_count = 0; |
| 285 | 249 |
if($admin->get_permission('modules') == true)
|
| 286 | 250 |
{
|
| 287 |
$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$MENU['MODULES'].'</a>';
|
|
| 251 |
$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$oTrans->MENU_MODULES.'</a>';
|
|
| 288 | 252 |
$addons_count = 1; |
| 289 | 253 |
} |
| 290 | 254 |
if($admin->get_permission('templates') == true)
|
| 291 | 255 |
{
|
| 292 | 256 |
if($addons_count == 1) { $addons_overview .= ', '; }
|
| 293 |
$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$MENU['TEMPLATES'].'</a>';
|
|
| 257 |
$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$oTrans->MENU_TEMPLATES.'</a>';
|
|
| 294 | 258 |
$addons_count = 1; |
| 295 | 259 |
} |
| 296 | 260 |
if($admin->get_permission('languages') == true)
|
| 297 | 261 |
{
|
| 298 | 262 |
if($addons_count == 1) { $addons_overview .= ', '; }
|
| 299 |
$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$MENU['LANGUAGES'].'</a>';
|
|
| 263 |
$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$oTrans->MENU_LANGUAGES.'</a>';
|
|
| 300 | 264 |
} |
| 301 | 265 |
|
| 302 | 266 |
// Insert "Access" section overview (pretty complex compared to normal) |
| 303 |
$access_overview = $TEXT['MANAGE'].' ';
|
|
| 267 |
$access_overview = $oTrans->TEXT_MANAGE.' ';
|
|
| 304 | 268 |
$access_count = 0; |
| 305 | 269 |
if($admin->get_permission('users') == true) {
|
| 306 |
$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$MENU['USERS'].'</a>';
|
|
| 270 |
$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$oTrans->MENU_USERS.'</a>';
|
|
| 307 | 271 |
$access_count = 1; |
| 308 | 272 |
} |
| 309 | 273 |
if($admin->get_permission('groups') == true) {
|
| 310 | 274 |
if($access_count == 1) { $access_overview .= ', '; }
|
| 311 |
$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$MENU['GROUPS'].'</a>';
|
|
| 275 |
$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$oTrans->MENU_GROUPS.'</a>';
|
|
| 312 | 276 |
$access_count = 1; |
| 313 | 277 |
} |
| 314 | 278 |
|
| 315 | 279 |
// Insert section names and descriptions |
| 316 | 280 |
$oTpl->set_var(array( |
| 317 |
'PAGES' => $MENU['PAGES'],
|
|
| 318 |
'MEDIA' => $MENU['MEDIA'],
|
|
| 319 |
'ADDONS' => $MENU['ADDONS'],
|
|
| 320 |
'ACCESS' => $MENU['ACCESS'],
|
|
| 321 |
'PREFERENCES' => $MENU['PREFERENCES'],
|
|
| 322 |
'SETTINGS' => $MENU['SETTINGS'],
|
|
| 323 |
'ADMINTOOLS' => $MENU['ADMINTOOLS'],
|
|
| 324 |
'HOME_OVERVIEW' => $OVERVIEW['START'],
|
|
| 325 |
'PAGES_OVERVIEW' => $OVERVIEW['PAGES'],
|
|
| 326 |
'MEDIA_OVERVIEW' => $OVERVIEW['MEDIA'],
|
|
| 327 |
'ADDONS_OVERVIEW' => $addons_overview, |
|
| 328 |
'ACCESS_OVERVIEW' => $access_overview, |
|
| 329 |
'PREFERENCES_OVERVIEW' => $OVERVIEW['PREFERENCES'],
|
|
| 330 |
'SETTINGS_OVERVIEW' => $OVERVIEW['SETTINGS'],
|
|
| 331 |
'ADMINTOOLS_OVERVIEW' => $OVERVIEW['ADMINTOOLS']
|
|
| 281 |
'PAGES' => $oTrans->MENU_PAGES,
|
|
| 282 |
'MEDIA' => $oTrans->MENU_MEDIA,
|
|
| 283 |
'ADDONS' => $oTrans->MENU_ADDONS,
|
|
| 284 |
'ACCESS' => $oTrans->MENU_ACCESS,
|
|
| 285 |
'PREFERENCES' => $oTrans->MENU_PREFERENCES,
|
|
| 286 |
'SETTINGS' => $oTrans->MENU_SETTINGS,
|
|
| 287 |
'ADMINTOOLS' => $oTrans->MENU_ADMINTOOLS,
|
|
| 288 |
'HOME_OVERVIEW' => $oTrans->OVERVIEW_START,
|
|
| 289 |
'PAGES_OVERVIEW' => $oTrans->OVERVIEW_PAGES,
|
|
| 290 |
'MEDIA_OVERVIEW' => $oTrans->OVERVIEW_MEDIA,
|
|
| 291 |
'ADDONS_OVERVIEW' => $addons_overview,
|
|
| 292 |
'ACCESS_OVERVIEW' => $access_overview,
|
|
| 293 |
'PREFERENCES_OVERVIEW' => $oTrans->OVERVIEW_PREFERENCES,
|
|
| 294 |
'SETTINGS_OVERVIEW' => $oTrans->OVERVIEW_SETTINGS,
|
|
| 295 |
'ADMINTOOLS_OVERVIEW' => $oTrans->OVERVIEW_ADMINTOOLS
|
|
| 332 | 296 |
) |
| 333 | 297 |
); |
| 334 | 298 |
|
Also available in: Unified diff
! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate