示例#1
0
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'];
    }
    if (isset($_REQUEST['setup_db_host_instance'])) {
        $_SESSION['setup_db_host_instance'] = $_REQUEST['setup_db_host_instance'];
    }
    // 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');
    if ($_SESSION['setup_db_type'] == 'oci8') {
        //if we are in Oracle Mode, 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 {
        //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 (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'];
    }
    if (isset($_REQUEST['setup_db_drop_tables']) || isset($_REQUEST['goto']) && $_REQUEST['goto'] == 'SilentInstall' && isset($SESSION['setup_db_drop_tables'])) {
        $_SESSION['setup_db_drop_tables'] = true;
        $_SESSION['setup_db_create_database'] = false;
    } else {
        $_SESSION['setup_db_drop_tables'] = false;
        $_SESSION['setup_db_create_database'] = true;
    }
}
示例#2
0
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'];
    }
}