} $aResult = $bCompiled ? array('code' => 0, 'message' => '_adm_txt_langs_success_key_save') : array('code' => 1, 'message' => '_adm_txt_langs_cannot_compile'); $aResult['message'] = MsgBox(_t($aResult['message'])); echo "<script>parent.onResult('edit', " . json_encode($aResult) . ");</script>"; exit; } } if (isset($_POST['adm-lang-key-delete']) && is_array($_POST['keys'])) { foreach ($_POST['keys'] as $iKeyId) { $GLOBALS['MySQL']->query("DELETE FROM `sys_localization_keys`, `sys_localization_strings` USING `sys_localization_keys`, `sys_localization_strings` WHERE `sys_localization_keys`.`ID`=`sys_localization_strings`.`IDKey` AND `sys_localization_keys`.`ID`='" . $iKeyId . "'"); } } $iNameIndex = 5; $_page = array('name_index' => $iNameIndex, 'css_name' => array('forms_adv.css', 'lang_file.css'), 'js_name' => array('lang_file.js'), 'header' => _t('_adm_page_cpt_lang_file')); $sLangRssFeed = 'on' == getParam('feeds_enable') ? DesignBoxAdmin(_t('_adm_box_cpt_lang_files'), '<div class="RSSAggrCont" rssid="boonex_unity_lang_files" rssnum="5" member="0">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>') : ''; $_page_cont[$iNameIndex] = array('page_result_code' => '', 'page_code_main' => PageCodeMain($aResults), 'page_code_key' => PageCodeKeyCreate() . $sLangRssFeed); PageCodeAdmin(); function PageCodeMain($aResults) { $aTopItems = array('adm-langs-btn-keys' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onChangeType(this)', 'title' => _t('_adm_txt_langs_keys'), 'active' => empty($aResults) ? 1 : 0), 'adm-langs-btn-keys-add' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onCreate()', 'title' => _t('_adm_txt_langs_add_key'), 'active' => 0), 'adm-langs-btn-langs' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onChangeType(this)', 'title' => _t('_adm_txt_langs_languages'), 'active' => isset($aResults['langs']) ? 1 : 0), 'adm-langs-btn-langs-add' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onChangeType(this)', 'title' => _t('_adm_txt_langs_languages_add'), 'active' => isset($aResults['langs-add']) ? 1 : 0), 'adm-langs-btn-langs-import' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onChangeType(this)', 'title' => _t('_adm_txt_langs_languages_import'), 'active' => isset($aResults['langs-import']) ? 1 : 0), 'adm-langs-btn-settings' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:onChangeType(this)', 'title' => _t('_adm_txt_langs_settings'), 'active' => isset($aResults['settings']) ? 1 : 0)); $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('langs.html', array('content_keys' => _getKeysList(isset($aResults['keys']) ? $aResults['keys'] : true, empty($aResults)), 'content_files' => _getLanguagesList(isset($aResults['langs']) ? $aResults['langs'] : true), 'content_create' => _getLanguageCreateForm(isset($aResults['langs-add']) ? $aResults['langs-add'] : true), 'content_import' => _getLanguageImportForm(isset($aResults['langs-import']) ? $aResults['langs-import'] : true), 'content_settings' => _getLanguageSettingsForm(isset($aResults['settings']) ? $aResults['settings'] : true))); return DesignBoxAdmin(_t('_adm_box_cpt_lang_available'), $sResult, $aTopItems); } function _getLanguagesArray() { return $GLOBALS['MySQL']->fromCache('sys_localization_languages', 'getAllWithKey', "SELECT `ID` AS `id`, `Name` AS `name`, `Title` AS `title`, `Flag` AS `flag` FROM `sys_localization_languages` ORDER BY `Name`", 'name'); } function _checkLangUnique($sLangName) { $aLangs = _getLanguagesArray(); return array_key_exists($sLangName, $aLangs);
} } if (isset($_POST['adm-lang-key-delete']) && is_array($_POST['keys'])) { foreach ($_POST['keys'] as $iKeyId) { $GLOBALS['MySQL']->query("DELETE FROM `sys_localization_keys`, `sys_localization_strings` USING `sys_localization_keys`, `sys_localization_strings` WHERE `sys_localization_keys`.`ID`=`sys_localization_strings`.`IDKey` AND `sys_localization_keys`.`ID`='" . $iKeyId . "'"); } } $iNameIndex = 5; $_page = array('name_index' => $iNameIndex, 'css_name' => array('forms_adv.css', 'lang_file.css'), 'js_name' => array('lang_file.js'), 'header' => _t('_adm_page_cpt_lang_file')); $sLangRssFeed = 'on' == getParam('feeds_enable') ? DesignBoxAdmin(_t('_adm_box_cpt_lang_files'), ' <div class="RSSAggrCont" rssid="boonex_unity_lang_files" rssnum="5" member="0"> <div class="loading_rss"> <img src="' . getTemplateImage('loading.gif') . '" alt="' . _t('_loading ...') . '" /> </div> </div>') : ''; $_page_cont[$iNameIndex] = array('page_result_code' => $sResult, 'page_code_settings' => PageCodeSettings($mixedResultSettings), 'page_code_create' => PageCodeCreate($mixedResultCreate), 'page_code_keys' => PageCodeKeys($mixedResultKeys), 'page_code_key' => PageCodeKeyCreate() . $sLangRssFeed); PageCodeAdmin(); function PageCodeSettings($mixedResult) { $aForm = array('form_attrs' => array('id' => 'adm-settings-form-settings', 'name' => 'adm-settings-form-settings', 'action' => $GLOBALS['site']['url_admin'] . 'lang_file.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array('lang_default' => array('type' => 'select', 'name' => 'lang_default', 'caption' => _t('_adm_txt_langs_def_lang'), 'values' => array(), 'value' => getParam('lang_default')), 'save_settings' => array('type' => 'submit', 'name' => 'save_settings', 'value' => _t("_adm_btn_settings_save")))); $aLangs = getLangsArr(); foreach ($aLangs as $sName => $sTitle) { $aForm['inputs']['lang_default']['values'][] = array('key' => $sName, 'value' => htmlspecialchars_adv($sTitle)); } $oForm = new BxTemplFormView($aForm); $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode())); if ($mixedResult !== true && !empty($mixedResult)) { $sResult = MsgBox(_t($mixedResult), 3) . $sResult; } return DesignBoxAdmin(_t('_adm_box_cpt_lang_settings'), $sResult); }