Exemplo n.º 1
0
 protected function upgradeLocaleNameFormat($name_format)
 {
     if (!in_array($name_format, $this->config['name_formats'])) {
         $new_config = sugarArrayMerge($this->config['name_formats'], array($name_format => $name_format));
         $this->upgrader->config['name_formats'] = $new_config;
     }
 }
 function handleOverride()
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     $overrideArray = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMerge($overrideArray, $diffArray);
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (strcmp("{$val}", 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (strcmp("{$val}", 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
 function display()
 {
     $this->parser = ParserFactory::getParser(MB_PORTAL . strtolower($this->editLayout), $this->editModule, null, null, MB_PORTAL);
     $smarty = new Sugar_Smarty();
     //Add in the module we are viewing to our current mod strings
     global $mod_strings, $current_language;
     $editModStrings = return_module_language($current_language, $this->editModule);
     $mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('MOD', $mod_strings);
     // assign buttons
     $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
     foreach ($images as $image => $file) {
         $smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file));
     }
     $smarty->assign('icon_delete', SugarThemeRegistry::current()->getImage('icon_Delete', '', 48, 48, '.gif', $mod_strings['LBL_MB_DELETE']));
     $buttons = array();
     $buttons[] = array('id' => 'saveBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_save'], '', null, null, '.gif', $mod_strings['LBL_BTN_SAVE']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handleSave();'");
     $buttons[] = array('id' => 'publishBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_publish'], '', null, null, '.gif', $mod_strings['LBL_BTN_PUBLISH']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handlePublish();'");
     $html = "";
     foreach ($buttons as $button) {
         if ($button['id'] == "spacer") {
             $html .= "<td style='width:{$button['width']}'> </td>";
         } else {
             $html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $this->parser->getAvailableFields());
     $smarty->assign('field_defs', $this->parser->getFieldDefs());
     $smarty->assign('layout', $this->parser->getLayout());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('calc_field_list', json_encode($this->parser->getCalculatedFields()));
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $this->parser->getMaxColumns());
     $smarty->assign('fieldwidth', '150px');
     $smarty->assign('translate', true);
     $smarty->assign('fromPortal', true);
     // flag for form submittal - when the layout is submitted the actions are the same for layouts and portal layouts, but the parsers must be different...
     if (!empty($this->parser->usingWorkingFile)) {
         $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_LAYOUT_PREVIEW']);
     } else {
         $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_CURRENT_LAYOUT']);
     }
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
     $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&layout=1")');
     $ajax->addCrumb(ucwords(translate('LBL_MODULE_NAME', $this->editModule)), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&view_module=' . $this->editModule . '")');
     $ajax->addCrumb(ucwords($this->editLayout), '');
     // set up language files
     $smarty->assign('language', $this->parser->getLanguage());
     // for sugar_translate in the smarty template
     //navjeet- assistant logic has changed
     //include('modules/ModuleBuilder/language/en_us.lang.php');
     //$smarty->assign('assistantBody', $mod_strings['assistantHelp']['module']['editView'] );
     $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_EDIT_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
     echo $ajax->getJavascript();
 }
Exemplo n.º 4
0
 public function testSugarArrayMergeMergesTwoArraysWithLikeKeysOverwritingExistingKeys()
 {
     $foo = array('one' => 123, 'two' => 123, 'foo' => array('int' => 123, 'foo' => 'bar'));
     $bar = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'bar' => 'foo'));
     $expected = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'foo' => 'bar', 'bar' => 'foo'));
     $this->assertEquals(sugarArrayMerge($foo, $bar), $expected);
     // insure that internal functions can't duplicate behavior
     $this->assertNotEquals(array_merge($foo, $bar), $expected);
     $this->assertNotEquals(array_merge_recursive($foo, $bar), $expected);
 }
Exemplo n.º 5
0
 /**
  * Returns an array with an element for each index
  *
  * @return array
  */
 public function getDuplicateCheckIndexes()
 {
     $super_language_pack = sugarArrayMerge(return_module_language($GLOBALS['current_language'], $this->_focus->module_dir), $GLOBALS['app_strings']);
     $index_array = array();
     foreach ($this->_getIndexVardefs() as $index) {
         if ($index['type'] == "index") {
             $labelsArray = array();
             foreach ($index['fields'] as $field) {
                 if ($field == 'deleted') {
                     continue;
                 }
                 $fieldDef = $this->_focus->getFieldDefinition($field);
                 if (isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']])) {
                     $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']];
                 } else {
                     $labelsArray[$fieldDef['name']] = $fieldDef['name'];
                 }
             }
             $index_array[$index['name']] = str_replace(":", "", implode(", ", $labelsArray));
         }
     }
     return $index_array;
 }
Exemplo n.º 6
0
     foreach ($config['languages'] as $k => $v) {
         $sugar_config['languages'][$k] = $v;
     }
 } else {
     writeLog('*** ERROR: install/lang.config.php was not found and writen to config.php!!');
 }
 if (isset($sugar_config['sugarbeet'])) {
     //$sugar_config['sugarbeet'] is only set in COMM
     unset($sugar_config['sugarbeet']);
 }
 if (isset($sugar_config['disable_team_access_check'])) {
     //no need to write to config.php
     unset($sugar_config['disable_team_access_check']);
 }
 $passwordsetting_defaults = array('passwordsetting' => array('minpwdlength' => '', 'maxpwdlength' => '', 'oneupper' => '', 'onelower' => '', 'onenumber' => '', 'onespecial' => '', 'SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'customregex' => '', 'regexcomment' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'userexpiration' => '0', 'userexpirationtime' => '', 'userexpirationtype' => '1', 'userexpirationlogin' => '', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '', 'lockoutexpiration' => '0', 'lockoutexpirationtime' => '', 'lockoutexpirationtype' => '1', 'lockoutexpirationlogin' => ''));
 $sugar_config = sugarArrayMerge($passwordsetting_defaults, $sugar_config);
 writeLog('Set default_max_tabs to 7');
 $sugar_config['default_max_tabs'] = '7';
 writeLog('Set default_theme to Sugar');
 $sugar_config['default_theme'] = 'Sugar';
 writeLog('Upgrading tracker dashlets for sales and marketing start.');
 upgradeDashletsForSalesAndMarketing();
 writeLog('Done upgrading tracker dashlets.');
 // Update admin values
 writeLog("Updating license values");
 $admin = new Administration();
 $admin->saveSetting('license', 'users', 0);
 $key = array('num_lic_oc', 'key', 'expire_date');
 foreach ($key as $k) {
     $admin->saveSetting('license', $k, '');
 }
Exemplo n.º 7
0
/**
 * This function will merge password default settings into config file
 * @param   $sugar_config
 * @param   $sugar_version
 * @return  bool true if successful
 */
function merge_passwordsetting($sugar_config, $sugar_version)
{
    $passwordsetting_defaults = array('passwordsetting' => array('minpwdlength' => '', 'maxpwdlength' => '', 'oneupper' => '', 'onelower' => '', 'onenumber' => '', 'onespecial' => '', 'SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'customregex' => '', 'regexcomment' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'userexpiration' => '0', 'userexpirationtime' => '', 'userexpirationtype' => '1', 'userexpirationlogin' => '', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '', 'lockoutexpiration' => '0', 'lockoutexpirationtime' => '', 'lockoutexpirationtype' => '1', 'lockoutexpirationlogin' => ''));
    $sugar_config = sugarArrayMerge($passwordsetting_defaults, $sugar_config);
    // need to override version with default no matter what
    $sugar_config['sugar_version'] = $sugar_version;
    ksort($sugar_config);
    if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 8
0
 /**
  * Initializes an element for processing
  * @param array $element Element metadata
  * @return array
  */
 function initElement($element, $alwaysMerge)
 {
     if ($this->isValidElement($element)) {
         $mergedElement = sugarArrayMerge($this->defaults, $element);
         foreach ($alwaysMerge as $key => $val) {
             if (!isset($mergedElement[$key])) {
                 $mergedElement[$key] = $val;
             }
         }
         if ($this->debugMode) {
             foreach ($this->elementRequired as $k => $v) {
                 if (!array_key_exists($v, $mergedElement) && !isset($mergedElement['handlers'])) {
                     $this->debugOutput("Element is missing required field after initialization: [ {$v} ].");
                 }
             }
         }
         // iterate through "handlers - mini-elements"
         if (isset($mergedElement['handlers'])) {
             if (is_array($mergedElement['handlers']) && !empty($mergedElement['handlers'])) {
                 foreach ($mergedElement['handlers'] as $miniKey => $miniElement) {
                     // apply parent element's properties to mini-element
                     foreach ($mergedElement as $key => $el) {
                         if ($key != 'handlers' && !isset($miniElement[$key])) {
                             // || empty($miniElement[$key])
                             $miniElement[$key] = $mergedElement[$key];
                         }
                     }
                     $miniElement = $this->initElement($miniElement, $alwaysMerge);
                     $mergedElement['handlers'][$miniKey] = $miniElement;
                 }
             } else {
                 if ($this->debugMode) {
                     $this->debugOutput("SugarRouting: element contains 'handlers' but is not an array:");
                     $this->debugOutput($mergedElement);
                 }
             }
         }
         return $mergedElement;
     } else {
         if ($this->debugMode) {
             $this->debugOutput("SugarRouting is trying to initialize a non-element:");
             $this->debugOutput($element);
         }
     }
 }
Exemplo n.º 9
0
/**
 * Checks if a locale name format is part of the default list, if not adds it to the config
 * @param $name_format string a local name format string such as 's f l'
 * @return bool true on successful write to config file, false on failure;
 */
function upgradeLocaleNameFormat($name_format)
{
    global $sugar_config, $sugar_version;
    $localization = new Localization();
    $localeConfigDefaults = $localization->getLocaleConfigDefaults();
    $uw_strings = return_module_language($GLOBALS['current_language'], 'UpgradeWizard');
    if (empty($sugar_config['name_formats'])) {
        $sugar_config['name_formats'] = $localeConfigDefaults['name_formats'];
        if (!rebuildConfigFile($sugar_config, $sugar_version)) {
            $errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
        }
    }
    if (!in_array($name_format, $sugar_config['name_formats'])) {
        $new_config = sugarArrayMerge($sugar_config['name_formats'], array($name_format => $name_format));
        $sugar_config['name_formats'] = $new_config;
        if (!rebuildConfigFile($sugar_config, $sugar_version)) {
            $errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
            return false;
        }
    }
    return true;
}
Exemplo n.º 10
0
 /**
  *
  */
 function process_page()
 {
     global $focus;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $odd_bg;
     global $even_bg;
     global $timedate;
     $history_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable]));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if (empty($task->date_due) || $task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => strtotime($task->fetched_row['date_due'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
             $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact');
             if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
                 $meeting->contact_id = $meeting_contacts[0]->id;
                 $meeting->contact_name = $meeting_contacts[0]->name;
             }
         }
         if ($meeting->status != "Planned") {
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($meeting->fetched_row['date_start'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if (empty($call->contact_id) && empty($call->contact_name)) {
             $call_contacts = $call->get_linked_beans('contacts', 'Contact');
             if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
                 $call->contact_id = $call_contacts[0]->id;
                 $call->contact_name = $call_contacts[0]->name;
             }
         }
         if ($call->status != "Planned") {
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($call->fetched_row['date_start'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         if (empty($email->contact_id) && empty($email->contact_name)) {
             $email_contacts = $email->get_linked_beans('contacts', 'Contact');
             if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
                 $email->contact_id = $email_contacts[0]->id;
                 $email->contact_name = $email_contacts[0]->name;
             }
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
     }
     //end Emails
     // Bug 46439 'No email archived when clicking on View Summary' (All condition)
     if (method_exists($focus, 'get_unlinked_email_query')) {
         $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
         $query = $queryArray['select'];
         $query .= $queryArray['from'];
         if (!empty($queryArray['join_tables'])) {
             foreach ($queryArray['join_tables'] as $join_table) {
                 if ($join_table != '') {
                     $query .= ', ' . $join_table . ' ';
                 }
             }
         }
         $query .= $queryArray['join'];
         $query .= $queryArray['where'];
         $emails = new Email();
         $focus_unlinked_emails_list = $emails->process_list_query($query, 0);
         $focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
         foreach ($focus_unlinked_emails_list as $email) {
             $email->retrieve($email->id);
             $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
         }
     }
     //end Unlinked Emails
     foreach ($focus_notes_list as $note) {
         $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
         if (!empty($note->filename)) {
             $count = count($history_list);
             $count--;
             $history_list[$count]['filename'] = $note->filename;
             $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
         }
     }
     // end Notes
     $xtpl = new XTemplate('modules/Activities/Popup_picker.html');
     $xtpl->assign('MOD', $mod_strings);
     $xtpl->assign('APP', $app_strings);
     insert_popup_header();
     //output header
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
     echo getClassicModuleTitle($focus->module_dir, array(translate('LBL_MODULE_NAME', $focus->module_dir), $focus->name), false);
     echo "</td><td align='right' class='moduleTitle'>";
     echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a>&nbsp;<A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
     echo "</td></tr></table>";
     $oddRow = true;
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $xtpl->assign("ACTIVITY", $activity_fields);
         $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
         if ($oddRow) {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'oddListRow');
             $xtpl->assign("BG_COLOR", $odd_bg);
         } else {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'evenListRow');
             $xtpl->assign("BG_COLOR", $even_bg);
         }
         $oddRow = !$oddRow;
         if (!empty($activity_fields['DESCRIPTION'])) {
             $xtpl->parse("history.row.description");
         }
         $xtpl->parse("history.row");
         // Put the rows in.
     }
     $xtpl->parse("history");
     $xtpl->out("history");
     insert_popup_footer();
 }
Exemplo n.º 11
0
 function widgetDisplay($widget_def, $use_default = false)
 {
     $theclass = $this->getClassFromWidgetDef($widget_def, $use_default);
     $label = isset($widget_def['module']) ? $widget_def['module'] : '';
     if (is_subclass_of($theclass, 'SugarWidgetSubPanelTopButton')) {
         $label = $theclass->get_subpanel_relationship_name($widget_def);
     }
     $theclass->setWidgetId($label);
     //#27426
     $fieldDef = $this->getFieldDef($widget_def);
     if (!empty($fieldDef) && !empty($fieldDef['type']) && strtolower(trim($fieldDef['type'])) == 'multienum') {
         $widget_def['fields'] = sugarArrayMerge($widget_def['fields'], $fieldDef);
         $widget_def['fields']['module'] = $label;
     }
     //end
     return $theclass->display($widget_def);
 }
Exemplo n.º 12
0
 function display($preview = false)
 {
     global $mod_strings;
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->package);
     $history = $parser->getHistory();
     $smarty = new Sugar_Smarty();
     //Add in the module we are viewing to our current mod strings
     if (!$this->fromModuleBuilder) {
         global $current_language;
         $editModStrings = return_module_language($current_language, $this->editModule);
         $mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
     }
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('MOD', $mod_strings);
     // assign buttons
     $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
     foreach ($images as $image => $file) {
         $smarty->assign($image, SugarThemeRegistry::current()->getImage($file));
     }
     $buttons = array();
     if ($preview) {
         $smarty->assign('layouttitle', translate('LBL_LAYOUT_PREVIEW', 'ModuleBuilder'));
     } else {
         $smarty->assign('layouttitle', translate('LBL_CURRENT_LAYOUT', 'ModuleBuilder'));
         if (!$this->fromModuleBuilder) {
             $buttons[] = array('id' => 'saveBtn', 'text' => translate('LBL_BTN_SAVE'), 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handleSave();'");
             $buttons[] = array('id' => 'publishBtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handlePublish();'");
             $buttons[] = array('id' => 'spacer', 'width' => '50px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'");
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'");
         } else {
             $buttons[] = array('id' => 'saveBtn', 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handlePublish();'");
             $buttons[] = array('id' => 'spacer', 'width' => '50px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'");
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'");
         }
     }
     $html = "";
     foreach ($buttons as $button) {
         if ($button['id'] == "spacer") {
             $html .= "<td style='width:{$button['width']}'> </td>";
         } else {
             $html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $parser->getAvailableFields());
     $smarty->assign('layout', $parser->getLayout());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $parser->getMaxColumns());
     $smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
     $smarty->assign('fieldwidth', 150);
     $smarty->assign('translate', true);
     if ($this->fromModuleBuilder) {
         $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
         $smarty->assign('view_package', $this->package);
     }
     $labels = array(MB_EDITVIEW => 'LBL_EDITVIEW', MB_DETAILVIEW => 'LBL_DETAILVIEW', MB_QUICKCREATE => 'LBL_QUICKCREATE');
     $layoutLabel = 'LBL_LAYOUTS';
     $layoutView = 'layouts';
     $ajax = new AjaxCompose();
     $viewType;
     $translatedViewType = '';
     if (isset($labels[strtolower($this->editLayout)])) {
         $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
     }
     if ($this->fromModuleBuilder) {
         $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")');
         $ajax->addCrumb($this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")');
         $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '&view_package=' . $this->package . '")');
         $ajax->addCrumb($translatedViewType, '');
     } else {
         $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")');
         $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb($translatedViewType, '');
     }
     // set up language files
     $smarty->assign('language', $parser->getLanguage());
     // for sugar_translate in the smarty template
     $smarty->assign('from_mb', $this->fromModuleBuilder);
     $ajax->addSection('center', $translatedViewType, $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
     if ($preview) {
         echo $smarty->fetch('modules/ModuleBuilder/tpls/Preview/layoutView.tpl');
     } else {
         echo $ajax->getJavascript();
     }
 }
 /**
  * Returns the history.
  *
  * @param $api
  * @param $args
  * @return array|mixed
  */
 public function getHistory($api, $args)
 {
     global $app_strings;
     global $app_list_strings;
     global $timedate;
     $history_list = array();
     $focus = BeanFactory::getBean($args['module'], $args['id']);
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable], array(), 0, 100));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if (empty($task->date_due) || $task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $ts = '';
             if (!empty($task->fetched_row['date_due'])) {
                 //tasks can have an empty date due field
                 $ts = $timedate->fromDb($task->fetched_row['date_due'])->ts;
             }
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $ts);
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
             $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
                 $meeting->contact_id = $meeting_contacts[0]->id;
                 $meeting->contact_name = $meeting_contacts[0]->name;
             }
         }
         if ($meeting->status != "Planned") {
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($meeting->fetched_row['date_start'])->ts);
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if (empty($call->contact_id) && empty($call->contact_name)) {
             $call_contacts = $call->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
                 $call->contact_id = $call_contacts[0]->id;
                 $call->contact_name = $call_contacts[0]->name;
             }
         }
         if ($call->status != "Planned") {
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($call->fetched_row['date_start'])->ts);
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         if (empty($email->contact_id) && empty($email->contact_name)) {
             $email_contacts = $email->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
                 $email->contact_id = $email_contacts[0]->id;
                 $email->contact_name = $email_contacts[0]->name;
             }
         }
         $ts = '';
         if (!empty($email->fetched_row['date_sent'])) {
             //emails can have an empty date sent field
             $ts = $timedate->fromDb($email->fetched_row['date_sent'])->ts;
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $ts);
     }
     //end Emails
     // Bug 46439 'No email archived when clicking on View Summary' (All condition)
     if (method_exists($focus, 'get_unlinked_email_query')) {
         $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
         $query = $queryArray['select'];
         $query .= $queryArray['from'];
         if (!empty($queryArray['join_tables'])) {
             foreach ($queryArray['join_tables'] as $join_table) {
                 if ($join_table != '') {
                     $query .= ', ' . $join_table . ' ';
                 }
             }
         }
         $query .= $queryArray['join'];
         $query .= $queryArray['where'];
         $emails = BeanFactory::getBean('Emails');
         $focus_unlinked_emails_list = $emails->process_list_query($query, 0);
         $focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
         foreach ($focus_unlinked_emails_list as $email) {
             $email->retrieve($email->id);
             $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
         }
     }
     //end Unlinked Emails
     foreach ($focus_notes_list as $note) {
         if ($note->ACLAccess('view')) {
             $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
             if (!empty($note->filename)) {
                 $count = count($history_list);
                 $count--;
                 $history_list[$count]['filename'] = $note->filename;
                 $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
             }
         }
     }
     // end Notes
     $oddRow = true;
     $result = array();
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "border='0' align='absmiddle'", null, null, '.gif', $activity['filename']) . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $result[] = $activity;
     }
     if (isset($focus->name)) {
         $name = $focus->name;
     } else {
         if ($focus->full_name) {
             $name = $focus->full_name;
         }
     }
     $response = array('module_key' => $focus->module_name, 'name' => $name, 'history' => $result);
     return $response;
 }
Exemplo n.º 14
0
    $storeQuery->saveFromRequest($currentModule);
}
// setup for search form
$thisMod = 'Reports';
$searchForm = new SearchFormReports($thisMod, $savedReportsSeed);
$searchForm->tabs = array(array('title' => $app_strings['LNK_BASIC_SEARCH'], 'link' => $thisMod . '|basic_search', 'key' => $thisMod . '|basic_search'), array('title' => $app_strings['LNK_ADVANCED_SEARCH'], 'link' => $thisMod . '|advanced_search', 'key' => $thisMod . '|advanced_search'));
$searchForm->populateFromRequest();
$searchForm->searchFields['module'] = $searchForm->searchFields['report_module'];
unset($searchForm->searchFields['report_module']);
$where_clauses = $searchForm->generateSearchWhere();
include 'include/modules.php';
$ACLAllowedModules = getACLAllowedModules();
$ACLUnAllowedModules = getACLDisAllowedModules();
$ACLAllowedModulesKeys = array_keys($ACLAllowedModules);
$listViewDefsNewArray = array();
$listViewDefsNewArray = sugarArrayMerge($listViewDefsNewArray, $listViewDefs);
unset($listViewDefsNewArray['Reports']['IS_EDIT']);
unset($listViewDefsNewArray['Reports']['LAST_RUN_DATE']);
foreach ($ACLUnAllowedModules as $module => $class_name) {
    array_push($where_clauses, "saved_reports.module != '{$module}'");
}
$reportModules = array();
foreach ($ACLAllowedModules as $key => $module) {
    $reportModules[$key] = isset($app_list_strings['moduleList'][$key]) ? $app_list_strings['moduleList'][$key] : $key;
}
asort($reportModules);
if (!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) {
    // handle ajax requests for search forms only
    switch ($_REQUEST['search_form_view']) {
        case 'basic_search':
            $searchForm->setup();
Exemplo n.º 15
0
 function getAppListStrings($language = 'en_us')
 {
     $language .= '.lang.php';
     if (!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php') {
         return sugarArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]);
     }
     if (!empty($this->appListStrings['en_us.lang.php'])) {
         return $this->appListStrings['en_us.lang.php'];
     }
     $empty = array();
     return $empty;
 }
Exemplo n.º 16
0
/**
 * This function will rebuild the config file
 * @param	$sugar_config
 * @param	$sugar_version
 * @return	bool true if successful
 */
function rebuildConfigFile($sugar_config, $sugar_version)
{
    // add defaults to missing values of in-memory sugar_config
    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
    if (isset($sugar_config['sugarbeet'])) {
        //$sugar_config['sugarbeet'] is only set in COMM
        unset($sugar_config['sugarbeet']);
    }
    if (isset($sugar_config['disable_team_access_check'])) {
        //$sugar_config['disable_team_access_check'] is a runtime configration,
        //no need to write to config.php
        unset($sugar_config['disable_team_access_check']);
    }
    // need to override version with default no matter what
    $sugar_config['sugar_version'] = $sugar_version;
    ksort($sugar_config);
    if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        return true;
    } else {
        return false;
    }
}
 protected static function loadLicenseStrings()
 {
     global $sugar_config, $currentModule, $current_language;
     //load license config file....if it isn't broken don't fix it
     $default_language = $sugar_config['default_language'];
     $langs = array();
     if ($current_language != 'en_us') {
         $langs[] = 'en_us';
     }
     if ($default_language != 'en_us' && $current_language != $default_language) {
         $langs[] = $default_language;
     }
     $langs[] = $current_language;
     foreach ($langs as $lang) {
         $license_strings = array();
         if (!@(include "modules/" . $currentModule . "/license/language/{$lang}.lang.php")) {
             //do nothing...lang file could not be found
         }
         $license_strings_array[] = $license_strings;
     }
     $license_strings = array();
     foreach ($license_strings_array as $license_strings_item) {
         $license_strings = sugarArrayMerge($license_strings, $license_strings_item);
     }
     return $license_strings;
 }
Exemplo n.º 18
0
 function display($preview = false)
 {
     global $mod_strings;
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->package);
     if (isset($this->view_object_map['new_parser'])) {
         $parser = $this->view_object_map['new_parser'];
     }
     $history = $parser->getHistory();
     $smarty = new Sugar_Smarty();
     //Add in the module we are viewing to our current mod strings
     if (!$this->fromModuleBuilder) {
         global $current_language;
         $editModStrings = return_module_language($current_language, $this->editModule);
         $mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
     }
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('MOD', $mod_strings);
     // assign buttons
     $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
     foreach ($images as $image => $file) {
         $smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file));
     }
     $requiredFields = implode($parser->getRequiredFields(), ',');
     $slashedRequiredFields = addslashes($requiredFields);
     $buttons = array();
     $disableLayout = false;
     if ($preview) {
         $smarty->assign('layouttitle', translate('LBL_LAYOUT_PREVIEW', 'ModuleBuilder'));
     } else {
         $smarty->assign('layouttitle', translate('LBL_CURRENT_LAYOUT', 'ModuleBuilder'));
         //Check if we need to synch edit view to other layouts
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $parser2 = ParserFactory::getParser(MB_EDITVIEW, $this->editModule, $this->package);
             if ($this->editLayout == MB_DETAILVIEW) {
                 $disableLayout = $parser2->getSyncDetailEditViews();
             }
             if (!empty($_REQUEST['copyFromEditView'])) {
                 $editViewPanels = $parser2->convertFromCanonicalForm($parser2->_viewdefs['panels'], $parser2->_fielddefs);
                 $parser->_viewdefs['panels'] = $editViewPanels;
                 $parser->_fielddefs = $parser2->_fielddefs;
                 $parser->setUseTabs($parser2->getUseTabs());
                 $parser->setTabDefs($parser2->getTabDefs());
             }
         }
         if (!$this->fromModuleBuilder) {
             $buttons[] = array('id' => 'saveBtn', 'text' => translate('LBL_BTN_SAVE'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handleSave();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'publishBtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         } else {
             $buttons[] = array('id' => 'saveBtn', 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         }
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $buttons[] = array('id' => 'copyFromEditView', 'text' => translate('LBL_COPY_FROM_EDITVIEW'), 'actionScript' => "onclick='ModuleBuilder.copyFromView(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
         }
     }
     $html = "";
     foreach ($buttons as $button) {
         if ($button['id'] == "spacer") {
             $html .= "<td style='width:{$button['width']}'> </td>";
         } else {
             $html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}'";
             if (!empty($button['disabled'])) {
                 $html .= " disabled";
             }
             $html .= "></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $parser->getAvailableFields());
     $smarty->assign('disable_layout', $disableLayout);
     $smarty->assign('required_fields', $requiredFields);
     $smarty->assign('layout', $parser->getLayout());
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $parser->getMaxColumns());
     $smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
     $smarty->assign('displayAsTabs', $parser->getUseTabs());
     $smarty->assign('tabDefs', $parser->getTabDefs());
     $smarty->assign('syncDetailEditViews', $parser->getSyncDetailEditViews());
     $smarty->assign('fieldwidth', 150);
     $smarty->assign('translate', $this->fromModuleBuilder ? false : true);
     if ($this->fromModuleBuilder) {
         $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
         $smarty->assign('view_package', $this->package);
     }
     $labels = array(MB_EDITVIEW => 'LBL_EDITVIEW', MB_DETAILVIEW => 'LBL_DETAILVIEW', MB_QUICKCREATE => 'LBL_QUICKCREATE');
     $layoutLabel = 'LBL_LAYOUTS';
     $layoutView = 'layouts';
     $ajax = new AjaxCompose();
     $translatedViewType = '';
     if (isset($labels[strtolower($this->editLayout)])) {
         $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
     } else {
         if (isset($this->sm)) {
             foreach ($this->sm->sources as $file => $def) {
                 if (!empty($def['view']) && $def['view'] == $this->editLayout && !empty($def['name'])) {
                     $translatedViewType = $def['name'];
                 }
             }
             if (empty($translatedViewType)) {
                 $label = "LBL_" . strtoupper($this->editLayout);
                 $translated = translate($label, $this->editModule);
                 if ($translated != $label) {
                     $translatedViewType = $translated;
                 }
             }
         }
     }
     if ($this->fromModuleBuilder) {
         $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")');
         $ajax->addCrumb($this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")');
         $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '&view_package=' . $this->package . '")');
         $ajax->addCrumb($translatedViewType, '');
     } else {
         $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")');
         $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb($translatedViewType, '');
     }
     // set up language files
     $smarty->assign('language', $parser->getLanguage());
     // for sugar_translate in the smarty template
     $smarty->assign('from_mb', $this->fromModuleBuilder);
     $smarty->assign('calc_field_list', json_encode($parser->getCalculatedFields()));
     if ($this->fromModuleBuilder) {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($this->package, $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
     }
     $ajax->addSection('center', $translatedViewType, $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
     if ($preview) {
         echo $smarty->fetch('modules/ModuleBuilder/tpls/Preview/layoutView.tpl');
     } else {
         echo $ajax->getJavascript();
     }
 }
Exemplo n.º 19
0
 function display($preview = false)
 {
     global $mod_strings;
     $params = array();
     if (!empty($_REQUEST['role'])) {
         $role = $params['role'] = $_REQUEST['role'];
     } else {
         $role = null;
     }
     $this->parser = $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->package, null, null, $params);
     $history = $parser->getHistory();
     $smarty = $this->getSmarty();
     //Add in the module we are viewing to our current mod strings
     if (!$this->fromModuleBuilder) {
         global $current_language;
         $editModStrings = return_module_language($current_language, $this->editModule);
         $mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
     }
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('MOD', $mod_strings);
     // assign buttons
     $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
     foreach ($images as $image => $file) {
         $smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file));
     }
     $requiredFields = implode($parser->getRequiredFields(), ',');
     $slashedRequiredFields = addslashes($requiredFields);
     $buttons = array();
     $disableLayout = false;
     if ($preview) {
         $smarty->assign('layouttitle', translate('LBL_LAYOUT_PREVIEW', 'ModuleBuilder'));
     } else {
         $smarty->assign('layouttitle', translate('LBL_CURRENT_LAYOUT', 'ModuleBuilder'));
         //Check if we need to synch edit view to other layouts
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $parser2 = ParserFactory::getParser(MB_EDITVIEW, $this->editModule, $this->package);
             if ($this->editLayout == MB_DETAILVIEW) {
                 $disableLayout = $parser2->getSyncDetailEditViews();
             }
             if (!empty($_REQUEST['copyFromEditView'])) {
                 $editViewPanels = $parser2->convertFromCanonicalForm($parser2->_viewdefs['panels'], $parser2->_fielddefs);
                 $parser->_viewdefs['panels'] = $editViewPanels;
                 $parser->_fielddefs = $parser2->_fielddefs;
                 $parser->setUseTabs($parser2->getUseTabs());
                 $parser->setTabDefs($parser2->getTabDefs());
             }
         }
         $buttons = $this->getButtons($history, $disableLayout, $params);
         $implementation = $parser->getImplementation();
         $roles = $this->getRoleList($implementation);
         $copyFromOptions = $this->getRoleListWithMetadata($roles, $role);
         $smarty->assign('copy_from_options', $copyFromOptions);
     }
     $smarty->assign('buttons', $this->getButtonHTML($buttons));
     // assign fields and layout
     $smarty->assign('available_fields', $parser->getAvailableFields());
     $smarty->assign('disable_layout', $disableLayout);
     $smarty->assign('required_fields', $requiredFields);
     $smarty->assign('layout', $parser->getLayout());
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('selected_role', $role);
     $smarty->assign('maxColumns', $parser->getMaxColumns());
     $smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
     $smarty->assign('displayAsTabs', $parser->getUseTabs());
     $smarty->assign('tabDefs', $parser->getTabDefs());
     $smarty->assign('syncDetailEditViews', $parser->getSyncDetailEditViews());
     $smarty->assign('fieldwidth', 300 / $parser->getMaxColumns());
     // Bug 57260 - LBL_PANEL_DEFAULT not translated for undeployed modules in layout editor
     $smarty->assign('translate', true);
     if ($this->fromModuleBuilder) {
         $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
         $smarty->assign('view_package', $this->package);
     }
     // Layout labels for the breadcrumb
     $labels = array(MB_EDITVIEW => 'LBL_EDITVIEW', MB_DETAILVIEW => 'LBL_DETAILVIEW', MB_QUICKCREATE => 'LBL_QUICKCREATE', MB_RECORDVIEW => 'LBL_RECORDVIEW', MB_WIRELESSEDITVIEW => 'LBL_WIRELESSEDITVIEW', MB_WIRELESSDETAILVIEW => 'LBL_WIRELESSDETAILVIEW');
     $layoutLabel = 'LBL_LAYOUTS';
     $layoutView = 'layouts';
     if (in_array($this->editLayout, array(MB_WIRELESSEDITVIEW, MB_WIRELESSDETAILVIEW))) {
         $layoutLabel = 'LBL_WIRELESSLAYOUTS';
         $layoutView = 'wirelesslayouts';
         $smarty->assign('wireless', true);
     }
     $ajax = new AjaxCompose();
     $translatedViewType = '';
     if (isset($labels[strtolower($this->editLayout)])) {
         $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
     } else {
         if (isset($this->sm)) {
             foreach ($this->sm->sources as $file => $def) {
                 if (!empty($def['view']) && $def['view'] == $this->editLayout && !empty($def['name'])) {
                     $translatedViewType = $def['name'];
                 }
             }
             if (empty($translatedViewType)) {
                 $label = "LBL_" . strtoupper($this->editLayout);
                 $translated = translate($label, $this->editModule);
                 if ($translated != $label) {
                     $translatedViewType = $translated;
                 }
             }
         }
     }
     if ($this->fromModuleBuilder) {
         $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")');
         $ajax->addCrumb($this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")');
         $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '&view_package=' . $this->package . '")');
         $ajax->addCrumb($translatedViewType, '');
     } else {
         $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")');
         $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb($translatedViewType, '');
     }
     // set up language files
     $smarty->assign('language', $parser->getLanguage());
     // for sugar_translate in the smarty template
     $smarty->assign('from_mb', $this->fromModuleBuilder);
     $smarty->assign('calc_field_list', json_encode($parser->getCalculatedFields()));
     if ($this->fromModuleBuilder) {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($this->package, $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
     }
     $ajax->addSection('center', $translatedViewType, $smarty->fetch(SugarAutoLoader::existingCustomOne('modules/ModuleBuilder/tpls/layoutView.tpl')));
     if ($preview) {
         echo $smarty->fetch('modules/ModuleBuilder/tpls/Preview/layoutView.tpl');
     } else {
         echo $ajax->getJavascript();
     }
 }
Exemplo n.º 20
0
/**
 * This function will merge password default settings into config file
 * @param   $sugar_config
 * @param   $sugar_version
 * @return  bool true if successful
 */
function merge_passwordsetting($sugar_config, $sugar_version)
{
    $passwordsetting_defaults = array('passwordsetting' => array('SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => ''));
    $sugar_config = sugarArrayMerge($passwordsetting_defaults, $sugar_config);
    // need to override version with default no matter what
    $sugar_config['sugar_version'] = $sugar_version;
    ksort($sugar_config);
    if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 21
0
 function save($key_name, $duplicate = false, $rename = false)
 {
     $header = file_get_contents('modules/ModuleBuilder/MB/header.php');
     $save_path = $this->path . '/language';
     mkdir_recursive($save_path);
     foreach ($this->strings as $lang => $values) {
         //Check if the module Label has changed.
         $renameLang = $rename || empty($values) || $this->label != $values['LBL_MODULE_NAME'];
         $mod_strings = return_module_language(str_replace('.lang.php', '', $lang), 'ModuleBuilder');
         $required = array('LBL_LIST_FORM_TITLE' => $this->label . " " . $mod_strings['LBL_LIST'], 'LBL_MODULE_NAME' => $this->label, 'LBL_MODULE_TITLE' => $this->label, 'LBL_HOMEPAGE_TITLE' => $mod_strings['LBL_HOMEPAGE_PREFIX'] . " " . $this->label, 'LNK_NEW_RECORD' => $mod_strings['LBL_CREATE'] . " " . $this->label, 'LNK_LIST' => $mod_strings['LBL_VIEW'] . " " . $this->label, 'LNK_IMPORT_' . strtoupper($this->key_name) => translate('LBL_IMPORT') . " " . $this->label, 'LBL_SEARCH_FORM_TITLE' => $mod_strings['LBL_SEARCH'] . " " . $this->label, 'LBL_HISTORY_SUBPANEL_TITLE' => $mod_strings['LBL_HISTORY'], 'LBL_ACTIVITIES_SUBPANEL_TITLE' => $mod_strings['LBL_ACTIVITIES'], 'LBL_' . strtoupper($this->key_name) . '_SUBPANEL_TITLE' => $this->label, 'LBL_NEW_FORM_TITLE' => $mod_strings['LBL_NEW'] . " " . $this->label);
         foreach ($required as $k => $v) {
             if (empty($values[$k]) || $renameLang) {
                 $values[$k] = $v;
             }
         }
         write_array_to_file('mod_strings', $values, $save_path . '/' . $lang, 'w', $header);
     }
     $app_save_path = $this->path . '/../../language/application';
     mkdir_recursive($app_save_path);
     $key_changed = $this->key_name != $key_name;
     foreach ($this->appListStrings as $lang => $values) {
         // Load previously created modules data
         $app_list_strings = array();
         $neededFile = $app_save_path . '/' . $lang;
         if (file_exists($neededFile)) {
             include $neededFile;
         }
         if (!$duplicate) {
             unset($values['moduleList'][$this->key_name]);
         }
         $values = sugarArrayMerge($values, $app_list_strings);
         $values['moduleList'][$key_name] = $this->label;
         $appFile = $header . "\n";
         require_once 'include/utils/array_utils.php';
         $this->getGlobalAppListStringsForMB($values);
         foreach ($values as $key => $array) {
             if ($duplicate) {
                 //keep the original when duplicating
                 $appFile .= override_value_to_string_recursive2('app_list_strings', $key, $array);
             }
             $okey = $key;
             if ($key_changed) {
                 $key = str_replace($this->key_name, $key_name, $key);
             }
             if ($key_changed) {
                 $key = str_replace(strtolower($this->key_name), strtolower($key_name), $key);
             }
             // if we aren't duplicating or the key has changed let's add it
             if (!$duplicate || $okey != $key) {
                 $appFile .= override_value_to_string_recursive2('app_list_strings', $key, $array);
             }
         }
         $fp = sugar_fopen($app_save_path . '/' . $lang, 'w');
         fwrite($fp, $appFile);
         fclose($fp);
     }
 }
Exemplo n.º 22
0
/**
 * takes session vars and creates config.php
 * @return array bottle collection of error messages
 */
function handleSugarConfig()
{
    global $bottle;
    global $cache_dir;
    global $mod_strings;
    global $setup_db_host_name;
    global $setup_db_host_instance;
    global $setup_db_sugarsales_user;
    global $setup_db_sugarsales_password;
    global $setup_db_database_name;
    global $setup_site_host_name;
    global $setup_site_log_dir;
    global $setup_site_log_file;
    global $setup_site_session_path;
    global $setup_site_guid;
    global $setup_site_url;
    global $setup_sugar_version;
    global $sugar_config;
    global $setup_site_log_level;
    echo "<b>{$mod_strings['LBL_PERFORM_CONFIG_PHP']} (config.php)</b><br>";
    ///////////////////////////////////////////////////////////////////////////////
    ////    $sugar_config SETTINGS
    if (is_file('config.php')) {
        $is_writable = is_writable('config.php');
        // require is needed here (config.php is sometimes require'd from install.php)
        require 'config.php';
    } else {
        $is_writable = is_writable('.');
    }
    // build default sugar_config and merge with new values
    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
    // always lock the installer
    $sugar_config['installer_locked'] = true;
    // we're setting these since the user was given a fair chance to change them
    $sugar_config['dbconfig']['db_host_name'] = $setup_db_host_name;
    $sugar_config['dbconfig']['db_host_instance'] = $setup_db_host_instance;
    $sugar_config['dbconfig']['db_user_name'] = $setup_db_sugarsales_user;
    $sugar_config['dbconfig']['db_password'] = $setup_db_sugarsales_password;
    $sugar_config['dbconfig']['db_name'] = $setup_db_database_name;
    $sugar_config['dbconfig']['db_type'] = $_SESSION['setup_db_type'];
    if (isset($_SESSION['setup_db_port_num'])) {
        $sugar_config['dbconfig']['db_port'] = $_SESSION['setup_db_port_num'];
    }
    $sugar_config['cache_dir'] = $cache_dir;
    $sugar_config['default_charset'] = $mod_strings['DEFAULT_CHARSET'];
    $sugar_config['default_email_client'] = 'sugar';
    $sugar_config['default_email_editor'] = 'html';
    $sugar_config['host_name'] = $setup_site_host_name;
    $sugar_config['import_dir'] = $cache_dir . 'import/';
    $sugar_config['js_custom_version'] = '';
    $sugar_config['log_dir'] = $setup_site_log_dir;
    $sugar_config['log_file'] = $setup_site_log_file;
    /*nsingh(bug 22402): Consolidate logger settings under $config['logger'] as liked by the new logger! If log4pphp exists,
    		these settings will be overwritten by those in log4php.properties when the user access admin->system settings.*/
    $sugar_config['logger'] = array('level' => $setup_site_log_level, 'file' => array('ext' => '.log', 'name' => 'sugarcrm', 'dateFormat' => '%c', 'maxSize' => '10MB', 'maxLogs' => 10, 'suffix' => '%m_%Y'));
    $sugar_config['session_dir'] = $setup_site_session_path;
    $sugar_config['site_url'] = $setup_site_url;
    $sugar_config['sugar_version'] = $setup_sugar_version;
    $sugar_config['tmp_dir'] = $cache_dir . 'xml/';
    $sugar_config['upload_dir'] = $cache_dir . 'upload/';
    $sugar_config['use_php_code_json'] = returnPhpJsonStatus();
    // true on error
    if (isset($_SESSION['setup_site_sugarbeet_anonymous_stats'])) {
        $sugar_config['sugarbeet'] = $_SESSION['setup_site_sugarbeet_anonymous_stats'];
    }
    $sugar_config['demoData'] = $_SESSION['demoData'];
    if (isset($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = $setup_site_guid;
    }
    if (empty($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = md5(create_guid());
    }
    // add installed langs to config
    // entry in upgrade_history comes AFTER table creation
    if (isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) {
        foreach ($_SESSION['INSTALLED_LANG_PACKS'] as $langZip) {
            $lang = getSugarConfigLanguageArray($langZip);
            if (!empty($lang)) {
                $exLang = explode('::', $lang);
                if (is_array($exLang) && count($exLang) == 3) {
                    $sugar_config['languages'][$exLang[0]] = $exLang[1];
                }
            }
        }
    }
    // handle localization defaults
    $sugar_config['default_date_format'] = $_SESSION["default_date_format"];
    $sugar_config['default_time_format'] = $_SESSION["default_time_format"];
    $sugar_config['default_language'] = $_SESSION["default_language"];
    $sugar_config['default_locale_name_format'] = $_SESSION["default_locale_name_format"];
    $sugar_config['default_email_charset'] = $_SESSION["default_email_charset"];
    $sugar_config['default_export_charset'] = $_SESSION["default_export_charset"];
    $sugar_config['export_delimiter'] = $_SESSION["export_delimiter"];
    $sugar_config['default_currency_name'] = $_SESSION["default_currency_name"];
    $sugar_config['default_currency_symbol'] = $_SESSION["default_currency_symbol"];
    $sugar_config['default_currency_iso4217'] = $_SESSION["default_currency_iso4217"];
    $sugar_config['default_currency_significant_digits'] = $_SESSION["default_currency_significant_digits"];
    $sugar_config['default_number_grouping_seperator'] = $_SESSION["default_number_grouping_seperator"];
    $sugar_config['default_decimal_seperator'] = $_SESSION["default_decimal_seperator"];
    ksort($sugar_config);
    $sugar_config_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . '$sugar_config = ' . var_export($sugar_config, true) . ";\n?>\n";
    if ($is_writable && write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        // was 'Done'
    } else {
        echo 'failed<br>';
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_1']}</p>\n";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_2']}</p>\n";
        echo "<TEXTAREA  rows=\"15\" cols=\"80\">" . $sugar_config_string . "</TEXTAREA>";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_3']}</p>";
        $bottle[] = $mod_strings['ERR_PERFORM_CONFIG_PHP_4'];
    }
    ////    END $sugar_config
    ///////////////////////////////////////////////////////////////////////////////
    return $bottle;
}
Exemplo n.º 23
0
 /**
  * Given a module, search all of the specified locations, and any others as specified
  * in order to refresh the cache file
  * 
  * @param string $module the given module we want to load the vardefs for
  * @param string $lang the given language we wish to load
  * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search
  */
 function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null)
 {
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $lang_paths = array('modules/' . $module . '/language/' . $lang . '.lang.php', 'modules/' . $module . '/language/' . $lang . '.lang.override.php', 'custom/modules/' . $module . '/Ext/Language/' . $lang . '.lang.ext.php', 'custom/modules/' . $module . '/language/' . $lang . '.lang.php');
     #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files.
     static $createdModules;
     if (empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])) {
         $object = $GLOBALS['beanList'][$module];
         if ($object == 'aCase') {
             $object = 'Case';
         }
         if (!empty($GLOBALS["dictionary"]["{$object}"]["templates"])) {
             $templates = $GLOBALS["dictionary"]["{$object}"]["templates"];
             $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings);
             $createdModules[$module] = true;
         }
     }
     //end of fix #27023
     // Add in additional search paths if they were provided.
     if (!empty($additional_search_paths) && is_array($additional_search_paths)) {
         $lang_paths = array_merge($lang_paths, $additional_search_paths);
     }
     //search a predefined set of locations for the vardef files
     foreach ($lang_paths as $path) {
         if (file_exists($path)) {
             require $path;
             if (!empty($mod_strings)) {
                 if (function_exists('sugarArrayMergeRecursive')) {
                     $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings);
                 } else {
                     $loaded_mod_strings = sugarArrayMerge($loaded_mod_strings, $mod_strings);
                 }
             }
         }
     }
     //great! now that we have loaded all of our vardefs.
     //let's go save them to the cache file.
     if (!empty($loaded_mod_strings)) {
         LanguageManager::saveCache($module, $lang, $loaded_mod_strings);
     }
 }
Exemplo n.º 24
0
 /**
  *
  */
 function process_page()
 {
     global $focus;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $odd_bg;
     global $even_bg;
     global $timedate;
     $history_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable]));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if ($task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if (!empty($task->date_due) and !empty($task->time_due)) {
             $sort_date_time = $timedate->to_db_date_time($task->date_due, $task->time_due);
             $sort_date_time = implode(' ', $sort_date_time);
             // kbrill - Bug #16714
             //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if ($meeting->status != "Planned") {
             $sort_date_time = '';
             if (!empty($meeting->date_start) and !empty($meeting->time_start)) {
                 $sort_date_time = $timedate->to_db_date_time($meeting->date_start, $meeting->time_start);
                 $sort_date_time = implode(' ', $sort_date_time);
                 // kbrill - Bug #16714
                 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
             }
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if ($call->status != "Planned") {
             $sort_date_time = '';
             if (!empty($call->date_start) and !empty($call->time_start)) {
                 $sort_date_time = $timedate->to_db_date_time($call->date_start, $call->time_start);
                 $sort_date_time = implode(' ', $sort_date_time);
                 // kbrill - Bug #16714
                 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
             } elseif (!empty($call->date_start) && empty($call->time_start)) {
                 //jc - Bug#19862
                 //for some reason the calls module does not populate the time_start variable in
                 //this case, so the date_start attribute contains the information we need
                 //to determine where in the history this call belongs.
                 //using swap_formats to get from the format '03/31/2008 09:45pm' to the format
                 //'2008-03-31 09:45:00'
                 $sort_date_time = $timedate->swap_formats($call->date_start, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
             }
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         $sort_date_time = '';
         if (!empty($email->date_start) and !empty($email->time_start)) {
             $sort_date_time = $timedate->to_db_date_time($email->date_start, $email->time_start);
             $sort_date_time = implode(' ', $sort_date_time);
             // kbrill - Bug #16714
             //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $sort_date_time);
     }
     //end Emails
     foreach ($focus_notes_list as $note) {
         if (!empty($note->date_modified)) {
             $sort_date_time = $timedate->swap_formats($note->date_modified, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
         }
         $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => $sort_date_time);
         if (!empty($note->filename)) {
             $count = count($history_list);
             $count--;
             $history_list[$count]['filename'] = $note->filename;
             $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
         }
     }
     // end Notes
     $xtpl = new XTemplate('modules/Activities/Popup_picker.html');
     $xtpl->assign('MOD', $mod_strings);
     $xtpl->assign('APP', $app_strings);
     insert_popup_header();
     //output header
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
     echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false);
     echo "</td><td align='right' class='moduleTitle'>";
     echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a>&nbsp;<A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
     echo "</td></tr></table>";
     $oddRow = true;
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $xtpl->assign("ACTIVITY", $activity_fields);
         $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
         if ($oddRow) {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'oddListRow');
             $xtpl->assign("BG_COLOR", $odd_bg);
         } else {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'evenListRow');
             $xtpl->assign("BG_COLOR", $even_bg);
         }
         $oddRow = !$oddRow;
         $xtpl->parse("history.row");
         // Put the rows in.
     }
     $xtpl->parse("history");
     $xtpl->out("history");
     insert_popup_footer();
 }
Exemplo n.º 25
0
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
 * Reserved. Contributor(s): ______________________________________..
 * *******************************************************************************/
global $current_language;
global $mod_strings;
// grab Adminstration strings too
$admin_mod_strings = return_module_language($current_language, 'Administration');
$mod_strings = sugarArrayMerge($admin_mod_strings, $mod_strings);
include "modules/Administration/Menu.php";
Exemplo n.º 26
0
/**
 * takes session vars and creates config.php
 * @return array bottle collection of error messages
 */
function handleSugarConfig()
{
    global $bottle;
    global $cache_dir;
    global $mod_strings;
    global $setup_db_host_name;
    global $setup_db_host_instance;
    global $setup_db_port_num;
    global $setup_db_sugarsales_user;
    global $setup_db_sugarsales_password;
    global $setup_db_database_name;
    global $setup_site_host_name;
    global $setup_site_log_dir;
    global $setup_site_log_file;
    global $setup_site_session_path;
    global $setup_site_guid;
    global $setup_site_url;
    global $setup_sugar_version;
    global $sugar_config;
    global $setup_site_log_level;
    echo "<b>{$mod_strings['LBL_PERFORM_CONFIG_PHP']} (config.php)</b><br>";
    ///////////////////////////////////////////////////////////////////////////////
    ////    $sugar_config SETTINGS
    if (is_file('config.php')) {
        $is_writable = is_writable('config.php');
        // require is needed here (config.php is sometimes require'd from install.php)
        require 'config.php';
    } else {
        $is_writable = is_writable('.');
    }
    // build default sugar_config and merge with new values
    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
    // always lock the installer
    $sugar_config['installer_locked'] = true;
    // we're setting these since the user was given a fair chance to change them
    $sugar_config['dbconfig']['db_host_name'] = $setup_db_host_name;
    if (!empty($setup_db_host_instance)) {
        $sugar_config['dbconfig']['db_host_instance'] = $setup_db_host_instance;
    } else {
        $sugar_config['dbconfig']['db_host_instance'] = '';
    }
    if (!isset($_SESSION['setup_db_manager'])) {
        $_SESSION['setup_db_manager'] = DBManagerFactory::getManagerByType($_SESSION['setup_db_type']);
    }
    $sugar_config['dbconfig']['db_user_name'] = $setup_db_sugarsales_user;
    $sugar_config['dbconfig']['db_password'] = $setup_db_sugarsales_password;
    $sugar_config['dbconfig']['db_name'] = $setup_db_database_name;
    $sugar_config['dbconfig']['db_type'] = $_SESSION['setup_db_type'];
    $sugar_config['dbconfig']['db_port'] = $setup_db_port_num;
    $sugar_config['dbconfig']['db_manager'] = $_SESSION['setup_db_manager'];
    if (!empty($_SESSION['setup_db_options'])) {
        $sugar_config['dbconfigoption'] = array_merge($sugar_config['dbconfigoption'], $_SESSION['setup_db_options']);
    }
    $sugar_config['cache_dir'] = $cache_dir;
    $sugar_config['default_charset'] = $mod_strings['DEFAULT_CHARSET'];
    $sugar_config['default_email_client'] = 'sugar';
    $sugar_config['default_email_editor'] = 'html';
    $sugar_config['host_name'] = $setup_site_host_name;
    $sugar_config['js_custom_version'] = '';
    $sugar_config['use_real_names'] = true;
    $sugar_config['disable_convert_lead'] = false;
    $sugar_config['log_dir'] = $setup_site_log_dir;
    $sugar_config['log_file'] = $setup_site_log_file;
    //Setup FTS
    if (!empty($_SESSION['fts_type'])) {
        $sugar_config['full_text_engine'] = array($_SESSION['fts_type'] => array('host' => $_SESSION['fts_host'], 'port' => $_SESSION['fts_port']));
    }
    // for silent install
    if (!empty($_SESSION['setup_fts_type'])) {
        $sugar_config['full_text_engine'] = array($_SESSION['setup_fts_type'] => array('host' => $_SESSION['setup_fts_host'], 'port' => $_SESSION['setup_fts_port']));
        if (isset($_SESSION['setup_fts_hide_config'])) {
            $sugar_config['hide_full_text_engine_config'] = $_SESSION['setup_fts_hide_config'];
        }
    }
    /*nsingh(bug 22402): Consolidate logger settings under $config['logger'] as liked by the new logger! If log4pphp exists,
    		these settings will be overwritten by those in log4php.properties when the user access admin->system settings.*/
    $sugar_config['logger'] = array('level' => $setup_site_log_level, 'file' => array('ext' => '.log', 'name' => 'sugarcrm', 'dateFormat' => '%c', 'maxSize' => '10MB', 'maxLogs' => 10, 'suffix' => ''));
    $sugar_config['session_dir'] = $setup_site_session_path;
    $sugar_config['site_url'] = $setup_site_url;
    $sugar_config['sugar_version'] = $setup_sugar_version;
    $sugar_config['tmp_dir'] = $cache_dir . 'xml/';
    $sugar_config['upload_dir'] = 'upload/';
    //    $sugar_config['use_php_code_json']              = returnPhpJsonStatus(); // true on error
    if (isset($_SESSION['setup_site_sugarbeet_anonymous_stats'])) {
        $sugar_config['sugarbeet'] = $_SESSION['setup_site_sugarbeet_anonymous_stats'];
    }
    $sugar_config['demoData'] = $_SESSION['demoData'];
    if (isset($setup_site_guid)) {
        $sugar_config['unique_key'] = $setup_site_guid;
    }
    if (empty($sugar_config['unique_key'])) {
        $sugar_config['unique_key'] = md5(create_guid());
    }
    // add installed langs to config
    // entry in upgrade_history comes AFTER table creation
    if (isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) {
        foreach ($_SESSION['INSTALLED_LANG_PACKS'] as $langZip) {
            $lang = getSugarConfigLanguageArray($langZip);
            if (!empty($lang)) {
                $exLang = explode('::', $lang);
                if (is_array($exLang) && count($exLang) == 3) {
                    $sugar_config['languages'][$exLang[0]] = $exLang[1];
                }
            }
        }
    }
    if (file_exists('install/lang.config.php')) {
        include 'install/lang.config.php';
        if (!empty($config['languages'])) {
            foreach ($config['languages'] as $lang => $label) {
                $sugar_config['languages'][$lang] = $label;
            }
        }
    }
    ksort($sugar_config);
    $sugar_config_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . '$sugar_config = ' . var_export($sugar_config, true) . ";\n?>\n";
    if ($is_writable && write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        // was 'Done'
    } else {
        echo 'failed<br>';
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_1']}</p>\n";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_2']}</p>\n";
        echo "<TEXTAREA  rows=\"15\" cols=\"80\">" . $sugar_config_string . "</TEXTAREA>";
        echo "<p>{$mod_strings['ERR_PERFORM_CONFIG_PHP_3']}</p>";
        $bottle[] = $mod_strings['ERR_PERFORM_CONFIG_PHP_4'];
    }
    //Now merge the config_si.php settings into config.php
    if (file_exists('config.php') && file_exists('config_si.php')) {
        require_once 'modules/UpgradeWizard/uw_utils.php';
        merge_config_si_settings(false, 'config.php', 'config_si.php');
    }
    ////    END $sugar_config
    ///////////////////////////////////////////////////////////////////////////////
    return $bottle;
}
Exemplo n.º 27
0
        }
    }
}
if (isset($_POST['language'])) {
    $_SESSION['language'] = str_replace('-', '_', $_POST['language']);
}
$current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang;
if (file_exists("install/language/{$current_language}.lang.php")) {
    require_once "install/language/{$current_language}.lang.php";
} else {
    require_once "install/language/{$default_lang}.lang.php";
}
if ($current_language != 'en_us') {
    $my_mod_strings = $mod_strings;
    include 'install/language/en_us.lang.php';
    $mod_strings = sugarArrayMerge($mod_strings, $my_mod_strings);
}
////	END INSTALLER LANGUAGE
///////////////////////////////////////////////////////////////////////////////
//get the url for the helper link
$help_url = get_help_button_url();
//if this license print, then redirect and exit,
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint') {
    include 'install/licensePrint.php';
    exit;
}
//if this is a system check, then just run the check and return,
//this is an ajax call and there is no need for further processing
if (isset($_REQUEST['checkInstallSystem']) && $_REQUEST['checkInstallSystem']) {
    require_once 'install/installSystemCheck.php';
    echo runCheck($install_script, $mod_strings);
Exemplo n.º 28
0
/**
 * This function will rebuild the config file
 * @param	$sugar_config
 * @param	$sugar_version
 * @return	bool true if successful
 */
function rebuildConfigFile($sugar_config, $sugar_version)
{
    // add defaults to missing values of in-memory sugar_config
    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
    // need to override version with default no matter what
    $sugar_config['sugar_version'] = $sugar_version;
    ksort($sugar_config);
    if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 29
0
function constructIndexesArray($indexes, $dictionary, $object_name, $current_language, $module_dir)
{
    global $mod_strings;
    global $app_strings;
    $language_pack = return_module_language($current_language, $module_dir);
    $super_language_pack = sugarArrayMerge($language_pack, $app_strings);
    //$super_language_pack = sugarArrayMerge($app_strings, $language_pack);
    $finalArray = array();
    //for each of the indexes in the passed in index array, check to see the index type
    $GLOBALS['log']->debug($mod_strings['LBL_MODULE_NAME'] . " Creating index multiselect box");
    foreach ($indexes as $index) {
        //if the type is of type index, then grab the labels
        //for each field and insert it into new array, by keyname of index name.
        if ($index['type'] == "index") {
            $fields_indexed = $index['fields'];
            //given the array of field names, grab the label value for each field
            foreach ($fields_indexed as $field) {
                //populate array with label value from vardefs as value, and index name as key
                // for each field in the index, get it's label and place into array
                //$labelsArray[$dictionary[$object_name]['fields'][$field]['name']] = $dictionary[$object_name]['fields'][$field]['name'];
                $labelsArray[$dictionary[$object_name]['fields'][$field]['name']] = $super_language_pack[$dictionary[$object_name]['fields'][$field]['vname']];
            }
            //populate array with list of labels for the value, and index name as key
            $labelArray_str = implode(", ", $labelsArray);
            //clear array for reuse;
            unset($labelsArray);
            $labelArray_str = str_replace(":", "", $labelArray_str);
            $finalArray[$index['name']] = $labelArray_str;
        }
    }
    return $finalArray;
}