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 432 | Zeile 444 |
---|
@include $editfile; $valid_keys = (array)$l; unset($l);
|
@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 479 | Zeile 500 |
---|
flash_message($lang->success_langfile_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith));
|
flash_message($lang->success_langfile_updated, 'success'); admin_redirect("index.php?module=config-languages&action=edit&lang=".htmlspecialchars_uni($editlang)."&editwith=".htmlspecialchars_uni($editwith));
|
}
| }
|
else
|
else
|
{
| {
|
$errors[] = $lang->error_cannot_write_to_file;
|
$errors[] = $lang->error_cannot_write_to_file;
|
}
| }
|
}
|
}
|
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); @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";
| } unset($langinfo); @include MYBB_ROOT."inc/languages/".$editlang.".php";
|
Zeile 504 | Zeile 528 |
---|
// 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 if($editwithfile)
| $withvars = array(); // Get edit with file in an array if exists if($editwithfile)
|
Zeile 567 | Zeile 596 |
---|
$editvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string', $editvars[$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
| // 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 577 | Zeile 606 |
---|
if($withvars[$key] && !$editvars[$key] || $withvars_value_cbvCount != $editvars_value_cbvCount) { $textarea_issue_class = " langeditor_textarea_issue";
|
if($withvars[$key] && !$editvars[$key] || $withvars_value_cbvCount != $editvars_value_cbvCount) { $textarea_issue_class = " langeditor_textarea_issue";
|
}
| }
|
else { $textarea_issue_class = "";
| else { $textarea_issue_class = "";
|
Zeile 632 | Zeile 661 |
---|
if(!count($editvars)) { $no_write = 1;
|
if(!count($editvars)) { $no_write = 1;
|
}
$buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
| }
$buttons[] = $form->generate_submit_button($lang->save_language_file, array('disabled' => $no_write));
|
$form->output_submit_wrapper($buttons); $form->end(); }
| $form->output_submit_wrapper($buttons); $form->end(); }
|
Zeile 658 | Zeile 687 |
---|
);
$page->output_nav_tabs($sub_tabs, 'language_files');
|
);
$page->output_nav_tabs($sub_tabs, 'language_files');
|
|
|
if(!file_exists(MYBB_ROOT."inc/languages/".$editlang.".php"))
|
if(!file_exists(MYBB_ROOT."inc/languages/".$editlang.".php"))
|
{
| {
|
flash_message($lang->error_invalid_set, 'error'); admin_redirect("index.php?module=config-languages"); }
| flash_message($lang->error_invalid_set, 'error'); admin_redirect("index.php?module=config-languages"); }
|
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 695 | Zeile 724 |
---|
} closedir($handle); sort($filenames);
|
} closedir($handle); sort($filenames);
|
}
| }
|
$edit_colspan = 3; // Get files from folder we want to peek at (if possible)
| $edit_colspan = 3; // Get files from folder we want to peek at (if possible)
|
Zeile 725 | Zeile 754 |
---|
foreach($files_left as $key => $file) {
|
foreach($files_left as $key => $file) {
|
@include $editwithfolder.$file; $editvars_left = (array)$l;
| $editvars_left = array();
|
unset($l);
|
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>";
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
if(count($editvars_left) >0)
| 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>";
|
}
| }
|
$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 743 | Zeile 778 |
---|
$table->construct_row(); } foreach($files_right as $key => $file)
|
$table->construct_row(); } foreach($files_right as $key => $file)
|
{ @include $folder.$file; $editvars_right = (array)$l; unset($l);
| { $editvars_right = array();
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"));
|
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile"));
| $table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile"));
|
$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
| $icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";
|
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"));
| unset($l);
$table->construct_cell(htmlspecialchars_uni($file), array("class" => "langeditor_editfile"));
|
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(); } }
|