本文整理汇总了PHP中Administration::saveSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Administration::saveSetting方法的具体用法?PHP Administration::saveSetting怎么用?PHP Administration::saveSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Administration
的用法示例。
在下文中一共展示了Administration::saveSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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, '');
}
}
示例2: upgrade_LDAP
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');
}
}
}
示例3: tearDown
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);
}
}
示例4: upgrade_config_pwd
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);
}
}
示例5: testsaveSetting
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');
}
示例6: display
/**
* @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');
}
示例7: run
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();
}
}
示例8: flushStaleEntries
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);
}
}
示例9: flushStaleEntries
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);
}
}
示例10: setCredentials
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);
}
}
示例11: Administration
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');
}
}
}
示例12: array
}
$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();
示例13: get_module_title
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"]));
示例14: logThis
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);
}
示例15: Administration
* 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();
}