Zeile 94 | Zeile 94 |
---|
log_admin_action($editlang);
flash_message($lang->success_langprops_updated, 'success');
|
log_admin_action($editlang);
flash_message($lang->success_langprops_updated, 'success');
|
admin_redirect("index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith));
| admin_redirect("index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editlang));
|
} else {
| } else {
|
Zeile 189 | Zeile 189 |
---|
if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php")) { // Then validate language pack folders (and try to fix them if missing)
|
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");
| if(!is_dir($folder)) { @mkdir($folder); } if(!is_dir($folder."admin")) { @mkdir($folder."admin"); }
|
}
if(!file_exists($folder) || !file_exists($folder."admin"))
| }
if(!file_exists($folder) || !file_exists($folder."admin"))
|
Zeile 283 | Zeile 289 |
---|
flash_message($lang->success_quickphrases_updated, 'success'); admin_redirect('index.php?module=config-languages&action=edit&lang='.$editlang);
|
flash_message($lang->success_quickphrases_updated, 'success'); admin_redirect('index.php?module=config-languages&action=edit&lang='.$editlang);
|
} } }
| } } }
|
$page->output_header($lang->languages);
| $page->output_header($lang->languages);
|
Zeile 308 | Zeile 314 |
---|
if($errors) { $page->output_inline_error($errors);
|
if($errors) { $page->output_inline_error($errors);
|
}
$table = new Table;
| }
$table = new Table;
|
// Check if files are writable, before allowing submission $no_write = null;
| // Check if files are writable, before allowing submission $no_write = null;
|
Zeile 319 | Zeile 325 |
---|
if(file_exists($folder.$file) && !is_writable($folder.$file) || !is_writable($folder)) { $no_write = 1;
|
if(file_exists($folder.$file) && !is_writable($folder.$file) || !is_writable($folder)) { $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);
|
Zeile 344 | Zeile 350 |
---|
{ $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", 'encode_language_string_utf8', $value); } else
| $value = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $value); } else
|
Zeile 374 | Zeile 380 |
---|
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang));
|
$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang));
|
$editwith = basename($mybb->input['editwith']);
| $editwith = basename($mybb->get_input('editwith'));
|
$editwithfolder = '';
if($editwith) { $editwithfolder = MYBB_ROOT."inc/languages/".$editwith."/";
|
$editwithfolder = '';
if($editwith) { $editwithfolder = MYBB_ROOT."inc/languages/".$editwith."/";
|
}
| }
|
// Validate that edited language pack really exists if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php")) { // Then validate edited language pack folders (and try to fix them if missing)
|
// Validate that edited language pack really exists if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php")) { // Then validate edited language pack folders (and try to fix them if missing)
|
@mkdir($folder); @mkdir($folder."admin"); }
| if(!is_dir($folder)) { @mkdir($folder); } if(!is_dir($folder."admin")) { @mkdir($folder."admin"); } }
|
if(!file_exists($folder) || !file_exists($folder."admin")) { flash_message($lang->error_folders_fail, 'error');
|
if(!file_exists($folder) || !file_exists($folder."admin")) { flash_message($lang->error_folders_fail, 'error');
|
admin_redirect("index.php?module=config-languages"); }
| admin_redirect("index.php?module=config-languages"); }
|
// If we edit in compare mode, verify that at least folders of compared language exists if($editwithfolder && (!file_exists($editwithfolder) || !file_exists($editwithfolder))) {
| // If we edit in compare mode, verify that at least folders of compared language exists if($editwithfolder && (!file_exists($editwithfolder) || !file_exists($editwithfolder))) {
|
Zeile 409 | Zeile 421 |
---|
{ // Validate input $file = basename($mybb->input['file']);
|
{ // Validate input $file = basename($mybb->input['file']);
|
if($mybb->input['inadmin'] == 1)
| if($mybb->get_input('inadmin') == 1)
|
{ $file = 'admin/'.$file; }
| { $file = 'admin/'.$file; }
|
Zeile 427 | Zeile 439 |
---|
if($mybb->request_method == "post") { // Save edited phrases to language file
|
if($mybb->request_method == "post") { // Save edited phrases to language file
|
|
|
// To validate input - build array of keys that allready exist in files @include $editfile; $valid_keys = (array)$l; unset($l);
|
// To validate input - build array of keys that allready exist in files @include $editfile; $valid_keys = (array)$l; unset($l);
|
@include $editwithfile; $valid_keys = array_merge($valid_keys, (array)$l); unset($l);
| if(!empty($editwithfile)) { @include $editwithfile; } if(!empty($l)) { $valid_keys = array_merge($valid_keys, (array)$l); } unset($l);
$contents_wfile = null;
|
// Then fetch from input only valid keys foreach($valid_keys as $key => $value)
| // Then fetch from input only valid keys foreach($valid_keys as $key => $value)
|
Zeile 486 | Zeile 507 |
---|
} }
|
} }
|
unset($langinfo); @include MYBB_ROOT."inc/languages/".$editwith.".php"; $editwith_dir_class = " langeditor_ltr"; if((int)$langinfo['rtl'] > 0)
| if(!empty($editwith))
|
{
|
{
|
$editwith_dir_class = " langeditor_rtl"; } unset($langinfo);
| unset($langinfo); @include MYBB_ROOT."inc/languages/".$editwith.".php"; $editwith_dir_class = " langeditor_ltr"; if((int)$langinfo['rtl'] > 0) { $editwith_dir_class = " langeditor_rtl"; } } unset($langinfo);
|
@include MYBB_ROOT."inc/languages/".$editlang.".php"; $editlang_dir_class = " langeditor_ltr"; if((int)$langinfo['rtl'] > 0)
|
@include MYBB_ROOT."inc/languages/".$editlang.".php"; $editlang_dir_class = " langeditor_ltr"; if((int)$langinfo['rtl'] > 0)
|
{
| {
|
$editlang_dir_class = " langeditor_rtl";
|
$editlang_dir_class = " langeditor_rtl";
|
}
| }
|
// Build and output form with edited phrases
// Get file being edited in an array
|
// Build and output form with edited phrases
// Get file being edited in an array
|
@include $editfile; $editvars = (array)$l;
| $editvars = array();
|
unset($l);
|
unset($l);
|
| @include $editfile; if(isset($l)) { $editvars = (array)$l; unset($l); }
|
$withvars = array(); // Get edit with file in an array if exists
| $withvars = array(); // Get edit with file in an array if exists
|
Zeile 670 | Zeile 699 |
---|
if($editwithfolder) { $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editwith])));
|
if($editwithfolder) { $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editwith])));
|
$table->construct_header($lang->phrases, array("class" => "align_center", "width" => 100)); $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])));
| $table->construct_header($lang->phrases, array("class" => "align_center", "width" => 100)); $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])));
|
$table->construct_header($lang->issues, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100)); }
| $table->construct_header($lang->issues, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100)); }
|
Zeile 706 | Zeile 735 |
---|
if($handle = opendir($editwithfolder)) { while(false !== ($file = readdir($handle)))
|
if($handle = opendir($editwithfolder)) { while(false !== ($file = readdir($handle)))
|
{
| {
|
if(preg_match("#\.lang\.php$#", $file)) { $filenameswith[] = $file;
| if(preg_match("#\.lang\.php$#", $file)) { $filenameswith[] = $file;
|
Zeile 724 | Zeile 753 |
---|
$files_both = array_intersect($filenameswith, $filenames);
foreach($files_left as $key => $file)
|
$files_both = array_intersect($filenameswith, $filenames);
foreach($files_left as $key => $file)
|
{ @include $editwithfolder.$file; $editvars_left = (array)$l; unset($l);
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>"; if(count($editvars_left) >0)
| { $editvars_left = array();
unset($l); @include $editwithfolder.$file; if(isset($l)) { $editvars_left = (array)$l; unset($l); }
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>"; if(count($editvars_left) > 0)
|
{ $icon_issues = "<span class='langeditor_warning' title='".$lang->issues_warning."'></span>"; }
| { $icon_issues = "<span class='langeditor_warning' title='".$lang->issues_warning."'></span>"; }
|
Zeile 744 | Zeile 779 |
---|
} foreach($files_right as $key => $file) {
|
} foreach($files_right as $key => $file) {
|
@include $folder.$file; $editvars_right = (array)$l;
| $editvars_right = array();
|
unset($l);
|
unset($l);
|
| @include $folder.$file; if(isset($l)) { $editvars_right = (array)$l; unset($l); }
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
if(count($editvars_right >0))
| if(count($editvars_right) > 0)
|
{ $icon_issues = "<span class='langeditor_nothingtocompare' title='".$lang->issues_nothingtocompare."'></span>"; }
| { $icon_issues = "<span class='langeditor_nothingtocompare' title='".$lang->issues_nothingtocompare."'></span>"; }
|
Zeile 763 | Zeile 804 |
---|
} foreach($files_both as $key => $file) {
|
} foreach($files_both as $key => $file) {
|
@include $editwithfolder.$file; $editvars_left = (array)$l;
| $editvars_right = $editvars_left = array();
|
unset($l);
|
unset($l);
|
| @include $editwithfolder.$file; if(isset($l)) { $editvars_left = (array)$l; unset($l); }
|
@include $folder.$file;
|
@include $folder.$file;
|
$editvars_right = (array)$l; unset($l);
| if(isset($l)) { $editvars_right = (array)$l; unset($l); }
|
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editwithfile")); $table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases"));
| $table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editwithfile")); $table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases"));
|
Zeile 800 | Zeile 850 |
---|
{ foreach($filenames as $key => $file) {
|
{ foreach($filenames as $key => $file) {
|
| unset($l);
|
@include $folder.$file;
|
@include $folder.$file;
|
$editvars_count = (array)$l;
| $editvars_count = array(); if(isset($l)) { $editvars_count = (array)$l; }
|
unset($l);
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell(count($editvars_count), array("class" => "langeditor_phrases")); $table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file=".htmlspecialchars_uni($file)."\">{$lang->edit}</a>", array("class" => "langeditor_edit")); $table->construct_row();
|
unset($l);
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell(count($editvars_count), array("class" => "langeditor_phrases")); $table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file=".htmlspecialchars_uni($file)."\">{$lang->edit}</a>", array("class" => "langeditor_edit")); $table->construct_row();
|
} }
| } }
|
if($table->num_rows() == 0) {
| if($table->num_rows() == 0) {
|
Zeile 825 | Zeile 880 |
---|
if($editwithfolder) { $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editwith])));
|
if($editwithfolder) { $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editwith])));
|
$table->construct_header($lang->phrases, array("class" => "align_center", "width" => 100));
| $table->construct_header($lang->phrases, array("class" => "align_center", "width" => 100));
|
$table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang]))); $table->construct_header($lang->issues, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100));
| $table->construct_header(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang]))); $table->construct_header($lang->issues, array("class" => "align_center", "width" => 100)); $table->construct_header($lang->controls, array("class" => "align_center", "width" => 100));
|
Zeile 842 | Zeile 897 |
---|
if($handle = opendir($folder."admin")) { while(false !== ($file = readdir($handle)))
|
if($handle = opendir($folder."admin")) { while(false !== ($file = readdir($handle)))
|
{
| {
|
if(preg_match("#\.lang\.php$#", $file)) { $adminfilenames[] = $file;
| if(preg_match("#\.lang\.php$#", $file)) { $adminfilenames[] = $file;
|
Zeile 865 | Zeile 920 |
---|
if(preg_match("#\.lang\.php$#", $file)) { $adminfilenameswith[] = $file;
|
if(preg_match("#\.lang\.php$#", $file)) { $adminfilenameswith[] = $file;
|
} }
| } }
|
closedir($handle); sort($adminfilenameswith); }
| closedir($handle); sort($adminfilenameswith); }
|
Zeile 888 | Zeile 943 |
---|
if(count($editvars_left) >0) { $icon_issues = "<span class='langeditor_warning' title='".$lang->issues_warning."'></span>";
|
if(count($editvars_left) >0) { $icon_issues = "<span class='langeditor_warning' title='".$lang->issues_warning."'></span>";
|
}
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editwithfile"));
| }
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editwithfile"));
|
$table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases")); $table->construct_cell("", array("class" => "langeditor_editfile")); $table->construct_cell($icon_issues, array("class" => "langeditor_issues"));
| $table->construct_cell(count($editvars_left), array("class" => "langeditor_phrases")); $table->construct_cell("", array("class" => "langeditor_editfile")); $table->construct_cell($icon_issues, array("class" => "langeditor_issues"));
|
Zeile 898 | Zeile 953 |
---|
$table->construct_row(); } foreach($files_right as $key => $file)
|
$table->construct_row(); } foreach($files_right as $key => $file)
|
{ @include $folder."admin/".$file; $editvars_right = (array)$l; unset($l);
| { @include $folder."admin/".$file; $editvars_right = (array)$l; unset($l);
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
if(count($editvars_right >0))
| if(count($editvars_right) >0)
|
{ $icon_issues = "<span class='langeditor_nothingtocompare' title='".$lang->issues_nothingtocompare."'></span>"; }
$table->construct_cell("", array("class" => "langeditor_editwithfile")); $table->construct_cell("", array("class" => "langeditor_phrases"));
|
{ $icon_issues = "<span class='langeditor_nothingtocompare' title='".$lang->issues_nothingtocompare."'></span>"; }
$table->construct_cell("", array("class" => "langeditor_editwithfile")); $table->construct_cell("", array("class" => "langeditor_phrases"));
|
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell($icon_issues, array("class" => "langeditor_issues")); $table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file={$config['admindir']}/".htmlspecialchars_uni($file)."&inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit")); $table->construct_row();
| $table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell($icon_issues, array("class" => "langeditor_issues")); $table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file={$config['admindir']}/".htmlspecialchars_uni($file)."&inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit")); $table->construct_row();
|
} foreach($files_both as $key => $file) {
| } foreach($files_both as $key => $file) {
|
Zeile 961 | Zeile 1016 |
---|
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell(count($editvars_count), array("class" => "langeditor_phrases"));
|
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile")); $table->construct_cell(count($editvars_count), array("class" => "langeditor_phrases"));
|
$table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file={$config['admindir']}/".htmlspecialchars_uni($file)."&inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));
| $table->construct_cell("<a href=\"index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith)."&file=/".htmlspecialchars_uni($file)."&inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));
|
$table->construct_row(); } }
| $table->construct_row(); } }
|