$lc = Languages::update($new_language, 0); if ($lc !== false) { fn_save_languages_integrity(); } } } if ($mode == 'export_language') { $lang_id = $_REQUEST['lang_id']; $lang_data = Languages::get(array('lang_id' => $lang_id), 'lang_id'); if (!empty($lang_data)) { Languages::export($lang_data[$lang_id]['lang_code']); } } if ($mode == 'delete_language') { if (!empty($_REQUEST['lang_id'])) { fn_delete_languages($_REQUEST['lang_id']); } return array(CONTROLLER_STATUS_REDIRECT, 'languages.manage?selected_section=languages'); } $q = empty($_REQUEST['q']) ? '' : $_REQUEST['q']; return array(CONTROLLER_STATUS_OK, 'languages' . $suffix . '?q=' . $q); } // // Get language variables values // if ($mode == 'manage') { if (fn_allowed_for('ULTIMATE:FREE') && !defined('AJAX_REQUEST')) { fn_set_notification('N', __('notice'), __('change_language_in_free_mode'), 'K'); } $sections = array('translations' => array('title' => __('translations'), 'href' => fn_url('languages.translations')), 'manage_languages' => array('title' => __('manage_languages'), 'href' => fn_url('languages.manage'))); Registry::set('navigation.dynamic.sections', $sections);
$limit = fn_paginate($page, $lang_data_count, Registry::get('settings.Appearance.admin_elements_per_page')); $lang_data = db_get_array("SELECT name, value FROM ?:language_values WHERE {$_query} ORDER BY name {$limit}"); Registry::set('navigation.tabs', array('translations' => array('title' => fn_get_lang_var('translations'), 'js' => true), 'languages' => array('title' => fn_get_lang_var('languages'), 'js' => true))); $view->assign('lang_data', $lang_data); $view->assign('langs', Registry::get('languages')); } elseif ($mode == 'delete_variable') { if (!empty($_REQUEST['name'])) { db_query("DELETE FROM ?:language_values WHERE name = ?s", $_REQUEST['name']); } return array(CONTROLLER_STATUS_REDIRECT, "languages.manage"); // // Delete languages // } elseif ($mode == 'delete_language') { if (!empty($_REQUEST['lang_code'])) { fn_delete_languages($_REQUEST['lang_code']); } return array(CONTROLLER_STATUS_REDIRECT, "languages.manage?selected_section=languages"); } function fn_delete_languages($lang_codes) { $db_descr_tables = db_get_fields("SHOW TABLES LIKE '%_descriptions'"); $db_descr_tables[] = '?:language_values'; $db_descr_tables[] = '?:product_features_values'; foreach ((array) $lang_codes as $v) { db_query("DELETE FROM ?:languages WHERE lang_code = ?s", $v); db_query("DELETE FROM ?:localization_elements WHERE element_type = 'L' AND element = ?s", $v); foreach ($db_descr_tables as $table) { db_query("DELETE FROM {$table} WHERE lang_code = ?s", $v); } }