Vergleich admin/modules/config/languages.php - 1.8.16 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 20Zeile 20

$plugins->run_hooks("admin_config_languages_begin");



$plugins->run_hooks("admin_config_languages_begin");


 
$no_write = null;

if($mybb->input['action'] == "edit_properties")
{
$editlang = basename($mybb->input['lang']);

if($mybb->input['action'] == "edit_properties")
{
$editlang = basename($mybb->input['lang']);

Zeile 94Zeile 95
			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 181Zeile 182
{
// Validate input
$editlang = basename($mybb->input['lang']);

{
// Validate input
$editlang = basename($mybb->input['lang']);

 

if(in_array($editlang, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}


	$folder = MYBB_ROOT."inc/languages/".$editlang."/";

	$folder = MYBB_ROOT."inc/languages/".$editlang."/";





	$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=quick_edit&amp;lang=".htmlspecialchars_uni($editlang));

// 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)

	$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=quick_edit&amp;lang=".htmlspecialchars_uni($editlang));

// 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");







		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 370Zeile 384
{
// Validate input
$editlang = basename($mybb->input['lang']);

{
// Validate input
$editlang = basename($mybb->input['lang']);

 

if(in_array($editlang, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}


	$folder = MYBB_ROOT."inc/languages/".$editlang."/";

	$folder = MYBB_ROOT."inc/languages/".$editlang."/";





	$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang));


	$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang));


	$editwith = basename($mybb->input['editwith']);









	$editwith = basename($mybb->get_input('editwith'));

if(in_array($editwith, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}



	$editwithfolder = '';

if($editwith)

	$editwithfolder = '';

if($editwith)

Zeile 384Zeile 413

// Validate that edited language pack really exists
if(file_exists(MYBB_ROOT."inc/languages/".$editlang.".php"))


// 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)

		// 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 404Zeile 439
	}

$plugins->run_hooks("admin_config_languages_edit");

	}

$plugins->run_hooks("admin_config_languages_edit");





	if(isset($mybb->input['file']))
{
// Validate input
$file = basename($mybb->input['file']);

	if(isset($mybb->input['file']))
{
// Validate input
$file = basename($mybb->input['file']);

		if($mybb->input['inadmin'] == 1)









if(in_array($file, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}

if($mybb->get_input('inadmin') == 1)

		{
$file = 'admin/'.$file;
}

		{
$file = 'admin/'.$file;
}

Zeile 432Zeile 474
			@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);









if(!empty($editwithfile))
{
@include $editwithfile;
}
if(!empty($l))
{
$valid_keys = array_merge($valid_keys, (array)$l);
}

			unset($l);

			unset($l);

 

$contents_wfile = null;


// Then fetch from input only valid keys
foreach($valid_keys as $key => $value)
{
$contents_wfile .= "\$l['".$key."'] = ".var_export($mybb->input['edit'][$key], true).";\n";


// Then fetch from input only valid keys
foreach($valid_keys as $key => $value)
{
$contents_wfile .= "\$l['".$key."'] = ".var_export($mybb->input['edit'][$key], true).";\n";

			}

			}


// Save edited language file
if($fp = @fopen($editfile, "w"))
{
// We need info about edited language files to generate credits for our file
require MYBB_ROOT."inc/languages/".$editlang.".php";


// Save edited language file
if($fp = @fopen($editfile, "w"))
{
// We need info about edited language files to generate credits for our file
require MYBB_ROOT."inc/languages/".$editlang.".php";





				// 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";

Zeile 486Zeile 537
			}
}


			}
}


		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);

		unset($langinfo);

		@include MYBB_ROOT."inc/languages/".$editlang.".php";
$editlang_dir_class = " langeditor_ltr";
if((int)$langinfo['rtl'] > 0)
{
$editlang_dir_class = " langeditor_rtl";

		@include MYBB_ROOT."inc/languages/".$editlang.".php";
$editlang_dir_class = " langeditor_ltr";
if((int)$langinfo['rtl'] > 0)
{
$editlang_dir_class = " langeditor_rtl";

		}

// Build and output form with edited phrases


		}

// Build and output form with edited phrases


		// Get file being edited in an array

		// Get file being edited in an array

 
		$editvars = array();
unset($l);

		@include $editfile;

		@include $editfile;

		$editvars = (array)$l;
unset($l);




		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 527Zeile 586
			"description" => $lang->edit_language_variables_desc
);
$page->output_nav_tabs($sub_tabs, "edit_language_variables");

			"description" => $lang->edit_language_variables_desc
);
$page->output_nav_tabs($sub_tabs, "edit_language_variables");





		$form = new Form("index.php?module=config-languages&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field("file", $file);
echo $form->generate_hidden_field("lang", $editlang);

		$form = new Form("index.php?module=config-languages&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field("file", $file);
echo $form->generate_hidden_field("lang", $editlang);

Zeile 536Zeile 595
		if($errors)
{
$page->output_inline_error($errors);

		if($errors)
{
$page->output_inline_error($errors);

		}


		}


		// Check if file is writable, before allowing submission
$no_write = null;
if(file_exists($editfile) && !is_writable($editfile) || !is_writable($folder))

		// Check if file is writable, before allowing submission
$no_write = null;
if(file_exists($editfile) && !is_writable($editfile) || !is_writable($folder))

Zeile 545Zeile 604
			$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 564Zeile 623
				else
{
$withvars[$key] = preg_replace_callback("#%u([0-9A-F]{1,4})#i", 'encode_language_string_utf8', $withvars[$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


					$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 577Zeile 636
				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

				}
else

				{
$textarea_issue_class = "";
}

				{
$textarea_issue_class = "";
}

Zeile 604Zeile 663

$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%'));

				}
}


				}
}


		}
else
{

		}
else
{

Zeile 635Zeile 694
		}

$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 644Zeile 703
		// Build and output list of available language files

$page->output_header($lang->languages);

		// Build and output list of available language files

$page->output_header($lang->languages);





		$sub_tabs['language_files'] = array(
'title' => $lang->language_files,
'link' => "index.php?module=config-languages&amp;action=edit&amp;lang=".$editlang,

		$sub_tabs['language_files'] = array(
'title' => $lang->language_files,
'link' => "index.php?module=config-languages&amp;action=edit&amp;lang=".$editlang,

Zeile 725Zeile 784

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(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 743Zeile 808
				$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;

			{
$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 762Zeile 833
				$table->construct_row();
}
foreach($files_both as $key => $file)

				$table->construct_row();
}
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 800Zeile 880
		{
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 894Zeile 979
					$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"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file={$config['admindir']}/".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file=".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_row();
}
foreach($files_right as $key => $file)

					$table->construct_row();
}
foreach($files_right as $key => $file)

Zeile 904Zeile 989
					unset($l);

$icon_issues = "<span class='langeditor_ok' title='".$lang->issues_ok."'></span>";

					unset($l);

$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 913Zeile 998
					$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("", 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&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file={$config['admindir']}/".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file=".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_row();
}
foreach($files_both as $key => $file)

					$table->construct_row();
}
foreach($files_both as $key => $file)

Zeile 947Zeile 1032
					}

$table->construct_cell($icon_issues, array("class" => "langeditor_issues"));

					}

$table->construct_cell($icon_issues, array("class" => "langeditor_issues"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file={$config['admindir']}/".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file=".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_row();
}
}

					$table->construct_row();
}
}

Zeile 961Zeile 1046

$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&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file={$config['admindir']}/".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_cell("<a href=\"index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang)."&amp;editwith=".htmlspecialchars_uni($editwith)."&amp;file=/".htmlspecialchars_uni($file)."&amp;inadmin=1\">{$lang->edit}</a>", array("class" => "langeditor_edit"));

					$table->construct_row();
}
}

					$table->construct_row();
}
}