$menu_step ) { if( !isset( $menu_step['state'] ) ) { if( !empty( $gBitDbType ) && !isset( $_SESSION['first_install'] ) ) { $pInstallFiles[$key]['state'] = 'complete'; $pInstallFiles[$key]['icon'] = 'icon-ok'; } else { $pInstallFiles[$key]['state'] = 'uncompleted'; $pInstallFiles[$key]['icon'] = 'spacer'; } } } // assign all this work to the template $gBitSmarty->assign( 'step', $pStep ); $gBitSmarty->assign( 'menu_steps', $pInstallFiles ); $gBitSmarty->assign( 'progress', ceil( 100 / ( count( $pInstallFiles ) ) * $done ) ); return $pInstallFiles; } /** * Global flag to indicate we are installing */ define( 'BIT_INSTALL', 'TRUE' ); global $gBitSmarty; // use relative path if no CONFIG_INC path specified - we know we are in installer here... $config_file = empty($_SERVER['CONFIG_INC']) ? '../config/kernel/config_inc.php' : $_SERVER['CONFIG_INC']; // We can't call clean_file_path here even though we would like to. $config_file = strpos($_SERVER["SERVER_SOFTWARE"],"IIS") ? str_replace( "/", "\\", $config_file) : $config_file; // DO THIS FIRST! Before we include any kernel stuff to avoid duplicate defines if( isset( $_REQUEST['submit_db_info'] ) ) { if ( $_REQUEST['db'] == "firebird" || $_REQUEST['db'] == "pdo" && empty( $gBitDbName ) ) { { // Should only be called when creating the datatabse require_once "create_firebird_database.php"; FirebirdCreateDB($_REQUEST['db'] == "pdo" ? "localhost" : $_REQUEST['host'], $_REQUEST['user'], $_REQUEST['pass'], $_REQUEST['name'], $_REQUEST['fbpath']); } } if ( empty( $gBitDbType ) ) { $tmpHost = $_REQUEST['host']; if ($_REQUEST['db'] == 'mssql') { // pull doubled up slashes from config $tmpHost = stripslashes($tmpHost); } require_once 'create_config_inc.php'; $createHash = [ "gBitDbType" => $_REQUEST['db'], "gBitDbHost" => $tmpHost, "gBitDbUser" => $_REQUEST['user'], "gBitDbPassword" => $_REQUEST['pass'], "gBitDbName" => $_REQUEST['name'], "gBitDbCaseSensitivity" => $_REQUEST['dbcase'], "bit_db_prefix" => $_REQUEST['prefix'], "bit_root_url" => $_REQUEST['baseurl'], "auto_bug_submit" => !empty( $_REQUEST['auto_bug_submit'] ) ? 'true' : 'false', "is_live" => !empty( $_REQUEST['is_live'] ) ? 'true' : 'false', ]; create_config( $createHash ); include $config_file; } } require_once '../kernel/includes/setup_inc.php'; use \Bitweaver\Install\BitInstaller; // set some preferences during installation global $gBitInstaller, $gBitSystem, $gBitThemes; $gBitInstaller = new BitInstaller(); // IF DB has not been created yet, then packages will not have been scanned yet. // and even if they have been scanned, then they will only include active packages, // not all packages. So we scan again here including all packages. $gBitSystem->scanPackages( 'bit_setup_inc.php', TRUE, 'all', TRUE, TRUE ); $gBitInstaller->mPackages = $gBitSystem->mPackages; // we need this massive array available during install to work out if bitweaver has already been installed // this array is so massive that it will kill system with too little memory allocated to php $dbTables = $gBitInstaller->verifyInstalledPackages( 'all' ); // set prefs to display help during install $gBitSystem->setConfig( 'site_online_help', 'y' ); $gBitSystem->setConfig( 'site_form_help', 'y' ); $gBitSystem->setConfig( 'site_help_popup', 'n' ); $commands = []; global $failedcommands; $failedcommands = []; global $gBitLanguage; $gBitLanguage->mLanguage = 'en'; // Empty SCRIPT_NAME and incorrect SCRIPT_NAME due to php-cgiwrap - wolff_borg if( empty( $_SERVER['SCRIPT_NAME'] )) { $_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_URL']; } $bit_root_url = empty( $_REQUEST['baseurl'] ) ? substr( $_SERVER['SCRIPT_NAME'], 0, strpos( $_SERVER['SCRIPT_NAME'], 'install/' )) : BIT_ROOT_URL; global $gBitUser; if( !empty( $_POST['signin'] ) ) { $gBitInstaller->login( $_REQUEST['user'], $_REQUEST['pass'] ); } elseif( is_object( $gBitUser ) && !empty( $_COOKIE[$gBitUser->getSiteCookieName()] ) && ( $gBitUser->mUserId = $gBitUser->getUserIdFromCookie( $_COOKIE[$gBitUser->getSiteCookieName()] ))) { $userInfo = $gBitUser->getUserInfo( [ 'user_id' => $gBitUser->mUserId ] ); if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { // User is valid and not due to change pass.. $gBitUser->mInfo = $userInfo; $gBitUser->loadPermissions( TRUE ); } } // if we came from anywhere appart from some installer page, nuke all settings in the _SESSION and set first_install FALSE if( ( !isset( $_SESSION['first_install'] ) || $_SESSION['first_install'] != TRUE ) || ( isset( $_SESSION['upgrade'] ) && $_SESSION['upgrade'] != TRUE ) || !isset( $_SERVER['HTTP_REFERER'] ) || isset( $_SERVER['HTTP_REFERER'] ) && ( ( !strpos( $_SERVER['HTTP_REFERER'],'install/install.php' )) && ( !strpos( $_SERVER['HTTP_REFERER'],'install/upgrade.php' )) && ( !strpos( $_SERVER['HTTP_REFERER'],'install/migrate.php' )) ) ) { if( empty( $gBitUser ) || !$gBitUser->isAdmin() ) { $_SESSION = NULL; } unset( $_SESSION['upgrade'] ); $_SESSION['first_install'] = FALSE; } // this is needed because some pages display some additional information during a first install $gBitSmarty->assign( 'first_install', $_SESSION['first_install'] );