function open($filename)
 {
     require_once 'modules/DynamicLayout/DynamicLayoutUtils.php';
     $custom_file = create_custom_directory('layout/' . $filename . '_slot.log');
     $this->fp = fopen($custom_file, 'a');
     fwrite($this->fp, "BEGIN;");
 }
 /**
  * Takes in the request params from a save request and processes 
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveTabGroups($params)
 {
     $tabGroups = array();
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     for ($count = 0; isset($params['slot_' . $count]); $count++) {
         if ($params['delete_' . $count] == 1) {
             continue;
         }
         $index = $params['slot_' . $count];
         $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
         $labelValue = $params['tablabel_' . $index];
         if (empty($GLOBALS['app_strings'][$labelID]) || $GLOBALS['app_strings'][$labelID] != $labelValue) {
             $contents = return_custom_app_list_strings_file_contents($selected_lang);
             $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
             save_custom_app_list_strings_contents($new_contents, $selected_lang);
             $app_strings[$labelID] = $labelValue;
         }
         $tabGroups[$labelID] = array('label' => $labelID);
         $tabGroups[$labelID]['modules'] = array();
         for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
             $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
         }
     }
     sugar_cache_put('app_strings', $GLOBALS['app_strings']);
     $newFile = create_custom_directory('include/tabConfig.php');
     write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
     $GLOBALS['tabStructure'] = $tabGroups;
 }
Beispiel #3
0
function write_logic_file($module_name, $contents)
{
    $file = "modules/" . $module_name . '/logic_hooks.php';
    $file = create_custom_directory($file);
    $fp = sugar_fopen($file, 'wb');
    fwrite($fp, $contents);
    fclose($fp);
    //end function write_logic_file
}
 /**
  * Retrieves a list of files that are backups to a given file
  *
  * @param unknown_type $file
  * @return unknown
  */
 function backupList($file)
 {
     $newPath = create_custom_directory('backup/' . $file);
     $path = dirname($newPath);
     $d = dir($path);
     $files = array();
     while ($entry = $d->read()) {
         if (is_file($path . '/' . $entry) && substr_count($path . '/' . $entry, $file) == 1) {
             $files[] = $path . '/' . $entry;
         }
     }
     arsort($files);
     return $files;
 }
Beispiel #5
0
function upgrade_aos()
{
    global $sugar_config, $db;
    if (!isset($sugar_config['aos']['version']) || $sugar_config['aos']['version'] < 5.2) {
        $db->query("UPDATE  aos_pdf_templates SET type = 'AOS_Quotes' WHERE type = 'Quotes'");
        $db->query("UPDATE  aos_pdf_templates SET type = 'AOS_Invoices' WHERE type = 'Invoices'");
        require_once 'include/utils/file_utils.php';
        $old_files = array('custom/Extension/modules/Accounts/Ext/Layoutdefs/Account.php', 'custom/Extension/modules/Accounts/Ext/Vardefs/Account.php', 'custom/Extension/modules/Contacts/Ext/Layoutdefs/Contact.php', 'custom/Extension/modules/Contacts/Ext/Vardefs/Contact.php', 'custom/Extension/modules/Opportunities/Ext/Layoutdefs/Opportunity.php', 'custom/Extension/modules/Opportunities/Ext/Vardefs/Opportunity.php', 'custom/Extension/modules/Project/Ext/Layoutdefs/Project.php', 'custom/Extension/modules/Project/Ext/Vardefs/Project.php', 'modules/AOS_Quotes/js/Quote.js');
        foreach ($old_files as $old_file) {
            if (file_exists($old_file)) {
                create_custom_directory('bak_aos/' . $old_file);
                sugar_rename($old_file, 'custom/bak_aos/' . $old_file);
            }
        }
    }
}
Beispiel #6
0
    public function createCustom()
    {
        //create new varchar widget and associate with Accounts
        $this->custField = get_widget('varchar');
        $this->custField->id = 'Accounts' . $this->custFieldName;
        $this->custField->name = $this->custFieldName;
        $this->custField->type = 'varchar';
        $this->custField->label = 'LBL_' . strtoupper($this->custFieldName);
        $this->custField->vname = 'LBL_' . strtoupper($this->custFieldName);
        $this->custField->len = 255;
        $this->custField->custom_module = 'Accounts';
        $this->custField->required = 0;
        $this->custField->default = 'goofy';
        $this->acc = new Account();
        $this->df = new DynamicField('Accounts');
        $this->df->setup($this->acc);
        $this->df->addFieldObject($this->custField);
        $this->df->buildCache('Accounts');
        $this->custField->save($this->df);
        VardefManager::clearVardef();
        VardefManager::refreshVardefs('Accounts', 'Account');
        //Now create the meta files to make this a Calculated Field.
        $fn = $this->custFieldName;
        $extensionContent = <<<EOQ
<?php
\$dictionary['Account']['fields']['{$fn}']['duplicate_merge_dom_value']=0;
\$dictionary['Account']['fields']['{$fn}']['calculated']='true';
\$dictionary['Account']['fields']['{$fn}']['formula']='related(\$assigned_user_link,"name")';
\$dictionary['Account']['fields']['{$fn}']['enforced']='true';
\$dictionary['Account']['fields']['{$fn}']['dependency']='';
\$dictionary['Account']['fields']['{$fn}']['type']='varchar';
\$dictionary['Account']['fields']['{$fn}']['name']='{$fn}';


EOQ;
        //create custom field file
        $this->custFileDirPath = create_custom_directory($this->custFileDirPath);
        $fileLoc = $this->custFileDirPath . 'sugarfield_' . $this->custFieldName . '.php';
        file_put_contents($fileLoc, $extensionContent);
        //run repair and clear to make sure the meta gets picked up
        $_REQUEST['repair_silent'] = 1;
        $rc = new RepairAndClear();
        $rc->repairAndClearAll(array("clearAll", "rebuildExtensions"), array("Accounts"), false, false);
        $fn = $this->custFieldName;
    }
function pre_install()
{
    require_once 'include/utils/array_utils.php';
    require_once 'include/utils/file_utils.php';
    require_once 'include/utils/sugar_file_utils.php';
    $modules_array = array('Accounts', 'Contacts', 'Leads');
    foreach ($modules_array as $module) {
        $file = "custom/modules/{$module}/metadata/detailviewdefs.php";
        if (file_exists($file)) {
            $old_contents = file_get_contents($file);
            include $file;
        } else {
            $old_contents = file_get_contents("modules/{$module}/metadata/detailviewdefs.php");
            include "modules/{$module}/metadata/detailviewdefs.php";
            create_custom_directory("modules/{$module}/metadata/detailviewdefs.php");
        }
        if (!isset($viewdefs[$module]['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'])) {
            $new_contents = "\$viewdefs['{$module}']['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'] = array('customCode'=>'<input type=\"button\" class=\"button\" onClick=\"showPopup();\" value=\"{\$APP.LBL_GENERATE_LETTER}\">');\n?>";
            $new_contents = str_replace("?>", $new_contents, $old_contents);
            $fp = sugar_fopen($file, 'wb');
            fwrite($fp, $new_contents);
            fclose($fp);
        }
    }
    /** add following:
    	$entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
    	$entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
    	*/
    $add_entry_point = false;
    $new_contents = "";
    $entry_point_registry = null;
    if (file_exists("custom/include/MVC/Controller/entry_point_registry.php")) {
        // This will load an array of the hooks to process
        include "custom/include/MVC/Controller/entry_point_registry.php";
        if (!isset($entry_point_registry['formLetter'])) {
            $add_entry_point = true;
            $entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
        }
        if (!isset($entry_point_registry['generatePdf'])) {
            $add_entry_point = true;
            $entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
        }
    } else {
        $add_entry_point = true;
        $entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
        $entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
    }
    if ($add_entry_point == true) {
        foreach ($entry_point_registry as $entryPoint => $epArray) {
            $new_contents .= "\$entry_point_registry['" . $entryPoint . "'] = array('file' => '" . $epArray['file'] . "' , 'auth' => '" . $epArray['auth'] . "'); \n";
        }
        $new_contents = "<?php\n{$new_contents}\n?>";
        $file = 'custom/include/MVC/Controller/entry_point_registry.php';
        $paths = explode('/', $file);
        $dir = '';
        for ($i = 0; $i < sizeof($paths) - 1; $i++) {
            if ($i > 0) {
                $dir .= '/';
            }
            $dir .= $paths[$i];
            if (!file_exists($dir)) {
                sugar_mkdir($dir, 0755);
            }
        }
        $fp = sugar_fopen($file, 'wb');
        fwrite($fp, $new_contents);
        fclose($fp);
    }
}
}
// re-minify the JS source files
$_REQUEST['root_directory'] = getcwd();
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once 'jssource/minify.php';
//Add the cache cleaning here.
if (function_exists('deleteCache')) {
    logThis('Call deleteCache', $path);
    @deleteCache();
}
// creating full text search logic hooks
// this will be merged into application/Ext/LogicHooks/logichooks.ext.php
// when rebuild_extensions is called
logThis(' Writing FTS hooks');
if (!function_exists('createFTSLogicHook')) {
    $customFileLoc = create_custom_directory('Extension/application/Ext/LogicHooks/SugarFTSHooks.php');
    $fp = sugar_fopen($customFileLoc, 'wb');
    $contents = <<<CIA
<?php
if (!isset(\$hook_array) || !is_array(\$hook_array)) {
    \$hook_array = array();
}
if (!isset(\$hook_array['after_save']) || !is_array(\$hook_array['after_save'])) {
    \$hook_array['after_save'] = array();
}
\$hook_array['after_save'][] = array(1, 'fts', 'include/SugarSearchEngine/SugarSearchEngineQueueManager.php', 'SugarSearchEngineQueueManager', 'populateIndexQueue');
CIA;
    fwrite($fp, $contents);
    fclose($fp);
} else {
    createFTSLogicHook('Extension/application/Ext/LogicHooks/SugarFTSHooks.php');
 /**
  * Takes in the request params from a save request and processes 
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveTabGroups($params)
 {
     //#30205
     global $sugar_config;
     //Get the selected tab group language
     $grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
     $tabGroups = array();
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $slot_count = $params['slot_count'];
     $completedIndexes = array();
     for ($count = 0; $count < $slot_count; $count++) {
         if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
             continue;
         }
         $index = $params['slot_' . $count];
         if (isset($completedIndexes[$index])) {
             continue;
         }
         $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
         $labelValue = $params['tablabel_' . $index];
         $app_strings = return_application_language($grouptab_lang);
         if (empty($app_strings[$labelID]) || $app_strings[$labelID] != $labelValue) {
             $contents = return_custom_app_list_strings_file_contents($grouptab_lang);
             $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
             save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
             $languages = get_languages();
             foreach ($languages as $language => $langlabel) {
                 if ($grouptab_lang == $language) {
                     continue;
                 }
                 $app_strings = return_application_language($language);
                 if (!isset($app_strings[$labelID])) {
                     $contents = return_custom_app_list_strings_file_contents($language);
                     $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
                     save_custom_app_list_strings_contents($new_contents, $language);
                 }
             }
             $app_strings[$labelID] = $labelValue;
         }
         $tabGroups[$labelID] = array('label' => $labelID);
         $tabGroups[$labelID]['modules'] = array();
         for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
             $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
         }
         $completedIndexes[$index] = true;
     }
     // Force a rebuild of the app language
     sugar_cache_clear('app_strings.' . $grouptab_lang);
     $newFile = create_custom_directory('include/tabConfig.php');
     write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
     $GLOBALS['tabStructure'] = $tabGroups;
 }
Beispiel #10
0
 /**
  * Saves the company logo to the custom directory for the default theme, so all themes can use it
  *
  * @param string $path path to the image to set as the company logo image
  */
 function saveCompanyLogo($path)
 {
     $path = $this->checkTempImage($path);
     $logo = create_custom_directory(SugarThemeRegistry::current()->getDefaultImagePath() . '/company_logo.png');
     copy($path, $logo);
     SugarAutoLoader::addToMap($logo);
     sugar_cache_clear('company_logo_attributes');
     SugarThemeRegistry::clearAllCaches();
     SugarThemeRegistry::current()->clearImageCache('company_logo.png');
     MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_LOGOURL));
 }
Beispiel #11
0
function write_workflow(&$workflow_object)
{
    global $beanlist;
    $module = $workflow_object->base_module;
    $file = "modules/" . $module . '/workflow/workflow.php';
    $file = create_custom_directory($file);
    $dump = $workflow_object->get_trigger_contents();
    $fp = sugar_fopen($file, 'wb');
    fwrite($fp, "<?php\n");
    fwrite($fp, '
include_once("include/workflow/alert_utils.php");
include_once("include/workflow/action_utils.php");
include_once("include/workflow/time_utils.php");
include_once("include/workflow/trigger_utils.php");
//BEGIN WFLOW PLUGINS
include_once("include/workflow/custom_utils.php");
//END WFLOW PLUGINS
	class ' . $workflow_object->base_module . '_workflow {
	function process_wflow_triggers(& $focus){
		include("custom/modules/' . $module . '/workflow/triggers_array.php");
		include("custom/modules/' . $module . '/workflow/alerts_array.php");
		include("custom/modules/' . $module . '/workflow/actions_array.php");
		include("custom/modules/' . $module . '/workflow/plugins_array.php");
		' . $dump . '
	//end function process_wflow_triggers
	}

	//end class
	}
');
    fwrite($fp, "\n?>");
    fclose($fp);
    SugarAutoLoader::addToMap($file);
    //end function write_triggers
}
Beispiel #12
0
function build_plugin_list()
{
    $plugin_list_dump = extract_plugin_list();
    $file = "workflow/plugins/plugin_list.php";
    $file = create_custom_directory($file);
    write_array_to_file('plugin_list', $plugin_list_dump, $file);
    SugarAutoLoader::addToMap($file);
}
Beispiel #13
0
 /**
  * Takes in the request params from a save request and processes 
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveTabGroups($params)
 {
     //#30205
     global $sugar_config;
     if (strcmp($params['other_group_tab_displayed'], '1') == 0) {
         $value = true;
     } else {
         $value = false;
     }
     if (!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value) {
         require_once 'modules/Configurator/Configurator.php';
         $cfg = new Configurator();
         $cfg->config['other_group_tab_displayed'] = $value;
         $cfg->handleOverride();
     }
     //Get the selected tab group language
     $grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
     $tabGroups = array();
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $slot_count = $params['slot_count'];
     $completedIndexes = array();
     for ($count = 0; $count < $slot_count; $count++) {
         if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
             continue;
         }
         $index = $params['slot_' . $count];
         if (isset($completedIndexes[$index])) {
             continue;
         }
         $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
         $labelValue = $params['tablabel_' . $index];
         $appStirngs = return_application_language($grouptab_lang);
         if (empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue) {
             $contents = return_custom_app_list_strings_file_contents($grouptab_lang);
             $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
             save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
             $languages = get_languages();
             foreach ($languages as $language => $langlabel) {
                 if ($grouptab_lang == $language) {
                     continue;
                 }
                 $appStirngs = return_application_language($language);
                 if (!isset($appStirngs[$labelID])) {
                     $contents = return_custom_app_list_strings_file_contents($language);
                     $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
                     save_custom_app_list_strings_contents($new_contents, $language);
                 }
             }
             $app_strings[$labelID] = $labelValue;
         }
         $tabGroups[$labelID] = array('label' => $labelID);
         $tabGroups[$labelID]['modules'] = array();
         for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
             $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
         }
         $completedIndexes[$index] = true;
     }
     sugar_cache_put('app_strings', $GLOBALS['app_strings']);
     $newFile = create_custom_directory('include/tabConfig.php');
     write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
     $GLOBALS['tabStructure'] = $tabGroups;
 }
 public static function createAnonymousCustomTheme($themename = '')
 {
     if (empty($themename)) {
         $themename = 'TestThemeCustom' . mt_rand();
     }
     create_custom_directory("themes/{$themename}/images/");
     create_custom_directory("themes/{$themename}/css/");
     create_custom_directory("themes/{$themename}/js/");
     sugar_touch("custom/themes/{$themename}/css/style.css");
     sugar_touch("custom/themes/{$themename}/js/style.js");
     sugar_touch("custom/themes/{$themename}/images/Accounts.gif");
     sugar_touch("custom/themes/{$themename}/images/fonts.big.icon.gif");
     $themedef = "<?php\n";
     $themedef .= "\$themedef = array(\n";
     $themedef .= "'name'  => 'custom {$themename}',";
     $themedef .= "'dirName'  => '{$themename}',";
     $themedef .= "'description' => 'custom {$themename}',";
     $themedef .= "'version' => array('regex_matches' => array('.*')),";
     $themedef .= ");";
     sugar_file_put_contents("custom/themes/{$themename}/themedef.php", $themedef);
     self::$_createdThemes[] = $themename;
     SugarThemeRegistry::buildRegistry();
     return $themename;
 }
global $current_user;
if (!is_admin($current_user)) {
    sugar_die("Unauthorized access to administration.");
}
$title = getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>", translate('LBL_CONFIGURE_SHORTCUT_BAR')), true);
$msg = "";
global $theme, $currentModule, $app_list_strings, $app_strings;
$GLOBALS['log']->info("Administration ConfigureShortcutBar view");
$actions_path = "include/DashletContainer/Containers/DCActions.php";
//If save is set, save then let the user know if the save worked.
if (!empty($_REQUEST['enabled_modules'])) {
    $toDecode = html_entity_decode($_REQUEST['enabled_modules'], ENT_QUOTES);
    $modules = json_decode($toDecode);
    $out = "<?php\n \$DCActions = \n" . var_export_helper($modules) . ";";
    if (!is_file("custom/" . $actions_path)) {
        create_custom_directory("include/DashletContainer/Containers/");
    }
    if (file_put_contents("custom/" . $actions_path, $out) === false) {
        echo translate("LBL_SAVE_FAILED");
    } else {
        echo "true";
    }
} else {
    include $actions_path;
    //Start with the default module
    $availibleModules = $DCActions;
    //Add the ones currently on the layout
    if (is_file('custom/' . $actions_path)) {
        include 'custom/' . $actions_path;
        $availibleModules = array_merge($availibleModules, $DCActions);
    }
Beispiel #16
0
    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
require_once 'modules/Administration/Administration.php';
require_once 'include/utils/array_utils.php';
require_once 'include/utils/file_utils.php';
require_once 'include/utils/sugar_file_utils.php';
$modules_array = array('Calls');
foreach ($modules_array as $module) {
    if (isset($viewdefs)) {
        unset($viewdefs);
    }
    $file = "custom/modules/{$module}/metadata/detailviewdefs.php";
    if (file_exists($file)) {
        include $file;
    } else {
        create_custom_directory("modules/{$module}/metadata/detailviewdefs.php");
        include "modules/{$module}/metadata/detailviewdefs.php";
    }
    if (isset($viewdefs["{$module}"]['DetailView']['templateMeta']['form']['buttons']['SA_RESCHEDULE'])) {
        unset($viewdefs["{$module}"]['DetailView']['templateMeta']['form']['buttons']['SA_RESCHEDULE']);
    }
    $viewdefs["{$module}"]['DetailView']['templateMeta']['form']['buttons']['SA_RESCHEDULE'] = array('customCode' => '{if $fields.status.value != "Held"} <input title="Reschedule" class="button" onclick="get_form();" name="Reschedule" id="reschedule_button" value="Reschedule" type="button">{/if}');
    $viewdefs["{$module}"]['DetailView']['templateMeta']['includes']['SA_RESCHEDULE']['file'] = 'modules/Calls_Reschedule/reschedule_form.js';
    ksort($viewdefs);
    write_array_to_file('viewdefs', $viewdefs, $file);
}
/** add following:
	$entry_point_registry['Reschedule'] = array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => '1');
	$entry_point_registry['Reschedule2'] = array('file' => 'custom/modules/Calls/Reschedule.php' , 'auth' => '1');
	*/
$add_entry_point = false;
 public function testcreate_custom_directory()
 {
     //execute the method and test if it created file/dir exists
     $file = 'Test/';
     $vfs = $this->rootFs;
     if ($vfs->hasChild($file) == true) {
         rmdir('custom/' . $file);
     }
     $actual = create_custom_directory($file);
     $this->assertFileExists($actual);
     if ($vfs->hasChild($file) == true) {
         rmdir('custom/' . $file);
     }
 }
 function handleSave()
 {
     global $mod_strings;
     $module_name = $this->module->module_dir;
     $fields = array();
     for ($i = 0; isset($_POST['group_' . $i]) && $i < 2; $i++) {
         foreach ($_POST['group_' . $i] as $field) {
             $field = strtoupper($field);
             if (isset($this->originalListViewDefs[$field])) {
                 $fields[$field] = $this->originalListViewDefs[$field];
             } else {
                 $fields[$field] = array('width' => 10, 'label' => $this->module->field_defs[strtolower($field)]['vname']);
             }
             $default = false;
             if ($i == 0) {
                 $default = true;
             }
             $fields[$field]['default'] = $default;
         }
     }
     $newFile = create_custom_directory('modules/' . $module_name . '/metadata/listviewdefs.php');
     write_array_to_file("listViewDefs['{$module_name}']", $fields, $newFile);
     $GLOBALS['listViewDefs'][$module_name] = $fields;
 }
Beispiel #19
0
 public function action_updatewirelessenabledmodules()
 {
     require_once 'modules/Administration/Forms.php';
     global $app_strings, $current_user, $moduleList;
     if (!is_admin($current_user)) {
         sugar_die($app_strings['ERR_NOT_ADMIN']);
     }
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     $configurator->saveConfig();
     if (isset($_REQUEST['enabled_modules']) && !empty($_REQUEST['enabled_modules'])) {
         $updated_enabled_modules = array();
         $wireless_module_registry = array();
         $file = 'include/MVC/Controller/wireless_module_registry.php';
         if (SugarAutoLoader::fileExists($file)) {
             require $file;
         }
         foreach (explode(',', $_REQUEST['enabled_modules']) as $moduleName) {
             $moduleDef = array_key_exists($moduleName, $wireless_module_registry) ? $wireless_module_registry[$moduleName] : array();
             $updated_enabled_modules[$moduleName] = $moduleDef;
         }
         $filename = create_custom_directory('include/MVC/Controller/wireless_module_registry.php');
         mkdir_recursive(dirname($filename));
         write_array_to_file('wireless_module_registry', $updated_enabled_modules, $filename);
         foreach ($moduleList as $mod) {
             sugar_cache_clear("CONTROLLER_wireless_module_registry_{$mod}");
         }
         //Users doesn't appear in the normal module list, but its value is cached on login.
         sugar_cache_clear("CONTROLLER_wireless_module_registry_Users");
         sugar_cache_reset();
         // Bug 59121 - Clear the metadata cache for the mobile platform
         MetaDataManager::refreshCache(array('mobile'));
     }
     echo "true";
 }
Beispiel #20
0
 function getWorkingFile($file, $refresh = false)
 {
     $workingFile = 'working/' . $file;
     $customFile = create_custom_directory($workingFile);
     if ($refresh || !file_exists($customFile)) {
         copy($file, $customFile);
     }
     return $customFile;
 }
 public function testDefaultThemedefFileHandled()
 {
     create_custom_directory('themes/default/');
     sugar_file_put_contents('custom/themes/default/themedef.php', '<?php $themedef = array("group_tabs" => false);');
     SugarThemeRegistry::buildRegistry();
     $this->assertEquals(SugarThemeRegistry::get($this->_themeName)->group_tabs, false);
     unlink('custom/themes/default/themedef.php');
 }
 * 
 * You should have received a copy of the GNU 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 General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU 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".
 ********************************************************************************/
require 'include/tabConfig.php';
require_once 'include/utils/file_utils.php';
if (!isset($GLOBALS['tabStructure']['LBL_TABGROUP_TOOLS'])) {
    $GLOBALS['tabStructure']['LBL_TABGROUP_TOOLS'] = array('label' => 'LBL_TABGROUP_TOOLS', 'modules' => array('iFrames'));
} else {
    if (isset($GLOBALS['tabStructure']['LBL_TABGROUP_TOOLS']) && !in_array('iFrames', $GLOBALS['tabStructure']['LBL_TABGROUP_TOOLS']['modules'])) {
        $GLOBALS['tabStructure']['LBL_TABGROUP_TOOLS']['modules'][] = 'iFrames';
    }
}
//Save the file
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $GLOBALS['tabStructure'], $newFile);
Beispiel #23
0
    function createFTSLogicHook($filePath = 'application/Ext/LogicHooks/logichooks.ext.php')
    {
        $customFileLoc = create_custom_directory($filePath);
        $fp = sugar_fopen($customFileLoc, 'wb');
        $contents = <<<CIA
<?php
if (!isset(\$hook_array) || !is_array(\$hook_array)) {
    \$hook_array = array();
}
if (!isset(\$hook_array['after_save']) || !is_array(\$hook_array['after_save'])) {
    \$hook_array['after_save'] = array();
}
\$hook_array['after_save'][] = array(1, 'fts', 'include/SugarSearchEngine/SugarSearchEngineQueueManager.php', 'SugarSearchEngineQueueManager', 'populateIndexQueue');
CIA;
        fwrite($fp, $contents);
        fclose($fp);
    }
Beispiel #24
0
 public function testGetTemplateDefaultCustom()
 {
     create_custom_directory('themes/default/tpls/');
     sugar_touch('custom/themes/default/tpls/SomeDefaultTemplate.tpl');
     $this->assertEquals('custom/themes/default/tpls/SomeDefaultTemplate.tpl', $this->_themeObject->getTemplate('SomeDefaultTemplate.tpl'));
     unlink('custom/themes/default/tpls/SomeDefaultTemplate.tpl');
 }
 public function testCanLoadCustomEnglishLanguageAppStringsWhenCurrentLanguageDoesNotExist()
 {
     $GLOBALS['current_language'] = 'FR_fr';
     sugar_mkdir("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/", null, true);
     sugar_file_put_contents("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/TestModuleDashlet.en_us.lang.php", '<?php $dashletStrings["TestModuleDashlet"]["foo"] = "bar"; ?>');
     create_custom_directory("modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/");
     sugar_file_put_contents("custom/modules/{$this->_moduleName}/Dashlets/TestModuleDashlet/TestModuleDashlet.en_us.lang.php", '<?php $dashletStrings["TestModuleDashlet"]["foo"] = "barbarbar"; ?>');
     $dashlet = new Dashlet(0);
     $dashlet->loadLanguage('TestModuleDashlet', "modules/{$this->_moduleName}/Dashlets/");
     $this->assertEquals("barbarbar", $dashlet->dashletStrings["foo"]);
 }
Beispiel #26
0
 function write_plugin_meta_file($module)
 {
     global $beanlist;
     $file = "modules/" . $module . "/workflow/plugins_array.php";
     $file = create_custom_directory($file);
     $dump = $this->plugin_meta_data;
     $fp = sugar_fopen($file, 'wb');
     fwrite($fp, "<?php\n");
     fwrite($fp, "//Workflow plugins Meta Data Arrays \n");
     fwrite($fp, $dump);
     fwrite($fp, " \n");
     fwrite($fp, "\n?>");
     fclose($fp);
     //end function write_action_meta_file
 }