Ejemplo n.º 1
0
 public function testPopulateFromPostConvertsBoolValuesFromStrings()
 {
     $_POST = array('disable_export' => 'true', 'admin_export_only' => 'false', 'upload_dir' => 'yummy');
     $cfg = new Configurator();
     $cfg->populateFromPost();
     $this->assertEquals($cfg->config['disable_export'], true);
     $this->assertEquals($cfg->config['admin_export_only'], false);
     $this->assertEquals($cfg->config['upload_dir'], 'yummy');
     $_POST = array();
 }
Ejemplo n.º 2
0
 function action_saveadminwizard()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $focus = new Administration();
     $focus->retrieveSettings();
     $focus->saveConfig();
     $configurator = new Configurator();
     $configurator->populateFromPost();
     $configurator->handleOverride();
     $configurator->parseLoggerSettings();
     $configurator->saveConfig();
     // Bug 37310 - Delete any existing currency that matches the one we've just set the default to during the admin wizard
     $currency = new Currency();
     $currency->retrieve($currency->retrieve_id_by_name($_REQUEST['default_currency_name']));
     if (!empty($currency->id) && $currency->symbol == $_REQUEST['default_currency_symbol'] && $currency->iso4217 == $_REQUEST['default_currency_iso4217']) {
         $currency->deleted = 1;
         $currency->save();
     }
     SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1');
 }
Ejemplo n.º 3
0
 ********************************************************************************/
/*********************************************************************************
 * Description:
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
 * Reserved. Contributor(s): ______________________________________..
 * *******************************************************************************/
require_once 'modules/Configurator/Configurator.php';
require_once 'include/Sugar_Smarty.php';
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_LOCALE_TITLE'] . ": ", true);
$cfg = new Configurator();
$sugar_smarty = new Sugar_Smarty();
$errors = '';
///////////////////////////////////////////////////////////////////////////////
////	HANDLE CHANGES
if (isset($_REQUEST['process']) && $_REQUEST['process'] == 'true') {
    $cfg->populateFromPost();
    $cfg->handleOverride();
}
///////////////////////////////////////////////////////////////////////////////
////	PAGE OUTPUT
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('LANGUAGES', get_languages());
$sugar_smarty->assign("JAVASCRIPT", get_set_focus_js());
$sugar_smarty->assign('config', $sugar_config);
$sugar_smarty->assign('error', $errors);
//$sugar_smarty->assign('salutation', 'Mr.');
//$sugar_smarty->assign('first_name', 'John');
//$sugar_smarty->assign('last_name', 'Doe');
$sugar_smarty->assign('getNameJs', $locale->getNameJs());
Ejemplo n.º 4
0
//          ---------------------------------------------------------->
installLog('save locale');
//global $current_user;
installLog('new Administration');
$focus = new Administration();
installLog('retrieveSettings');
//$focus->retrieveSettings();
// switch off the adminwizard (mark that we have got past this point)
installLog('AdminWizard OFF');
$focus->saveSetting('system', 'adminwizard', 1);
installLog('saveConfig');
$focus->saveConfig();
installLog('new Configurator');
$configurator = new Configurator();
installLog('populateFromPost');
$configurator->populateFromPost();
installLog('handleOverride');
// add local settings to config overrides
if (!empty($_SESSION['default_date_format'])) {
    $sugar_config['default_date_format'] = $_SESSION['default_date_format'];
}
if (!empty($_SESSION['default_time_format'])) {
    $sugar_config['default_date_format'] = $_SESSION['default_time_format'];
}
if (!empty($_SESSION['default_language'])) {
    $sugar_config['default_language'] = $_SESSION['default_language'];
}
if (!empty($_SESSION['default_locale_name_format'])) {
    $sugar_config['default_locale_name_format'] = $_SESSION['default_locale_name_format'];
}
//$configurator->handleOverride();
Ejemplo n.º 5
0
 function action_saveadminwizard()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $focus = new Administration();
     $focus->retrieveSettings();
     $focus->saveConfig();
     $configurator = new Configurator();
     $configurator->populateFromPost();
     $configurator->handleOverride();
     $configurator->parseLoggerSettings();
     $configurator->saveConfig();
     //The save of the admin wizard stops the post silent install from re-showing the admin wizard on each login
     $postSilentInstallAdminWizardCompleted = $current_user->getPreference('postSilentInstallAdminWizardCompleted');
     if (isset($postSilentInstallAdminWizardCompleted) && !$postSilentInstallAdminWizardCompleted) {
         $current_user->setPreference('postSilentInstallAdminWizardCompleted', true);
     }
     // Bug 37310 - Delete any existing currency that matches the one we've just set the default to during the admin wizard
     $currency = new Currency();
     $currency->retrieve($currency->retrieve_id_by_name($_REQUEST['default_currency_name']));
     if (!empty($currency->id) && $currency->symbol == $_REQUEST['default_currency_symbol'] && $currency->iso4217 == $_REQUEST['default_currency_iso4217']) {
         $currency->deleted = 1;
         $currency->save();
     }
     //Only process the scenario item for admin users!
     if ($current_user->isAdmin()) {
         //Process the scenarios selected in the wizard
         require_once 'install/suite_install/enabledTabs.php';
         //We need to load the tabs so that we can remove those which are scenario based and un-selected
         //Remove the custom tabConfig as this overwrites the complete list containined in the include/tabConfig.php
         if (file_exists('custom/include/tabConfig.php')) {
             unlink('custom/include/tabConfig.php');
         }
         require_once 'include/tabConfig.php';
         //Remove the custom dashlet so that we can use the complete list of defaults to filter by category
         if (file_exists('custom/modules/Home/dashlets.php')) {
             unlink('custom/modules/Home/dashlets.php');
         }
         //Check if the folder is in place
         if (!file_exists('custom/modules/Home')) {
             sugar_mkdir('custom/modules/Home', 0775);
         }
         //Check if the folder is in place
         if (!file_exists('custom/include')) {
             sugar_mkdir('custom/include', 0775);
         }
         require_once 'modules/Home/dashlets.php';
         require_once 'install/suite_install/scenarios.php';
         foreach ($installation_scenarios as $scenario) {
             //If the item is not in $_SESSION['scenarios'], then unset them as they are not required
             if (!in_array($scenario['key'], $_REQUEST['scenarios'])) {
                 foreach ($scenario['modules'] as $module) {
                     if (($removeKey = array_search($module, $enabled_tabs)) !== false) {
                         unset($enabled_tabs[$removeKey]);
                     }
                 }
                 //Loop through the dashlets to remove from the default home page based on this scenario
                 foreach ($scenario['dashlets'] as $dashlet) {
                     //if (($removeKey = array_search($dashlet, $defaultDashlets)) !== false) {
                     //    unset($defaultDashlets[$removeKey]);
                     // }
                     if (isset($defaultDashlets[$dashlet])) {
                         unset($defaultDashlets[$dashlet]);
                     }
                 }
                 //If the scenario has an associated group tab, remove accordingly (by not adding to the custom tabconfig.php
                 if (isset($scenario['groupedTabs'])) {
                     unset($GLOBALS['tabStructure'][$scenario['groupedTabs']]);
                 }
             }
         }
         //Have a 'core' options, with accounts / contacts if no other scenario is selected
         if (!is_null($_SESSION['scenarios'])) {
             unset($GLOBALS['tabStructure']['LBL_TABGROUP_DEFAULT']);
         }
         //Write the tabstructure to custom so that the grouping are not shown for the un-selected scenarios
         $fp = sugar_fopen('custom/include/tabConfig.php', 'w');
         $fileContents = "<?php \n" . '$GLOBALS["tabStructure"] =' . var_export($GLOBALS['tabStructure'], true) . ';';
         fwrite($fp, $fileContents);
         fclose($fp);
         //Write the dashlets to custom so that the dashlets are not shown for the un-selected scenarios
         $fp = sugar_fopen('custom/modules/Home/dashlets.php', 'w');
         $fileContents = "<?php \n" . '$defaultDashlets =' . var_export($defaultDashlets, true) . ';';
         fwrite($fp, $fileContents);
         fclose($fp);
         // End of the scenario implementations
     }
     SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1');
 }
Ejemplo n.º 6
0
 function action_saveadminwizard()
 {
     $focus = new Administration();
     $focus->retrieveSettings();
     $focus->saveConfig();
     $configurator = new Configurator();
     $configurator->populateFromPost();
     $configurator->handleOverride();
     $configurator->parseLoggerSettings();
     $configurator->saveConfig();
     SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1');
 }