Commit 69c479b3 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4183 (Bugs in lang_code_to_default_content and lang_code_to_static_content functions)

parent e8b7e3eb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -223,13 +223,13 @@ function _create_selection_list_langs($select_lang = null, $show_unset = false)
 */
function lang_code_to_default_content($field_name, $code, $comcode = false, $level = 2, $connection = null)
{
    $insert_map = insert_lang($field_name, do_lang($code), $level, null, $comcode);
    $insert_map = insert_lang($field_name, do_lang($code), $level, $connection, $comcode);
    if (multi_lang_content()) {
        $langs = find_all_langs();
        foreach ($langs as $lang => $lang_type) {
            if ($lang != user_lang()) {
                if (is_file(get_file_base() . '/' . $lang_type . '/' . $lang . '/critical_error.ini')) { // Make sure it's a reasonable looking pack, not just a stub (Google Translate addon can be made to go nuts otherwise)
                    insert_lang($field_name, do_lang($code, '', '', '', $lang), $level, $connection, true, $insert_map[$field_name], $lang);
                if ((is_file(get_file_base() . '/lang/' . $lang . '/critical_error.ini')) || (is_file(get_file_base() . '/lang_custom/' . $lang . '/critical_error.ini'))) { // Make sure it's a reasonable looking pack, not just a stub (Google Translate addon can be made to go nuts otherwise)
                    insert_lang($field_name, do_lang($code, '', '', '', $lang), $level, $connection, $comcode, $insert_map[$field_name], $lang);
                }
            }
        }
@@ -254,7 +254,7 @@ function lang_code_to_static_content($field_name, $str, $comcode = false, $level
        $langs = find_all_langs();
        foreach ($langs as $lang => $lang_type) {
            if ($lang != user_lang()) {
                if (is_file(get_file_base() . '/' . $lang_type . '/' . $lang . '/critical_error.ini')) { // Make sure it's a reasonable looking pack, not just a stub
                if ((is_file(get_file_base() . '/lang/' . $lang . '/critical_error.ini')) || (is_file(get_file_base() . '/lang_custom/' . $lang . '/critical_error.ini'))) { // Make sure it's a reasonable looking pack, not just a stub (Google Translate addon can be made to go nuts otherwise)
                    insert_lang($field_name, $str, $level, $connection, $comcode, $insert_map[$field_name], $lang);
                }
            }