/** * Step #3 - Import Language XML * */ function step_3() { $this->show_message($this->phrase['final']['import_latest_language']); require_once DIR . '/includes/adminfunctions_language.php'; if (!($xml = file_read(DIR . '/install/vbulletin-language.xml'))) { $this->add_error(sprintf($this->phrase['vbphrase']['file_not_found'], 'vbulletin-language.xml'), self::PHP_TRIGGER_ERROR, true); return; } $this->show_message(sprintf($this->phrase['vbphrase']['importing_file'], 'vbulletin-language.xml')); xml_import_language($xml, -1, '', false, true, !defined('SUPPRESS_KEEPALIVE_ECHO')); build_language(); build_language_datastore(); $this->show_message($this->phrase['core']['import_done']); }
if (!($xml = file_read('./install/vbulletin-settings.xml'))) { echo '<p>Uh oh, ./install/vbulletin-settings.xml doesn\'t appear to exist! Upload it and refresh the page.</p>'; print_cp_footer(); } echo '<p>Importing vbulletin-settings.xml'; xml_import_settings($xml); echo '<br /><span class="smallfont"><b>Okay</b></span></p>'; break; case 'language': require_once './includes/adminfunctions_language.php'; if (!($xml = file_read('./install/vbulletin-language.xml'))) { echo '<p>Uh oh, ./install/vbulletin-language.xml doesn\'t appear to exist! Upload it and refresh the page.</p>'; print_cp_footer(); } echo '<p>Importing vbulletin-language.xml'; xml_import_language($xml); build_language(); echo '<br /><span class="smallfont"><b>Okay</b></span></p>'; break; case 'adminhelp': require_once './includes/adminfunctions_help.php'; if (!($xml = file_read('./install/vbulletin-adminhelp.xml'))) { echo '<p>Uh oh, ./install/vbulletin-adminhelp.xml doesn\'t appear to exist! Upload it and refresh the page.</p>'; print_cp_footer(); } echo '<p>Importing vbulletin-adminhelp.xml'; xml_import_help_topics($xml); echo "<br /><span class=\"smallfont\"><b>Okay</b></span></p>"; break; } define('SCRIPT_REDIRECT', true);
// ########################################################################## if ($_POST['do'] == 'upload') { ignore_user_abort(true); $vbulletin->input->clean_array_gpc('p', array('title' => TYPE_STR, 'serverfile' => TYPE_STR, 'anyversion' => TYPE_BOOL)); $vbulletin->input->clean_array_gpc('f', array('languagefile' => TYPE_FILE)); // got an uploaded file? if (file_exists($vbulletin->GPC['languagefile']['tmp_name'])) { $xml = file_read($vbulletin->GPC['languagefile']['tmp_name']); } else { if (file_exists($vbulletin->GPC['serverfile'])) { $xml = file_read($vbulletin->GPC['serverfile']); } else { print_stop_message('no_file_uploaded_and_no_local_file_found'); } } xml_import_language($xml, $vbulletin->GPC['dolanguageid'], $vbulletin->GPC['title'], $vbulletin->GPC['anyversion']); build_language_datastore(); print_cp_redirect("language.php?" . $vbulletin->session->vars['sessionurl'] . "do=rebuild&goto=language.php?" . $vbulletin->session->vars['sessionurl'], 0); } // ########################################################################## if ($_REQUEST['do'] == 'files') { require_once DIR . '/includes/functions_misc.php'; $languages = fetch_language_titles_array('', 1); // download form print_form_header('language', 'download', 0, 1, 'downloadform" target="download'); print_table_header($vbphrase['download']); print_label_row($vbphrase['language'], '<select name="dolanguageid" tabindex="1" class="bginput">' . iif($vbulletin->debug, '<option value="-1">' . MASTER_LANGUAGE . '</option>') . construct_select_options($languages, $vbulletin->GPC['dolanguageid']) . '</select>', '', 'top', 'languageid'); print_select_row($vbphrase['product'], 'product', fetch_product_list()); print_input_row($vbphrase['filename'], 'filename', DEFAULT_FILENAME); print_yes_no_row($vbphrase['include_custom_phrases'], 'custom', 0); print_yes_no_row($vbphrase['just_fetch_phrases'], 'just_phrases', 0);
ignore_user_abort(true); $vbulletin->input->clean_array_gpc('p', array('title' => TYPE_STR, 'serverfile' => TYPE_STR, 'anyversion' => TYPE_BOOL, 'readcharset' => TYPE_BOOL)); $vbulletin->input->clean_array_gpc('f', array('languagefile' => TYPE_FILE)); ($hook = vBulletinHook::fetch_hook('admin_language_import')) ? eval($hook) : false; // got an uploaded file? // do not use file_exists here, under IIS it will return false in some cases if (is_uploaded_file($vbulletin->GPC['languagefile']['tmp_name'])) { $xml = file_read($vbulletin->GPC['languagefile']['tmp_name']); } else { if (file_exists($vbulletin->GPC['serverfile'])) { $xml = file_read($vbulletin->GPC['serverfile']); } else { print_stop_message('no_file_uploaded_and_no_local_file_found'); } } xml_import_language($xml, $vbulletin->GPC['dolanguageid'], $vbulletin->GPC['title'], $vbulletin->GPC['anyversion'], true, true, $vbulletin->GPC['readcharset']); build_language_datastore(); print_cp_redirect("language.php?" . $vbulletin->session->vars['sessionurl'] . "do=rebuild&goto=language.php?" . $vbulletin->session->vars['sessionurl'], 0); } // ########################################################################## if ($_REQUEST['do'] == 'files') { require_once DIR . '/includes/functions_misc.php'; $alllanguages = fetch_languages_array(); $languages = array(); $charsets = array('ISO-8859-1' => 'ISO-8859-1'); $jscharsets = array('-1' => 'ISO-8859-1'); foreach ($alllanguages as $languageid => $language) { $jscharsets[$languageid] = strtoupper($language['charset']); $languages[$languageid] = $language['title']; if ($languageid == $vbulletin->GPC['dolanguageid']) { $charset = strtoupper($language['charset']);
/** * Import a language * * @param string $xml Language xml data * @param int $languageid Language ID to be overwrite. 0 means creating new language * @param string $title Title for Imported Language. Empty means to use the language title specified in the language xml * @param bool $anyversion Whether to Ignore Language Version * @param bool Allow user-select of imported language * @param bool Echo output.. * @param bool Read charset from XML header * @return void */ public function import($xml, $languageid = 0, $title = '', $anyversion = false, $userselect = true, $output = true, $readcharset = false) { $this->checkHasAdminPermission('canadminlanguages'); require_once DIR . '/includes/adminfunctions_language.php'; xml_import_language($xml, $languageid, $title, $anyversion, $userselect, $output, $readcharset); build_language_datastore(); }