Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: languages.php 5380 2011-02-21 12:04:43Z Tomm $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 45 | Zeile 45 |
---|
{ $info = str_replace("\\", "\\\\", $info); $info = str_replace('$', '\$', $info);
|
{ $info = str_replace("\\", "\\\\", $info); $info = str_replace('$', '\$', $info);
|
| if($key == 'admin' || $key == 'rtl') { $info = (int)$info; }
|
$newlanginfo[$key] = str_replace("\"", '\"', $info); }
| $newlanginfo[$key] = str_replace("\"", '\"', $info); }
|
Zeile 64 | Zeile 70 |
---|
// Compatible version of MyBB \$langinfo['version'] = \"{$langinfo['version']}\";
|
// Compatible version of MyBB \$langinfo['version'] = \"{$langinfo['version']}\";
|
|
|
// Sets if the translation includes the Admin CP (1 = yes, 0 = no) \$langinfo['admin'] = {$newlanginfo['admin']};
| // Sets if the translation includes the Admin CP (1 = yes, 0 = no) \$langinfo['admin'] = {$newlanginfo['admin']};
|
Zeile 83 | Zeile 89 |
---|
{ fwrite($file, $newfile); fclose($file);
|
{ fwrite($file, $newfile); fclose($file);
|
|
|
$plugins->run_hooks("admin_config_languages_edit_properties_commit");
// Log admin action
| $plugins->run_hooks("admin_config_languages_edit_properties_commit");
// Log admin action
|
Zeile 91 | Zeile 97 |
---|
flash_message($lang->success_langprops_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
|
flash_message($lang->success_langprops_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang={$editlang}&editwith={$editwith}");
|
}
| }
|
else { $errors[] = $lang->error_cannot_write_to_file; }
|
else { $errors[] = $lang->error_cannot_write_to_file; }
|
}
| }
|
$page->add_breadcrumb_item($languages[$editlang], "index.php?module=config-languages&action=edit&lang={$editlang}"); $page->add_breadcrumb_item($lang->nav_editing_set);
|
$page->add_breadcrumb_item($languages[$editlang], "index.php?module=config-languages&action=edit&lang={$editlang}"); $page->add_breadcrumb_item($lang->nav_editing_set);
|
|
|
$page->output_header($lang->languages); $sub_tabs['edit_properties'] = array(
| $page->output_header($lang->languages); $sub_tabs['edit_properties'] = array(
|
Zeile 109 | Zeile 115 |
---|
"description" => $lang->edit_properties_desc ); $page->output_nav_tabs($sub_tabs, "edit_properties");
|
"description" => $lang->edit_properties_desc ); $page->output_nav_tabs($sub_tabs, "edit_properties");
|
|
|
// Get language info require $file;
| // Get language info require $file;
|
Zeile 118 | Zeile 124 |
---|
echo $form->generate_hidden_field("info[author]", $langinfo['author']); echo $form->generate_hidden_field("info[website]", $langinfo['website']); echo $form->generate_hidden_field("info[version]", $langinfo['version']);
|
echo $form->generate_hidden_field("info[author]", $langinfo['author']); echo $form->generate_hidden_field("info[website]", $langinfo['website']); echo $form->generate_hidden_field("info[version]", $langinfo['version']);
|
if($errors) { $page->output_inline_error($errors); }
| if($errors) { $page->output_inline_error($errors); }
|
else { if($langinfo['admin'])
| else { if($langinfo['admin'])
|
Zeile 132 | Zeile 138 |
---|
else { $mybb->input['info']['admin'] = 0;
|
else { $mybb->input['info']['admin'] = 0;
|
}
| }
|
if($langinfo['rtl']) { $mybb->input['info']['rtl'] = 1;
|
if($langinfo['rtl']) { $mybb->input['info']['rtl'] = 1;
|
}
| }
|
else { $mybb->input['info']['rtl'] = 0;
| else { $mybb->input['info']['rtl'] = 0;
|
Zeile 147 | Zeile 153 |
---|
$mybb->input['info']['htmllang'] = $langinfo['htmllang']; $mybb->input['info']['charset'] = $langinfo['charset']; }
|
$mybb->input['info']['htmllang'] = $langinfo['htmllang']; $mybb->input['info']['charset'] = $langinfo['charset']; }
|
|
|
$form_container = new FormContainer($lang->edit_properties); $form_container->output_row($lang->friendly_name." <em>*</em>", "", $form->generate_text_box('info[name]', $mybb->input['info']['name'], array('id' => 'name')), 'name');
| $form_container = new FormContainer($lang->edit_properties); $form_container->output_row($lang->friendly_name." <em>*</em>", "", $form->generate_text_box('info[name]', $mybb->input['info']['name'], array('id' => 'name')), 'name');
|
Zeile 160 | Zeile 166 |
---|
if(!is_writable($file)) { $no_write = 1;
|
if(!is_writable($file)) { $no_write = 1;
|
$page->output_alert($lang->alert_note_cannot_write); }
| $page->output_alert($lang->alert_note_cannot_write); }
|
$form_container->end();
| $form_container->end();
|
Zeile 270 | Zeile 276 |
---|
$table = new Table; // Check if file is writable, before allowing submission
|
$table = new Table; // Check if file is writable, before allowing submission
|
$no_write = 0;
| $no_write = null;
|
foreach($quick_phrases as $file => $phrases) { if(!is_writable($folder.$file)) { $no_write = 1;
|
foreach($quick_phrases as $file => $phrases) { if(!is_writable($folder.$file)) { $no_write = 1;
|
} }
| } }
|
if($no_write) { $page->output_alert($lang->alert_note_cannot_write);
|
if($no_write) { $page->output_alert($lang->alert_note_cannot_write);
|
}
| }
|
$form_container = new FormContainer($lang->quick_phrases); foreach($quick_phrases as $file => $phrases)
| $form_container = new FormContainer($lang->quick_phrases); foreach($quick_phrases as $file => $phrases)
|
Zeile 296 | Zeile 302 |
---|
$value = $l[$phrase]; if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = $l[$phrase]; if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
|
} else {
|
} else {
|
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "'&#'.hexdec('$1').';'", $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
|
} $form_container->output_row($description, $phrase, $form->generate_text_area("edit[$phrase]", $value, array('id' => 'lang_'.$phrase, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$phrase, array('width' => '50%')); } }
|
} $form_container->output_row($description, $phrase, $form->generate_text_area("edit[$phrase]", $value, array('id' => 'lang_'.$phrase, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$phrase, array('width' => '50%')); } }
|
|
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
| $form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
|
Zeile 320 | Zeile 326 |
---|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_config_languages_edit");
|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_config_languages_edit");
|
|
|
// Validate input $editlang = basename($mybb->input['lang']); $folder = MYBB_ROOT."inc/languages/".$editlang."/";
| // Validate input $editlang = basename($mybb->input['lang']); $folder = MYBB_ROOT."inc/languages/".$editlang."/";
|
Zeile 350 | Zeile 356 |
---|
$file = 'admin/'.$file; } $page->add_breadcrumb_item($file);
|
$file = 'admin/'.$file; } $page->add_breadcrumb_item($file);
|
|
|
$editfile = $folder.$file; $withfile = '';
| $editfile = $folder.$file; $withfile = '';
|
Zeile 359 | Zeile 365 |
---|
{ $editwithfile = $editwithfolder.$file; }
|
{ $editwithfile = $editwithfolder.$file; }
|
if(!file_exists($editfile) || ($editwithfile && !file_exists($editwithfile)))
| if(!file_exists($editfile) || ($editwithfile && !file_exists($editwithfile)) || $file == '.' || $file == '..')
|
{ flash_message($lang->error_invalid_file, 'error'); admin_redirect("index.php?module=config-languages");
| { flash_message($lang->error_invalid_file, 'error'); admin_redirect("index.php?module=config-languages");
|
Zeile 451 | Zeile 457 |
---|
}
// Check if file is writable, before allowing submission
|
}
// Check if file is writable, before allowing submission
|
$no_write = 0;
| $no_write = null;
|
if(!is_writable($editfile)) { $no_write = 1;
| if(!is_writable($editfile)) { $no_write = 1;
|
Zeile 470 | Zeile 476 |
---|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$withvars[$key] = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $withvars[$key]); $value = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $value);
| $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]); $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
|
} else {
|
} else {
|
$withvars[$key] = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $withvars[$key]); $value = preg_replace("#%u([0-9A-F]{1,4})#ie", "'&#'.hexdec('$1').';'", $value);
| $withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $withvars[$key]); $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
|
} $form_container->output_row($key, "", $form->generate_text_area("", $withvars[$key], array('disabled' => true, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%'));
| } $form_container->output_row($key, "", $form->generate_text_area("", $withvars[$key], array('disabled' => true, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), "", array('width' => '50%', 'skip_construct' => true)); $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%'));
|
Zeile 492 | Zeile 498 |
---|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
{ if(my_strtolower($langinfo['charset']) == "utf-8") {
|
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), $value);
|
} else {
|
} else {
|
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "'&#'.hexdec('$1').';'", $value);
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return "&#".hexdec($matches[1]).";";'), $value);
|
} $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%')); }
| } $form_container->output_row($key, "", $form->generate_text_area("edit[$key]", $value, array('id' => 'lang_'.$key, 'rows' => 2, 'style' => "width: 98%; padding: 4px;")), 'lang_'.$key, array('width' => '50%')); }
|