コード例 #1
0
ファイル: install_utils.php プロジェクト: klr2003/sourceread
/**
 * takes session vars and creates config.php
 * @return array bottle collection of error messages
 */
function handleSugarConfig()
{
    global $bottle;
    global $cache_dir;
    global $mod_strings;
    global $setup_db_host_name;
    global $setup_db_host_instance;
    global $setup_db_sugarsales_user;
    global $setup_db_sugarsales_password;
    global $setup_db_database_name;
    global $setup_site_host_name;
    global $setup_site_log_dir;
    global $setup_site_log_file;
    global $setup_site_session_path;
    global $setup_site_guid;
    global $setup_site_url;
    global $setup_sugar_version;
    global $sugar_config;
    global $setup_site_log_level;
    echo "<b>{$mod_strings['LBL_PERFORM_CONFIG_PHP']} (config.php)</b><br>";
    ///////////////////////////////////////////////////////////////////////////////
    ////    $sugar_config SETTINGS
    if (is_file('config.php')) {
        $is_writable = is_writable('config.php');
        // require is needed here (config.php is sometimes require'd from install.php)
        require 'config.php';
    } else {
        $is_writable = is_writable('.');
    }
    // build default sugar_config and merge with new values
    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
    // always lock the installer
    $sugar_config['installer_locked'] = true;
    // we're setting these since the user was given a fair chance to change them
    $sugar_config['dbconfig']['db_host_name'] = $setup_db_host_name;
    $sugar_config['dbconfig']['db_host_instance'] = $setup_db_host_instance;
    $sugar_config['dbconfig']['db_user_name'] = $setup_db_sugarsales_user;
    $sugar_config['dbconfig']['db_password'] = $setup_db_sugarsales_password;
    $sugar_config['dbconfig']['db_name'] = $setup_db_database_name;
    $sugar_config['dbconfig']['db_type'] = $_SESSION['setup_db_type'];
    if (isset($_SESSION['setup_db_port_num'])) {
        $sugar_config['dbconfig']['db_port'] = $_SESSION['setup_db_port_num'];
    }
    $sugar_config['cache_dir'] = $cache_dir;
    $sugar_config['default_charset'] = $mod_strings['DEFAULT_CHARSET'];
    $sugar_config['default_email_client'] = 'sugar';
    $sugar_config['default_email_editor'] = 'html';
    $sugar_config['host_name'] = $setup_site_host_name;
    $sugar_config['import_dir'] = $cache_dir . 'import/';
    $sugar_config['js_custom_version'] = '';
    $sugar_config['log_dir'] = $setup_site_log_dir;
    $sugar_config['log_file'] = $setup_site_log_file;
    /*nsingh(bug 22402): Consolidate logger settings under $config['logger'] as liked by the new logger! If log4pphp exists,
    		these settings will be overwritten by those in log4php.properties when the user access admin->system settings.*/
    $sugar_config['logger'] = array('level' => $setup_site_log_level, 'file' => array('ext' => '.log', 'name' => 'sugarcrm', 'dateFormat' => '%c', 'maxSize' => '10MB', 'maxLogs' => 10, 'suffix' => '%m_%Y'));
    $sugar_config['session_dir'] = $setup_site_session_path;
    $sugar_config['site_url'] = $setup_site_url;
    $sugar_config['sugar_version'] = $setup_sugar_version;
    $sugar_config['tmp_dir'] = $cache_dir . 'xml/';
    $sugar_config['upload_dir'] = $cache_dir . 'upload/';
    $sugar_config['use_php_code_json'] = returnPhpJsonStatus();
    // true on error
    if (isset($_SESSION['setup_site_sugarbeet_anonymous_stats'])) {
        $sugar_config['sugarbeet'] = $_SESSION['setup_site_sugarbeet_anonymous_stats'];
    }
    $sugar_config['demoData'] = $_SESSION['demoData'];
    if (isset($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = $setup_site_guid;
    }
    if (empty($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = md5(create_guid());
    }
    // add installed langs to config
    // entry in upgrade_history comes AFTER table creation
    if (isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) {
        foreach ($_SESSION['INSTALLED_LANG_PACKS'] as $langZip) {
            $lang = getSugarConfigLanguageArray($langZip);
            if (!empty($lang)) {
                $exLang = explode('::', $lang);
                if (is_array($exLang) && count($exLang) == 3) {
                    $sugar_config['languages'][$exLang[0]] = $exLang[1];
                }
            }
        }
    }
    // handle localization defaults
    $sugar_config['default_date_format'] = $_SESSION["default_date_format"];
    $sugar_config['default_time_format'] = $_SESSION["default_time_format"];
    $sugar_config['default_language'] = $_SESSION["default_language"];
    $sugar_config['default_locale_name_format'] = $_SESSION["default_locale_name_format"];
    $sugar_config['default_email_charset'] = $_SESSION["default_email_charset"];
    $sugar_config['default_export_charset'] = $_SESSION["default_export_charset"];
    $sugar_config['export_delimiter'] = $_SESSION["export_delimiter"];
    $sugar_config['default_currency_name'] = $_SESSION["default_currency_name"];
    $sugar_config['default_currency_symbol'] = $_SESSION["default_currency_symbol"];
    $sugar_config['default_currency_iso4217'] = $_SESSION["default_currency_iso4217"];
    $sugar_config['default_currency_significant_digits'] = $_SESSION["default_currency_significant_digits"];
    $sugar_config['default_number_grouping_seperator'] = $_SESSION["default_number_grouping_seperator"];
    $sugar_config['default_decimal_seperator'] = $_SESSION["default_decimal_seperator"];
    ksort($sugar_config);
    $sugar_config_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . '$sugar_config = ' . var_export($sugar_config, true) . ";\n?>\n";
    if ($is_writable && write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        // was 'Done'
    } else {
        echo 'failed<br>';
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_1']}</p>\n";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_2']}</p>\n";
        echo "<TEXTAREA  rows=\"15\" cols=\"80\">" . $sugar_config_string . "</TEXTAREA>";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_3']}</p>";
        $bottle[] = $mod_strings['ERR_PERFORM_CONFIG_PHP_4'];
    }
    ////    END $sugar_config
    ///////////////////////////////////////////////////////////////////////////////
    return $bottle;
}
コード例 #2
0
ファイル: utils.php プロジェクト: aldridged/gtg-sugar
function get_sugar_config_defaults()
{
    global $locale;
    /**
     * used for getting base values for array style config.php.  used by the
     * installer and to fill in new entries on upgrades.  see also:
     * sugar_config_union
     */
    $sugar_config_defaults = array('admin_export_only' => false, 'export_delimiter' => ',', 'cache_dir' => 'cache/', 'calculate_response_time' => true, 'create_default_user' => false, 'date_formats' => array('Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010', 'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010', 'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010'), 'dbconfigoption' => array('persistent' => true, 'autofree' => false, 'debug' => 0, 'seqname_format' => '%s_seq', 'portability' => 0, 'ssl' => false), 'default_action' => 'index', 'default_charset' => return_session_value_or_default('default_charset', 'UTF-8'), 'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'), 'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'), 'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'), 'default_currency_significant_digits' => return_session_value_or_default('default_currency_significant_digits', 2), 'default_number_grouping_seperator' => return_session_value_or_default('default_number_grouping_seperator', ','), 'default_decimal_seperator' => return_session_value_or_default('default_decimal_seperator', '.'), 'default_date_format' => 'm/d/Y', 'default_export_charset' => 'UTF-8', 'default_language' => return_session_value_or_default('default_language', 'en_us'), 'default_module' => 'Home', 'default_password' => '', 'default_permissions' => array('dir_mode' => 02770, 'file_mode' => 0660, 'user' => '', 'group' => ''), 'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar5'), 'default_time_format' => 'h:ia', 'default_user_is_admin' => false, 'default_user_name' => '', 'disable_export' => false, 'disable_persistent_connections' => return_session_value_or_default('disable_persistent_connections', 'false'), 'display_email_template_variable_chooser' => false, 'display_inbound_email_buttons' => false, 'dump_slow_queries' => false, 'email_default_editor' => 'html', 'email_default_client' => 'sugar', 'email_default_delete_attachments' => true, 'history_max_viewed' => 50, 'installer_locked' => true, 'import_max_records_per_file' => 100, 'languages' => array('en_us' => 'English (US)'), 'large_scale_test' => false, 'list_max_entries_per_page' => 20, 'list_max_entries_per_subpanel' => 10, 'lock_default_user_name' => false, 'log_memory_usage' => false, 'portal_view' => 'single_user', 'resource_management' => array('special_query_limit' => 50000, 'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'), 'default_limit' => 1000), 'require_accounts' => true, 'rss_cache_time' => return_session_value_or_default('rss_cache_time', '10800'), 'save_query' => 'all', 'showDetailData' => true, 'showThemePicker' => true, 'slow_query_time_msec' => '100', 'sugarbeet' => true, 'time_formats' => array('H:i' => '23:00', 'h:ia' => '11:00pm', 'h:iA' => '11:00PM', 'H.i' => '23.00', 'h.ia' => '11.00pm', 'h.iA' => '11.00PM'), 'tracker_max_display_length' => 15, 'translation_string_prefix' => return_session_value_or_default('translation_string_prefix', false), 'upload_badext' => array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm'), 'upload_maxsize' => 3000000, 'import_max_execution_time' => 3600, 'use_php_code_json' => returnPhpJsonStatus(), 'verify_client_ip' => true, 'js_custom_version' => '', 'js_lang_version' => 1, 'default_number_grouping_seperator' => ',', 'default_decimal_seperator' => '.', 'lock_homepage' => false, 'lock_subpanels' => false, 'max_dashlets_homepage' => '15', 'default_max_tabs' => '7', 'dashlet_display_row_options' => array('1', '3', '5', '10'), 'default_subpanel_tabs' => true, 'default_subpanel_links' => false, 'default_swap_last_viewed' => false, 'default_swap_shortcuts' => false, 'default_navigation_paradigm' => 'gm', 'admin_access_control' => false, 'use_common_ml_dir' => false, 'common_ml_dir' => '', 'vcal_time' => '2', 'passwordsetting' => empty($passwordsetting) ? array('SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '') : $passwordsetting, 'use_real_names' => true);
    if (!is_object($locale)) {
        $locale = new Localization();
    }
    $sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
    $sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
    return $sugar_config_defaults;
}
コード例 #3
0
function get_sugar_config_defaults()
{
    global $locale;
    /**
     * used for getting base values for array style config.php.  used by the
     * installer and to fill in new entries on upgrades.  see also:
     * sugar_config_union
     */
    $sugar_config_defaults = array('admin_export_only' => false, 'export_delimiter' => ',', 'calculate_response_time' => true, 'create_default_user' => false, 'date_formats' => array('Y-m-d' => '2006-12-23', 'm-d-Y' => '12-23-2006', 'd-m-Y' => '23-12-2006', 'Y/m/d' => '2006/12/23', 'm/d/Y' => '12/23/2006', 'd/m/Y' => '23/12/2006', 'Y.m.d' => '2006.12.23', 'd.m.Y' => '23.12.2006', 'm.d.Y' => '12.23.2006'), 'dbconfigoption' => array('persistent' => true, 'autofree' => false, 'debug' => 0, 'seqname_format' => '%s_seq', 'portability' => 0, 'ssl' => false), 'default_action' => 'index', 'default_charset' => return_session_value_or_default('default_charset', 'UTF-8'), 'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'), 'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'), 'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'), 'default_date_format' => 'Y-m-d', 'default_language' => return_session_value_or_default('default_language', 'en_us'), 'default_module' => 'Home', 'default_password' => '', 'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar'), 'default_time_format' => 'H:i', 'default_user_is_admin' => false, 'default_user_name' => '', 'disable_export' => false, 'disable_persistent_connections' => return_session_value_or_default('disable_persistent_connections', 'false'), 'display_email_template_variable_chooser' => false, 'display_inbound_email_buttons' => false, 'dump_slow_queries' => false, 'history_max_viewed' => 10, 'installer_locked' => true, 'languages' => array('en_us' => 'US English'), 'large_scale_test' => false, 'list_max_entries_per_page' => 20, 'list_max_entries_per_subpanel' => 10, 'lock_default_user_name' => false, 'log_memory_usage' => false, 'login_nav' => false, 'require_accounts' => true, 'rss_cache_time' => return_session_value_or_default('rss_cache_time', '10800'), 'save_query' => 'all', 'slow_query_time_msec' => '100', 'sugarbeet' => true, 'time_formats' => array('H:i' => '23:00', 'h:ia' => '11:00pm', 'h:iA' => '11:00PM', 'H.i' => '23.00', 'h.ia' => '11.00pm', 'h.iA' => '11.00PM'), 'translation_string_prefix' => return_session_value_or_default('translation_string_prefix', false), 'upload_badext' => array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm'), 'upload_maxsize' => 3000000, 'import_max_execution_time' => 3600, 'use_php_code_json' => returnPhpJsonStatus(), 'verify_client_ip' => true, 'js_custom_version' => '', 'js_lang_version' => 1, 'default_number_grouping_seperator' => ',', 'default_decimal_seperator' => '.', 'lock_homepage' => false, 'lock_subpanels' => false, 'max_dashlets_homepage' => '15', 'default_max_tabs' => '12', 'default_max_subtabs' => '12', 'dashlet_display_row_options' => array('1', '3', '5', '10'), 'default_subpanel_tabs' => true, 'default_subpanel_links' => false, 'default_swap_last_viewed' => false, 'default_swap_shortcuts' => false, 'default_navigation_paradigm' => 'm');
    if (!is_object($locale)) {
        if (!class_exists('Localization')) {
            require_once 'include/Localization/Localization.php';
        }
        $locale = new Localization();
    }
    $sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
    $sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
    return $sugar_config_defaults;
}
コード例 #4
0
if (function_exists('mb_strlen')) {
    $mbstringStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</font></b>";
} else {
    $mbstringStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_MBSTRING']}</font></b>";
    $error_found = true;
}
// zlib
if (function_exists('gzclose')) {
    $zlibStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
    $zlibStatus = "<b><span class=go>{$mod_strings['ERR_CHECKSYS_ZLIB']}</span></b>";
}
// php-json
if (function_exists('json_encode')) {
    $jsonPhpStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
    if (returnPhpJsonStatus()) {
        $phpInfo = getPhpInfo(8);
        $jsonPhpStatus = "<b><span class='go'>{$mod_strings['ERR_CHECKSYS_PHP_JSON_VERSION']}<br>" . $mod_strings['LBL_CHECKSYS_VER'] . $phpInfo['json']['json version'] . " )</span></b>";
    }
} else {
    $jsonPhpStatus = "<b><span class='go'>{$mod_strings['ERR_CHECKSYS_PHP_JSON']}</span></b>";
}
// imap
if (function_exists('imap_open')) {
    $imapStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
    $imapStatus = "<b><span class=go>{$mod_strings['ERR_CHECKSYS_IMAP']}</span></b>";
}
// config.php
if (make_writable('./config.php')) {
    $configStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";