function zuckerreports_query($session, $sql)
 {
     global $current_user;
     $util = new SugarWebServiceUtilv4_1();
     if (!$util->validate_authenticated($session)) {
         return array('result' => 'error', 'message' => 'ZuckerReports Query invalid session');
     }
     $admin = new Administration();
     $admin->retrieveSettings();
     $sugaruser = $admin->settings['zuckerreports2_ondemandsugaruser'];
     if ($current_user->user_name != $sugaruser) {
         return array('result' => 'error', 'message' => 'ZuckerReports Query invalid user (' . $current_user->user_name . ')');
     }
     $db = DBManagerFactory::getInstance();
     $result = $db->query($sql);
     $row_list = array();
     $colnames_list = array();
     while (($row = $db->fetchByAssoc($result)) != null) {
         if (empty($colnames_list)) {
             foreach ($row as $colname => $colval) {
                 $colnames_list[] = $colname;
             }
         }
         $json_row = array();
         foreach ($row as $colname => $colval) {
             $json_row[] = $colval;
         }
         $row_list[] = $json_row;
     }
     return array('result' => 'ok', 'columnnames_list' => $colnames_list, 'rows_list' => $row_list);
 }
 /**
  * BreadCrumbStack
  * Constructor for BreadCrumbStack that builds list of breadcrumbs using tracker table
  *
  * @param $user_id String value of user id to get bread crumb items for
  * @param $modules mixed value of module name(s) to provide extra filtering
  */
 public function __construct($user_id, $modules = '')
 {
     $this->stack = array();
     $this->stackMap = array();
     $admin = new Administration();
     $admin->retrieveSettings('tracker');
     $this->deleteInvisible = !empty($admin->settings['tracker_Tracker']);
     $db = DBManagerFactory::getInstance();
     $module_query = '';
     if (!empty($modules)) {
         $history_max_viewed = 10;
         $module_query = is_array($modules) ? ' AND module_name IN (\'' . implode("','", $modules) . '\')' : ' AND module_name = \'' . $modules . '\'';
     } else {
         $history_max_viewed = !empty($GLOBALS['sugar_config']['history_max_viewed']) ? $GLOBALS['sugar_config']['history_max_viewed'] : 50;
     }
     $query = 'SELECT distinct item_id AS item_id, id, item_summary, module_name, monitor_id, date_modified FROM tracker WHERE user_id = \'' . $user_id . '\' AND deleted = 0 AND visible = 1 ' . $module_query . ' ORDER BY date_modified DESC';
     $result = $db->limitQuery($query, 0, $history_max_viewed);
     $items = array();
     while ($row = $db->fetchByAssoc($result)) {
         $items[] = $row;
     }
     $items = array_reverse($items);
     foreach ($items as $item) {
         $this->push($item);
     }
 }
Beispiel #3
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the sectionPanels.
  * If portal is not enabled then don't show the Portal Information panel.
  */
 public function display()
 {
     $this->ev->process();
     if (!empty($_REQUEST['contact_name']) && !empty($_REQUEST['contact_id']) && $this->ev->fieldDefs['report_to_name']['value'] == '' && $this->ev->fieldDefs['reports_to_id']['value'] == '') {
         $this->ev->fieldDefs['report_to_name']['value'] = $_REQUEST['contact_name'];
         $this->ev->fieldDefs['reports_to_id']['value'] = $_REQUEST['contact_id'];
     }
     $admin = new Administration();
     $admin->retrieveSettings();
     if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) {
         unset($this->ev->sectionPanels[strtoupper('lbl_portal_information')]);
     } else {
         if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
             $this->ev->fieldDefs['portal_name']['value'] = '';
             $this->ev->fieldDefs['portal_active']['value'] = '0';
             $this->ev->fieldDefs['portal_password']['value'] = '';
             $this->ev->fieldDefs['portal_password1']['value'] = '';
             $this->ev->fieldDefs['portal_name_verified'] = '0';
             $this->ev->focus->portal_name = '';
             $this->ev->focus->portal_password = '';
             $this->ev->focus->portal_acitve = 0;
         } else {
             $this->ev->fieldDefs['portal_password']['value'] = '';
             $this->ev->fieldDefs['portal_password1']['value'] = '';
         }
         echo getVersionedScript('modules/Contacts/Contact.js');
         echo '<script language="javascript">';
         echo 'addToValidateComparison(\'EditView\', \'portal_password\', \'varchar\', false, SUGAR.language.get(\'app_strings\', \'ERR_SQS_NO_MATCH_FIELD\') + SUGAR.language.get(\'Contacts\', \'LBL_PORTAL_PASSWORD\'), \'portal_password1\');';
         echo 'addToValidateVerified(\'EditView\', \'portal_name_verified\', \'bool\', false, SUGAR.language.get(\'app_strings\', \'ERR_EXISTING_PORTAL_USERNAME\'));';
         echo 'YAHOO.util.Event.onDOMReady(function() {YAHOO.util.Event.on(\'portal_name\', \'blur\', validatePortalName);YAHOO.util.Event.on(\'portal_name\', \'keydown\', handleKeyDown);});';
         echo '</script>';
     }
     echo $this->ev->display($this->showTitle);
 }
 /**
  * main method that runs reminding process
  * @return boolean
  */
 public function process()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     $meetings = $this->getMeetingsForRemind();
     foreach ($meetings as $id) {
         $recipients = $this->getRecipients($id, 'Meetings');
         $bean = new Meeting();
         $bean->retrieve($id);
         if ($this->sendReminders($bean, $admin, $recipients)) {
             $bean->email_reminder_sent = 1;
             $bean->save();
         }
     }
     $calls = $this->getCallsForRemind();
     foreach ($calls as $id) {
         $recipients = $this->getRecipients($id, 'Calls');
         $bean = new Call();
         $bean->retrieve($id);
         if ($this->sendReminders($bean, $admin, $recipients)) {
             $bean->email_reminder_sent = 1;
             $bean->save();
         }
     }
     return true;
 }
Beispiel #5
0
 public function display()
 {
     echo $this->getModuleTitle();
     $this->ss->assign("RETURN_MODULE", "Administration");
     $this->ss->assign("RETURN_ACTION", "index");
     $zendesk_helper = new ZendeskHelper();
     $admin = new Administration();
     $admin->retrieveSettings('zendesk');
     $this->ss->assign('zendesk_instance', $admin->settings['system_zendesk_instance']);
     $this->ss->assign('zendesk_https', $admin->settings['system_zendesk_https']);
     $this->ss->assign("zendesk_https_checkbox", $admin->settings['system_zendesk_https'] ? "checked='checked'" : "");
     $this->ss->assign('zendesk_login', $admin->settings['system_zendesk_login']);
     $this->ss->assign('use_account_name', $zendesk_helper->getGlobalConfigValue('use_account_name'));
     $this->ss->assign('per_page', $zendesk_helper->getGlobalConfigValue('per_page', '6'));
     $this->ss->assign('sort', $zendesk_helper->getGlobalConfigValue('sort', '1'));
     $this->ss->assign('order_by', $zendesk_helper->getGlobalConfigValue('order_by', 'priority'));
     $this->ss->assign('status_filter', $zendesk_helper->getGlobalConfigValue('status_filter', 'lsolved'));
     $this->ss->assign('priority_filter', $zendesk_helper->getGlobalConfigValue('priority_filter', 'any'));
     $this->ss->assign('type_filter', $zendesk_helper->getGlobalConfigValue('type_filter', 'any'));
     $this->ss->assign('statusoptions', $zendesk_helper->getStatusFilterOptions());
     $this->ss->assign('priorityoptions', $zendesk_helper->getPriorityFilterOptions());
     $this->ss->assign('typeoptions', $zendesk_helper->getTypeFilterOptions());
     $this->ss->assign('columns', $zendesk_helper->getColumnOptions());
     $this->ss->display('modules/zd_Tickets/tpls/config.tpl');
 }
Beispiel #6
0
function getPortalEmailSettings()
{
    global $sugar_config;
    $settings = array('from_name' => '', 'from_address' => '');
    if (array_key_exists("aop", $sugar_config)) {
        if (array_key_exists('support_from_address', $sugar_config['aop'])) {
            $settings['from_address'] = $sugar_config['aop']['support_from_address'];
        }
        if (array_key_exists('support_from_name', $sugar_config['aop'])) {
            $settings['from_name'] = $sugar_config['aop']['support_from_name'];
        }
    }
    if ($settings['from_name'] && $settings['from_address']) {
        return $settings;
    }
    //Fallback to sugar settings
    $admin = new Administration();
    $admin->retrieveSettings();
    if (!$settings['from_name']) {
        $settings['from_name'] = $admin->settings['notify_fromname'];
    }
    if (!$settings['from_address']) {
        $settings['from_address'] = $admin->settings['notify_fromaddress'];
    }
    return $settings;
}
Beispiel #7
0
function getZendeskConnection()
{
    global $current_user;
    $read_only = true;
    $zendesk_https = false;
    $zendesk_helper = new ZendeskHelper();
    $admin = new Administration();
    $admin->retrieveSettings('system');
    if ($admin->settings['system_zendesk_instance']) {
        $zendesk_instance = $admin->settings['system_zendesk_instance'];
    } else {
        throw new Exception('Zendesk credentials not configured');
    }
    if ($admin->settings['system_zendesk_https']) {
        $zendesk_https = true;
    }
    $personal_login = $zendesk_helper->getPersonalConfigValue('login');
    if ($personal_login && $personal_login != '') {
        $read_only = false;
        $zendesk_login = $personal_login;
        $zendesk_password = $zendesk_helper->getPersonalConfigValue('password');
    } else {
        $zendesk_login = $zendesk_helper->getGlobalConfigValue('login');
        $zendesk_password = $zendesk_helper->getGlobalConfigValue('password');
    }
    $c = new Zendesk($zendesk_instance, $zendesk_login, $zendesk_password, true, $zendesk_https);
    $c->read_only = $read_only;
    return $c;
}
Beispiel #8
0
 /**
  * Sole constructor
  */
 function SugarPHPMailer()
 {
     global $locale;
     global $current_user;
     global $sugar_config;
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
         $this->disclosureEnabled = true;
         $this->disclosureText = $admin->settings['disclosure_text'];
     }
     $this->oe = new OutboundEmail();
     $this->oe->getUserMailerSettings($current_user);
     $this->SetLanguage('en', 'include/phpmailer/language/');
     $this->PluginDir = 'include/phpmailer/';
     $this->Mailer = 'sendmail';
     // cn: i18n
     $this->CharSet = $locale->getPrecedentPreference('default_email_charset');
     $this->Encoding = 'quoted-printable';
     $this->IsHTML(false);
     // default to plain-text email
     $this->Hostname = $sugar_config['host_name'];
     $this->WordWrap = 996;
     // cn: gmail fix
     $this->protocol = $this->oe->mail_smtpssl == 1 ? "ssl://" : $this->protocol;
 }
Beispiel #9
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale;
     $configurator = new Configurator();
     $sugarConfig = SugarConfig::getInstance();
     $focus = new Administration();
     $configurator->parseLoggerSettings();
     $focus->retrieveSettings();
     if (!empty($_POST['restore'])) {
         $configurator->restoreConfig();
     }
     $this->ss->assign('MOD', $mod_strings);
     $this->ss->assign('APP', $app_strings);
     $this->ss->assign('APP_LIST', $app_list_strings);
     $this->ss->assign('config', $configurator->config);
     $this->ss->assign('error', $configurator->errors);
     $this->ss->assign("AUTO_REFRESH_INTERVAL_OPTIONS", get_select_options_with_id($app_list_strings['dashlet_auto_refresh_options_admin'], isset($configurator->config['dashlet_auto_refresh_min']) ? $configurator->config['dashlet_auto_refresh_min'] : 30));
     $this->ss->assign('LANGUAGES', get_languages());
     $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("settings", $focus->settings);
     $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
     if (!empty($focus->settings['proxy_on'])) {
         $this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline');
     } else {
         $this->ss->assign("PROXY_CONFIG_DISPLAY", 'none');
     }
     if (!empty($focus->settings['proxy_auth'])) {
         $this->ss->assign("PROXY_AUTH_DISPLAY", 'inline');
     } else {
         $this->ss->assign("PROXY_AUTH_DISPLAY", 'none');
     }
     if (!empty($configurator->config['logger']['level'])) {
         $this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), $configurator->config['logger']['level']));
     } else {
         $this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), ''));
     }
     if (!empty($configurator->config['lead_conv_activity_opt'])) {
         $this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), $configurator->config['lead_conv_activity_opt']));
     } else {
         $this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), ''));
     }
     if (!empty($configurator->config['logger']['file']['suffix'])) {
         $this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, $configurator->config['logger']['file']['suffix']));
     } else {
         $this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, ''));
     }
     echo $this->getModuleTitle(false);
     $this->ss->display('modules/Configurator/tpls/EditView.tpl');
     $javascript = new javascript();
     $javascript->setFormName("ConfigureSettings");
     $javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, "");
     $javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, "");
     $javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, "");
     $javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, "");
     $javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, "");
     $javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, "");
     echo $javascript->getScript();
 }
Beispiel #10
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the portal information.
  * If portal is not enabled then don't show the portal fields.
  */
 public function display()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     parent::display();
 }
Beispiel #11
0
 /**
  * @see SugarView::display()
  * 
  * We are overridding the display method to manipulate the sectionPanels.
  * If portal is not enabled then don't show the Portal Information panel.
  */
 public function display()
 {
     $this->ev->process();
     $admin = new Administration();
     $admin->retrieveSettings();
     if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) {
         unset($this->ev->sectionPanels[strtoupper('lbl_portal_information')]);
     }
     echo $this->ev->display($this->showTitle);
 }
Beispiel #12
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the portal information.
  * If portal is not enabled then don't show the portal fields.
  */
 public function display()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     //echo('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>');
     parent::display();
 }
Beispiel #13
0
 public function display()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     parent::display();
     echo "<script src='custom/include/javascript/ajaxButton.js'></script>";
 }
 public function setUp()
 {
     $startTime = microtime();
     $system_config = new Administration();
     $system_config->retrieveSettings();
     $GLOBALS['system_config'] = $system_config;
     $this->_app = new SugarApplicationMock();
     if (isset($_SESSION['authenticated_user_theme'])) {
         unset($_SESSION['authenticated_user_theme']);
     }
 }
Beispiel #15
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');
 }
 public function action_display()
 {
     require_once 'modules/Administration/Administration.php';
     $administration = new Administration();
     $administration->retrieveSettings();
     $api_key = $administration->settings['Nexmo_api_key'];
     echo $administration->settings['Nexmo_api_key'] . '<br>';
     echo $administration->settings['Nexmo_api_secret'] . '<br>';
     echo $administration->settings['Nexmo_budget'] . '<br>';
     echo $administration->settings['Nexmo_send_msg'] . '<br>';
 }
 /**
  * display
  *
  * We are overridding the display method to manipulate the portal information.
  * If portal is not enabled then don't show the portal fields.
  */
 function display()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::DVPopupHtml('Contacts');
     parent::display();
 }
Beispiel #18
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, '');
     }
 }
 public function testactivateAndDisableModuleFeed()
 {
     $admin = new Administration();
     //test activateModuleFeed method
     SugarFeed::activateModuleFeed('Accounts');
     $admin->retrieveSettings('sugarfeed');
     $this->assertEquals(1, $admin->settings['sugarfeed_module_Accounts']);
     //test disableModuleFeed method
     SugarFeed::disableModuleFeed('Accounts');
     $admin->retrieveSettings('sugarfeed');
     $this->assertEquals(0, $admin->settings['sugarfeed_module_Accounts']);
 }
Beispiel #20
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the portal information.
  * If portal is not enabled then don't show the portal fields.
  */
 public function display()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     echo "<script src='custom/include/javascript/ajaxButton.js'></script>";
     parent::display();
     echo "<input title='Отправить презентацию' class='button' onclick='window.open(\"index.php?module=Contacts&action=send_presentation&id={$_REQUEST['record']}\")' value='Отправить презентацию' type='button'>";
     echo "\n\t\t<style>\n\t\t\t._realty_interests_{\n\t\t\t\tbackground-color:#fff;\n\t\t\t\tborder:1px solid #222;\n\t\t\t\twidth:250px;\n\t\t\t\tpadding:1px;\n\t\t\t\tmargin:0px;\n\t\t\t}\n\t\t\t._realty_interests_ li{\n\t\t\t\tpadding:2px;\n\t\t\t\tmargin:0px;\n\t\t\t}\n\t\t\t._realty_interests_ li:hover{\n\t\t\t\tbackground-color:#24D;\n\t\t\t\tcolor:#fff;\n\t\t\t}\n\t\t</style>";
 }
 public function testget_config_prefix()
 {
     $admin = new Administration();
     //test with empty string
     $expected = array(false, false);
     $actual = $admin->get_config_prefix('');
     $this->assertSame($expected, $actual);
     //test with a valid string
     $expected = array('category', 'test');
     $actual = $admin->get_config_prefix('category_test');
     $this->assertSame($expected, $actual);
 }
 /**
  * Gets configs
  * 
  * @return array
  */
 protected function getConfigs()
 {
     $configs = array();
     $admin = new Administration();
     $admin->retrieveSettings();
     foreach ($admin->settings as $setting_name => $setting_value) {
         if (stristr($setting_name, 'portal_')) {
             $key = str_replace('portal_', '', $setting_name);
             $configs[$key] = json_decode(html_entity_decode($setting_value), true);
         }
     }
     return $configs;
 }
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');
        }
    }
}
Beispiel #24
0
 public function display()
 {
     global $dictionary;
     global $current_user;
     global $beanList, $beanFiles;
     global $app_list_strings;
     echo $this->getModuleTitle();
     $this->ss->assign("RETURN_MODULE", "Administration");
     $this->ss->assign("RETURN_ACTION", "index");
     $admin = new Administration();
     $admin->retrieveSettings('system');
     $this->ss->assign('system_zendesk_status_map', $admin->settings['system_zendesk_status_map']);
     $this->ss->assign('system_zendesk_status_map_0', $admin->settings['system_zendesk_status_map_0']);
     $this->ss->assign('system_zendesk_status_map_1', $admin->settings['system_zendesk_status_map_1']);
     $this->ss->assign('system_zendesk_status_map_2', $admin->settings['system_zendesk_status_map_2']);
     $this->ss->assign('system_zendesk_status_map_3', $admin->settings['system_zendesk_status_map_3']);
     $this->ss->assign('system_zendesk_status_map_4', $admin->settings['system_zendesk_status_map_4']);
     $this->ss->assign('system_zendesk_type_map', $admin->settings['system_zendesk_type_map']);
     $this->ss->assign('system_zendesk_type_map_0', $admin->settings['system_zendesk_type_map_0']);
     $this->ss->assign('system_zendesk_type_map_1', $admin->settings['system_zendesk_type_map_1']);
     $this->ss->assign('system_zendesk_type_map_2', $admin->settings['system_zendesk_type_map_2']);
     $this->ss->assign('system_zendesk_type_map_3', $admin->settings['system_zendesk_type_map_3']);
     $this->ss->assign('system_zendesk_type_map_4', $admin->settings['system_zendesk_type_map_4']);
     $this->ss->assign('system_zendesk_priority_map', $admin->settings['system_zendesk_priority_map']);
     $this->ss->assign('system_zendesk_priority_map_0', $admin->settings['system_zendesk_priority_map_0']);
     $this->ss->assign('system_zendesk_priority_map_1', $admin->settings['system_zendesk_priority_map_1']);
     $this->ss->assign('system_zendesk_priority_map_2', $admin->settings['system_zendesk_priority_map_2']);
     $this->ss->assign('system_zendesk_priority_map_3', $admin->settings['system_zendesk_priority_map_3']);
     $this->ss->assign('system_zendesk_priority_map_4', $admin->settings['system_zendesk_priority_map_4']);
     $fields = array();
     $dropdowns = array();
     $bean = new aCase();
     foreach ($dictionary[$bean->object_name]['fields'] as $name => $field_meta) {
         if ($field_meta['type'] != 'link') {
             $field_name = translate($field_meta['vname'], $bean->module_dir);
             $field_name = preg_replace('/:\\s*$/', '', $field_name);
             if ($field_name != '') {
                 if ($field_meta['type'] == 'enum' || $field_meta['type'] == 'varchar' || $field_meta['type'] == 'text' || $field_meta['type'] == 'name') {
                     $fields[$name] = $field_name;
                 }
                 if ($field_meta['type'] == 'enum') {
                     $dropdowns[$name] = $app_list_strings[$field_meta['options']];
                 }
             }
         }
     }
     asort($fields);
     $this->ss->assign('case_fields', $fields);
     $this->ss->assign('dropdowns', $dropdowns);
     $this->ss->display('modules/zd_Tickets/tpls/syncconfig.tpl');
 }
Beispiel #25
0
 /**
  * setup
  * This is a private method used to load the configuration settings whereby
  * monitors may be disabled via the Admin settings interface
  *
  */
 private function setup()
 {
     if (!empty($this->metadata) && empty($GLOBALS['installing'])) {
         $admin = new Administration();
         $admin->retrieveSettings('tracker');
         foreach ($this->metadata as $key => $entry) {
             if (isset($entry['bean'])) {
                 if (!empty($admin->settings['tracker_' . $entry['name']])) {
                     $this->disabledMonitors[$entry['name']] = true;
                 }
             }
         }
     }
 }
 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);
     }
 }
Beispiel #27
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the portal information.
  * If portal is not enabled then don't show the portal fields.
  */
 public function display()
 {
     global $sugar_config;
     $aop_portal_enabled = !empty($sugar_config['aop']['enable_portal']) && !empty($sugar_config['aop']['enable_aop']);
     $this->ss->assign("AOP_PORTAL_ENABLED", $aop_portal_enabled);
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::DVPopupHtml('Contacts');
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     parent::display();
 }
 public function setUp()
 {
     $startTime = microtime();
     $system_config = new Administration();
     $system_config->retrieveSettings();
     $GLOBALS['system_config'] = $system_config;
     $this->_app = new SugarApplicationMock();
     if (isset($_SESSION['authenticated_user_theme'])) {
         unset($_SESSION['authenticated_user_theme']);
     }
     if (isset($GLOBALS['sugar_config']['http_referer'])) {
         $this->prevRefererList = $GLOBALS['sugar_config']['http_referer'];
     }
     $GLOBALS['sugar_config']['http_referer'] = array('list' => array(), 'actions' => array());
 }
 public static function driver()
 {
     if (class_exists('Administration')) {
         return Administration::instance()->Configuration;
     }
     return Frontend::instance()->Configuration;
 }
 function generate($items, $subsection_field, $subsection_id, $entry_id = NULL, $full = false)
 {
     if (!is_array($items)) {
         $items = array($items);
     }
     $this->_Items = $items;
     // Fetch subsection meta data
     $meta = Administration::instance()->Database->fetch("SELECT filter_tags, caption, show_preview\n\t\t\t\tFROM tbl_fields_subsectionmanager\n\t\t\t\tWHERE field_id = '{$subsection_field}'\n\t\t\t\tLIMIT 1");
     // Get display mode
     if ($meta[0]['show_preview'] == 'yes') {
         $mode = 'preview';
     } else {
         $mode = 'plain';
     }
     // Fetch entry data
     $sectionManager = new SectionManager($this->_Parent);
     $subsection = $sectionManager->fetch($subsection_id, 'ASC', 'name');
     $fields = $subsection->fetchFields();
     $entries = $this->__filterEntries($subsection_id, $fields, $meta[0]['filter_tags'], $entry_id);
     // Check caption
     $caption = $meta[0]['caption'];
     if ($caption == '') {
         // Fetch name of primary field in subsection
         $primary = Administration::instance()->Database->fetch("SELECT element_name\n\t\t\t\t\tFROM tbl_fields\n\t\t\t\t\tWHERE parent_section = '{$subsection_id}'\n\t\t\t\t\tAND sortorder = '0'\n\t\t\t\t\tLIMIT 1");
         $caption = '{$' . $primary[0]['element_name'] . '}';
     }
     // Layout subsection data
     $data = $this->__layoutSubsection($entries, $fields, $caption, $mode, $full);
     return $data;
 }