if (!isset($install_script) || !$install_script) { die($mod_strings['ERR_NO_DIRECT_SCRIPT']); } // DB split $createDbCheckbox = ''; $createDb = !empty($_SESSION['setup_db_create_database']) ? 'checked="checked"' : ''; $dropCreate = !empty($_SESSION['setup_db_drop_tables']) ? 'checked="checked"' : ''; $instanceName = ''; if (isset($_SESSION['setup_db_host_instance']) && !empty($_SESSION['setup_db_host_instance'])) { $instanceName = $_SESSION['setup_db_host_instance']; } $setupDbPortNum = ''; if (isset($_SESSION['setup_db_port_num']) && !empty($_SESSION['setup_db_port_num'])) { $setupDbPortNum = $_SESSION['setup_db_port_num']; } $db = getInstallDbInstance(); /////////////////////////////////////////////////////////////////////////////// //// BEGIN PAGE OUTPUT $langHeader = get_language_header(); $out = <<<EOQ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html {$langHeader}> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <meta http-equiv="Content-Style-Type" content="text/css"> <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_DBCONF_TITLE']}</title> <link rel="stylesheet" href="install/install.css" type="text/css" /> <script type="text/javascript" src="install/installCommon.js"></script> <script type="text/javascript" src="install/dbConfig.js"></script> <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">
function getDbConnection() { $dbconfig = array("db_host_name" => $_SESSION['setup_db_host_name'], "db_user_name" => $_SESSION['setup_db_admin_user_name'], "db_password" => $_SESSION['setup_db_admin_password'], "db_host_instance" => $_SESSION['setup_db_host_instance'], "db_port" => $_SESSION['setup_db_port_num']); if (empty($_SESSION['setup_db_create_database'])) { $dbconfig["db_name"] = $_SESSION['setup_db_database_name']; } $db = getInstallDbInstance(); if (!empty($_SESSION['setup_db_options'])) { $db->setOptions($_SESSION['setup_db_options']); } $db->connect($dbconfig, true); return $db; }
function copyInputsIntoSession() { if (isset($_REQUEST['setup_db_type'])) { $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type']; } if (isset($_REQUEST['setup_db_admin_user_name'])) { $_SESSION['setup_db_admin_user_name'] = $_REQUEST['setup_db_admin_user_name']; } if (isset($_REQUEST['setup_db_admin_password'])) { $_SESSION['setup_db_admin_password'] = $_REQUEST['setup_db_admin_password']; } if (isset($_REQUEST['setup_db_database_name'])) { $_SESSION['setup_db_database_name'] = $_REQUEST['setup_db_database_name']; } if (isset($_REQUEST['setup_db_host_name'])) { $_SESSION['setup_db_host_name'] = $_REQUEST['setup_db_host_name']; } //FTS Support $_SESSION['fts_type'] = isset($_REQUEST['fts_type']) ? $_REQUEST['fts_type'] : ""; if (isset($_REQUEST['fts_host'])) { $_SESSION['fts_host'] = $_REQUEST['fts_host']; } if (isset($_REQUEST['fts_port'])) { $_SESSION['fts_port'] = $_REQUEST['fts_port']; } if (isset($_SESSION['setup_db_type']) && (!isset($_SESSION['setup_db_manager']) || isset($_REQUEST['setup_db_type']))) { $_SESSION['setup_db_manager'] = DBManagerFactory::getManagerByType($_SESSION['setup_db_type']); } if (isset($_REQUEST['setup_db_host_instance'])) { $_SESSION['setup_db_host_instance'] = $_REQUEST['setup_db_host_instance']; } if (isset($_REQUEST['setup_db_port_num'])) { $_SESSION['setup_db_port_num'] = $_REQUEST['setup_db_port_num']; } // on a silent install, copy values from $_SESSION into $_REQUEST if (isset($_REQUEST['goto']) && $_REQUEST['goto'] == 'SilentInstall') { if (isset($_SESSION['dbUSRData']) && !empty($_SESSION['dbUSRData'])) { $_REQUEST['dbUSRData'] = $_SESSION['dbUSRData']; } else { $_REQUEST['dbUSRData'] = 'same'; } if (isset($_SESSION['setup_db_sugarsales_user']) && !empty($_SESSION['setup_db_sugarsales_user'])) { $_REQUEST['setup_db_sugarsales_user'] = $_SESSION['setup_db_sugarsales_user']; } else { $_REQUEST['dbUSRData'] = 'same'; } $_REQUEST['setup_db_sugarsales_password'] = $_SESSION['setup_db_sugarsales_password']; $_REQUEST['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password']; } //make sure we are creating or using provided user for app db connections $_SESSION['setup_db_create_sugarsales_user'] = true; //get_boolean_from_request('setup_db_create_sugarsales_user'); $db = getInstallDbInstance(); if (!$db->supports("create_user")) { //if the DB doesn't support creating users, make the admin user/password same as connecting user/password $_SESSION['setup_db_sugarsales_user'] = $_SESSION['setup_db_admin_user_name']; $_SESSION['setup_db_sugarsales_password'] = $_SESSION['setup_db_admin_password']; $_SESSION['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password']; $_SESSION['setup_db_create_sugarsales_user'] = false; $_SESSION['setup_db_create_database'] = false; } else { $_SESSION['setup_db_create_database'] = true; //retrieve the value from dropdown in order to know what settings the user //wants to use for the sugar db user. //use provided db admin by default $_SESSION['dbUSRData'] = 'same'; if (isset($_REQUEST['dbUSRData']) && !empty($_REQUEST['dbUSRData'])) { $_SESSION['dbUSRData'] = $_REQUEST['dbUSRData']; } if ($_SESSION['dbUSRData'] == 'auto') { //create user automatically $_SESSION['setup_db_create_sugarsales_user'] = true; $_SESSION['setup_db_sugarsales_user'] = "******" . create_db_user_creds(5); $_SESSION['setup_db_sugarsales_password'] = create_db_user_creds(10); $_SESSION['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password']; } elseif ($_SESSION['dbUSRData'] == 'provide') { //use provided user info $_SESSION['setup_db_create_sugarsales_user'] = false; $_SESSION['setup_db_sugarsales_user'] = $_REQUEST['setup_db_sugarsales_user']; $_SESSION['setup_db_sugarsales_password'] = $_REQUEST['setup_db_sugarsales_password']; $_SESSION['setup_db_sugarsales_password_retype'] = $_REQUEST['setup_db_sugarsales_password_retype']; } elseif ($_SESSION['dbUSRData'] == 'create') { // create user with provided info $_SESSION['setup_db_create_sugarsales_user'] = true; $_SESSION['setup_db_sugarsales_user'] = $_REQUEST['setup_db_sugarsales_user']; $_SESSION['setup_db_sugarsales_password'] = $_REQUEST['setup_db_sugarsales_password']; $_SESSION['setup_db_sugarsales_password_retype'] = $_REQUEST['setup_db_sugarsales_password_retype']; } else { //Use the same login as provided admin user $_SESSION['setup_db_create_sugarsales_user'] = false; $_SESSION['setup_db_sugarsales_user'] = $_SESSION['setup_db_admin_user_name']; $_SESSION['setup_db_sugarsales_password'] = $_SESSION['setup_db_admin_password']; $_SESSION['setup_db_sugarsales_retype'] = $_SESSION['setup_db_admin_password']; } } if (!isset($_SESSION['demoData']) || empty($_SESSION['demoData'])) { $_SESSION['demoData'] = 'no'; } if (isset($_REQUEST['demoData'])) { $_SESSION['demoData'] = $_REQUEST['demoData']; } if ($db->supports('create_db')) { if (!empty($_SESSION['setup_db_create_database'])) { // if we're dropping DB, no need to drop tables $_SESSION['setup_db_drop_tables'] = false; } } else { // we can't create DB, so can't drop it $_SESSION['setup_db_create_database'] = false; } if (isset($_REQUEST['goto']) && $_REQUEST['goto'] == 'SilentInstall' && isset($_SESSION['setup_db_drop_tables'])) { //set up for Oracle Silent Installer $_REQUEST['setup_db_drop_tables'] = $_SESSION['setup_db_drop_tables']; } }