34 |
34 |
* @deprecated
|
35 |
35 |
* @description xyz
|
36 |
36 |
*/
|
|
37 |
if(!class_exists('PasswordHash', false))
|
|
38 |
{
|
|
39 |
include(dirname(__FILE__).'/include/phpass/PasswordHash.php');
|
|
40 |
}
|
37 |
41 |
// Include config file
|
38 |
|
$config_file = realpath('config.php');
|
|
42 |
$config_file = dirname(__FILE__).'/config.php';
|
39 |
43 |
if(file_exists($config_file) && !defined('WB_URL'))
|
40 |
44 |
{
|
41 |
45 |
require($config_file);
|
42 |
|
|
43 |
46 |
}
|
44 |
|
//require_once(WB_PATH.'/framework/class.admin.php');
|
45 |
|
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
|
|
47 |
if(!class_exists('admin', false))
|
|
48 |
{
|
|
49 |
include(WB_PATH.'/framework/class.admin.php');
|
|
50 |
}
|
46 |
51 |
$admin = new admin('Addons', 'modules', false, false);
|
47 |
|
|
48 |
52 |
// solved wrong pages_directory value before creating access files
|
49 |
53 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` '
|
50 |
54 |
. 'WHERE `name`=\'pages_directory\'';
|
... | ... | |
52 |
56 |
$sTmp = trim($sPagesDirectory, '/');
|
53 |
57 |
$sTmp = ($sTmp == '' ? '' : '/'.$sTmp);
|
54 |
58 |
if($sTmp != $sPagesDirectory) {
|
55 |
|
$sql = 'UPDATE `'.TABLE_PREFIX.'settings` '
|
56 |
|
. 'SET `value` = \''.$sTmpDir.'\' '
|
57 |
|
. 'WHERE `name`=\'pages_directory\' ';
|
58 |
|
WbDatabase::getInstance()->query($sql);
|
|
59 |
$sql = 'UPDATE `'.TABLE_PREFIX.'settings` '
|
|
60 |
. 'SET `value` = \''.$sTmpDir.'\' '
|
|
61 |
. 'WHERE `name`=\'pages_directory\' ';
|
|
62 |
WbDatabase::getInstance()->query($sql);
|
59 |
63 |
}
|
60 |
64 |
require_once(WB_PATH.'/framework/functions.php');
|
61 |
65 |
// require_once(WB_PATH.'/framework/Database.php');
|
... | ... | |
330 |
334 |
exit();
|
331 |
335 |
}
|
332 |
336 |
if($admin->get_user_id()!=1){
|
333 |
|
status_msg('<br /><h3>WebsiteBaker upgrading is not possible!<br />Before upgrading to Revision '.REVISION.' you have to login as System-Administrator!</h3>', 'warning', 'div');
|
334 |
|
echo '<br /><br />';
|
|
337 |
status_msg('<br /><h3>WebsiteBaker upgrading is not possible!<br />Before upgrading '
|
|
338 |
.'to Revision '.REVISION.' you have to login as System-Administrator!</h3>',
|
|
339 |
'warning', 'div');
|
|
340 |
echo '<br /><br />';
|
335 |
341 |
// delete remember key of current user from database
|
336 |
|
//if (isset($_SESSION['USER_ID']) && isset($database)) {
|
337 |
|
// $table = TABLE_PREFIX . 'users';
|
338 |
|
// $sql = "UPDATE `$table` SET `remember_key` = '' WHERE `user_id` = '" . (int) $_SESSION['USER_ID'] . "'";
|
339 |
|
// $database->query($sql);
|
340 |
|
//}
|
341 |
|
|
|
342 |
//if (isset($_SESSION['USER_ID']) && isset($database)) {
|
|
343 |
// $table = TABLE_PREFIX . 'users';
|
|
344 |
// $sql = "UPDATE `$table` SET `remember_key` = '' WHERE `user_id` = '" . (int) $_SESSION['USER_ID'] . "'";
|
|
345 |
// $database->query($sql);
|
|
346 |
//}
|
342 |
347 |
// delete remember key cookie if set
|
343 |
|
if (isset($_COOKIE['REMEMBER_KEY']) && !headers_sent() ) {
|
344 |
|
setcookie('REMEMBER_KEY', '', time() - 3600, '/');
|
345 |
|
}
|
346 |
|
|
347 |
|
// delete most critical session variables manually
|
348 |
|
$_SESSION['USER_ID'] = null;
|
349 |
|
$_SESSION['GROUP_ID'] = null;
|
350 |
|
$_SESSION['GROUPS_ID'] = null;
|
351 |
|
$_SESSION['USERNAME'] = null;
|
352 |
|
$_SESSION['PAGE_PERMISSIONS'] = null;
|
353 |
|
$_SESSION['SYSTEM_PERMISSIONS'] = null;
|
354 |
|
// overwrite session array
|
355 |
|
$_SESSION = array();
|
356 |
|
// delete session cookie if set
|
357 |
|
if (isset($_COOKIE[session_name()]) && !headers_sent()) {
|
358 |
|
setcookie(session_name(), '', time() - 42000, '/');
|
359 |
|
}
|
360 |
|
// delete the session itself
|
361 |
|
session_destroy();
|
362 |
|
status_msg('<br /><h3>After login as System-Adminstrator you have to start upgrade-script.php again!</h3>', 'info', 'div');
|
363 |
|
echo '<br /><br />';
|
364 |
|
if(defined('ADMIN_URL')) {
|
365 |
|
echo '<form action="'.ADMIN_URL.'/index.php" method="post">';
|
366 |
|
echo ' <input name="backend_send" type="submit" value="Kick me to the Login" />';
|
367 |
|
echo '</form>';
|
368 |
|
}
|
369 |
|
echo "<br /><br /></div>
|
370 |
|
</div>
|
371 |
|
</div>
|
372 |
|
</body>
|
373 |
|
</html>
|
374 |
|
";
|
|
348 |
if (isset($_COOKIE['REMEMBER_KEY']) && !headers_sent() ) {
|
|
349 |
setcookie('REMEMBER_KEY', '', time() - 3600, '/');
|
|
350 |
}
|
|
351 |
// delete most critical session variables manually
|
|
352 |
$_SESSION['USER_ID'] = null;
|
|
353 |
$_SESSION['GROUP_ID'] = null;
|
|
354 |
$_SESSION['GROUPS_ID'] = null;
|
|
355 |
$_SESSION['USERNAME'] = null;
|
|
356 |
$_SESSION['PAGE_PERMISSIONS'] = null;
|
|
357 |
$_SESSION['SYSTEM_PERMISSIONS'] = null;
|
|
358 |
// overwrite session array
|
|
359 |
$_SESSION = array();
|
|
360 |
// delete session cookie if set
|
|
361 |
if (isset($_COOKIE[session_name()]) && !headers_sent()) {
|
|
362 |
setcookie(session_name(), '', time() - 42000, '/');
|
|
363 |
}
|
|
364 |
// delete the session itself
|
|
365 |
session_destroy();
|
|
366 |
status_msg('<br /><h3>You have to login as System-Adminstrator start '
|
|
367 |
.'upgrade-script.php again!</h3>',
|
|
368 |
'info', 'div');
|
|
369 |
echo '<br /><br />';
|
|
370 |
if(defined('ADMIN_URL')) {
|
|
371 |
echo '<form action="'.ADMIN_URL.'/index.php" method="post">'
|
|
372 |
.' <input name="backend_send" type="submit" value="Kick me to the Login" />'
|
|
373 |
.'</form>';
|
|
374 |
}
|
|
375 |
echo '<br /><br /></div>'
|
|
376 |
.'</div>'
|
|
377 |
.'</div>'
|
|
378 |
.'</body>'
|
|
379 |
.'</html>';
|
375 |
380 |
exit();
|
376 |
381 |
}
|
377 |
382 |
|
... | ... | |
399 |
404 |
<br />
|
400 |
405 |
|
401 |
406 |
<?php
|
402 |
|
status_msg('<strong> Notice:</strong><br />You need to confirm that you have created a manual backup of the '.PAGES_DIRECTORY.'/ directory and the MySQL database before you can proceed.', 'warning', 'div');
|
403 |
|
echo "<br /><br /></div>
|
404 |
|
</div>
|
405 |
|
</div>
|
406 |
|
</body>
|
407 |
|
</html>";
|
|
407 |
status_msg('<strong> Notice:</strong><br />You need to confirm that you have created '
|
|
408 |
.'a manual backup of the '.PAGES_DIRECTORY.'/ directory and the MySQL '
|
|
409 |
.'database before you can proceed.',
|
|
410 |
'warning', 'div');
|
|
411 |
echo '<br /><br /></div>'
|
|
412 |
.'</div>'
|
|
413 |
.'</div>'
|
|
414 |
.'</body>'
|
|
415 |
.'</html>';
|
408 |
416 |
exit();
|
409 |
417 |
}
|
410 |
418 |
|
411 |
419 |
/**********************************************************
|
412 |
420 |
* - check tables coming with WebsiteBaker
|
413 |
421 |
*/
|
414 |
|
$aMissingTables = UpgradeHelper::existsAllTables($aPackage);
|
|
422 |
$aMissingTables = UpgradeHelper::getMissingTables($aPackage);
|
415 |
423 |
if( sizeof($aMissingTables) == 0){
|
416 |
|
echo '<h4 style="margin-left:0;">NOTICE: '.sizeof($aPackage).' total tables included in package are successfully installed into your database `'.$database->DbName.'` '.$OK.'</h4>';
|
|
424 |
echo '<h4 style="margin-left:0;">NOTICE: '.sizeof($aPackage).' total tables '
|
|
425 |
.'included in package are successfully installed into your database `'
|
|
426 |
.$database->DbName.'` '.$OK.'</h4>';
|
417 |
427 |
} else {
|
418 |
428 |
status_msg('<strong>:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
|
419 |
|
echo '<h4>Missing required tables. You can install them in backend->addons->modules.<br />';
|
420 |
|
echo 'Or if you uploaded per FTP install possible by backend->addons->modules->advanced.<br />';
|
421 |
|
echo 'First rename or delete the upgrade-script.php, so the script can\'t start automatically by backend<br />';
|
422 |
|
echo 'After installing missing tables upload and run again upgrade-script.php<br /><br /></h4>';
|
423 |
|
echo '<h4 class="warning">';
|
424 |
|
echo 'Missing required tables.<br /><br />';
|
425 |
|
echo 'TABLE `'.implode('` missing! '.$FAIL.'<br />TABLE `',$aMissingTables).'` missing! '.$FAIL;
|
426 |
|
echo '<br /><br /></h4>';
|
427 |
|
echo '<br /><br />';
|
|
429 |
echo '<h4>Missing required tables. You can install them in backend->addons->modules.<br />'
|
|
430 |
.'Or if you uploaded per FTP install possible by backend->addons->modules->advanced.<br />'
|
|
431 |
.'First rename or delete the upgrade-script.php, so the script can\'t start automatically by backend<br />'
|
|
432 |
.'After installing missing tables upload and run again upgrade-script.php<br /><br /></h4>'
|
|
433 |
.'<h4 class="warning">'
|
|
434 |
.'Missing required tables.<br /><br />'
|
|
435 |
.'TABLE `'.implode('` missing! '.$FAIL.'<br />TABLE `',$aMissingTables).'` missing! '.$FAIL
|
|
436 |
.'<br /><br /></h4>'
|
|
437 |
.'<br /><br />';
|
428 |
438 |
if(isset($_SERVER['SCRIPT_NAME'])) {
|
429 |
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">';
|
430 |
|
echo ' <input type="submit" value="Start upgrade again" />';
|
431 |
|
echo '</form>';
|
|
439 |
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">'
|
|
440 |
.' <input type="submit" value="Start upgrade again" />'
|
|
441 |
.'</form>';
|
432 |
442 |
}
|
433 |
443 |
if(defined('ADMIN_URL')) {
|
434 |
|
echo '<form action="'.ADMIN_URL.'/index.php" method="post">';
|
435 |
|
echo ' <input name="backend_send" type="submit" value="kick me to the Backend" />';
|
436 |
|
echo '</form>';
|
|
444 |
echo '<form action="'.ADMIN_URL.'/index.php" method="post">'
|
|
445 |
.' <input name="backend_send" type="submit" value="kick me to the Backend" />'
|
|
446 |
.'</form>';
|
437 |
447 |
}
|
438 |
|
echo "<br /><br /></div>
|
439 |
|
</div>
|
440 |
|
</div>
|
441 |
|
</body>
|
442 |
|
</html>";
|
443 |
|
|
|
448 |
echo '<br /><br /></div>'
|
|
449 |
.'</div>'
|
|
450 |
.'</div>'
|
|
451 |
.'</body>'
|
|
452 |
.'</html>';
|
444 |
453 |
exit();
|
445 |
454 |
}
|
446 |
455 |
|
447 |
|
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
|
448 |
|
$aDebugMessage = array();
|
|
456 |
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
|
|
457 |
$aDebugMessage = array();
|
449 |
458 |
/**********************************************************
|
450 |
459 |
* - Adding field default_theme to settings table
|
451 |
460 |
*/
|
... | ... | |
458 |
467 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
459 |
468 |
$aDebugMessage[] = '</div>';
|
460 |
469 |
|
461 |
|
if($bDebugModus) {
|
462 |
|
echo implode(PHP_EOL,$aDebugMessage);
|
463 |
|
}
|
464 |
|
$aDebugMessage = array();
|
465 |
|
echo'<h3>Step '.(++$stepID).': Updating core table included in package</h3>';
|
|
470 |
if($bDebugModus) {
|
|
471 |
echo implode(PHP_EOL,$aDebugMessage);
|
|
472 |
}
|
|
473 |
$aDebugMessage = array();
|
|
474 |
echo'<h3>Step '.(++$stepID).': Updating core table included in package</h3>';
|
466 |
475 |
/**********************************************************
|
467 |
476 |
* - Adding field sec_anchor to settings table
|
468 |
477 |
*/
|
added framework/UpgradeHelper::getMissingTables()
added alias framework/UpgradeHelper::getMissingTables() with existsAllTables()
added upgrade-script.php add loading class PasswordHash
update some corrections of typos in upgrade-sript.php