Ejemplo n.º 1
0
 public function run()
 {
     if (!($this->from_flavor == 'ce' && $this->toFlavor('pro'))) {
         return;
     }
     $admin = new Administration();
     $category = 'license';
     $admin->saveSetting($category, 'users', 0);
     foreach (array('num_lic_oc', 'key', 'expire_date') as $k) {
         $admin->saveSetting($category, $k, '');
     }
 }
function upgrade_LDAP()
{
    require_once 'modules/Administration/Administration.php';
    $focus = new Administration();
    $focus->retrieveSettings('ldap', true);
    if (isset($focus->settings['ldap_admin_user']) && !empty($focus->settings['ldap_admin_user'])) {
        $focus->saveSetting('ldap', 'authentication', '1');
    } else {
        if (isset($focus->settings['ldap_admin_user'])) {
            $focus->saveSetting('ldap', 'authentication', '0');
        }
    }
}
Ejemplo n.º 3
0
 public function tearDown()
 {
     //$this->_contact->mark_deleted($this->_contact->id);
     parent::tearDown();
     $administration = new Administration();
     $administration->retrieveSettings();
     if ($this->_opt === null) {
         if (isset($administration->settings['portal_on'])) {
             $administration->saveSetting('portal', 'on', 0);
         }
     } else {
         $administration->saveSetting('portal', 'on', $this->_opt);
     }
 }
Ejemplo n.º 4
0
function upgrade_config_pwd()
{
    require_once 'modules/Administration/Administration.php';
    $focus = new Administration();
    $focus->retrieveSettings(false, true);
    if (isset($focus->settings['ldap_admin_password'])) {
        $pwd = $focus->encrpyt_before_save($focus->settings['ldap_admin_password']);
        $focus->saveSetting('ldap', 'admin_password', $pwd);
    }
    if (isset($focus->settings['proxy_password'])) {
        $pwd = $focus->encrpyt_before_save($focus->settings['proxy_password']);
        $focus->saveSetting('proxy', 'password', $pwd);
    }
}
Ejemplo n.º 5
0
 public function testsaveSetting()
 {
     $admin = new Administration();
     //execute the method and verify that sets the correct config key
     $result = $admin->saveSetting('category', 'key', 'test value');
     $admin->retrieveSettings('category');
     $actual = $admin->settings['category_key'];
     $this->assertEquals($actual, 'test value');
 }
Ejemplo n.º 6
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $themeObject = SugarThemeRegistry::current();
     $configurator = new Configurator();
     $sugarConfig = SugarConfig::getInstance();
     $focus = new Administration();
     $focus->retrieveSettings();
     $ut = $GLOBALS['current_user']->getPreference('ut');
     if (empty($ut)) {
         $this->ss->assign('SKIP_URL', 'index.php?module=Users&action=Wizard&skipwelcome=1');
     } else {
         $this->ss->assign('SKIP_URL', 'index.php?module=Home&action=index');
     }
     // Always mark that we have got past this point
     $focus->saveSetting('system', 'adminwizard', 1);
     $css = $themeObject->getCSS();
     $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     $this->ss->assign('FAVICON_URL', getJSPath($favicon));
     $this->ss->assign('SUGAR_CSS', $css);
     $this->ss->assign('MOD_USERS', return_module_language($GLOBALS['current_language'], 'Users'));
     $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
     $this->ss->assign('LANGUAGES', get_languages());
     $this->ss->assign('config', $sugar_config);
     $this->ss->assign('SUGAR_VERSION', $sugar_version);
     $this->ss->assign('settings', $focus->settings);
     $this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
     $this->ss->assign('getNameJs', $locale->getNameJs());
     $this->ss->assign('NAMEFORMATS', $locale->getUsableLocaleNameOptions($sugar_config['name_formats']));
     $this->ss->assign('JAVASCRIPT', get_set_focus_js() . get_configsettings_js());
     $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
     $this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']);
     $this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']);
     $this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']);
     $this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']);
     $this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']);
     $this->ss->assign('mail_smtpauth_req', $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : '');
     $this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
     $this->ss->assign('notify_allow_default_outbound_on', !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2 ? 'CHECKED' : '');
     $this->ss->assign('THEME', SugarThemeRegistry::current()->__toString());
     // get javascript
     ob_start();
     $this->options['show_javascript'] = true;
     $this->renderJavascript();
     $this->options['show_javascript'] = false;
     $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
     ob_end_clean();
     $this->ss->assign('langHeader', get_language_header());
     $this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome');
     $this->ss->display('modules/Configurator/tpls/adminwizard.tpl');
 }
Ejemplo n.º 7
0
 public function run()
 {
     if (!$this->toFlavor('ent')) {
         return;
     }
     // Grabs the portal config setting.
     $query = "SELECT value FROM config WHERE category='portal' AND name='on'";
     $portalEnabled = (bool) $this->db->getOne($query);
     // Remove `portal_on` with platform equals to NULL or platform equals to empty string
     $query = "DELETE FROM config WHERE category='portal' AND name='on' AND (platform IS NULL OR platform='')";
     $this->db->query($query);
     // only run this when coming from a version lower than 7.1.5
     if (version_compare($this->from_version, '7.1.5', '>=')) {
         return;
     }
     global $mod_strings;
     // Update portal setting name `displayModules` to `tab`
     $this->updatePortalTabsSetting();
     // Set portal setting `logLevel` to `ERROR`
     $fieldKey = 'logLevel';
     $fieldValue = 'ERROR';
     $admin = new Administration();
     if (!$admin->saveSetting('portal', $fieldKey, json_encode($fieldValue), 'support')) {
         $error = sprintf($this->mod_strings['ERROR_UW_PORTAL_CONFIG_DB'], 'portal', $fieldKey, $fieldValue);
         return $this->fail($error);
     }
     // Remove `fieldsToDisplay` (# of fields displayed in detail view - not used anymore in 7.0)
     $query = "DELETE FROM config WHERE category='portal' AND name='fieldsToDisplay' AND platform='support'";
     $this->db->query($query);
     // Enables portal if it is set to true.
     // TODO: category should be `support`, platform should be `portal`
     $admin->saveSetting('portal', 'on', $portalEnabled, 'support');
     // Sets up portal.
     if ($portalEnabled) {
         $parser = new ParserModifyPortalConfig();
         $parser->setUpPortal();
     }
 }
Ejemplo n.º 8
0
 function flushStaleEntries($bean, $event, $arguments)
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     $timedate = TimeDate::getInstance();
     $currDate = $timedate->nowDbDate();
     if (isset($admin->settings['sugarfeed_flushdate']) && $admin->settings['sugarfeed_flushdate'] != $currDate) {
         global $db;
         if (!isset($db)) {
             $db = DBManagerFactory::getInstance();
         }
         $tmpTime = time();
         $tmpSF = new SugarFeed();
         $flushBefore = $timedate->asDbDate($timedate->getNow()->modify("-14 days")->setTime(0, 0));
         $db->query("DELETE FROM " . $tmpSF->table_name . " WHERE date_entered < '" . $db->quote($flushBefore) . "'");
         $admin->saveSetting('sugarfeed', 'flushdate', $currDate);
         // Flush the cache
         $admin->retrieveSettings(FALSE, TRUE);
     }
 }
Ejemplo n.º 9
0
 function flushStaleEntries($bean, $event, $arguments)
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     $td = new TimeDate();
     $currDate = $td->get_gmt_db_date();
     if ($admin->settings['sugarfeed_flushdate'] != $currDate) {
         if (isset($GLOBALS['db'])) {
             $db = $GLOBALS['db'];
         }
         if (!isset($db)) {
             $db = DBManagerFactory::getInstance();
         }
         $tmpTime = time();
         $tmpSF = new SugarFeed();
         $flushBefore = gmdate($td->dbDayFormat, gmmktime(0, 0, 0, gmdate('m'), gmdate('d') - 14, gmdate('Y')));
         $db->query("DELETE FROM " . $tmpSF->table_name . " WHERE date_entered < '" . $db->quote($flushBefore) . "'");
         $admin->saveSetting('sugarfeed', 'flushdate', $currDate);
         // Flush the cache
         $admin->retrieveSettings(FALSE, TRUE);
     }
 }
Ejemplo n.º 10
0
 function setCredentials($username, $password, $systemname)
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_USERNAME, $username);
     $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_PASSWORD, $password);
     if (!empty($systemname)) {
         $admin->saveSetting('system', 'name', $systemname);
     }
 }
Ejemplo n.º 11
0
 function set_users_can_edit($boolean)
 {
     global $current_user;
     if (is_admin($current_user)) {
         $administration = new Administration();
         if ($boolean) {
             $administration->saveSetting('MySettings', 'disable_useredit', 'no');
         } else {
             $administration->saveSetting('MySettings', 'disable_useredit', 'yes');
         }
     }
 }
Ejemplo n.º 12
0
         }
         $active_modules = $_REQUEST['modules'];
         if (!is_array($active_modules)) {
             $active_modules = array();
         }
         foreach ($active_modules as $name => $is_active) {
             $module = substr($name, 7);
             if ($is_active == '1') {
                 // They are activating something that was disabled before
                 SugarFeed::activateModuleFeed($module);
             } else {
                 // They are disabling something that was active before
                 SugarFeed::disableModuleFeed($module);
             }
         }
         $admin->saveSetting('sugarfeed', 'enabled', '1');
     } else {
         $admin->saveSetting('sugarfeed', 'enabled', '0');
         // Now we need to remove all of the logic hooks, so they don't continue to run
         // We also need to leave the database alone, so they can enable/disable modules with the system disabled
         $modulesWithFeeds = SugarFeed::getAllFeedModules();
         foreach ($modulesWithFeeds as $currFeedModule) {
             SugarFeed::disableModuleFeed($currFeedModule, FALSE);
         }
     }
     $admin->retrieveSettings(FALSE, TRUE);
     SugarFeed::flushBackendCache();
 } else {
     if ($_REQUEST['process'] == 'deleteRecords') {
         if (!isset($db)) {
             $db = DBManagerFactory::getInstance();
Ejemplo n.º 13
0
if (!is_admin($current_user)) {
    sugar_die('Admin Only');
}
echo get_module_title($mod_strings['LBL_MANAGE_ZUCKERREPORTS2CONFIG'], $mod_strings['LBL_MANAGE_ZUCKERREPORTS2CONFIG'], false);
require_once 'include/Sugar_Smarty.php';
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('RETURN_ACTION', 'index');
$sugar_smarty->assign('RETURN_MODULE', 'Administration');
require_once 'modules/Administration/Administration.php';
$admin = new Administration();
$admin->retrieveSettings();
if (!empty($_REQUEST["index_include"])) {
    $admin->saveSetting("zuckerreports2", "index_include", html_entity_decode($_REQUEST["index_include"]));
}
if (!empty($_REQUEST["script_enabled"])) {
    $admin->saveSetting("zuckerreports2", "script_enabled", $_REQUEST["script_enabled"]);
}
if (!empty($_REQUEST["debug_enabled"])) {
    $admin->saveSetting("zuckerreports2", "debug_enabled", $_REQUEST["debug_enabled"]);
}
if (!empty($_REQUEST["charset"])) {
    $admin->saveSetting("zuckerreports2", "charset", html_entity_decode($_REQUEST["charset"]));
}
if (!empty($_REQUEST["deployment"])) {
    $admin->saveSetting("zuckerreports2", "deployment", html_entity_decode($_REQUEST["deployment"]));
}
if (!empty($_REQUEST["localjdkpath"])) {
    $admin->saveSetting("zuckerreports2", "localjdkpath", html_entity_decode($_REQUEST["localjdkpath"]));
Ejemplo n.º 14
0
     logThis('module tabs updated', $path);
 }
 //Also set the tracker settings if  flavor conversion ce->pro or ce->ent
 if (isset($_SESSION['current_db_version']) && isset($_SESSION['target_db_version'])) {
     if ($_SESSION['current_db_version'] == $_SESSION['target_db_version']) {
         $_REQUEST['upgradeWizard'] = true;
         ob_start();
         include 'include/Smarty/internals/core.write_file.php';
         ob_end_clean();
         $db =& DBManagerFactory::getInstance();
         if ($ce_to_pro_ent) {
             //Also set license information
             $admin = new Administration();
             $category = 'license';
             $value = 0;
             $admin->saveSetting($category, 'users', $value);
             $key = array('num_lic_oc', 'key', 'expire_date');
             $value = '';
             foreach ($key as $k) {
                 $admin->saveSetting($category, $k, $value);
             }
         }
     }
 }
 $phpErrors = ob_get_contents();
 ob_end_clean();
 logThis("**** Potential PHP generated error messages: {$phpErrors}", $path);
 if (count($errors) > 0) {
     foreach ($errors as $error) {
         logThis("****** SilentUpgrade ERROR: {$error}", $path);
     }
Ejemplo n.º 15
0
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
 * Reserved. Contributor(s): ______________________________________..
 * *******************************************************************************/
$admin = new Administration();
$admin->retrieveSettings();
require 'modules/Trackers/config.php';
require_once 'modules/Configurator/Configurator.php';
///////////////////////////////////////////////////////////////////////////////
////	HANDLE CHANGES
if (isset($_POST['process'])) {
    if ($_POST['process'] == 'true') {
        foreach ($tracker_config as $entry) {
            if (isset($entry['bean'])) {
                //If checkbox is unchecked, we add the entry into the config table; otherwise delete it
                if (empty($_POST[$entry['name']])) {
                    $admin->saveSetting('tracker', $entry['name'], 1);
                } else {
                    $db = DBManagerFactory::getInstance();
                    $db->query("DELETE FROM config WHERE category = 'tracker' and name = '" . $entry['name'] . "'");
                }
            }
        }
        //foreach
        //save the tracker prune interval
        if (!empty($_POST['tracker_prune_interval'])) {
            $admin->saveSetting('tracker', 'prune_interval', $_POST['tracker_prune_interval']);
        }
        //save log slow queries and slow query interval
        $configurator = new Configurator();
        $configurator->saveConfig();
    }
function set_last_check_date_config_setting($value)
{
    include_once 'modules/Administration/Administration.php';
    $admin = new Administration();
    $admin->saveSetting('Update', 'last_check_date', $value);
}
Ejemplo n.º 17
0
/**
 * Fully enable SugarFeeds, enabling the user feed and all available modules that have SugarFeed data.
 */
function enableSugarFeeds()
{
    $admin = new Administration();
    $admin->saveSetting('sugarfeed', 'enabled', '1');
    foreach (SugarFeed::getAllFeedModules() as $module) {
        SugarFeed::activateModuleFeed($module);
    }
    check_logic_hook_file('Users', 'after_login', array(1, 'SugarFeed old feed entry remover', 'modules/SugarFeed/SugarFeedFlush.php', 'SugarFeedFlush', 'flushStaleEntries'));
}
Ejemplo n.º 18
0
 function set_hidden_subpanels($panels)
 {
     $administration = new Administration();
     $serialized = base64_encode(serialize($panels));
     $administration->saveSetting('MySettings', 'hide_subpanels', $serialized);
 }
 public function action_config()
 {
     $this->view_object_map['error_1'] = false;
     $this->view_object_map['error_2'] = false;
     $this->view_object_map['error_3'] = false;
     $api_and_secret_saved = false;
     if (isset($_POST) && !empty($_POST)) {
         require_once 'modules/Administration/Administration.php';
         $administration = new Administration();
         $clean_api_key = trim($_REQUEST['api_key']);
         $clean_api_secret = trim($_REQUEST['api_secret']);
         $clean_budget = trim($_REQUEST['budget']);
         if ($clean_api_key != "" && $clean_api_secret != "") {
             $response = @file_get_contents('https://rest.nexmo.com/account/numbers/' . $clean_api_key . '/' . $clean_api_secret);
             //fetching from number
             $msg_from = (array) json_decode($response);
             if (isset($msg_from['numbers'][0]->msisdn) && $msg_from['numbers'][0]->msisdn != "") {
                 $administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
                 $administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
                 $api_and_secret_saved = true;
                 //SugarApplication::appendErrorMessage("<span style='color:green'>Nexmo key and secret saved successfully.</span>");
             } else {
                 $this->view_object_map['error_1'] = true;
                 $this->view_object_map['error_2'] = true;
                 $administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
                 $administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
                 //$administration->saveSetting('Nexmo', 'budget', "");
                 SugarApplication::appendErrorMessage("Please enter valid Nexmo Key and Secret.");
             }
         } else {
             if ($clean_api_key == "" && $clean_api_secret == "") {
                 $this->view_object_map['error_1'] = true;
                 $this->view_object_map['error_2'] = true;
                 SugarApplication::appendErrorMessage("Please enter Nexmo Key and Secret.");
             } else {
                 $administration->saveSetting('Nexmo', 'api_key', $clean_api_key);
                 $administration->saveSetting('Nexmo', 'api_secret', $clean_api_secret);
                 $this->view_object_map['error_1'] = true;
                 $this->view_object_map['error_2'] = true;
                 SugarApplication::appendErrorMessage("Please enter valid Nexmo Key and Secret.");
             }
         }
         if (!empty($clean_budget)) {
             if (is_numeric($clean_budget) && $clean_budget > 0) {
                 if ($api_and_secret_saved == true) {
                     $administration->saveSetting('Nexmo', 'budget', $clean_budget);
                     //SugarApplication::appendErrorMessage("<span style='color:green'>Threshold saved successfully.</span>");
                     SugarApplication::appendErrorMessage("<span style='color:green'>Configuration settings saved successfully.</span>");
                 } else {
                     $administration->saveSetting('Nexmo', 'budget', "");
                 }
             } else {
                 $administration->saveSetting('Nexmo', 'budget', "");
                 SugarApplication::appendErrorMessage("Please enter a valid Threshold.");
                 $this->view_object_map['error_3'] = true;
             }
         } else {
             $this->view_object_map['error_3'] = true;
             $administration->saveSetting('Nexmo', 'budget', "");
             SugarApplication::appendErrorMessage("Please enter the Threshold value.");
         }
         if (isset($_REQUEST['send_msg']) && $_REQUEST['send_msg'] == true && $api_and_secret_saved == true) {
             $administration->saveSetting('Nexmo', 'send_msg', true);
         } else {
             $administration->saveSetting('Nexmo', 'send_msg', false);
         }
         $this->view = 'config';
     } else {
         $this->view = 'config';
     }
 }
Ejemplo n.º 20
0
 static function disableModuleFeed($module, $updateDB = true)
 {
     if ($module != 'UserFeed') {
         // UserFeed is a fake module, used for the user postings to the feed
         // Don't try to load up any classes for it
         $fileList = SugarFeed::getModuleFeedFiles($module);
         foreach ($fileList as $fileName) {
             $feedClass = substr(basename($fileName), 0, -4);
             require_once $fileName;
             $tmpClass = new $feedClass();
             $tmpClass->removeHook($fileName, $feedClass);
         }
     }
     if ($updateDB == true) {
         $admin = new Administration();
         $admin->saveSetting('sugarfeed', 'module_' . $admin->db->quote($module), '0');
     }
 }
Ejemplo n.º 21
0
 /** 
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings;
     $admin = new Administration();
     $admin->retrieveSettings();
     // Handle posts
     if (!empty($_REQUEST['process'])) {
         // Check the cleanup logic hook, make sure it is still there
         check_logic_hook_file('Users', 'after_login', array(1, 'SugarFeed old feed entry remover', 'modules/SugarFeed/SugarFeedFlush.php', 'SugarFeedFlush', 'flushStaleEntries'));
         // We have data posted
         if ($_REQUEST['process'] == 'true') {
             // They want us to process it, the false will just fall outside of this statement
             if ($_REQUEST['feed_enable'] == '1') {
                 // The feed is enabled, pay attention to what categories should be enabled or disabled
                 $db = DBManagerFactory::getInstance();
                 $ret = $db->query("SELECT * FROM config WHERE category = 'sugarfeed' AND name LIKE 'module_%'");
                 $current_modules = array();
                 while ($row = $db->fetchByAssoc($ret)) {
                     $current_modules[$row['name']] = $row['value'];
                 }
                 $active_modules = $_REQUEST['modules'];
                 if (!is_array($active_modules)) {
                     $active_modules = array();
                 }
                 foreach ($active_modules as $name => $is_active) {
                     $module = substr($name, 7);
                     if ($is_active == '1') {
                         // They are activating something that was disabled before
                         SugarFeed::activateModuleFeed($module);
                     } else {
                         // They are disabling something that was active before
                         SugarFeed::disableModuleFeed($module);
                     }
                 }
                 $admin->saveSetting('sugarfeed', 'enabled', '1');
             } else {
                 $admin->saveSetting('sugarfeed', 'enabled', '0');
                 // Now we need to remove all of the logic hooks, so they don't continue to run
                 // We also need to leave the database alone, so they can enable/disable modules with the system disabled
                 $modulesWithFeeds = SugarFeed::getAllFeedModules();
                 foreach ($modulesWithFeeds as $currFeedModule) {
                     SugarFeed::disableModuleFeed($currFeedModule, FALSE);
                 }
             }
             $admin->retrieveSettings(FALSE, TRUE);
             SugarFeed::flushBackendCache();
         } else {
             if ($_REQUEST['process'] == 'deleteRecords') {
                 if (!isset($db)) {
                     $db = DBManagerFactory::getInstance();
                 }
                 $db->query("UPDATE sugarfeed SET deleted = '1'");
                 echo translate('LBL_RECORDS_DELETED', 'SugarFeed');
             }
         }
         if ($_REQUEST['process'] == 'true' || $_REQUEST['process'] == 'false') {
             header('Location: index.php?module=Administration&action=index');
             return;
         }
     }
     $sugar_smarty = new Sugar_Smarty();
     $sugar_smarty->assign('mod', $mod_strings);
     $sugar_smarty->assign('app', $app_strings);
     if (isset($admin->settings['sugarfeed_enabled']) && $admin->settings['sugarfeed_enabled'] == '1') {
         $sugar_smarty->assign('enabled_checkbox', 'checked');
     }
     $possible_feeds = SugarFeed::getAllFeedModules();
     $module_list = array();
     $userFeedEnabled = 0;
     foreach ($possible_feeds as $module) {
         $currModule = array();
         if (isset($admin->settings['sugarfeed_module_' . $module]) && $admin->settings['sugarfeed_module_' . $module] == '1') {
             $currModule['enabled'] = 1;
         } else {
             $currModule['enabled'] = 0;
         }
         $currModule['module'] = $module;
         if ($module == 'UserFeed') {
             // Fake module, need to handle specially
             $userFeedEnabled = $currModule['enabled'];
             continue;
         } else {
             $currModule['label'] = $GLOBALS['app_list_strings']['moduleList'][$module];
         }
         $module_list[] = $currModule;
     }
     $sugar_smarty->assign('module_list', $module_list);
     $sugar_smarty->assign('user_feed_enabled', $userFeedEnabled);
     echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", $mod_strings['LBL_MODULE_NAME']), false);
     $sugar_smarty->display('modules/SugarFeed/tpls/AdminSettings.tpl');
 }
Ejemplo n.º 22
0
 function createDefaultLocalization()
 {
     global $sugar_config, $moduleList;
     global $current_language;
     $json = getJSONobj();
     require_once 'modules/Administration/Administration.php';
     $administration = new Administration();
     $administration->retrieveSettings();
     $str = '<?php $default_language = "' . $sugar_config['default_language'] . '";';
     $str .= '$time = "' . time() . '";';
     $str .= ' ?>';
     //		if ($sugar_config['sugar_version']<'6.3'){
     $saveDir = realpath(dirname(__FILE__) . '/../../../mobile/fielddefs/');
     if ($fh = fopen($saveDir . '/' . 'localization.php', "w")) {
         fputs($fh, $str);
         fclose($fh);
     } else {
         $mod_strings = return_module_language($current_language, "Administration");
         echo $mod_strings['LBL_ERR_DIR_MSG'] . $saveDir;
     }
     //		}
     $str = "var mobile_edition = 'CE',Q_API='2.3', app_support=true, module_access={}, sugar_mod_fields={};";
     $str .= 'var js_plugins=[],html_plugins=[];';
     $str .= 'var sugar_version = "' . $sugar_config['sugar_version'] . '";';
     $str .= 'var sugar_name = "' . $administration->settings['system_name'] . '";';
     $str .= 'var default_language = "' . $sugar_config['default_language'] . '";';
     $lst_lang = get_languages();
     $str .= 'var sugar_languages = ' . $json->encode($lst_lang) . ';';
     $str .= 'var default_currency_name = "' . $sugar_config['default_currency_name'] . '";';
     $str .= 'var default_currency_symbol = "' . $sugar_config['default_currency_symbol'] . '";';
     $str .= 'var default_date_format = "' . $sugar_config['default_date_format'] . '";';
     $str .= 'var db_type = "' . $sugar_config['dbconfig']['db_type'] . '",';
     if (in_array('jjwg_Maps', $moduleList)) {
         $str .= ' jjwg_installed = true,';
         if (isset($administration->settings['jjwg_map_default_unit_type'])) {
             $jjwg_def_unit = $administration->settings['jjwg_map_default_unit_type'];
         } else {
             $jjwg_def_unit = 'miles';
         }
         $str .= 'jjwg_def_unit="' . $jjwg_def_unit . '",';
         if (isset($administration->settings['jjwg_valid_geocode_modules'])) {
             $jjwg_modules = $administration->settings['jjwg_valid_geocode_modules'];
         } else {
             $jjwg_modules = '';
         }
         $str .= 'jjwg_modules="' . $jjwg_modules . '",';
         if (isset($administration->settings['map_default_center_latitude'])) {
             $jjwg_c_lat = $administration->settings['map_default_center_latitude'];
             $jjwg_c_lng = $administration->settings['map_default_center_longitude'];
         } else {
             $jjwg_c_lat = 39.5;
             $jjwg_c_lng = -99.5;
         }
         $str .= 'jjwg_c_lat=' . $jjwg_c_lat . ',' . 'jjwg_c_lng=' . $jjwg_c_lng . ',';
     } else {
         $str .= ' jjwg_installed = false,jjwg_def_unit="",';
     }
     $str .= ' securitysuite = ' . (in_array('SecurityGroups', $moduleList) ? 'true' : 'false') . ',';
     $str .= ' offline_max_days = 0;';
     $str .= 'var quickcrm_upd_time = "' . time() . '";';
     $str .= "var CustomHTML=" . (file_exists("custom/QuickCRM/home.html") ? "true" : "false") . ";";
     $str .= "var CustomJS=" . (file_exists("custom/QuickCRM/custom.js") ? "true" : "false") . ";";
     $administration->saveSetting('QuickCRM', 'sugar_config', base64_encode($str));
     $saveDir = realpath(dirname(__FILE__) . '/../../../mobile/');
     if ($fh = @fopen($saveDir . '/config.js', "w")) {
         fputs($fh, $str);
         fclose($fh);
     }
 }
Ejemplo n.º 23
0
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
global $current_user;
if (!is_admin($current_user)) {
    sugar_die("Unauthorized access to administration.");
}
$focus = new Administration();
// filter for relevant POST data and update config table
foreach ($_POST as $key => $val) {
    $prefix = $focus->get_config_prefix($key);
    if (in_array($prefix[0], $focus->config_categories)) {
        if ($prefix[0] == "license") {
            if ($prefix[1] == "expire_date") {
                global $timedate;
                $val = $timedate->swap_formats($val, $timedate->get_date_format(), $timedate->dbDayFormat);
            } else {
                if ($prefix[1] == "key") {
                    $val = trim($val);
                    // bug 16860 tyoung - trim whitespace from the start and end of the licence key value
                }
            }
        }
        $focus->saveSetting($prefix[0], $prefix[1], $val);
    }
}
header("Location: index.php?action={$_POST['return_action']}&module={$_POST['return_module']}");
Ejemplo n.º 24
0
/**
 * Fully enable SugarFeeds, enabling the user feed and all available modules that have SugarFeed data.
 */
function enableSugarFeeds()
{
    $admin = new Administration();
    $admin->saveSetting('sugarfeed', 'enabled', '1');
    foreach (SugarFeed::getAllFeedModules() as $module) {
        SugarFeed::activateModuleFeed($module);
    }
}
Ejemplo n.º 25
0
                <input type="hidden" name="default_user_name" value="admin" />
                <input class="button" type="submit" name="next" value="{$mod_strings['LBL_PERFORM_FINISH']}" id="button_next2"/>
            </form>
         </td>
       </tr>
     </table>
FP;
}
if (isset($_SESSION['setup_site_sugarbeet_automatic_checks']) && $_SESSION['setup_site_sugarbeet_automatic_checks'] == true) {
    set_CheckUpdates_config_setting('automatic');
} else {
    set_CheckUpdates_config_setting('manual');
}
if (!empty($_SESSION['setup_system_name'])) {
    $admin = new Administration();
    $admin->saveSetting('system', 'name', $_SESSION['setup_system_name']);
}
// Bug 28601 - Set the default list of tabs to show
$enabled_tabs = array();
$enabled_tabs[] = 'Home';
$enabled_tabs[] = 'Accounts';
$enabled_tabs[] = 'Contacts';
$enabled_tabs[] = 'Opportunities';
$enabled_tabs[] = 'Leads';
$enabled_tabs[] = 'Calendar';
$enabled_tabs[] = 'Documents';
$enabled_tabs[] = 'Emails';
$enabled_tabs[] = 'Campaigns';
$enabled_tabs[] = 'Calls';
$enabled_tabs[] = 'Meetings';
$enabled_tabs[] = 'Tasks';
Ejemplo n.º 26
0
function set_last_check_date_config_setting($value)
{
    $admin = new Administration();
    $admin->saveSetting('Update', 'last_check_date', $value);
}
Ejemplo n.º 27
0
 /**
  * Save Configuration Settings using Administration Module
  *  
  * @param $data array of post data
  */
 function saveConfiguration($data = array())
 {
     $admin = new Administration();
     //$admin->retrieveSettings('jjwg', true);
     //$settings = $admin->settings;
     $category = 'jjwg';
     if (!empty($data) && count($data) > 0) {
         if (isset($data['valid_geocode_modules'])) {
             if (is_array($data['valid_geocode_modules'])) {
                 $data['valid_geocode_modules'] = join(', ', $data['valid_geocode_modules']);
             }
             $admin->saveSetting($category, 'valid_geocode_modules', $data['valid_geocode_modules']);
         }
         if (isset($data['valid_geocode_tables'])) {
             if (is_array($data['valid_geocode_tables'])) {
                 $data['valid_geocode_tables'] = join(', ', $data['valid_geocode_tables']);
             }
             $admin->saveSetting($category, 'valid_geocode_tables', $data['valid_geocode_tables']);
         }
         foreach ($data as $name => $value) {
             // Trim white space on each
             $value = trim($value);
             // Set geocode_modules_to_address_type
             if (substr($name, 0, 13) == 'address_type_') {
                 $module = substr($name, 13);
                 if (in_array($module, $this->settings['valid_geocode_modules'])) {
                     if (in_array($value, array('billing', 'shipping', 'primary', 'alt', 'flex_relate', 'custom', 'address'))) {
                         $admin->saveSetting($category, $name, $value);
                     }
                 }
             }
             // Set map_markers_grouping_field
             if (substr($name, 0, 15) == 'grouping_field_') {
                 $module = substr($name, 15);
                 if (in_array($module, $this->settings['valid_geocode_modules'])) {
                     if (!empty($value)) {
                         $admin->saveSetting($category, $name, $value);
                     }
                 }
             }
         }
         // Integer Settings
         $int_settings = array('geocoding_limit', 'google_geocoding_limit', 'map_markers_limit', 'map_default_distance', 'export_addresses_limit', 'map_clusterer_grid_size', 'map_clusterer_max_zoom', 'address_cache_get_enabled', 'address_cache_save_enabled', 'logic_hooks_enabled', 'allow_approximate_location_type');
         foreach ($int_settings as $setting) {
             if (isset($data[$setting]) && is_numeric(trim($data[$setting]))) {
                 $admin->saveSetting($category, $setting, (int) trim($data[$setting]));
             }
         }
         // Float/Language Settings
         if (isset($data['map_default_unit_type']) && in_array(trim($data['map_default_unit_type']), array('mi', 'km'))) {
             $admin->saveSetting($category, 'map_default_unit_type', trim($data['map_default_unit_type']));
         }
         if (empty($data['map_duplicate_marker_adjustment'])) {
             $data['map_duplicate_marker_adjustment'] = 2.0E-5;
         }
         if (isset($data['map_duplicate_marker_adjustment']) && is_numeric(trim($data['map_duplicate_marker_adjustment']))) {
             $admin->saveSetting($category, 'map_duplicate_marker_adjustment', (double) trim($data['map_duplicate_marker_adjustment']));
         }
         if (!$this->is_valid_lat($data['map_default_center_latitude'])) {
             $data['map_default_center_latitude'] = 39.5;
         }
         if (isset($data['map_default_center_latitude']) && is_numeric(trim($data['map_default_center_latitude']))) {
             $admin->saveSetting($category, 'map_default_center_latitude', (double) trim($data['map_default_center_latitude']));
         }
         if (!$this->is_valid_lng($data['map_default_center_longitude'])) {
             $data['map_default_center_longitude'] = -99.5;
         }
         if (isset($data['map_default_center_longitude']) && is_numeric(trim($data['map_default_center_longitude']))) {
             $admin->saveSetting($category, 'map_default_center_longitude', (double) trim($data['map_default_center_longitude']));
         }
         // Set Geocoding API URL or Proxy URL
         if (substr($data['geocoding_api_url'], 0, 4) != 'http' && substr($data['geocoding_api_url'], 0, 2) != '//') {
             $data['geocoding_api_url'] = $this->settings['geocoding_api_url'];
         }
         if (isset($data['geocoding_api_url'])) {
             $admin->saveSetting($category, 'geocoding_api_url', trim($data['geocoding_api_url']));
         }
         // Set Google Maps API Secret
         if (empty($data['geocoding_api_secret'])) {
             $data['geocoding_api_secret'] = '';
         }
         if (isset($data['geocoding_api_secret'])) {
             $admin->saveSetting($category, 'geocoding_api_secret', trim($data['geocoding_api_secret']));
         }
         return true;
     }
     return false;
 }
 public function display()
 {
     global $current_user, $app_strings, $sugar_config, $currentModule, $sugar_version;
     //load license validation config
     require_once 'modules/' . $currentModule . '/license/config.php';
     echo $this->getModuleTitle();
     $GLOBALS['log']->info("License Configuration");
     //$this->ss->assign("MOD", $mod_strings);
     //$this->ss->assign("APP", $app_strings);
     //todo: redirect appropriately
     $this->ss->assign("RETURN_MODULE", "Administration");
     $this->ss->assign("RETURN_ACTION", "index");
     $this->ss->assign("MODULE", $currentModule);
     $license_strings = ViewLicense::loadLicenseStrings();
     $this->ss->assign("LICENSE", $license_strings);
     if (!empty($sugar_config['outfitters_licenses']) && !empty($sugar_config['outfitters_licenses'][$outfitters_config['shortname']])) {
         $this->ss->assign("license_key", $sugar_config['outfitters_licenses'][$outfitters_config['shortname']]);
     }
     $this->ss->assign("continue_url", $outfitters_config['continue_url']);
     $this->ss->assign("file_path", getJSPath("modules/" . $currentModule . "/license/lib/jquery-1.7.1.min.js"));
     if (preg_match("/^6.*/", $sugar_version)) {
         $this->ss->assign("IS_SUGAR_6", true);
     } else {
         $this->ss->assign("IS_SUGAR_6", false);
     }
     if (!function_exists('curl_init')) {
         global $current_language;
         $admin_mod_strings = return_module_language($current_language, 'Administration');
         $curl_not_enabled = $admin_mod_strings['ERR_ENABLE_CURL'];
         $this->ss->assign("CURL_NOT_ENABLED", $curl_not_enabled);
     }
     if (isset($outfitters_config['validate_users']) && $outfitters_config['validate_users'] == true) {
         $this->ss->assign("validate_users", true);
         //get user count for all active, non-portal, non-group users
         $active_users = get_user_array(FALSE, 'Active', '', false, '', ' AND portal_only=0 AND is_group=0');
         $this->ss->assign("current_users", count($active_users));
         $this->ss->assign("user_count_param", "user_count: '" . count($active_users) . "'");
     } else {
         $this->ss->assign("validate_users", false);
         $this->ss->assign("current_users", '');
         $this->ss->assign("user_count_param", '');
     }
     if (isset($outfitters_config['manage_licensed_users']) && $outfitters_config['manage_licensed_users'] == true) {
         $this->ss->assign("manage_licensed_users", true);
         $this->ss->assign("validation_required", true);
         //check if here is a key already...if so then validate to ensure latest licensed user count is pulled in
         require_once 'modules/Administration/Administration.php';
         $administration = new Administration();
         $administration->retrieveSettings();
         $last_validation = $administration->settings['SugarOutfitters_' . $outfitters_config['shortname']];
         $trimmed_last = trim($last_validation);
         //only run a license check if one has been done in the past
         if (!empty($trimmed_last)) {
             //if new then don't do
             require_once 'modules/' . $currentModule . '/license/OutfittersLicense.php';
             $validated = OutfittersLicense::doValidate($currentModule);
             $store = array('last_ran' => time(), 'last_result' => $validated);
             $serialized = base64_encode(serialize($store));
             $administration->saveSetting('SugarOutfitters', $outfitters_config['shortname'], $serialized);
             $licensed_users = 0;
             //check last validation
             if (!empty($validated['result'])) {
                 $licensed_users = $validated['result']['licensed_user_count'];
                 if (!is_numeric($licensed_users)) {
                     $licensed_users = 0;
                 }
                 $this->ss->assign("validation_required", false);
             }
         }
         $this->ss->assign("licensed_users", $licensed_users);
         require_once 'include/templates/TemplateGroupChooser.php';
         $chooser = new TemplateGroupChooser();
         $chooser->args['id'] = 'edit_licensed_users';
         $chooser->args['values_array'] = array();
         $chooser->args['values_array'][0] = get_user_array(false, 'Active', '', false, '', " AND is_group=0");
         $chooser->args['values_array'][1] = array();
         $used_licenses = 0;
         global $db, $locale;
         $result = $db->query("SELECT users.id, users.user_name, users.first_name, users.last_name FROM so_users INNER JOIN users ON so_users.user_id = users.id WHERE shortname = '" . $db->quote($outfitters_config['shortname']) . "'", false);
         while ($row = $db->fetchByAssoc($result)) {
             $used_licenses++;
             $display_name = $row['user_name'];
             if (showFullName()) {
                 if (isset($row['last_name'])) {
                     // cn: we will ALWAYS have both first_name and last_name (empty value if blank in db)
                     $display_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
                 }
             }
             $chooser->args['values_array'][1][$row['id']] = $display_name;
             unset($chooser->args['values_array'][0][$row['id']]);
         }
         $this->ss->assign("available_licensed_users", $licensed_users - $used_licenses);
         $chooser->args['left_name'] = 'unlicensed_users';
         $chooser->args['right_name'] = 'licensed_users';
         $chooser->args['left_label'] = $license_strings['LBL_UNLICENSED_USER_LIST'];
         $chooser->args['right_label'] = $license_strings['LBL_LICENSED_USER_LIST'];
         $chooser->args['title'] = '';
         $this->ss->assign('USER_CHOOSER', $chooser->display());
         $this->ss->assign('CHOOSER_SCRIPT', 'set_chooser();');
         $this->ss->assign('CHOOSE_WHICH', '');
     } else {
         $this->ss->assign("manage_licensed_users", false);
     }
     $this->ss->display('modules/' . $currentModule . '/license/tpls/license.tpl');
 }
Ejemplo n.º 29
0
            //Also set license information
            $admin = new Administration();
            $category = 'license';
            $value = '0';
            $admin->saveSetting($category, 'users', $value);
            $key = array('num_lic_oc', 'key', 'expire_date');
            $value = '';
            foreach ($key as $k) {
                $admin->saveSetting($category, $k, $value);
            }
        }
    }
}
// Mark the instance as having gone thru the admin wizard
$admin = new Administration();
$admin->saveSetting('system', 'adminwizard', 1);
/////////////////////////Old Logger settings///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
if (file_exists('modules/Configurator/Configurator.php')) {
    require_once 'include/utils/array_utils.php';
    require_once 'modules/Configurator/Configurator.php';
    $Configurator = new Configurator();
    $Configurator->parseLoggerSettings();
}
//unset the logger previously instantiated
if (file_exists('include/SugarLogger/LoggerManager.php')) {
    unset($GLOBALS['log']);
    $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
}
//Upgrade connectors
/*
<?php

require_once 'modules/Administration/Administration.php';
$administration = new Administration();
$administration->saveSetting('Nexmo', 'api_key', '');
$administration->saveSetting('Nexmo', 'api_secret', '');
$administration->saveSetting('Nexmo', 'budget', '');
$administration->saveSetting('Nexmo', 'send_msg', false);