Revision 1870
Added by Luisehahne over 12 years ago
| save.php | ||
|---|---|---|
| 17 | 17 |
|
| 18 | 18 |
$debug = true; |
| 19 | 19 |
|
| 20 |
include(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php'); |
|
| 21 |
include(dirname(dirname(__FILE__)).'/framework/WbAutoloader.php'); |
|
| 22 |
WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m'));
|
|
| 23 |
|
|
| 20 | 24 |
if (true === $debug) {
|
| 21 | 25 |
ini_set('display_errors', 1);
|
| 22 | 26 |
error_reporting(E_ALL); |
| ... | ... | |
| 31 | 35 |
list($usec,$sec) = explode(' ',microtime());
|
| 32 | 36 |
srand((float)$sec+((float)$usec*100000)); |
| 33 | 37 |
$session_rand = rand(1000,9999); |
| 34 |
if(!class_exists('WbAutoloader', false)) {
|
|
| 35 |
include(dirname(dirname(__FILE__)).'/framework/WbAutoloader.php'); |
|
| 36 |
} |
|
| 37 |
WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m'));
|
|
| 38 | 38 |
|
| 39 | 39 |
// Function to set error |
| 40 | 40 |
function set_error($message, $field_name = '') {
|
| ... | ... | |
| 98 | 98 |
$default_file_mode = '0'.substr(sprintf('%o', fileperms($filename)), -3);
|
| 99 | 99 |
unlink($filename); |
| 100 | 100 |
} else {
|
| 101 |
$default_file_mode = '0777';
|
|
| 101 |
$default_file_mode = '0666';
|
|
| 102 | 102 |
} |
| 103 | 103 |
return $default_file_mode; |
| 104 | 104 |
} |
| ... | ... | |
| 328 | 328 |
define('ADMIN_URL', $wb_url.'/'.ADMIN_DIRECTORY);
|
| 329 | 329 |
|
| 330 | 330 |
// Check if the user has entered a correct path |
| 331 |
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
|
|
| 332 |
set_error('It appears the Absolute path that you entered is incorrect');
|
|
| 333 |
}
|
|
| 331 |
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
|
|
| 332 |
set_error('It appears the Absolute path that you entered is incorrect');
|
|
| 333 |
}
|
|
| 334 | 334 |
$sSqlUrl = DB_TYPE.'://'.DB_USERNAME.':'.DB_PASSWORD.'@'.DB_HOST.'/'.DB_NAME; |
| 335 | 335 |
$database = WbDatabase::getInstance(); |
| 336 | 336 |
$database->doConnect($sSqlUrl); |
| ... | ... | |
| 351 | 351 |
} |
| 352 | 352 |
|
| 353 | 353 |
// core tables only structure |
| 354 |
$sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
|
|
| 355 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
|
|
| 354 |
$sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
|
|
| 355 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
|
|
| 356 | 356 |
|
| 357 | 357 |
require(ADMIN_PATH.'/interface/version.php'); |
| 358 | 358 |
|
| ... | ... | |
| 430 | 430 |
if(!$database->query($insert_admin_group)) { set_error($database->get_error()); }
|
| 431 | 431 |
|
| 432 | 432 |
// Admin user |
| 433 |
$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');";
|
|
| 433 |
$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');";
|
|
| 434 | 434 |
if(!$database->query($insert_admin_user)) { set_error($database->get_error()); }
|
| 435 | 435 |
|
| 436 | 436 |
// Search layout default data |
| 437 |
$sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql';
|
|
| 438 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
|
|
| 437 |
$sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql';
|
|
| 438 |
if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
|
|
| 439 | 439 |
|
| 440 |
require_once(WB_PATH.'/framework/initialize.php'); |
|
| 440 | 441 |
// Include WB functions file |
| 441 | 442 |
require_once(WB_PATH.'/framework/functions.php'); |
| 442 | 443 |
// Re-connect to the database, this time using in-build database class |
| 443 | 444 |
require_once(WB_PATH.'/framework/class.login.php'); |
| 444 |
|
|
| 445 |
require_once(WB_PATH.'/framework/initialize.php'); |
|
| 446 | 445 |
// Include the PclZip class file (thanks to |
| 447 | 446 |
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php'); |
| 448 | 447 |
// Install add-ons |
| ... | ... | |
| 490 | 489 |
set_error($database->get_error()); |
| 491 | 490 |
} |
| 492 | 491 |
|
| 493 |
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) { }
|
|
| 494 |
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) { }
|
|
| 495 |
if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) { }
|
|
| 492 |
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) { }
|
|
| 493 |
if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) { }
|
|
| 494 |
if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) { }
|
|
| 496 | 495 |
|
| 497 | 496 |
// end of if install_tables |
| 498 | 497 |
|
Also available in: Unified diff
! upgrade-script sanitize pages_directory before creating access files