Ejemplo n.º 1
0
 /**
  * @see SugarView::process()
  */
 public function process()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die("Unauthorized access to administration.");
     }
     // Check if default_theme is valid
     if (isset($_REQUEST['default_theme']) && !in_array($_REQUEST['default_theme'], array_keys(SugarThemeRegistry::allThemes()))) {
         sugar_die("Default theme is invalid.");
     }
     if (isset($_REQUEST['disabled_themes'])) {
         $toDecode = html_entity_decode($_REQUEST['disabled_themes'], ENT_QUOTES);
         $disabledThemes = json_decode($toDecode, true);
         if (($key = array_search(SugarThemeRegistry::current()->__toString(), $disabledThemes)) !== FALSE) {
             unset($disabledThemes[$key]);
         }
         $_REQUEST['disabled_themes'] = implode(',', $disabledThemes);
         $configurator = new Configurator();
         $configurator->config['disabled_themes'] = $_REQUEST['disabled_themes'];
         $configurator->config['default_theme'] = $_REQUEST['default_theme'];
         $configurator->handleOverride();
         echo "true";
     } else {
         parent::process();
     }
 }
Ejemplo n.º 2
0
 public function action_savelanguages()
 {
     global $sugar_config;
     $toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES);
     $disabled_langs = json_decode($toDecode);
     $toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES);
     $enabled_langs = json_decode($toDecode);
     if (count($sugar_config['languages']) === count($disabled_langs)) {
         sugar_die(translate('LBL_CAN_NOT_DISABLE_ALL_LANG'));
     } else {
         $cfg = new Configurator();
         if (in_array($sugar_config['default_language'], $disabled_langs)) {
             reset($enabled_langs);
             $cfg->config['default_language'] = current($enabled_langs);
         }
         if (in_array($GLOBALS['current_user']->preferred_language, $disabled_langs)) {
             $GLOBALS['current_user']->preferred_language = current($enabled_langs);
             $GLOBALS['current_user']->save();
         }
         $cfg->config['disabled_languages'] = join(',', $disabled_langs);
         // TODO: find way to enforce order
         $cfg->handleOverride();
         // Clear the metadata cache so changes to languages are picked up right away
         MetaDataManager::refreshLanguagesCache($enabled_langs);
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->clearLanguageCache();
     }
     //Call Ping API to refresh the language list.
     die("\n            <script>\n            var app = window.parent.SUGAR.App;\n            app.api.call('read', app.api.buildURL('ping'));\n            app.router.navigate('#bwc/index.php?module=Administration&action=Languages', {trigger:true, replace:true});\n            </script>");
 }
Ejemplo n.º 3
0
 /**
  * @see SugarView::process()
  */
 public function process()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die("Unauthorized access to administration.");
     }
     // Check if the theme is valid
     if (!isset($_REQUEST['theme']) || !in_array($_REQUEST['theme'], array_keys(SugarThemeRegistry::allThemes()))) {
         sugar_die("theme is invalid.");
     }
     if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') {
         $theme_config = SugarThemeRegistry::getThemeConfig($_REQUEST['theme']);
         $configurator = new Configurator();
         foreach ($theme_config as $name => $def) {
             if (isset($_REQUEST[$name])) {
                 if ($_REQUEST[$name] == 'true') {
                     $_REQUEST[$name] = true;
                 } else {
                     if ($_REQUEST[$name] == 'false') {
                         $_REQUEST[$name] = false;
                     }
                 }
                 $configurator->config['theme_settings'][$_REQUEST['theme']][$name] = $_REQUEST[$name];
             }
         }
         $configurator->handleOverride();
         SugarApplication::redirect('index.php?module=Administration&action=ThemeSettings');
         exit;
     }
     parent::process();
 }
function setAppSettings($appId, $appSecret)
{
    if (ctype_alnum($appId) && strlen($appId) == 20 && ctype_alnum($appSecret) && strlen($appSecret) == 40) {
        $configurator = new Configurator();
        $configurator->config['authenticationClass'] = "LatchAuthenticate";
        $configurator->config['appId'] = $appId;
        $configurator->config['appSecret'] = $appSecret;
        $configurator->handleOverride();
    }
}
Ejemplo n.º 5
0
 public function action_savelanguages()
 {
     global $sugar_config;
     $toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES);
     $disabled_langs = json_decode($toDecode);
     $toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES);
     $enabled_langs = json_decode($toDecode);
     $cfg = new Configurator();
     $cfg->config['disabled_languages'] = join(',', $disabled_langs);
     // TODO: find way to enforce order
     $cfg->handleOverride();
     header("Location: index.php?module=Administration&action=Languages");
 }
Ejemplo n.º 6
0
 /**
  * After the notification is displayed, clear the fts flags
  * @return null
  */
 protected function clearFTSFlags()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $admin = Administration::getSettings();
         if (!empty($settings->settings['info_fts_index_done'])) {
             $admin->saveSetting('info', 'fts_index_done', 0);
         }
         // remove notification disabled notification
         $cfg = new Configurator();
         $cfg->config['fts_disable_notification'] = false;
         $cfg->handleOverride();
     }
 }
Ejemplo n.º 7
0
 /**
  * @see SugarView::process()
  */
 public function process()
 {
     global $current_user;
     if (is_admin($current_user) && isset($_REQUEST['disabled_themes'])) {
         $_REQUEST['disabled_themes'] = explode(',', $_REQUEST['disabled_themes']);
         if (($key = array_search(SugarThemeRegistry::current()->__toString(), $_REQUEST['disabled_themes'])) !== FALSE) {
             unset($_REQUEST['disabled_themes'][$key]);
         }
         $_REQUEST['disabled_themes'] = implode(',', $_REQUEST['disabled_themes']);
         $configurator = new Configurator();
         $configurator->config['disabled_themes'] = $_REQUEST['disabled_themes'];
         $configurator->handleOverride();
     }
     parent::process();
 }
Ejemplo n.º 8
0
 /**
  * @see SugarView::process()
  */
 public function process()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die("Unauthorized access to administration.");
     }
     // Check if default_theme is valid
     if (isset($_REQUEST['default_theme']) && !in_array($_REQUEST['default_theme'], array_keys(SugarThemeRegistry::allThemes()))) {
         sugar_die("Default theme is invalid.");
     }
     if (isset($_REQUEST['disabled_themes'])) {
         $configurator = new Configurator();
         $configurator->config['disabled_themes'] = implode(',', $_REQUEST['disabled_themes']);
         $configurator->config['default_theme'] = $_REQUEST['default_theme'];
         $configurator->handleOverride();
     }
     parent::process();
 }
 /**
  * Disable FTS and write to config.
  *
  */
 protected function disableFTS()
 {
     $this->logger->fatal('Full Text Search has been disabled because the system is not able to connect to the search engine.');
     self::markSearchEngineStatus(true);
     // notification
     if (empty($GLOBALS['sugar_config']['fts_disable_notification'])) {
         $cfg = new Configurator();
         $cfg->config['fts_disable_notification'] = true;
         $cfg->handleOverride();
     }
 }
Ejemplo n.º 10
0
         //no need to write to config.php
         unset($sugar_config['disable_team_access_check']);
     }
     logThis('Running merge_passwordsetting', $path);
     if (!merge_passwordsetting($sugar_config, $sugar_version)) {
         logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
         $errors[] = 'Could not write config.php!';
     }
     logThis('Done merge_passwordsetting', $path);
 }
 if (version_compare($sugar_version, '6.7.0', '<') && isset($sugar_config['default_theme']) && $sugar_config['default_theme'] == 'Sugar5') {
     logThis('Set default_theme to RacerX', $path);
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     $configurator->config['default_theme'] = 'RacerX';
     $configurator->handleOverride();
 }
 if (!write_array_to_file("sugar_config", $sugar_config, "config.php")) {
     logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
     $errors[] = 'Could not write config.php!';
 }
 logThis('Set default_max_tabs to 7', $path);
 $sugar_config['default_max_tabs'] = '7';
 logThis('Upgrade the sugar_version', $path);
 $sugar_config['sugar_version'] = $sugar_version;
 ksort($sugar_config);
 if (!write_array_to_file("sugar_config", $sugar_config, "config.php")) {
     logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
     $errors[] = 'Could not write config.php!';
 }
 logThis('post_install() done.', $path);
Ejemplo n.º 11
0
 public function putSettingsEngine($api, $args)
 {
     $this->checkACL($api, $args);
     if (!empty($args['data'])) {
         $cfg = new Configurator();
         $cfg->config['pmse_settings_default'] = $args['data'];
         $cfg->handleOverride();
     }
     return array('success' => true, 'data' => $args['data']);
 }
Ejemplo n.º 12
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.º 13
0
 function action_Save()
 {
     require_once 'include/OutboundEmail/OutboundEmail.php';
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     global $sugar_config;
     global $current_user, $mod_strings;
     if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
         sugar_die($mod_strings['LBL_UNAUTH_ACCESS']);
     }
     //Do not allow users to spoof for sendmail if the config flag is not set.
     if (!isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound']) {
         $_REQUEST['mail_sendtype'] = "SMTP";
     }
     // save Outbound settings  #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
     if (isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
         $oe = new OutboundEmail();
         $oe->populateFromPost();
         $oe->saveSystem();
     }
     $focus = BeanFactory::getBean('Administration');
     if (isset($_POST['tracking_entities_location_type'])) {
         if ($_POST['tracking_entities_location_type'] != '2') {
             unset($_POST['tracking_entities_location']);
             unset($_POST['tracking_entities_location_type']);
         }
     }
     // cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
     if (!isset($_POST['mail_smtpauth_req'])) {
         $_POST['mail_smtpauth_req'] = 0;
         if (empty($_POST['campaignConfig'])) {
             $_POST['notify_allow_default_outbound'] = 0;
             // If smtp auth is disabled ensure outbound is disabled.
         }
     }
     $focus->saveConfig();
     // mark user metadata changed so the user preferences get refreshed
     // (user preferences contain email client preference)
     $mm = MetadataManager::getManager();
     $mm->setUserMetadataHasChanged($current_user);
     // save User defaults for emails
     $configurator->config['email_default_delete_attachments'] = isset($_REQUEST['email_default_delete_attachments']) ? true : false;
     ///////////////////////////////////////////////////////////////////////////////
     ////	SECURITY
     $security = array();
     if (isset($_REQUEST['applet'])) {
         $security['applet'] = 'applet';
     }
     if (isset($_REQUEST['base'])) {
         $security['base'] = 'base';
     }
     if (isset($_REQUEST['embed'])) {
         $security['embed'] = 'embed';
     }
     if (isset($_REQUEST['form'])) {
         $security['form'] = 'form';
     }
     if (isset($_REQUEST['frame'])) {
         $security['frame'] = 'frame';
     }
     if (isset($_REQUEST['frameset'])) {
         $security['frameset'] = 'frameset';
     }
     if (isset($_REQUEST['iframe'])) {
         $security['iframe'] = 'iframe';
     }
     if (isset($_REQUEST['import'])) {
         $security['import'] = '\\?import';
     }
     if (isset($_REQUEST['layer'])) {
         $security['layer'] = 'layer';
     }
     if (isset($_REQUEST['link'])) {
         $security['link'] = 'link';
     }
     if (isset($_REQUEST['object'])) {
         $security['object'] = 'object';
     }
     if (isset($_REQUEST['style'])) {
         $security['style'] = 'style';
     }
     if (isset($_REQUEST['xmp'])) {
         $security['xmp'] = 'xmp';
     }
     $security['script'] = 'script';
     $configurator->config['email_xss'] = base64_encode(serialize($security));
     ////	SECURITY
     ///////////////////////////////////////////////////////////////////////////////
     ksort($sugar_config);
     $configurator->handleOverride();
 }
Ejemplo n.º 14
0
 public function action_UpdateAjaxUI()
 {
     require_once 'modules/Configurator/Configurator.php';
     $cfg = new Configurator();
     $disabled = json_decode(html_entity_decode($_REQUEST['disabled_modules'], ENT_QUOTES));
     $cfg->config['addAjaxBannedModules'] = empty($disabled) ? FALSE : $disabled;
     $cfg->handleOverride();
     $this->view = "configureajaxui";
 }
Ejemplo n.º 15
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');
 }
 /**
  * Check FTS server status and update cache file and notification.
  *
  * @return boolean
  */
 protected function updateFTSServerStatus()
 {
     $GLOBALS['log']->debug('Going to check and update FTS Server status.');
     // check FTS server status
     $result = $this->SSEngine->getServerStatus();
     if ($result['valid']) {
         $GLOBALS['log']->debug('FTS Server is OK.');
         // server is ok
         if (SugarSearchEngineAbstractBase::isSearchEngineDown()) {
             $GLOBALS['log']->debug('Restoring FTS Server status.');
             // mark fts server as up
             SugarSearchEngineAbstractBase::markSearchEngineStatus(false);
             // remove notification
             $cfg = new Configurator();
             $cfg->config['fts_disable_notification'] = false;
             $cfg->handleOverride();
         }
         return true;
     } else {
         $GLOBALS['log']->info('FTS Server is down?');
         // server is down
         if (!SugarSearchEngineAbstractBase::isSearchEngineDown()) {
             $GLOBALS['log']->fatal('Marking FTS Server as down.');
             // fts is not marked as down, so mark it as down
             SugarSearchEngineAbstractBase::markSearchEngineStatus(true);
         }
         return false;
     }
 }
Ejemplo n.º 17
0
 /**
  * Generates custom field_defs for selected fields
  */
 function action_historyContactsEmailsSave()
 {
     if (!empty($_POST['modules']) && is_array($_POST['modules'])) {
         $modules = array();
         foreach ($_POST['modules'] as $moduleName => $enabled) {
             $bean = BeanFactory::getBean($moduleName);
             if (!$bean instanceof SugarBean) {
                 continue;
             }
             if (empty($bean->field_defs)) {
                 continue;
             }
             // these are the specific modules we care about
             if (!in_array($moduleName, array('Opportunities', 'Accounts', 'Cases'))) {
                 continue;
             }
             $bean->load_relationships();
             foreach ($bean->get_linked_fields() as $fieldName => $fieldDef) {
                 if ($bean->{$fieldName}->getRelatedModuleName() == 'Contacts') {
                     $modules[$moduleName] = !$enabled;
                     break;
                 }
             }
         }
         $configurator = new Configurator();
         $configurator->config['hide_history_contacts_emails'] = $modules;
         $configurator->handleOverride();
     }
     SugarApplication::redirect('index.php?module=Administration&action=index');
 }
 /**
  * This method sets the full text search to available when a scheduled FTS Index occurs.  
  * An indexing can only occur with a valid connection
  * 
  * TODO: XXX Fix this to use admin settings not config options
  * @return bool
  */
 protected function setFTSUp()
 {
     $cfg = new Configurator();
     $cfg->config['fts_disable_notification'] = false;
     $cfg->handleOverride();
     // set it up
     SugarSearchEngineAbstractBase::markSearchEngineStatus(false);
     $admin = BeanFactory::newBean('Administration');
     $admin->retrieveSettings(FALSE, TRUE);
     return TRUE;
 }
Ejemplo n.º 19
0
 /**
  * Displays the header on section of the page; basically everything before the content
  */
 public function displayHeader()
 {
     global $theme;
     global $max_tabs;
     global $app_strings;
     global $current_user;
     global $sugar_config;
     global $app_list_strings;
     global $mod_strings;
     global $current_language;
     $GLOBALS['app']->headerDisplayed = true;
     $themeObject = SugarThemeRegistry::current();
     $theme = $themeObject->__toString();
     $ss = new Sugar_Smarty();
     $ss->assign("APP", $app_strings);
     $ss->assign("THEME", $theme);
     $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
     $ss->assign("MODULE_NAME", $this->module);
     // get browser title
     $ss->assign("SYSTEM_NAME", $this->getBrowserTitle());
     // get css
     $css = $themeObject->getCSS();
     if ($this->_getOption('view_print')) {
         $css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
     }
     $ss->assign("SUGAR_CSS", $css);
     // get javascript
     ob_start();
     $this->renderJavascript();
     $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
     ob_end_clean();
     // get favicon
     if (isset($GLOBALS['sugar_config']['default_module_favicon'])) {
         $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
     } else {
         $module_favicon = false;
     }
     $favicon = '';
     if ($module_favicon) {
         $favicon = $themeObject->getImageURL($this->module . '.gif', false);
     }
     if (!sugar_is_file($favicon) || !$module_favicon) {
         $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     }
     $ss->assign('FAVICON_URL', getJSPath($favicon));
     // build the shortcut menu
     $shortcut_menu = array();
     foreach ($this->getMenu() as $key => $menu_item) {
         $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "'  border='0' align='absmiddle'"));
     }
     $ss->assign("SHORTCUT_MENU", $shortcut_menu);
     // handle rtl text direction
     if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
         $_SESSION['RTL'] = true;
     }
     if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
         unset($_SESSION['RTL']);
     }
     if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
         $ss->assign("DIR", 'dir="RTL"');
     }
     // handle resizing of the company logo correctly on the fly
     $companyLogoURL = $themeObject->getImageURL('company_logo.png');
     $companyLogoURL_arr = explode('?', $companyLogoURL);
     $companyLogoURL = $companyLogoURL_arr[0];
     $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
     if (!empty($company_logo_attributes)) {
         $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
         $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
         $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
     } else {
         // Always need to md5 the file
         $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
         list($width, $height) = getimagesize($companyLogoURL);
         if ($width > 212 || $height > 40) {
             $resizePctWidth = ($width - 212) / 212;
             $resizePctHeight = ($height - 40) / 40;
             if ($resizePctWidth > $resizePctHeight) {
                 $resizeAmount = $width / 212;
             } else {
                 $resizeAmount = $height / 40;
             }
             $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
             $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
         } else {
             $ss->assign("COMPANY_LOGO_WIDTH", $width);
             $ss->assign("COMPANY_LOGO_HEIGHT", $height);
         }
         // Let's cache the results
         sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
     }
     $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
     // get the global links
     $gcls = array();
     $global_control_links = array();
     require "include/globalControlLinks.php";
     foreach ($global_control_links as $key => $value) {
         if ($key == 'users') {
             //represents logout link.
             $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
             $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));
             //key value for first element.
             continue;
         }
         foreach ($value as $linkattribute => $attributevalue) {
             // get the main link info
             if ($linkattribute == 'linkinfo') {
                 $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue), "SUBMENU" => array());
                 if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
                     $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11);
                     $gcls[$key]["URL"] = "#";
                 }
             }
             // and now the sublinks
             if ($linkattribute == 'submenu' && is_array($attributevalue)) {
                 foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) {
                     $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo));
                 }
                 if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
                     $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11);
                     $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "#";
                 }
             }
         }
     }
     $ss->assign("GCLS", $gcls);
     $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : '');
     if ($this->action == "EditView" || $this->action == "Login") {
         $ss->assign("ONLOAD", 'onload="set_focus()"');
     }
     $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
     // get other things needed for page style popup
     if (isset($_SESSION["authenticated_user_id"])) {
         // get the current user name and id
         $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() ? $current_user->user_name : $current_user->full_name);
         $ss->assign("CURRENT_USER_ID", $current_user->id);
         // get the last viewed records
         $tracker = new Tracker();
         $history = $tracker->get_recently_viewed($current_user->id);
         foreach ($history as $key => $row) {
             $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
             $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
         }
         $ss->assign("recentRecords", $history);
     }
     $bakModStrings = $mod_strings;
     if (isset($_SESSION["authenticated_user_id"])) {
         // get the module list
         $moduleTopMenu = array();
         $max_tabs = $current_user->getPreference('max_tabs');
         // Attempt to correct if max tabs count is waaay too high.
         if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) {
             $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
             $current_user->setPreference('max_tabs', $max_tabs, 0, 'global');
         }
         $moduleTab = $this->_getModuleTab();
         $ss->assign('MODULE_TAB', $moduleTab);
         // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1)
         $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
         if (!isset($user_navigation_paradigm)) {
             $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
         }
         // Get the full module list for later use
         foreach (query_module_access_list($current_user) as $module) {
             // Bug 25948 - Check for the module being in the moduleList
             if (isset($app_list_strings['moduleList'][$module])) {
                 $fullModuleList[$module] = $app_list_strings['moduleList'][$module];
             }
         }
         if (!should_hide_iframes()) {
             $iFrame = new iFrame();
             $frames = $iFrame->lookup_frames('tab');
             foreach ($frames as $key => $values) {
                 $fullModuleList[$key] = $values;
             }
         } elseif (isset($fullModuleList['iFrames'])) {
             unset($fullModuleList['iFrames']);
         }
         if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) {
             // We are using grouped tabs
             require_once 'include/GroupedTabs/GroupedTabStructure.php';
             $groupedTabsClass = new GroupedTabStructure();
             $modules = query_module_access_list($current_user);
             //handle with submoremodules
             $max_tabs = $current_user->getPreference('max_subtabs');
             // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size
             if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) {
                 // We have a default value. Use it
                 if (isset($GLOBALS['sugar_config']['default_max_subtabs'])) {
                     // As of 6.1, we shouldn't have a max subtabs higher than 10.
                     // If it's larger, bring it down to the max and save it in the config override
                     if ($GLOBALS['sugar_config']['default_max_subtabs'] > 10) {
                         require_once 'modules/Configurator/Configurator.php';
                         $configurator = new Configurator();
                         $configurator->config['default_max_subtabs'] = '10';
                         $configurator->handleOverride();
                         $configurator->clearCache();
                     }
                     $max_tabs = $GLOBALS['sugar_config']['default_max_subtabs'];
                 } else {
                     $max_tabs = 8;
                 }
             }
             $subMoreModules = false;
             $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules));
             // We need to put this here, so the "All" group is valid for the user's preference.
             $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList;
             // Setup the default group tab.
             $allGroup = $app_strings['LBL_TABGROUP_ALL'];
             $ss->assign('currentGroupTab', $allGroup);
             $currentGroupTab = $allGroup;
             $usersGroup = $current_user->getPreference('theme_current_group');
             // Figure out which tab they currently have selected (stored as a user preference)
             if (!empty($usersGroup) && isset($groupTabs[$usersGroup])) {
                 $currentGroupTab = $usersGroup;
             } else {
                 $current_user->setPreference('theme_current_group', $currentGroupTab);
             }
             $ss->assign('currentGroupTab', $currentGroupTab);
             $usingGroupTabs = true;
         } else {
             // Setup the default group tab.
             $ss->assign('currentGroupTab', $app_strings['LBL_TABGROUP_ALL']);
             $usingGroupTabs = false;
             $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList;
         }
         $topTabList = array();
         // Now time to go through each of the tab sets and fix them up.
         foreach ($groupTabs as $tabIdx => $tabData) {
             $topTabs = $tabData['modules'];
             if (!is_array($topTabs)) {
                 $topTabs = array();
             }
             $extraTabs = array();
             // Split it in to the tabs that go across the top, and the ones that are on the extra menu.
             if (count($topTabs) > $max_tabs) {
                 $extraTabs = array_splice($topTabs, $max_tabs);
             }
             // Make sure the current module is accessable through one of the top tabs
             if (!isset($topTabs[$moduleTab])) {
                 // Nope, we need to add it.
                 // First, take it out of the extra menu, if it's there
                 if (isset($extraTabs[$moduleTab])) {
                     unset($extraTabs[$moduleTab]);
                 }
                 if (count($topTabs) >= $max_tabs - 1) {
                     // We already have the maximum number of tabs, so we need to shuffle the last one
                     // from the top to the first one of the extras
                     $lastElem = array_splice($topTabs, $max_tabs - 1);
                     $extraTabs = $lastElem + $extraTabs;
                 }
                 $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
             }
             /*
             // This was removed, but I like the idea, so I left the code in here in case we decide to turn it back on
             // If we are using group tabs, add all the "hidden" tabs to the end of the extra menu
             if ( $usingGroupTabs ) {
                 foreach($fullModuleList as $moduleKey => $module ) {
                     if ( !isset($topTabs[$moduleKey]) && !isset($extraTabs[$moduleKey]) ) {
                         $extraTabs[$moduleKey] = $module;
                     }
                 }
             }
             */
             // Get a unique list of the top tabs so we can build the popup menus for them
             foreach ($topTabs as $moduleKey => $module) {
                 $topTabList[$moduleKey] = $module;
             }
             $groupTabs[$tabIdx]['modules'] = $topTabs;
             $groupTabs[$tabIdx]['extra'] = $extraTabs;
         }
     }
     if (isset($topTabList) && is_array($topTabList)) {
         // Adding shortcuts array to menu array for displaying shortcuts associated with each module
         $shortcutTopMenu = array();
         foreach ($topTabList as $module_key => $label) {
             global $mod_strings;
             $mod_strings = return_module_language($current_language, $module_key);
             foreach ($this->getMenu($module_key) as $key => $menu_item) {
                 $shortcutTopMenu[$module_key][$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "'  border='0' align='absmiddle'"));
             }
         }
         $ss->assign("groupTabs", $groupTabs);
         $ss->assign("shortcutTopMenu", $shortcutTopMenu);
         $ss->assign('USE_GROUP_TABS', $usingGroupTabs);
         // This is here for backwards compatibility, someday, somewhere, it will be able to be removed
         $ss->assign("moduleTopMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']);
         $ss->assign("moduleExtraMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']);
     }
     global $mod_strings;
     $mod_strings = $bakModStrings;
     $headerTpl = $themeObject->getTemplate('header.tpl');
     if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) {
         $ss->clear_compiled_tpl($headerTpl);
     }
     $ss->display($headerTpl);
     $this->includeClassicFile('modules/Administration/DisplayWarnings.php');
 }
Ejemplo n.º 20
0
 function action_Save()
 {
     require_once 'include/OutboundEmail/OutboundEmail.php';
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     global $sugar_config;
     global $current_user;
     if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
         sugar_die("Unauthorized access to administration.");
     }
     //Do not allow users to spoof for sendmail if the config flag is not set.
     if (!isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound']) {
         $_REQUEST['mail_sendtype'] = "SMTP";
     }
     // save Outbound settings  #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
     if (isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
         $oe = new OutboundEmail();
         $oe->populateFromPost();
         $oe->saveSystem();
     }
     $focus = new Administration();
     if (isset($_POST['tracking_entities_location_type'])) {
         if ($_POST['tracking_entities_location_type'] != '2') {
             unset($_POST['tracking_entities_location']);
             unset($_POST['tracking_entities_location_type']);
         }
     }
     // cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
     if (!isset($_POST['mail_smtpauth_req'])) {
         $_POST['mail_smtpauth_req'] = 0;
         if (empty($_POST['campaignConfig'])) {
             $_POST['notify_allow_default_outbound'] = 0;
             // If smtp auth is disabled ensure outbound is disabled.
         }
     }
     if (!empty($_POST['notify_allow_default_outbound'])) {
         $oe = new OutboundEmail();
         if (!$oe->isAllowUserAccessToSystemDefaultOutbound()) {
             $oe->removeUserOverrideAccounts();
         }
     }
     $focus->saveConfig();
     // save User defaults for emails
     $configurator->config['email_default_delete_attachments'] = isset($_REQUEST['email_default_delete_attachments']) ? true : false;
     ///////////////////////////////////////////////////////////////////////////////
     ////	SECURITY
     $security = array();
     if (isset($_REQUEST['applet'])) {
         $security['applet'] = 'applet';
     }
     if (isset($_REQUEST['base'])) {
         $security['base'] = 'base';
     }
     if (isset($_REQUEST['embed'])) {
         $security['embed'] = 'embed';
     }
     if (isset($_REQUEST['form'])) {
         $security['form'] = 'form';
     }
     if (isset($_REQUEST['frame'])) {
         $security['frame'] = 'frame';
     }
     if (isset($_REQUEST['frameset'])) {
         $security['frameset'] = 'frameset';
     }
     if (isset($_REQUEST['iframe'])) {
         $security['iframe'] = 'iframe';
     }
     if (isset($_REQUEST['import'])) {
         $security['import'] = '\\?import';
     }
     if (isset($_REQUEST['layer'])) {
         $security['layer'] = 'layer';
     }
     if (isset($_REQUEST['link'])) {
         $security['link'] = 'link';
     }
     if (isset($_REQUEST['object'])) {
         $security['object'] = 'object';
     }
     if (isset($_REQUEST['style'])) {
         $security['style'] = 'style';
     }
     if (isset($_REQUEST['xmp'])) {
         $security['xmp'] = 'xmp';
     }
     $security['script'] = 'script';
     $configurator->config['email_xss'] = base64_encode(serialize($security));
     ////	SECURITY
     ///////////////////////////////////////////////////////////////////////////////
     ksort($sugar_config);
     $configurator->handleOverride();
 }
 /**
  * For validation via client-side (used by License Configuration form)
  *
  * Does NOT obey the validation_frequency setting. Validates every time.
  * This function is meant to be used only on the License Configuration screen for a specific add-on
  */
 public static function validate()
 {
     $json = getJSONobj();
     if (empty($_REQUEST['key'])) {
         header('HTTP/1.1 400 Bad Request');
         $response = "Key is required.";
         echo $json->encode($response);
         exit;
     }
     global $sugar_config, $currentModule;
     //load license validation config
     require 'modules/' . $currentModule . '/license/config.php';
     $validated = AddonBoilerplateOutfittersLicense::doValidate($currentModule, $_REQUEST['key']);
     $store = array('last_ran' => time(), 'last_result' => $validated);
     require_once 'modules/Administration/Administration.php';
     $administration = new Administration();
     $serialized = base64_encode(serialize($store));
     $administration->saveSetting('SugarOutfitters', $outfitters_config['shortname'], $serialized);
     if ($validated['success'] === false) {
         header('HTTP/1.1 400 Bad Request');
     } else {
         //use config_override.php...config.php has a higher chance of having rights restricted on servers
         global $currentModule;
         //load license validation config
         require 'modules/' . $currentModule . '/license/config.php';
         require 'modules/Configurator/Configurator.php';
         $cfg = new Configurator();
         $cfg->config['outfitters_licenses'][$outfitters_config['shortname']] = $_REQUEST['key'];
         $cfg->handleOverride();
     }
     echo $json->encode($validated['result']);
 }
Ejemplo n.º 22
0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * Positionnement des modules installés en interface non-AJAX
 */
require_once 'modules/Configurator/Configurator.php';
$cfg = new Configurator();
$cfg->config['addAjaxBannedModules'][] = 'TILKEE_CONNEXIONS';
$cfg->config['addAjaxBannedModules'][] = 'TILKEE_PROJECTS';
$cfg->config['addAjaxBannedModules'][] = 'TILKEE_TILKS';
$cfg->handleOverride();
?>
<br />
<h1>TILKEE Connector for SugarCRM</h1>
<p>
    Installation complete...
</p>
<p></p>
    <p>This connector is design to access to TILKEE server information from your SugarCRM instance</p>   
    <p>see below for more information</p>
    <h2>ChangeLog</h2>
    <p>version 1.0</p>
    <ul>
        <li>External API access to Tilkee REST service</li>
        <li>Set and Access to Tilkee projects, TILKs and TILKEE Connexions</li>
        <li>Links Tilkee projects to Opportunities and Accounts</li>
function post_install()
{
    // create directory for external contract pdf files
    $externalContractsPdfDir = "{$GLOBALS['sugar_config']['cache_dir']}/modules/Emails/attachments/";
    mkdir_recursive($externalContractsPdfDir);
    if (file_exists($externalContractsPdfDir)) {
        $GLOBALS['log']->debug("Successfully created directory '{$externalContractsPdfDir}'");
    } else {
        $GLOBALS['log']->fatal("Could not create directory for creation of pdf files: '{$externalContractsPdfDir}'");
    }
    global $sugar_config;
    global $sugar_version;
    $module_list = array('oqc_TextBlock', 'oqc_Offering', 'oqc_Product', 'oqc_Contract', 'oqc_ExternalContract', 'oqc_ProductCatalog', 'oqc_Addition', 'oqc_Task');
    // Add banning of AjaxUI for openqc modules
    require_once 'modules/Configurator/Configurator.php';
    $cfg = new Configurator();
    $overrideArray = $cfg->readOverride();
    if (array_key_exists('addAjaxBannedModules', $overrideArray)) {
        $disabled_modules = $overrideArray['addAjaxBannedModules'];
        $updatedArray = array_merge($disabled_modules, array_diff($module_list, $disabled_modules));
    } else {
        $updatedArray = $module_list;
    }
    $cfg->config['addAjaxBannedModules'] = empty($updatedArray) ? FALSE : $updatedArray;
    $cfg->handleOverride();
    // Configure documents.properties file depending on OS. There is three choices atm
    //1. Default- Linux (OpenSuse, Ubuntu); 2. WinXP; 3. MACOSX
    $oqc_config_directory = 'include/oqc/conf/';
    if (strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN') {
        if (file_exists($oqc_config_directory . 'documents_linux.properties')) {
            unlink($oqc_config_directory . 'documents_linux.properties');
        }
        rename($oqc_config_directory . 'documents.properties', $oqc_config_directory . 'documents_linux.properties');
        rename($oqc_config_directory . 'documents_windows.properties', $oqc_config_directory . 'documents.properties');
    } elseif (strtoupper(substr(php_uname('s'), 0, 3)) === 'DAR') {
        if (file_exists($oqc_config_directory . 'documents_linux.properties')) {
            unlink($oqc_config_directory . 'documents_linux.properties');
        }
        rename($oqc_config_directory . 'documents.properties', $oqc_config_directory . 'documents_linux.properties');
        rename($oqc_config_directory . 'documents_macosx.properties', $oqc_config_directory . 'documents.properties');
    }
    //Do some sanity checks before installing scheduler file if sugar version is lower than 6.3
    if (floatval(substr($sugar_version, 0, 3)) < 6.3) {
        $scheduler_directory = 'custom/modules/Schedulers/';
        if (file_exists($scheduler_directory . '_AddJobsHere.php')) {
            //rename existing file; User can merge oqc file with original one manually
            if (file_exists($scheduler_directory . '_AddJobsHere_original.php')) {
                unlink($scheduler_directory . '_AddJobsHere_original.php');
            }
            rename($scheduler_directory . '_AddJobsHere.php', $scheduler_directory . '_AddJobsHere_original.php');
        }
        rename($scheduler_directory . 'oqc_AddJobsHere.php', $scheduler_directory . '_AddJobsHere.php');
    }
    // Rebuild Roles after install
    require_once 'modules/ACL/install_actions.php';
    //Last, Do a Quick Repair & Rebuild
    $module = array('All Modules');
    $selected_actions = array('clearAll');
    require_once 'modules/Administration/QuickRepairAndRebuild.php';
    $randc = new RepairAndClear();
    $randc->repairAndClearAll($selected_actions, $module, false, false);
}
Ejemplo n.º 24
0
 /**
  * Takes in the request params from a save request and processes 
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveTabGroups($params)
 {
     //#30205
     global $sugar_config;
     if (strcmp($params['other_group_tab_displayed'], '1') == 0) {
         $value = true;
     } else {
         $value = false;
     }
     if (!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value) {
         require_once 'modules/Configurator/Configurator.php';
         $cfg = new Configurator();
         $cfg->config['other_group_tab_displayed'] = $value;
         $cfg->handleOverride();
     }
     //Get the selected tab group language
     $grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
     $tabGroups = array();
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $slot_count = $params['slot_count'];
     $completedIndexes = array();
     for ($count = 0; $count < $slot_count; $count++) {
         if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
             continue;
         }
         $index = $params['slot_' . $count];
         if (isset($completedIndexes[$index])) {
             continue;
         }
         $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
         $labelValue = $params['tablabel_' . $index];
         $appStirngs = return_application_language($grouptab_lang);
         if (empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue) {
             $contents = return_custom_app_list_strings_file_contents($grouptab_lang);
             $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
             save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
             $languages = get_languages();
             foreach ($languages as $language => $langlabel) {
                 if ($grouptab_lang == $language) {
                     continue;
                 }
                 $appStirngs = return_application_language($language);
                 if (!isset($appStirngs[$labelID])) {
                     $contents = return_custom_app_list_strings_file_contents($language);
                     $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
                     save_custom_app_list_strings_contents($new_contents, $language);
                 }
             }
             $app_strings[$labelID] = $labelValue;
         }
         $tabGroups[$labelID] = array('label' => $labelID);
         $tabGroups[$labelID]['modules'] = array();
         for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
             $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
         }
         $completedIndexes[$index] = true;
     }
     sugar_cache_put('app_strings', $GLOBALS['app_strings']);
     $newFile = create_custom_directory('include/tabConfig.php');
     write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
     $GLOBALS['tabStructure'] = $tabGroups;
 }
Ejemplo n.º 25
0
 /**
  * Set SNIP instance URL.
  * @param string $url
  */
 public function setSnipURL($url)
 {
     $cfg = new Configurator();
     $cfg->config['snip_url'] = $url;
     $cfg->handleOverride();
     $this->config['snip_url'] = $url;
     return $this;
 }
Ejemplo n.º 26
0
 /**
  * Generates custom field_defs for selected fields
  */
 function action_historyContactsEmailsSave()
 {
     if (!empty($_POST['modules']) && is_array($_POST['modules'])) {
         require_once 'include/SubPanel/SubPanelDefinitions.php';
         $modules = [];
         foreach ($_POST['modules'] as $moduleName => $enabled) {
             $bean = BeanFactory::getBean($moduleName);
             if (!$bean instanceof SugarBean) {
                 continue;
             }
             if (empty($bean->field_defs)) {
                 continue;
             }
             $subPanel = new SubPanelDefinitions($bean);
             if (empty($subPanel->layout_defs)) {
                 continue;
             }
             if (empty($subPanel->layout_defs['subpanel_setup'])) {
                 continue;
             }
             $isValid = false;
             foreach ($subPanel->layout_defs['subpanel_setup'] as $subPanelDef) {
                 if (empty($subPanelDef['module']) || $subPanelDef['module'] != 'History') {
                     continue;
                 }
                 if (empty($subPanelDef['collection_list'])) {
                     continue;
                 }
                 foreach ($subPanelDef['collection_list'] as $v) {
                     if (!empty($v['get_subpanel_data']) && $v['get_subpanel_data'] == 'function:get_emails_by_assign_or_link') {
                         $isValid = true;
                         break 2;
                     }
                 }
             }
             if (!$isValid) {
                 continue;
             }
             $bean->load_relationships();
             foreach ($bean->get_linked_fields() as $fieldName => $fieldDef) {
                 if ($bean->{$fieldName}->getRelatedModuleName() == 'Contacts') {
                     $modules[$moduleName] = !$enabled;
                     break;
                 }
             }
         }
         $configurator = new Configurator();
         $configurator->config['hide_history_contacts_emails'] = $modules;
         $configurator->handleOverride();
     }
     SugarApplication::redirect('index.php?module=Administration&action=index');
 }
Ejemplo n.º 27
0
function upgradeOutboundSetting()
{
    $query = "select count(*) as count from outbound_email where name='system' and mail_sendtype='sendmail' ";
    $result = $GLOBALS['db']->query($query);
    $row = $GLOBALS['db']->fetchByAssoc($result);
    if ($row['count'] > 0) {
        require_once 'modules/Configurator/Configurator.php';
        $configurator = new Configurator();
        $configurator->config['allow_sendmail_outbound'] = true;
        $configurator->handleOverride();
    }
}