• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sugar_fopen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中sugar_fopen函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_fopen函数的具体用法?PHP sugar_fopen怎么用?PHP sugar_fopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sugar_fopen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: putDataToFile

 /**
  * Writes the specified binary or text data to a file
  * @param string The file path
  * @param mixed The data to be written
  * @param string The attributes for the write operation ('w' or 'wb')
  */
 function putDataToFile($fileName, &$data, $writeAttributes)
 {
     $fileHandle = @sugar_fopen($fileName, $writeAttributes);
     if ($fileHandle) {
         fwrite($fileHandle, $data);
         fclose($fileHandle);
     }
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:14,代码来源:php_file_utilities.php


示例2: write_logic_file

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
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:9,代码来源:logic_utils.php


示例3: pre_uninstall

function pre_uninstall()
{
    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)) {
            include $file;
            if (isset($viewdefs[$module]['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'])) {
                unset($viewdefs[$module]['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET']);
                $new_contents = file_get_contents($file);
                $old_contents_v1 = "\$viewdefs['{$module}']['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'] = array('customCode'=>'<input type=\"button\" class=\"button\" onClick=\"showPopup();\" value=\"{\$APP.LBL_GENERATE_LETTER}\">');";
                $old_contents_v2 = "customCode' => '<input type=\"button\" class=\"button\" onClick=\"showPopup();\" value=\"{\$APP.LBL_GENERATE_LETTER}\">";
                $new_contents = str_replace($old_contents_v1, "", $new_contents);
                $new_contents = str_replace($old_contents_v2, "", $new_contents);
                $new_contents = str_replace("AOS_GENLET", "", $new_contents);
                $fp = sugar_fopen($file, 'wb');
                fwrite($fp, $new_contents);
                fclose($fp);
            }
        }
    }
    /** remove 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);
        	*/
    $remove_entry_point = false;
    $new_contents = "";
    $entry_point_registry = null;
    if (file_exists("custom/include/MVC/Controller/entry_point_registry.php")) {
        include "custom/include/MVC/Controller/entry_point_registry.php";
        if (isset($entry_point_registry['formLetter'])) {
            $remove_entry_point = true;
            unset($entry_point_registry['formLetter']);
        }
        if (isset($entry_point_registry['generatePdf'])) {
            $remove_entry_point = true;
            unset($entry_point_registry['generatePdf']);
        }
        if ($remove_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';
            $fp = sugar_fopen($file, 'wb');
            fwrite($fp, $new_contents);
            fclose($fp);
        }
    }
}
开发者ID:santara12,项目名称:advanced-opensales,代码行数:53,代码来源:pre_uninstall.php


示例4: save_xml_file

function save_xml_file($filename, $xml_file)
{
    global $app_strings;
    if (!($handle = sugar_fopen($filename, 'w'))) {
        $GLOBALS['log']->debug("Cannot open file ({$filename})");
        return;
    }
    if (fwrite($handle, $xml_file) === FALSE) {
        $GLOBALS['log']->debug("Cannot write to file ({$filename})");
        return false;
    }
    $GLOBALS['log']->debug("Success, wrote ({$xml_file}) to file ({$filename})");
    fclose($handle);
    return true;
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:15,代码来源:Charts.php


示例5: createAppStringsCache

    function createAppStringsCache($lang = 'en_us')
    {
        // cn: bug 8242 - non-US langpack chokes
        $app_strings = return_application_language($lang);
        $app_list_strings = return_app_list_strings_language($lang);
        $json = getJSONobj();
        $app_list_strings_encoded = $json->encode($app_list_strings);
        $app_strings_encoded = $json->encode($app_strings);
        $str = <<<EOQ
SUGAR.language.setLanguage('app_strings', {$app_strings_encoded});
SUGAR.language.setLanguage('app_list_strings', {$app_list_strings_encoded});
EOQ;
        $cacheDir = create_cache_directory('jsLanguage/');
        if ($fh = @sugar_fopen($cacheDir . $lang . '.js', "w")) {
            fputs($fh, $str);
            fclose($fh);
        }
    }
开发者ID:klr2003,项目名称:sourceread,代码行数:18,代码来源:jsLanguage.php


示例6: download

 /**
  * Using curl we will download the file from the depot server
  * 
  * @param session_id		the session_id this file is queued for
  * @param file_name			the file_name to download
  * @param save_dir			(optional) if specified it will direct where to save the file once downloaded
  * @param download_sever	(optional) if specified it will direct the url for the download
  * 
  * @return the full path of the saved file
  */
 function download($session_id, $file_name, $save_dir = '', $download_server = '')
 {
     if (empty($save_dir)) {
         $save_dir = PACKAGE_MANAGER_DOWNLOAD_PATH;
     }
     if (empty($download_server)) {
         $download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
     }
     $download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
     $ch = curl_init($download_server . '?filename=' . $file_name);
     $fp = sugar_fopen($save_dir . $file_name, 'w');
     curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID=' . $session_id . ';');
     curl_setopt($ch, CURLOPT_FILE, $fp);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     return $save_dir . $file_name;
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:30,代码来源:PackageManagerDownloader.php


示例7: setup

 /**
  * DetailView constructor
  * This is the DetailView constructor responsible for processing the new
  * Meta-Data framework
  *    
  * @param $module String value of module this detail view is for
  * @param $focus An empty sugarbean object of module
  * @param $id The record id to retrieve and populate data for
  * @param $metadataFile String value of file location to use in overriding default metadata file
  * @param tpl String value of file location to use in overriding default Smarty template
  * 
  */
 function setup($module, $focus, $metadataFile = null, $tpl = 'include/DetailView/DetailView.tpl')
 {
     $this->th = new TemplateHandler();
     $this->th->ss =& $this->ss;
     $this->focus = $focus;
     $this->tpl = $tpl;
     $this->module = $module;
     $this->metadataFile = $metadataFile;
     if (isset($GLOBALS['sugar_config']['disable_vcr'])) {
         $this->showVCRControl = !$GLOBALS['sugar_config']['disable_vcr'];
     }
     if (!empty($this->metadataFile) && file_exists($this->metadataFile)) {
         require_once $this->metadataFile;
     } else {
         //If file doesn't exist we create a best guess
         if (!file_exists("modules/{$this->module}/metadata/detailviewdefs.php") && file_exists("modules/{$this->module}/DetailView.html")) {
             global $dictionary;
             $htmlFile = "modules/" . $this->module . "/DetailView.html";
             $parser = new DetailViewMetaParser();
             if (!file_exists('modules/' . $this->module . '/metadata')) {
                 sugar_mkdir('modules/' . $this->module . '/metadata');
             }
             $fp = sugar_fopen('modules/' . $this->module . '/metadata/detailviewdefs.php', 'w');
             fwrite($fp, $parser->parse($htmlFile, $dictionary[$focus->object_name]['fields'], $this->module));
             fclose($fp);
         }
         //Flag an error... we couldn't create the best guess meta-data file
         if (!file_exists("modules/{$this->module}/metadata/detailviewdefs.php")) {
             global $app_strings;
             $error = str_replace("[file]", "modules/{$this->module}/metadata/detailviewdefs.php", $app_strings['ERR_CANNOT_CREATE_METADATA_FILE']);
             $GLOBALS['log']->fatal($error);
             echo $error;
             die;
         }
         require_once "modules/{$this->module}/metadata/detailviewdefs.php";
     }
     $this->defs = $viewdefs[$this->module][$this->view];
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:50,代码来源:DetailView2.php


示例8: __construct

 /**
  * Constructor
  *
  * @param string $filename
  * @param string $delimiter
  * @param string $enclosure
  * @param bool   $deleteFile
  * @param bool   $checkUploadPath
  * @param int    $rowsCount
  */
 public function __construct($filename, $delimiter = ',', $enclosure = '', $deleteFile = true, $checkUploadPath = true, $rowsCount = 0)
 {
     if (!is_file($filename) || !is_readable($filename)) {
         return false;
     }
     if ($checkUploadPath && UploadStream::path($filename) == null) {
         $GLOBALS['log']->fatal("ImportFile detected attempt to access to the following file not within the sugar upload dir: {$filename}");
         return null;
     }
     // turn on auto-detection of line endings to fix bug #10770
     ini_set('auto_detect_line_endings', '1');
     $this->_fp = sugar_fopen($filename, 'r');
     $this->_sourcename = $filename;
     $this->_deleteFile = $deleteFile;
     $this->_delimiter = empty($delimiter) ? ',' : $delimiter;
     if ($this->_delimiter == '\\t') {
         $this->_delimiter = "\t";
     }
     $this->_enclosure = empty($enclosure) ? '' : trim($enclosure);
     // Autodetect does setFpAfterBOM()
     $this->_encoding = $this->autoDetectCharacterSet();
     $this->_rowsCount = $rowsCount;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:33,代码来源:ImportFile.php


示例9: pre_install

function pre_install()
{
    //2.1 remove legacy layout and vardefs files from custom/Extension/modules that are 'forgotten' by uninstaller
    $file_list = array('Accounts', 'Contacts', 'Documents', 'Opportunities', 'Project');
    $dir = 'custom/Extension/modules/';
    foreach ($file_list as $file) {
        if (file_exists($dir . $file . '/Ext/Layoutdefs/' . $file . '.php')) {
            unlink($dir . $file . '/Ext/Layoutdefs/' . $file . '.php');
        }
        if (file_exists($dir . $file . '/Ext/Vardefs/' . $file . '.php')) {
            unlink($dir . $file . '/Ext/Vardefs/' . $file . '.php');
        }
    }
    // Now cleanup all files in custom/Extension/ that have filename start with oqc
    $custom_dir = 'custom/Extension';
    //$GLOBALS['log']->error("Custom directory structure is ". var_export(glob($custom_dir.'/*'),true));
    if (is_dir($custom_dir)) {
        oqc_cleanup($custom_dir);
    }
    // This is the hack to make oqc_CreatePopup available for non-admin users
    // Required for button Create Attachement to work in Quotes and Contracts
    //TODO Make oqc_Create_popup work without this hack
    $str = "<?php \n //WARNING: The contents of this file are auto-generated\n";
    $str .= "\$modules_exempt_from_availability_check['oqc_CreatePopup'] = 'oqc_CreatePopup';\n";
    $str .= "\$modInvisList[] = 'oqc_CreatePopup';\n";
    $str .= "\n?>";
    if (!file_exists("custom/Extension/application/Ext/Include")) {
        mkdir_recursive("custom/Extension/application/Ext/Include", true);
    }
    if (file_exists("custom/Extension/application/Ext/Include/oqc_CreatePopup.php")) {
        unlink("custom/Extension/application/Ext/Include/oqc_CreatePopup.php");
    }
    $out = sugar_fopen("custom/Extension/application/Ext/Include/oqc_CreatePopup.php", 'w');
    fwrite($out, $str);
    fclose($out);
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:36,代码来源:pre_install.php


示例10: testRangeSearchWithSavedReportValues

 /**
  * testRangeSearchWithSavedReportValues
  * This test attempts to simulate testing what would happen should a saved report be invoked against
  * a range search field
  *
  */
 public function testRangeSearchWithSavedReportValues()
 {
     require_once 'include/SugarFields/Fields/Datetime/SugarFieldDatetime.php';
     $parentFieldArray = 'fields';
     $vardef = array();
     $vardef['name'] = 'date_closed_advanced';
     $vardef['vname'] = 'LBL_DATE_CLOSED';
     $opportunity = new Opportunity();
     $vardef = $opportunity->field_defs['date_closed'];
     $vardef['name'] = 'date_closed_advanced';
     $vardef['options'] = array('=' => 'Equals', 'not_equal' => 'Not On', 'greater_than' => ' After', 'less_than' => ' Before', 'last_7_days' => ' Last 7 Days', 'next_7_days' => ' Next 7 Days', 'last_30_days' => ' Last 30 Days', 'next_30_days' => ' Next 30 Days', 'last_month' => ' Last Month', 'this_month' => ' This Month', 'next_month' => ' Next Month', 'last_year' => ' Last Year', 'this_year' => ' This Year', 'next_year' => ' Next Year', 'between' => ' Is Between');
     $displayParams = array('labelSpan' => '', 'fieldSpan' => '');
     $tabindex = '';
     $sugarFieldDatetime = new SugarFieldDatetime('Datetime');
     $_REQUEST['action'] = 'SearchForm';
     $html = $sugarFieldDatetime->getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
     //Write this widget's contents to a file
     $this->smartyTestFile = 'tests/include/SearchForm/RangeSearchTest.tpl';
     $handle = sugar_fopen($this->smartyTestFile, 'wb');
     fwrite($handle, $html);
     //Check that the template exists before we proceed with further tests
     $this->assertTrue(file_exists($this->smartyTestFile));
     //Stuff Smarty variables
     $vardef['value'] = '';
     $fields = array();
     $fields['date_closed_advanced'] = $vardef;
     //Create Smarty instance
     require_once 'include/Sugar_Smarty.php';
     $ss = new Sugar_Smarty();
     //Assign Smarty variables
     $ss->assign('fields', $fields);
     $ss->assign('APP', $GLOBALS['app_strings']);
     $ss->assign('CALENDAR_FORMAT', 'm-d-Y');
     //Simulate the request with saved report value
     $_REQUEST['date_closed_advanced'] = '07-03-2009';
     $output = $ss->fetch($this->smartyTestFile);
     $this->assertRegExp('/range_date_closed_advanced\\"\\s+?value\\s*?\\=s*?\'07\\-03\\-2009\'/', $output);
     //Simulate the request with range search value
     $_REQUEST['range_date_closed_advanced'] = '07-04-2009';
     $output = $ss->fetch($this->smartyTestFile);
     $this->assertRegExp('/range_date_closed_advanced\\"\\s+?value\\s*?\\=s*?\'07\\-04\\-2009\'/', $output);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:48,代码来源:RangeSearchTest.php


示例11: filesize

 if ($ignore_self) {
     echo $mod_strings['LBL_IT_WILL_BE_IGNORED'];
 }
 if (empty($_SESSION['log_file_size'])) {
     $_SESSION['log_file_size'] = 0;
 }
 $cur_size = filesize($logFile);
 $_SESSION['last_log_file_size'] = $cur_size;
 $pos = 0;
 if ($cur_size >= $_SESSION['log_file_size']) {
     $pos = $_SESSION['log_file_size'] - $cur_size;
 }
 if ($_SESSION['log_file_size'] == $cur_size) {
     echo $mod_strings['LBL_LOG_NOT_CHANGED'] . '<br>';
 } else {
     $fp = sugar_fopen($logFile, 'r');
     fseek($fp, $pos, SEEK_END);
     echo '<pre>';
     while ($line = fgets($fp)) {
         $line = filter_var($line, FILTER_SANITIZE_SPECIAL_CHARS);
         //preg_match('/[^\]]*\[([0-9]*)\] ([a-zA-Z]+) ([a-zA-Z0-9\.]+) - (.*)/', $line, $result);
         preg_match('/[^\\]]*\\[([0-9]*)\\]/', $line, $result);
         ob_flush();
         flush();
         if (empty($result) && $lastMatch) {
             echo $line;
         } else {
             $lastMatch = false;
             if (empty($result) || $ignore_self && $result[LOG_NAME] == $_SERVER['REMOTE_ADDR']) {
             } else {
                 if (empty($filter) || !$reg_ex && substr_count($line, $filter) > 0 || $reg_ex && preg_match($filter, $line)) {
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:31,代码来源:LogView.php


示例12: preflightCheckJsonPrepSchemaCheck

/**
 * loads the sql file into an array
 * @param array persistence
 * @param bool preflight Flag to load for Preflight or Commit
 * @return array persistence
 */
function preflightCheckJsonPrepSchemaCheck($persistence, $preflight = true)
{
    global $mod_strings;
    global $db;
    global $sugar_db_version;
    global $manifest;
    unset($persistence['sql_to_run']);
    $persistence['sql_to_check'] = array();
    $persistence['sql_to_check_backup'] = array();
    if (isset($persistence['sql_check_done'])) {
        // reset flag to not check (on Recheck)
        unset($persistence['sql_check_done']);
        unset($persistence['sql_errors']);
    }
    // get schema script if not loaded
    if ($preflight) {
        logThis('starting schema preflight check...');
    } else {
        logThis('Preparing SQL statements for sequential execution...');
    }
    if (empty($sugar_db_version)) {
        include 'sugar_version.php';
    }
    if (!isset($manifest['version']) || empty($manifest['version'])) {
        include $persistence['unzip_dir'] . '/manifest.php';
    }
    $origVersion = implodeVersion($sugar_db_version);
    $destVersion = implodeVersion($manifest['version']);
    $script_name = $db->getScriptType();
    $sqlScript = $persistence['unzip_dir'] . "/scripts/{$origVersion}_to_{$destVersion}_{$script_name}.sql";
    $newTables = array();
    logThis('looking for schema script at: ' . $sqlScript);
    if (is_file($sqlScript)) {
        logThis('found schema upgrade script: ' . $sqlScript);
        $fp = sugar_fopen($sqlScript, 'r');
        if (!empty($fp)) {
            $completeLine = '';
            while ($line = fgets($fp)) {
                if (strpos($line, '--') === false) {
                    $completeLine .= " " . trim($line);
                    if (strpos($line, ';') !== false) {
                        $completeLine = str_replace(';', '', $completeLine);
                        $persistence['sql_to_check'][] = $completeLine;
                        $completeLine = '';
                        //reset for next loop
                    }
                }
            }
            $persistence['sql_total'] = count($persistence['sql_to_check']);
        } else {
            logThis('*** ERROR: could not read schema script: ' . $sqlScript);
            $persistence['sql_errors'][] = $mod_strings['ERR_UW_FILE_NOT_READABLE'] . '::' . $sqlScript;
        }
    }
    // load a new array if for commit
    if ($preflight) {
        $persistence['sql_to_check_backup'] = $persistence['sql_to_check'];
        $persistence['sql_to_run'] = $persistence['sql_to_check'];
        echo "1% " . $mod_strings['LBL_UW_DONE'];
    } else {
        $persistence['sql_to_run'] = $persistence['sql_to_check'];
        unset($persistence['sql_to_check']);
    }
    return $persistence;
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:71,代码来源:uw_ajax.php


示例13: retrieveFile

 function retrieveFile($id, $filename)
 {
     if (empty($filename)) {
         return '';
     }
     $this->upload_file->stored_file_name = $filename;
     $filepath = $this->upload_file->get_upload_path($id);
     if (file_exists($filepath)) {
         $fp = sugar_fopen($filepath, 'rb');
         $file = fread($fp, filesize($filepath));
         fclose($fp);
         return base64_encode($file);
     }
     return -1;
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:15,代码来源:NoteSoap.php


示例14: getcwd

// 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');
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:31,代码来源:silentUpgrade_step2.php


示例15: createFTSLogicHook

    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);
    }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:17,代码来源:performSetup.php


示例16: save

 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) || isset($values['LBL_MODULE_NAME']) && $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 (); --- fix for issue #305
         $neededFile = $app_save_path . '/' . $lang;
         if (file_exists($neededFile)) {
             include $neededFile;
         }
         if (!$duplicate) {
             unset($values['moduleList'][$this->key_name]);
         }
         // $values = sugarLangArrayMerge($values, $app_list_strings); --- fix for issue #305
         $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);
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:57,代码来源:MBLanguage.php


示例17: _writeCacheFile

    /**
     * Performs the actual file write.  Abstracted from writeCacheFile() for
     * flexibility
     * @param array $array The array to write to the cache
     * @param string $file Full path (relative) with cache file name
     * @return bool
     */
    function _writeCacheFile($array, $file)
    {
        global $sugar_config;
        $arrayString = var_export_helper($array);
        $date = date("r");
        $the_string = <<<eoq
<?php // created: {$date}
\t\$cacheFile = {$arrayString};
?>
eoq;
        if ($fh = @sugar_fopen($file, "w")) {
            fputs($fh, $the_string);
            fclose($fh);
            return true;
        } else {
            $GLOBALS['log']->debug("EMAILUI: Could not write cache file [ {$file} ]");
            return false;
        }
    }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:26,代码来源:EmailUI.php


示例18: saveSubPanelDefOverride

 function saveSubPanelDefOverride($panel, $subsection, $override)
 {
     global $layout_defs, $beanList;
     //save the new subpanel
     $name = "subpanel_layout['list_fields']";
     //bugfix: load looks for moduleName/metadata/subpanels, not moduleName/subpanels
     $path = 'custom/modules/' . $panel->_instance_properties['module'] . '/metadata/subpanels';
     //bug# 40171: "Custom subpanels not working as expected"
     //each custom subpanel needs to have a unique custom def file
     $filename = $panel->parent_bean->object_name . "_subpanel_" . $panel->name;
     //bug 42262 (filename with $panel->_instance_properties['get_subpanel_data'] can create problem if had word "function" in it)
     $oldName1 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['module'] . $panel->_instance_properties['subpanel_name'];
     $oldName2 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['get_subpanel_data'];
     if (file_exists('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName1}.php")) {
         unlink('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName1}.php");
     }
     if (file_exists('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName2}.php")) {
         unlink('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$oldName2}.php");
     }
     $extname = '_override' . $filename;
     //end of bug# 40171
     mkdir_recursive($path, true);
     write_array_to_file($name, $override, $path . '/' . $filename . '.php');
     //save the override for the layoutdef
     //tyoung 10.12.07 pushed panel->name to lowercase to match case in subpaneldefs.php files -
     //gave error on bad index 'module' as this override key didn't match the key in the subpaneldefs
     $name = "layout_defs['" . $panel->parent_bean->module_dir . "']['subpanel_setup']['" . strtolower($panel->name) . "']";
     //  	$GLOBALS['log']->debug('SubPanel.php->saveSubPanelDefOverride(): '.$name);
     $newValue = override_value_to_string($name, 'override_subpanel_name', $filename);
     mkdir_recursive('custom/Extension/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs', true);
     $fp = sugar_fopen('custom/Extension/modules/' . $panel->parent_bean->module_dir . "/Ext/Layoutdefs/{$extname}.php", 'w');
     fwrite($fp, "<?php\n//auto-generated file DO NOT EDIT\n{$newValue}\n?>");
     fclose($fp);
     require_once 'ModuleInstall/ModuleInstaller.php';
     $moduleInstaller = new ModuleInstaller();
     $moduleInstaller->silent = true;
     // make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs
     $moduleInstaller->rebuild_layoutdefs();
     if (file_exists('modules/' . $panel->parent_bean->module_dir . '/layout_defs.php')) {
         include 'modules/' . $panel->parent_bean->module_dir . '/layout_defs.php';
     }
     if (file_exists('custom/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php')) {
         include 'custom/modules/' . $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php';
     }
 }
开发者ID:recci,项目名称:SuiteCRM,代码行数:45,代码来源:SubPanel.php


示例19: setLastUser

function setLastUser($user_id, $id)
{
    $_SESSION['lastuser'][$id] = $user_id;
    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
    $arrayString = var_export_helper(array('User' => $user_id));
    $content = <<<eoq
<?php
\t\$lastUser = {$arrayString};
?>
eoq;
    if ($fh = @sugar_fopen($file, 'w')) {
        fputs($fh, $content);
        fclose($fh);
    }
    return true;
}
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:16,代码来源:aow_utils.php


示例20: getLicenseContents

function getLicenseContents($filename)
{
    $license_file = '';
    if (file_exists($filename) && filesize($filename) > 0) {
        $fh = sugar_fopen($filename, 'r') or die("License file not found!");
        $license_file = fread($fh, filesize($filename));
        fclose($fh);
    }
    return $license_file;
}
开发者ID:klr2003,项目名称:sourceread,代码行数:10,代码来源:install_utils.php



注:本文中的sugar_fopen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sugar_is_dir函数代码示例发布时间:2022-05-23
下一篇:
PHP sugar_file_put_contents_atomic函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap