Zeile 44 | Zeile 44 |
---|
{ $info = str_replace("\\", "\\\\", $info); $info = str_replace('$', '\$', $info);
|
{ $info = str_replace("\\", "\\\\", $info); $info = str_replace('$', '\$', $info);
|
|
|
if($key == 'admin' || $key == 'rtl') { $info = (int)$info; }
|
if($key == 'admin' || $key == 'rtl') { $info = (int)$info; }
|
|
|
$newlanginfo[$key] = str_replace("\"", '\"', $info); }
| $newlanginfo[$key] = str_replace("\"", '\"', $info); }
|
Zeile 103 | Zeile 103 |
---|
}
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", $languages[$editlang]), "index.php?module=config-languages&action=edit&lang={$editlang}");
|
}
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", $languages[$editlang]), "index.php?module=config-languages&action=edit&lang={$editlang}");
|
$page->add_breadcrumb_item($lang->nav_editing_set);
| $page->add_breadcrumb_item($lang->nav_editing_set);
|
$page->output_header($lang->languages);
| $page->output_header($lang->languages);
|
Zeile 132 | Zeile 132 |
---|
if($langinfo['admin']) { $mybb->input['info']['admin'] = 1;
|
if($langinfo['admin']) { $mybb->input['info']['admin'] = 1;
|
} else
| } else
|
{ $mybb->input['info']['admin'] = 0; }
| { $mybb->input['info']['admin'] = 0; }
|
Zeile 164 | Zeile 164 |
---|
if(!is_writable($file)) { $no_write = 1;
|
if(!is_writable($file)) { $no_write = 1;
|
$page->output_alert($lang->alert_note_cannot_write); }
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
| $page->output_alert($lang->alert_note_cannot_write); }
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
|
$form->output_submit_wrapper($buttons); $form->end();
$page->output_footer(); }
|
$form->output_submit_wrapper($buttons); $form->end();
$page->output_footer(); }
|
|
|
if($mybb->input['action'] == "quick_phrases") { // Validate input
| if($mybb->input['action'] == "quick_phrases") { // Validate input
|
Zeile 184 | Zeile 184 |
---|
$folder = MYBB_ROOT."inc/languages/".$editlang."/";
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", $languages[$editlang]), "index.php?module=config-languages&action=quick_edit&lang={$editlang}");
|
$folder = MYBB_ROOT."inc/languages/".$editlang."/";
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", $languages[$editlang]), "index.php?module=config-languages&action=quick_edit&lang={$editlang}");
|
|
|
// Validate that this language pack really exists if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php"))
|
// Validate that this language pack really exists if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php"))
|
{
| {
|
// Then validate language pack folders (and try to fix them if missing) @mkdir($folder); @mkdir($folder."admin");
|
// Then validate language pack folders (and try to fix them if missing) @mkdir($folder); @mkdir($folder."admin");
|
}
| }
|
if(!file_exists($folder) || !file_exists($folder."admin")) { flash_message($lang->error_folders_fail, 'error'); admin_redirect("index.php?module=config-languages");
|
if(!file_exists($folder) || !file_exists($folder."admin")) { flash_message($lang->error_folders_fail, 'error'); admin_redirect("index.php?module=config-languages");
|
}
$plugins->run_hooks("admin_config_languages_quick_phrases");
| }
$plugins->run_hooks("admin_config_languages_quick_phrases");
|
$quick_phrases = array( 'member.lang.php' => array(
| $quick_phrases = array( 'member.lang.php' => array(
|
Zeile 244 | Zeile 244 |
---|
// Lets make nice credits header in language file $lang_file_credits = "<?php\n/**\n"; $lang_file_credits .= " * MyBB Copyright 2014 MyBB Group, All Rights Reserved\n *\n";
|
// Lets make nice credits header in language file $lang_file_credits = "<?php\n/**\n"; $lang_file_credits .= " * MyBB Copyright 2014 MyBB Group, All Rights Reserved\n *\n";
|
$lang_file_credits .= " * Website: http://www.mybb.com\n"; $lang_file_credits .= " * License: http://www.mybb.com/about/license\n *\n */\n\n";
| $lang_file_credits .= " * Website: https://mybb.com\n"; $lang_file_credits .= " * License: https://mybb.com/about/license\n *\n */\n\n";
|
$lang_file_credits .= "// ".str_repeat('-',80)."\n"; $lang_file_credits .= "// MyBB Language Pack File.\n"; $lang_file_credits .= "// This file has been generated by MyBB - buildin language pack editor.\n";
| $lang_file_credits .= "// ".str_repeat('-',80)."\n"; $lang_file_credits .= "// MyBB Language Pack File.\n"; $lang_file_credits .= "// This file has been generated by MyBB - buildin language pack editor.\n";
|
Zeile 263 | Zeile 263 |
---|
{ $contents_wfile .= "\$l['".$key."'] = ".var_export($value, true).";\n"; }
|
{ $contents_wfile .= "\$l['".$key."'] = ".var_export($value, true).";\n"; }
|
|
|
flock($fp, LOCK_EX); fwrite($fp, $contents_wfile); flock($fp, LOCK_UN);
| flock($fp, LOCK_EX); fwrite($fp, $contents_wfile); flock($fp, LOCK_UN);
|
Zeile 293 | Zeile 293 |
---|
'title' => $lang->language_files, 'link' => "index.php?module=config-languages&action=edit&lang=".$editlang, 'description' => $lang->language_files_desc
|
'title' => $lang->language_files, 'link' => "index.php?module=config-languages&action=edit&lang=".$editlang, 'description' => $lang->language_files_desc
|
);
| );
|
$sub_tabs['quick_phrases'] = array( 'title' => $lang->quick_phrases,
| $sub_tabs['quick_phrases'] = array( 'title' => $lang->quick_phrases,
|
Zeile 345 | Zeile 345 |
---|
$value = $l[$phrase]; if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = $l[$phrase]; if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $value);
|
} else {
|
} else {
|
$value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string', $value);
|
}
$form_container->output_row($description, $phrase, $form->generate_text_area("edit[$phrase]", $value, array('id' => 'lang_'.$phrase, 'rows' => 2, 'class' => "langeditor_textarea_edit {$quickphrases_dir_class}")), 'lang_'.$phrase, array('width' => '50%'));
| }
$form_container->output_row($description, $phrase, $form->generate_text_area("edit[$phrase]", $value, array('id' => 'lang_'.$phrase, 'rows' => 2, 'class' => "langeditor_textarea_edit {$quickphrases_dir_class}")), 'lang_'.$phrase, array('width' => '50%'));
|
Zeile 451 | Zeile 451 |
---|
// Lets make nice credits header in language file $lang_file_credits = "<?php\n/**\n"; $lang_file_credits .= " * MyBB Copyright 2014 MyBB Group, All Rights Reserved\n *\n";
|
// Lets make nice credits header in language file $lang_file_credits = "<?php\n/**\n"; $lang_file_credits .= " * MyBB Copyright 2014 MyBB Group, All Rights Reserved\n *\n";
|
$lang_file_credits .= " * Website: http://www.mybb.com\n"; $lang_file_credits .= " * License: http://www.mybb.com/about/license\n *\n */\n\n";
| $lang_file_credits .= " * Website: https://mybb.com\n"; $lang_file_credits .= " * License: https://mybb.com/about/license\n *\n */\n\n";
|
$lang_file_credits .= "// ".str_repeat('-',80)."\n"; $lang_file_credits .= "// MyBB Language Pack File.\n"; $lang_file_credits .= "// This file has been generated by MyBB - buildin language pack editor.\n";
| $lang_file_credits .= "// ".str_repeat('-',80)."\n"; $lang_file_credits .= "// MyBB Language Pack File.\n"; $lang_file_credits .= "// This file has been generated by MyBB - buildin language pack editor.\n";
|
Zeile 475 | Zeile 475 |
---|
$plugins->run_hooks("admin_config_languages_edit_commit");
// Log admin action
|
$plugins->run_hooks("admin_config_languages_edit_commit");
// Log admin action
|
log_admin_action($editlang, $editfile, (int)$mybb->input['inadmin']);
| log_admin_action($editlang, $editfile, $mybb->get_input('inadmin', MyBB::INPUT_INT));
|
flash_message($lang->success_langfile_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
| flash_message($lang->success_langfile_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
|
Zeile 532 | Zeile 532 |
---|
echo $form->generate_hidden_field("file", htmlspecialchars_uni($file)); echo $form->generate_hidden_field("lang", $editlang); echo $form->generate_hidden_field("editwith", $editwith);
|
echo $form->generate_hidden_field("file", htmlspecialchars_uni($file)); echo $form->generate_hidden_field("lang", $editlang); echo $form->generate_hidden_field("editwith", $editwith);
|
echo $form->generate_hidden_field("inadmin", (int)$mybb->input['inadmin']);
| echo $form->generate_hidden_field("inadmin", $mybb->get_input('inadmin', MyBB::INPUT_INT));
|
if($errors) { $page->output_inline_error($errors);
| if($errors) { $page->output_inline_error($errors);
|
Zeile 544 | Zeile 544 |
---|
{ $no_write = 1; $page->output_alert($lang->alert_note_cannot_write);
|
{ $no_write = 1; $page->output_alert($lang->alert_note_cannot_write);
|
}
| }
|
$form_container = new FormContainer(htmlspecialchars_uni($file)); if($editwithfile && $withvars) {
| $form_container = new FormContainer(htmlspecialchars_uni($file)); if($editwithfile && $withvars) {
|
Zeile 557 | Zeile 557 |
---|
foreach($withvars as $key => $value) { if(my_strtolower($langinfo['charset']) == "utf-8")
|
foreach($withvars as $key => $value) { if(my_strtolower($langinfo['charset']) == "utf-8")
|
{ $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]); $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $editvars[$key]); } else { $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]); $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $editvars[$key]); }
// Find problems and differences in editfile in comparision to editwithfile
| { $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $withvars[$key]); $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $editvars[$key]); } else { $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $withvars[$key]); $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string', $editvars[$key]); }
// Find problems and differences in editfile in comparision to editwithfile
|
// Count {x} in left and right variable $withvars_value_cbvCount = preg_match_all("/{[ \t]*\d+[ \t]*}/", $withvars[$key], $matches); $editvars_value_cbvCount = preg_match_all("/{[ \t]*\d+[ \t]*}/", $editvars[$key], $matches);
| // Count {x} in left and right variable $withvars_value_cbvCount = preg_match_all("/{[ \t]*\d+[ \t]*}/", $withvars[$key], $matches); $editvars_value_cbvCount = preg_match_all("/{[ \t]*\d+[ \t]*}/", $editvars[$key], $matches);
|
Zeile 586 | Zeile 586 |
---|
$form_container->output_row($key, "", $form->generate_text_area("", $withvars[$key], array('readonly' => true, 'rows' => 2, 'class' => "langeditor_textarea_editwith {$editwith_dir_class}")), "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $editvars[$key], array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$textarea_issue_class} {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
|
$form_container->output_row($key, "", $form->generate_text_area("", $withvars[$key], array('readonly' => true, 'rows' => 2, 'class' => "langeditor_textarea_editwith {$editwith_dir_class}")), "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $editvars[$key], array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$textarea_issue_class} {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
|
|
|
// Create form fields for extra variables that are present only in edited file $present_in_edit_vars_only = (array)array_diff_key($editvars, $withvars); if($present_in_edit_vars_only)
| // Create form fields for extra variables that are present only in edited file $present_in_edit_vars_only = (array)array_diff_key($editvars, $withvars); if($present_in_edit_vars_only)
|
Zeile 595 | Zeile 595 |
---|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $editvars[$key]);
| $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $editvars[$key]);
|
} else {
|
} else {
|
$editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $editvars[$key]);
| $editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string', $editvars[$key]);
|
}
|
}
|
|
|
$form_container->output_row("", "", "", "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $editvars[$key], array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
| $form_container->output_row("", "", "", "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $editvars[$key], array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
|
Zeile 618 | Zeile 618 |
---|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $value);
|
} else {
|
} else {
|
$value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string', $value);
|
} $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
| } $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'class' => "langeditor_textarea_edit {$editlang_dir_class}")), 'lang_'.$key, array('width' => '50%')); }
|
Zeile 923 | Zeile 923 |
---|
unset($l); @include $folder."admin/".$file; $editvars_right = (array)$l;
|
unset($l); @include $folder."admin/".$file; $editvars_right = (array)$l;
|
unset($l);
| unset($l);
|
$table->construct_cell($file, array("class" => "langeditor_editwithfile")); $table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases"));
| $table->construct_cell($file, array("class" => "langeditor_editwithfile")); $table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases"));
|
Zeile 990 | Zeile 990 |
---|
); $sub_tabs['find_language'] = array( 'title' => $lang->find_language_packs,
|
); $sub_tabs['find_language'] = array( 'title' => $lang->find_language_packs,
|
'link' => "http://community.mybb.com/mods.php?action=browse&category=19", 'target' => "_blank"
| 'link' => "https://community.mybb.com/mods.php?action=browse&category=19", 'link_target' => "_blank", 'link_rel' => "noopener"
|
);
$plugins->run_hooks("admin_config_languages_start");
| );
$plugins->run_hooks("admin_config_languages_start");
|
Zeile 1002 | Zeile 1003 |
---|
$table->construct_header($lang->languagevar); $table->construct_header($lang->version, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 155));
|
$table->construct_header($lang->languagevar); $table->construct_header($lang->version, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 155));
|
|
|
asort($languages);
foreach($languages as $key1 => $langname1)
| asort($languages);
foreach($languages as $key1 => $langname1)
|
Zeile 1016 | Zeile 1017 |
---|
if(!empty($langinfo['website'])) {
|
if(!empty($langinfo['website'])) {
|
$author = "<a href=\"{$langinfo['website']}\" target=\"_blank\">{$langinfo['author']}</a>";
| $author = "<a href=\"{$langinfo['website']}\" target=\"_blank\" rel=\"noopener\">{$langinfo['author']}</a>";
|
} else {
| } else {
|
Zeile 1049 | Zeile 1050 |
---|
$table->output($lang->installed_language_packs);
$page->output_footer();
|
$table->output($lang->installed_language_packs);
$page->output_footer();
|
| }
/** * Fixes url encoded unicode characters * * @param string $string The string to encode. * @return string The encoded string. */ function encode_language_string_utf8($matches) { return dec_to_utf8(hexdec($matches[1])); }
/** * Fixes url encoded unicode characters * * @param string $string The string to encode. * @return string The encoded string. */ function encode_language_string($matches) { return "&#".hexdec($matches[1]).";";
|
}
| }
|