コード例 #1
0
ファイル: Form.php プロジェクト: MarionCrp/Projet
 /**
  * Affiche une liste de tous les languages de la base de donnée.
  * Selectionne par défaut une langue utilisée si elle est passée en paramètre
  * @param LanguageManager $lang_manager
  * @param int $spoken_language_id
  *
  */
 public static function languages(LanguageManager $lang_manager, $spoken_language_id = null)
 {
     $languages = $lang_manager->getLanguages();
     echo '<option value="">' . _('Choose a Language') . '</option>';
     foreach ($languages as $language) {
         if ($language->id() == $spoken_language_id) {
             $selected = 'selected';
         } else {
             $selected = '';
         }
         echo '<option value="' . $language->id() . '" ' . $selected . '>' . $language->name() . '</option>';
     }
 }
コード例 #2
0
 public function load()
 {
     if (isset($_GET['path'])) {
         if (array_key_exists($_GET['path'], Config::getPageList())) {
             $this->pageId = $_GET['path'];
         } else {
             $this->pageId = 'not_found';
         }
     }
     if (isset($_GET['lang'])) {
         if (array_key_exists($_GET['lang'], Config::getLanguageList())) {
             $this->language = $_GET['lang'];
         }
     } else {
         if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
             $langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
             $nblang = count($langs);
             for ($i = 0; $i < $nblang; $i++) {
                 if (array_key_exists($langs[$i], Config::getLanguageList())) {
                     $this->language = $langs[$i];
                     break;
                 }
             }
         }
     }
     LanguageManager::loadLocales($this->language);
     $pageList = Config::getPageList();
     require_once $_SERVER["DOCUMENT_ROOT"] . '/page/' . $pageList[$this->pageId]['path'] . '.php';
     $this->page = new CurrentPage();
 }
コード例 #3
0
 function import($language_code)
 {
     $filename = tempnam(AT_CONTENT_DIR . 'import', $language_code);
     if ($this->fetchLanguage($language_code, $filename)) {
         parent::import($filename);
     }
 }
コード例 #4
0
 public function load()
 {
     $this->setDescriptionTagValue('Build you computer (PC) using this tool and order it. We\'ll configure your PC and proceed your order!');
     $this->setKeywordsTagValue('Build PC, Build Computer, Build Desktop Computer');
     $this->setTitleTagValue('PC Configurator, build your computer!');
     $pccm = PcConfiguratorManager::getInstance($this->config, $this->args);
     $this->addParam('pccm', $pccm);
     if (isset($this->args[0])) {
         $edited_pc_cart_item_id = $this->args[0];
         //if (!isset($this->customerEmail))
         $this->initVars();
         if (!isset($this->customerEmail)) {
             exit;
         }
         $pcToBeEdit = $this->getPcToBeEdited($edited_pc_cart_item_id);
         if ($pcToBeEdit != null) {
             $this->setPcConfiguratorRequestParamsCorrespondingToEditedPcComponents($pcToBeEdit);
             $this->addParam("configurator_mode_edit_cart_row_id", $edited_pc_cart_item_id);
         }
     }
     $right_side_panel_width = $this->getCmsVar('pc_configurator_right_side_panel_width');
     $width = intval($this->getCmsVar('whole_page_width')) - $right_side_panel_width;
     $this->addParam('left_side_panel_width', $width);
     $this->addParam('pcc_components_count', count(PcConfiguratorManager::$PCC_COMPONENTS));
     $lm = LanguageManager::getInstance($this->config, $this->args);
     $componentDisplayNames = array();
     foreach (PcConfiguratorManager::$PCC_COMPONENTS_DISPLAY_NAMES_IDS as $pid) {
         $componentDisplayNames[] = $pid;
     }
     $this->addParam("component_display_names", $componentDisplayNames);
 }
コード例 #5
0
 public function __construct(Host $host, $dbInstanceKey = null)
 {
     $this->host = $host;
     parent::__construct(null, $dbInstanceKey);
     $this->hostLangs = static::getHostLanguages($this->host);
     $this->setCurrentHostLangId();
 }
コード例 #6
0
 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance($config, $args)
 {
     if (self::$instance == null) {
         self::$instance = new LanguageManager($config, $args);
     }
     return self::$instance;
 }
コード例 #7
0
 /**
  * Returns an singleton instance of this class
  * @return
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new LanguageManager();
     }
     return self::$instance;
 }
コード例 #8
0
 public function service()
 {
     $languageManager = LanguageManager::getInstance($this->config, $this->args);
     $phrase_id = $this->secure($_REQUEST["phrase_id"]);
     $phrase_text = $_REQUEST["phrase_text"];
     $languageManager->updatePhrase($phrase_id, $phrase_text);
     $jsonArr = array('status' => "ok");
     echo json_encode($jsonArr);
     return true;
 }
コード例 #9
0
ファイル: 3_RebuildJS.php プロジェクト: jglaine/sugar761-ent
 public function run()
 {
     if (empty($this->upgrader->config['js_lang_version'])) {
         $this->upgrader->config['js_lang_version'] = 1;
     } else {
         $this->upgrader->config['js_lang_version'] += 1;
     }
     //remove lanugage cache files
     require_once 'include/SugarObjects/LanguageManager.php';
     LanguageManager::clearLanguageCache();
 }
コード例 #10
0
ファイル: HtmlPage.php プロジェクト: niavok/perroquet-website
 function generateHeader()
 {
     $this->content .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . LanguageManager::getLanguage() . '" >
        <head>
            <title>' . _("Perroquet — Listening comprehension tutor — ") . $this->title . '</title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <link rel="stylesheet" media="screen" type="text/css" title="Design" href="/style/default.css" />
         <link rel="icon" type="image/png" href="/ressources/style/favicon.png" />
        </head>
        <body>';
 }
コード例 #11
0
 static function loadLocales($lang)
 {
     bindtextdomain("perroquet-website", dirname($_SERVER['SCRIPT_FILENAME']) . '/locales');
     bind_textdomain_codeset("perroquet-website", 'UTF-8');
     textdomain("perroquet-website");
     $languageList = Config::getLanguageList();
     if (!$languageList[$lang]['choosable']) {
         $lang = $languageList[$lang]['ref'];
     }
     setlocale(LC_ALL, $languageList[$lang]['key']);
     LanguageManager::$lang = $lang;
 }
コード例 #12
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     $languages = LanguageManager::getEnabledAndDisabledLanguages();
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('MOD', $GLOBALS['mod_strings']);
     $this->ss->assign('enabled_langs', json_encode($languages['enabled']));
     $this->ss->assign('disabled_langs', json_encode($languages['disabled']));
     $this->ss->assign('title', $this->getModuleTitle(false));
     echo $this->ss->fetch('modules/Administration/templates/Languages.tpl');
 }
コード例 #13
0
ファイル: select.php プロジェクト: niavok/perroquet-website
 function execute()
 {
     $this->language = "None";
     if (isset($_GET['language'])) {
         if (array_key_exists($_GET['language'], Config::getLanguageList())) {
             LanguageManager::loadLocales($_GET['language']);
             $this->language = $_GET['language'];
         } else {
             $this->language = "Invalid";
         }
     }
     $this->title = _('Select language');
 }
コード例 #14
0
ファイル: GuestLoad.class.php プロジェクト: pars5555/pcstore
 public function putAllPhrasesInSmarty()
 {
     $lm = LanguageManager::getInstance($this->config, $this->args);
     $this->addParam("all_phrases_dtos_mapped_by_id", json_encode($lm->getAllPhrasesDtosMappedById()));
     $this->addParam("langManager", $lm);
     $ul = $_COOKIE['ul'];
     if (!($ul === 'en' || $ul === 'ru' || $ul === 'am')) {
         $ul = 'en';
     }
     if (!isset($_COOKIE['ul'])) {
         $this->setcookie('ul', $ul);
     }
     $this->addParam("ul", $ul);
 }
コード例 #15
0
ファイル: MailSender.class.php プロジェクト: pars5555/pcstore
 public function send($from, $recipients, $subject, $template, $params = array(), $separate = false)
 {
     //--proccessing the message
     $smarty = new FAZSmarty();
     $lm = LanguageManager::getInstance(null, null);
     $params["all_phrases"] = $lm->getAllPhrases();
     $ul = $_COOKIE['ul'];
     if (!($ul === 'en' || $ul === 'ru' || $ul === 'am')) {
         $ul = 'en';
     }
     $params["ul"] = $ul;
     $smarty->assign("ns", $params);
     $message = $smarty->fetch($template);
     // To send HTML mail, the Content-type header must be set
     $headers = "";
     //'MIME-Version: 1.0' . "\r\n";
     $headers .= "Reply-To: {$from}\r\n";
     $headers .= "Return-Path: {$from}\r\n";
     $headers .= "X-Priority: normal\r\n";
     $headers .= 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
     $headers .= "X-Priority: 3\r\n";
     $headers .= "X-Mailer: PHP" . phpversion() . "\r\n";
     //$headers .= 'Content-type: text/plain; charset=utf-8' . "\n";
     // Additional headers
     //			$headers .= 'To: Mary <*****@*****.**>, Kelly <*****@*****.**>' . "\r\n";
     $headers .= "From: {$from}\r\n";
     //		$headers .= 'From: Birthday Reminder <*****@*****.**>' . "\r\n";
     //		$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
     //		$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
     // multiple recipients
     if ($separate) {
         foreach ($recipients as $recipient) {
             if (!empty($recipient)) {
                 mail($recipient, $subject, $message, $headers);
             }
         }
     } else {
         $to = "";
         foreach ($recipients as $recipient) {
             if (!empty($recipient)) {
                 $to .= $recipient . ',';
             }
         }
         $to = substr($to, 0, -1);
         mail($to, $subject, $message, $headers);
     }
 }
コード例 #16
0
 public function initialize($sessionManager, $loadMapper, $args)
 {
     parent::initialize($sessionManager, $loadMapper, $args);
     $lm = LanguageManager::getInstance();
     $this->addParam("lm", $lm);
     $userLevel = $this->getUserLevel();
     $customer = $this->getCustomer();
     $this->addParam('DOCUMENT_ROOT', DOCUMENT_ROOT);
     $this->addParam('customer', $customer);
     $this->addParam('userLevel', $userLevel);
     $this->addParam('userId', $this->getUserId());
     $this->addParam('userGroupsGuest', UserGroups::$GUEST);
     $this->addParam('userGroupsAdmin', UserGroups::$ADMIN);
     $this->addParam('userGroupsCarwash', UserGroups::$CARWASH);
     $this->addParam("page_name", isset($_REQUEST['page']) ? $_REQUEST['page'] : "");
 }
コード例 #17
0
ファイル: VardefManager.php プロジェクト: klr2003/sourceread
 /**
  * this method is called within a vardefs.php file which extends from a SugarObject.
  * It is meant to load the vardefs from the SugarObject.
  */
 function createVardef($module, $object, $templates = array('default'), $object_name = false)
 {
     global $dictionary;
     //reverse the sort order so priority goes highest to lowest;
     $templates = array_reverse($templates);
     foreach ($templates as $template) {
         VardefManager::addTemplate($module, $object, $template, $object_name);
     }
     LanguageManager::createLanguageFile($module, $templates);
     $vardef_paths = array('custom/modules/' . $module . '/Ext/Vardefs/vardefs.ext.php', 'custom/Extension/modules/' . $module . '/Ext/Vardefs/vardefs.php');
     //search a predefined set of locations for the vardef files
     foreach ($vardef_paths as $path) {
         if (file_exists($path)) {
             require $path;
         }
     }
 }
コード例 #18
0
ファイル: choose.php プロジェクト: niavok/perroquet-website
 function generateContent()
 {
     $content = '
     <h1>' . _('Select language') . '</h1>';
     $langs = Config::getLanguagelist();
     $content .= '<form action="' . RessourceManager::getInnerUrl('special/language/select') . '" method="GET">';
     $content .= '
             <label for="language">' . _('Choose the new language : ') . '</label>
             <select name="language" id="language">';
     foreach ($langs as $lang) {
         if ($lang['choosable']) {
             $content .= '
             <option value="' . $lang['code'] . '" ' . ($lang['code'] == LanguageManager::getLanguage() ? 'selected="selected"' : '') . '>' . $lang['label'] . '</option>';
         }
     }
     $content .= '</select><br /><input type="submit" value="' . _("Select") . '"></form>';
     return $content;
 }
コード例 #19
0
 /**
  * Constructs a new class instance.
  *
  * @param array $values
  *   An array of property values, keyed by property name, used to construct
  *   the language.
  */
 public function __construct(array $values = array())
 {
     // Set all the provided properties for the language.
     foreach ($values as $key => $value) {
         $this->{$key} = $value;
     }
     // If some values were not set, set sane defaults of a predefined language.
     if (!isset($values['name']) || !isset($values['direction'])) {
         $predefined = LanguageManager::getStandardLanguageList();
         if (isset($predefined[$this->id])) {
             if (!isset($values['name'])) {
                 $this->name = $predefined[$this->id][0];
             }
             if (!isset($values['direction']) && isset($predefined[$this->id][2])) {
                 $this->direction = $predefined[$this->id][2];
             }
         }
     }
 }
コード例 #20
0
 /**
  * this method is called within a vardefs.php file which extends from a SugarObject.
  * It is meant to load the vardefs from the SugarObject.
  *
  * @param string $module
  * @param string $object
  * @param array  $templates
  * @param bool   $object_name
  */
 static function createVardef($module, $object, $templates = ['default'], $object_name = false)
 {
     global $dictionary;
     include_once 'modules/TableDictionary.php';
     //reverse the sort order so priority goes highest to lowest;
     $templates = array_reverse($templates);
     foreach ($templates as $template) {
         VardefManager::addTemplate($module, $object, $template, $object_name);
     }
     LanguageManager::createLanguageFile($module, $templates);
     if (isset(VardefManager::$custom_disabled_modules[$module])) {
         $vardef_paths = ['custom/modules/' . $module . '/Ext/Vardefs/vardefs.ext.php', 'custom/Extension/modules/' . $module . '/Ext/Vardefs/vardefs.php'];
         //search a predefined set of locations for the vardef files
         foreach ($vardef_paths as $path) {
             if (file_exists($path)) {
                 require $path;
             }
         }
     }
 }
コード例 #21
0
 /**
  * Get Default language
  * @return Language
  */
 public function getDefaultLanguage($cacheMinutes = null, $tryToAutoCreateDefaultLanguage = true)
 {
     $qb = new QueryBuilder();
     $qb->select(new Field('*', 'l'))->from(Tbl::get("TBL_HOST_LANGUAGE"), 'hl')->leftJoin(Tbl::get("TBL_LANGUAGES", "Language"), 'l', $qb->expr()->equal(new Field('lang_id', 'hl'), new Field('id', 'l')))->where($qb->expr()->equal(new Field('host_id', 'hl'), $this->host->id))->andWhere($qb->expr()->equal(new Field('default', 'hl'), 1));
     $this->query->exec($qb->getSQL(), $cacheMinutes);
     if ($this->query->countRecords()) {
         $lang_data = $this->query->fetchRecord();
         $l = new Language();
         Language::setData($lang_data, $l);
         return $l;
     } elseif ($tryToAutoCreateDefaultLanguage) {
         $defaultLanguage = parent::getDefaultLanguage();
         try {
             $this->addHostLanguage($this->host, $defaultLanguage);
             $this->setHostsDefaultLanguage($this->host, $defaultLanguage);
         } catch (MySqlException $e) {
         }
         return $this->getDefaultLanguage(0, false);
     }
     throw new RuntimeException("Default language not defined for '" . $this->host->host . "'");
 }
コード例 #22
0
 /**
  * Renders the change language form and handles its submission
  * @param CFilterChain $filterChain
  * @return boolean whether to continue execution
  */
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ChangeLanguageForm'])) {
         $model = new ChangeLanguageForm();
         $model->attributes = $_POST['ChangeLanguageForm'];
         if ($model->validate()) {
             // Get the display name of the new language
             $languages = LanguageManager::getAvailableLanguages();
             $newLanguage = $languages[$model->language];
             // Update user's default language
             if ($model->setDefault) {
                 $user = User::model()->findByPk(Yii::app()->user->id);
                 $user->language = $model->language;
                 // Don't rehash the password, it hasn't been changed
                 $user->inhibitPasswordHash();
                 $user->save();
             }
             // Update and inform
             Yii::app()->languageManager->setCurrent($model->language);
             Yii::app()->user->setFlash('success', Yii::t('Language', 'Language changed to {newLanguage}', array('{newLanguage}' => $newLanguage)));
         }
     }
     return true;
 }
コード例 #23
0
ファイル: utils.php プロジェクト: razorinc/sugarcrm-example
/**
 * This function retrieves a module's language file and returns the array of strings included.
 *
 * @param string $language specific language to load
 * @param string $module module name to load strings for
 * @param bool $refresh optional, true if you want to rebuild the language strings
 * @return array lang strings
 */
function return_module_language($language, $module, $refresh = false)
{
    global $mod_strings;
    global $sugar_config;
    global $currentModule;
    // Jenny - Bug 8119: Need to check if $module is not empty
    if (empty($module)) {
        $stack = debug_backtrace();
        $GLOBALS['log']->warn("Variable module is not in return_module_language " . var_export($stack, true));
        return array();
    }
    if (!$refresh) {
        $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
        // Check for cached value
        $cache_entry = sugar_cache_retrieve($cache_key);
        if (!empty($cache_entry)) {
            return $cache_entry;
        }
    }
    // Store the current mod strings for later
    $temp_mod_strings = $mod_strings;
    $loaded_mod_strings = array();
    $language_used = $language;
    $default_language = $sugar_config['default_language'];
    if (empty($language)) {
        $language = $default_language;
    }
    // Bug 21559 - So we can get all the strings defined in the template, refresh
    // the vardefs file if the cached language file doesn't exist.
    if (!file_exists($GLOBALS['sugar_config']['cache_dir'] . 'modules/' . $module . '/language/' . $language . '.lang.php') && !empty($GLOBALS['beanList'][$module])) {
        $object = $GLOBALS['beanList'][$module];
        if ($object == 'aCase') {
            $object = 'Case';
        }
        VardefManager::refreshVardefs($module, $object);
    }
    $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language, $refresh);
    // cn: bug 6048 - merge en_us with requested language
    if ($language != $sugar_config['default_language']) {
        $loaded_mod_strings = sugarArrayMerge(LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'], $refresh), $loaded_mod_strings);
    }
    // Load in en_us strings by default
    if ($language != 'en_us' && $sugar_config['default_language'] != 'en_us') {
        $loaded_mod_strings = sugarArrayMerge(LanguageManager::loadModuleLanguage($module, 'en_us', $refresh), $loaded_mod_strings);
    }
    // If we are in debug mode for translating, turn on the prefix now!
    if ($sugar_config['translation_string_prefix']) {
        foreach ($loaded_mod_strings as $entry_key => $entry_value) {
            $loaded_mod_strings[$entry_key] = $language_used . ' ' . $entry_value;
        }
    }
    $return_value = $loaded_mod_strings;
    if (!isset($mod_strings)) {
        $mod_strings = $return_value;
    } else {
        $mod_strings = $temp_mod_strings;
    }
    $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
    sugar_cache_put($cache_key, $return_value);
    return $return_value;
}
コード例 #24
0
ファイル: commit.php プロジェクト: razorinc/sugarcrm-example
foreach ($_SESSION['sugarMergeRunResults'] as $mergeModule => $mergeModuleFileList) {
    if (!empty($mergeModuleFileList)) {
        $skipLayouts = false;
    }
}
$stepNext = $skipLayouts ? $_REQUEST['step'] + 2 : $_REQUEST['step'] + 1;
$stepCancel = -1;
$stepRecheck = $_REQUEST['step'];
$_SESSION['step'][$steps['files'][$_REQUEST['step']]] = $stop ? 'failed' : 'success';
// clear out the theme cache
if (!class_exists('SugarThemeRegistry')) {
    require_once 'include/SugarTheme/SugarTheme.php';
}
$themeObject = SugarThemeRegistry::current();
$styleJSFilePath = $GLOBALS['sugar_config']['cache_dir'] . $themeObject->getJSPath() . DIRECTORY_SEPARATOR . 'style-min.js';
if (file_exists($styleJSFilePath)) {
    logThis("Rebuilding style js file: {$styleJSFilePath}");
    unlink($styleJSFilePath);
    SugarThemeRegistry::current()->clearJSCache();
    SugarThemeRegistry::current()->getJS();
}
SugarThemeRegistry::buildRegistry();
SugarThemeRegistry::clearAllCaches();
//Clean out the language files
logThis("Rebuilding language cache");
sugar_cache_reset_full();
LanguageManager::clearLanguageCache();
// re-minify the JS source files
$_REQUEST['root_directory'] = getcwd();
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once 'jssource/minify.php';
コード例 #25
0
 static function addLabels($language, $labels, $moduleName, $basepath = null, $forRelationshipLabel = false)
 {
     $GLOBALS['log']->debug("ParserLabel->addLabels({$language}, \$labels, {$moduleName}, {$basepath} );");
     $GLOBALS['log']->debug("\$labels:" . print_r($labels, true));
     $deployedModule = false;
     if (is_null($basepath)) {
         $deployedModule = true;
         $basepath = "custom/modules/{$moduleName}/language";
         if ($forRelationshipLabel) {
             $basepath = "custom/modules/{$moduleName}/Ext/Language";
         }
         if (!is_dir($basepath)) {
             mkdir_recursive($basepath);
         }
     }
     $filename = "{$basepath}/{$language}.lang.php";
     if ($forRelationshipLabel) {
         $filename = "{$basepath}/{$language}.lang.ext.php";
     }
     $dir_exists = is_dir($basepath);
     $mod_strings = array();
     if ($dir_exists) {
         if (file_exists($filename)) {
             // obtain $mod_strings
             include $filename;
         } else {
             if ($forRelationshipLabel) {
                 $fh = fopen($filename, 'a');
                 fclose($fh);
             }
         }
     } else {
         return false;
     }
     $changed = false;
     //$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
     foreach ($labels as $key => $value) {
         if (!isset($mod_strings[$key]) || strcmp($value, $mod_strings[$key]) != 0) {
             $mod_strings[$key] = to_html(strip_tags(from_html($value)));
             // must match encoding used in view.labels.php
             $changed = true;
         }
     }
     if ($changed) {
         $GLOBALS['log']->debug("ParserLabel->addLabels: writing new mod_strings to {$filename}");
         $GLOBALS['log']->debug("ParserLabel->addLabels: mod_strings=" . print_r($mod_strings, true));
         if (!write_array_to_file("mod_strings", $mod_strings, $filename)) {
             $GLOBALS['log']->fatal("Could not write {$filename}");
         } else {
             // if we have a cache to worry about, then clear it now
             if ($deployedModule) {
                 SugarCache::cleanOpcodes();
                 $GLOBALS['log']->debug("PaserLabel->addLabels: clearing language cache");
                 $cache_key = "module_language." . $language . $moduleName;
                 sugar_cache_clear($cache_key);
                 LanguageManager::clearLanguageCache($moduleName, $language);
             }
         }
     }
     return true;
 }
コード例 #26
0
 /**
  * Clear the language string cache in sugar_cache, which will get rid of our
  * language file overrides.
  */
 protected function clearLangCache()
 {
     $language = $GLOBALS['current_language'];
     if (isset($this->_strings['app_strings'])) {
         $cache_key = 'app_strings.' . $language;
         sugar_cache_clear($cache_key);
     }
     if (isset($this->_strings['app_list_strings'])) {
         $cache_key = 'app_list_strings.' . $language;
         sugar_cache_clear($cache_key);
     }
     if (isset($this->_strings['mod_strings'])) {
         foreach ($this->_strings['mod_strings'] as $module => $strings) {
             $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
             sugar_cache_clear($cache_key);
         }
     }
 }
コード例 #27
0
 function loadModuleLanguage($module, $lang, $refresh = false)
 {
     //here check if the cache file exists, if it does then load it, if it doesn't
     //then call refreshVardef
     //if either our session or the system is set to developerMode then refresh is set to true
     // Retrieve the vardefs from cache.
     $key = self::getLanguageCacheKey($module, $lang);
     if (!$refresh) {
         $return_result = sugar_cache_retrieve($key);
         if (!empty($return_result) && is_array($return_result)) {
             return $return_result;
         }
     }
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $cachedfile = sugar_cached('modules/') . $module . '/language/' . $lang . '.lang.php';
     if ($refresh || !file_exists($cachedfile)) {
         LanguageManager::refreshLanguage($module, $lang);
     }
     //at this point we should have the cache/modules/... file
     //which was created from the refreshVardefs so let's try to load it.
     if (file_exists($cachedfile)) {
         global $mod_strings;
         require $cachedfile;
         // now that we hae loaded the data from disk, put it in the cache.
         if (!empty($mod_strings)) {
             sugar_cache_put($key, $mod_strings);
         }
         if (!empty($_SESSION['translation_mode'])) {
             $mod_strings = array_map('translated_prefix', $mod_strings);
         }
         return $mod_strings;
     }
 }
コード例 #28
0
 function rebuild_languages($languages = array(), $modules = "")
 {
     foreach ($languages as $language => $value) {
         $this->log(translate('LBL_MI_REBUILDING') . " Language...{$language}");
         $this->merge_files('Ext/Language/', $language . '.lang.ext.php', $language);
         if ($modules != "") {
             foreach ($modules as $module) {
                 LanguageManager::clearLanguageCache($module, $language);
             }
         }
     }
     sugar_cache_reset();
 }
コード例 #29
0
ファイル: controller.php プロジェクト: klr2003/sourceread
 function action_SaveRelationship()
 {
     if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
         $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
     }
     if (empty($_REQUEST['view_package'])) {
         require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php';
         $relationships = new DeployedRelationships($_REQUEST['view_module']);
     } else {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php';
         $relationships = new UndeployedRelationships($module->getModuleDir());
     }
     $relationships->addFromPost();
     $relationships->save();
     $GLOBALS['log']->debug("\n\nSTART BUILD");
     if (empty($_REQUEST['view_package'])) {
         $relationships->build();
         LanguageManager::clearLanguageCache($_REQUEST['view_module']);
     }
     $GLOBALS['log']->debug("\n\nEND BUILD");
     $this->view = 'relationships';
 }
コード例 #30
0
ファイル: index.php プロジェクト: priyankajsr19/indusdiva2
define('PS_BASE_URI', $tmpBaseUri[strlen($tmpBaseUri) - 1] == '/' ? $tmpBaseUri : $tmpBaseUri . '/');
define('PS_BASE_URI_ABSOLUTE', 'http://' . ToolsInstall::getHttpHost(false, true) . PS_BASE_URI);
/* Old version detection */
$oldversion = false;
$sameVersions = false;
$tooOld = true;
$installOfOldVersion = false;
if (file_exists(INSTALL_PATH . '/../config/settings.inc.php')) {
    include INSTALL_PATH . '/../config/settings.inc.php';
    $oldversion = _PS_VERSION_;
    $tooOld = version_compare($oldversion, MINIMUM_VERSION_TO_UPDATE) == -1;
    $sameVersions = version_compare($oldversion, INSTALL_VERSION) == 0;
    $installOfOldVersion = version_compare($oldversion, INSTALL_VERSION) == 1;
}
include INSTALL_PATH . '/classes/LanguagesManager.php';
$lm = new LanguageManager(dirname(__FILE__) . '/langs/list.xml');
$_LANG = array();
$_LIST_WORDS = array();
function lang($txt)
{
    global $_LANG, $_LIST_WORDS;
    return isset($_LANG[$txt]) ? $_LANG[$txt] : $txt;
}
if ($lm->getIncludeTradFilename()) {
    include_once $lm->getIncludeTradFilename();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />