コード例 #1
0
ファイル: utils.php プロジェクト: jglaine/sugar761-ent
function make_sugar_config(&$sugar_config)
{
    /* used to convert non-array config.php file to array format */
    global $admin_export_only;
    global $cache_dir;
    global $calculate_response_time;
    global $create_default_user;
    global $dateFormats;
    global $dbconfig;
    global $dbconfigoption;
    global $default_action;
    global $default_charset;
    global $default_currency_name;
    global $default_currency_symbol;
    global $default_currency_iso4217;
    global $defaultDateFormat;
    global $default_language;
    global $default_module;
    global $default_password;
    global $default_permission_mode;
    global $default_theme;
    global $defaultTimeFormat;
    global $default_user_is_admin;
    global $default_user_name;
    global $disable_export;
    global $disable_persistent_connections;
    global $display_email_template_variable_chooser;
    global $display_inbound_email_buttons;
    global $history_max_viewed;
    global $host_name;
    global $import_dir;
    global $languages;
    global $list_max_entries_per_page;
    global $lock_default_user_name;
    global $log_memory_usage;
    global $nameFormats;
    global $requireAccounts;
    global $RSS_CACHE_TIME;
    global $session_dir;
    global $site_URL;
    global $site_url;
    global $sugar_version;
    global $timeFormats;
    global $tmp_dir;
    global $translation_string_prefix;
    global $unique_key;
    global $upload_badext;
    global $upload_dir;
    global $upload_maxsize;
    global $import_max_execution_time;
    global $list_max_entries_per_subpanel;
    global $passwordsetting;
    // assumes the following variables must be set:
    // $dbconfig, $dbconfigoption, $cache_dir,  $session_dir, $site_URL, $upload_dir
    $sugar_config = array('admin_export_only' => empty($admin_export_only) ? false : $admin_export_only, 'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter, 'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir, 'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time, 'create_default_user' => empty($create_default_user) ? false : $create_default_user, 'chartEngine' => 'nvd3', 'date_formats' => empty($dateFormats) ? array('Y-m-d' => '2010-12-23', 'd-m-Y' => '23-12-2010', 'm-d-Y' => '12-23-2010', 'Y/m/d' => '2010/12/23', 'd/m/Y' => '23/12/2010', 'm/d/Y' => '12/23/2010', 'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010') : $dateFormats, 'dbconfig' => $dbconfig, 'dbconfigoption' => $dbconfigoption, 'default_action' => empty($default_action) ? 'index' : $default_action, 'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset, 'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name, 'default_currency_symbol' => empty($default_currency_symbol) ? '$' : $default_currency_symbol, 'default_currency_iso4217' => empty($default_currency_iso4217) ? '$' : $default_currency_iso4217, 'default_date_format' => empty($defaultDateFormat) ? 'm/d/Y' : $defaultDateFormat, 'default_locale_name_format' => empty($defaultNameFormat) ? 's f l' : $defaultNameFormat, 'default_export_charset' => 'UTF-8', 'default_language' => empty($default_language) ? 'en_us' : $default_language, 'default_module' => empty($default_module) ? 'Home' : $default_module, 'default_password' => empty($default_password) ? '' : $default_password, 'default_permissions' => array('dir_mode' => 02770, 'file_mode' => 0660, 'chown' => '', 'chgrp' => ''), 'default_theme' => empty($default_theme) ? 'RacerX' : $default_theme, 'default_time_format' => empty($defaultTimeFormat) ? 'h:ia' : $defaultTimeFormat, 'default_user_is_admin' => empty($default_user_is_admin) ? false : $default_user_is_admin, 'default_user_name' => empty($default_user_name) ? '' : $default_user_name, 'disable_export' => empty($disable_export) ? false : $disable_export, 'display_email_template_variable_chooser' => empty($display_email_template_variable_chooser) ? false : $display_email_template_variable_chooser, 'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons, 'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed, 'host_name' => empty($host_name) ? 'localhost' : $host_name, 'import_dir' => $import_dir, 'import_max_records_per_file' => 100, 'import_max_records_total_limit' => '', 'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages, 'list_max_entries_per_page' => empty($list_max_entries_per_page) ? 20 : $list_max_entries_per_page, 'list_max_entries_per_subpanel' => empty($list_max_entries_per_subpanel) ? 5 : $list_max_entries_per_subpanel, 'lock_default_user_name' => empty($lock_default_user_name) ? false : $lock_default_user_name, 'log_memory_usage' => empty($log_memory_usage) ? false : $log_memory_usage, 'name_formats' => empty($nameFormats) ? array('s f l' => 's f l', 'f l' => 'f l', 's l' => 's l', 'l, s f' => 'l, s f', 'l, f' => 'l, f', 's l, f' => 's l, f', 'l s f' => 'l s f', 'l f s' => 'l f s') : $nameFormats, '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' => empty($requireAccounts) ? true : $requireAccounts, 'rss_cache_time' => empty($RSS_CACHE_TIME) ? '10800' : $RSS_CACHE_TIME, 'session_dir' => $session_dir, 'site_url' => empty($site_URL) ? $site_url : $site_URL, 'showDetailData' => true, 'showThemePicker' => true, 'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version, 'time_formats' => empty($timeFormats) ? array('H:i' => '23:00', 'h:ia' => '11:00 pm', 'h:iA' => '11:00PM', 'H.i' => '23.00', 'h.ia' => '11.00 pm', 'h.iA' => '11.00PM') : $timeFormats, 'tmp_dir' => $tmp_dir, 'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix, 'unique_key' => empty($unique_key) ? get_unique_key() : $unique_key, 'upload_badext' => empty($upload_badext) ? array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm') : $upload_badext, 'upload_dir' => $upload_dir, 'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize, 'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time, 'lock_homepage' => false, 'lock_subpanels' => false, 'collapse_subpanels' => false, 'max_dashlets_homepage' => 15, 'dashlet_display_row_options' => array('1', '3', '5', '10'), 'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs, 'default_subpanel_tabs' => empty($subpanel_tabs) ? true : $subpanel_tabs, 'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links, 'default_swap_last_viewed' => empty($swap_last_viewed) ? false : $swap_last_viewed, 'default_swap_shortcuts' => empty($swap_shortcuts) ? false : $swap_shortcuts, 'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm, 'default_call_status' => 'Planned', 'js_lang_version' => 1, 'passwordsetting' => empty($passwordsetting) ? array('minpwdlength' => '', 'maxpwdlength' => '', 'oneupper' => '', 'onelower' => '', 'onenumber' => '', 'onespecial' => '', 'SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'customregex' => '', 'regexcomment' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'userexpiration' => '0', 'userexpirationtime' => '', 'userexpirationtype' => '1', 'userexpirationlogin' => '', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '', 'lockoutexpiration' => '0', 'lockoutexpirationtime' => '', 'lockoutexpirationtype' => '1', 'lockoutexpirationlogin' => '') : $passwordsetting, 'use_sprites' => function_exists('imagecreatetruecolor'), 'search_wildcard_infront' => false, 'search_wildcard_char' => '%', 'jobs' => array('min_retry_interval' => 60, 'max_retries' => 5, 'timeout' => 3600, 'soft_lifetime' => 7, 'hard_lifetime' => 21), "cron" => array('max_cron_jobs' => 25, 'max_cron_runtime' => 1800, 'min_cron_interval' => 30), 'max_record_fetch_size' => 1000, 'max_record_link_fetch_size' => 5000, 'mass_actions' => array(), 'merge_duplicates' => array('merge_relate_fetch_concurrency' => 2, 'merge_relate_fetch_timeout' => 90000, 'merge_relate_fetch_limit' => 20, 'merge_relate_update_concurrency' => 4, 'merge_relate_update_timeout' => 90000, 'merge_relate_max_attempt' => 3));
}
コード例 #2
0
ファイル: install.php プロジェクト: jglaine/sugar761-ent
     break;
 case 'SilentInstall':
     $si_errors = false;
     pullSilentInstallVarsIntoSession();
     /*
      * Make sure we are using the correct unique_key. The logic
      * to save a custom unique_key happens lower in the process.
      * However because of the initial FTS check we are already
      * relying on this value which will not get reinitialized
      * when we actual need it during index creation because
      * SilentInstaller runs in one single process.
      */
     if (!empty($_SESSION['setup_site_specify_guid']) && !empty($_SESSION['setup_site_guid'])) {
         $sugar_config['unique_key'] = $_SESSION['setup_site_guid'];
     } else {
         $sugar_config['unique_key'] = get_unique_key();
     }
     $validation_errors = validate_dbConfig('a');
     if (count($validation_errors) > 0) {
         $the_file = 'dbConfig_a.php';
         $si_errors = true;
     }
     $validation_errors = validate_siteConfig('a');
     if (count($validation_errors) > 0) {
         $the_file = 'siteConfig_a.php';
         $si_errors = true;
     }
     $validation_errors = validate_siteConfig('b');
     if (count($validation_errors) > 0) {
         $the_file = 'siteConfig_b.php';
         $si_errors = true;
コード例 #3
0
/**
 * 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_port_num;
    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;
    if (!empty($setup_db_host_instance)) {
        $sugar_config['dbconfig']['db_host_instance'] = $setup_db_host_instance;
    } else {
        $sugar_config['dbconfig']['db_host_instance'] = '';
    }
    if (!isset($_SESSION['setup_db_manager'])) {
        $_SESSION['setup_db_manager'] = DBManagerFactory::getManagerByType($_SESSION['setup_db_type']);
    }
    $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'];
    $sugar_config['dbconfig']['db_port'] = $setup_db_port_num;
    $sugar_config['dbconfig']['db_manager'] = $_SESSION['setup_db_manager'];
    if (!empty($_SESSION['setup_db_options'])) {
        $sugar_config['dbconfigoption'] = array_merge($sugar_config['dbconfigoption'], $_SESSION['setup_db_options']);
    }
    $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['js_custom_version'] = '';
    $sugar_config['use_real_names'] = true;
    $sugar_config['disable_convert_lead'] = false;
    $sugar_config['log_dir'] = $setup_site_log_dir;
    $sugar_config['log_file'] = $setup_site_log_file;
    // It is possible to hide the Full Text Search Engine config form
    if (isset($_SESSION['setup_fts_hide_config'])) {
        $sugar_config['hide_full_text_engine_config'] = $_SESSION['setup_fts_hide_config'];
    }
    // Setup FTS settings
    if (!empty($_SESSION['setup_fts_type'])) {
        $sugar_config['full_text_engine'] = array($_SESSION['setup_fts_type'] => getFtsSettings());
    }
    /* 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' => ''));
    $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'] = 'upload/';
    //    $sugar_config['use_php_code_json']              = returnPhpJsonStatus(); // true on error
    $sugar_config['demoData'] = $_SESSION['demoData'];
    if (isset($setup_site_guid)) {
        $sugar_config['unique_key'] = $setup_site_guid;
    }
    if (empty($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = get_unique_key();
    }
    // 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];
                }
            }
        }
    }
    if (file_exists('install/lang.config.php')) {
        include 'install/lang.config.php';
        if (!empty($config['languages'])) {
            foreach ($config['languages'] as $lang => $label) {
                $sugar_config['languages'][$lang] = $label;
            }
        }
    }
    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'];
    }
    //Now merge the config_si.php settings into config.php
    if (file_exists('config.php') && file_exists('config_si.php')) {
        require_once 'modules/UpgradeWizard/uw_utils.php';
        merge_config_si_settings(false, 'config.php', 'config_si.php');
    }
    require_once 'ModuleInstall/ModuleInstaller.php';
    ModuleInstaller::handlePortalConfig();
    ModuleInstaller::handleBaseConfig();
    ////    END $sugar_config
    ///////////////////////////////////////////////////////////////////////////////
    return $bottle;
}