perms('manage_project')) {
Flyspray::show_error(28);
}
// Make it possible to reload page after updating language
// Don't want to send form data again if user reloads the page
ob_start();
?>
\n";
}
if(!file_exists('en.php')) {
$fail .= "The english language file en.php
is missing. Make sure this script is run from the same directory as the language files .../flyspray/lang/
\n";
}
if($fail) {
die($fail."Usage: <lang code> where <lang code> should be replaced by your language, e.g. de for German.");
}
// Read english language file in array $language (assumed to be UTF-8 encoded)
require('en.php');
if(!is_array(@$language)){
die("Invalid language file for english");
}
$count = count($language);
// Read the translation file in array $translation (assumed to be UTF-8 encoded)
$working_copy = false;
if(!file_exists($lang.'.php') && !file_exists('.'.$lang.'.php.work')) {
echo '
'.$lang.'.php
';
} else {
if($lang != 'en') {
if(file_exists('.'.$lang.'.php.work')) {
$working_copy = true;
include_once('.'.$lang.'.php.work'); // Read the translation array (work in progress)
} else{
include($lang.'.php'); // Read the original translation array - maybe again, no _once here!
}
} else if(file_exists('.en.php.work')){
$working_copy = true;
$tmp = $language;
include_once('.en.php.work'); // Read the language array (work in progress)
$translation = $language; // Edit the english language file
$language = $tmp;
} else{
$translation = $language; // Edit the english language file
}
if(!is_array(@$translation)){
echo "Warning: the translation file does not contain the \$translation array, a new file will be created: $lang.php
\n";
}
}
$limit = 30;
$begin = isset($_GET['begin']) ? (int)($_GET['begin'] / $limit) * $limit : 0;
// Was show missing pressed?
$show_empty = (!isset($_POST['search']) && isset($_REQUEST['empty'])); // Either POST or URL
// Any text in search box?
if(!$show_empty && isset($_POST['search_for'])) {
$search = trim($_POST['search_for']);
} else if(!$show_empty && isset($_GET['search_for'])) {
$search = trim(urldecode($_GET['search_for']));
} else {
$search = "";
}
// Path to this file
$self = "{$_SERVER['SCRIPT_NAME']}?do=langedit&lang=$lang";
if(isset($_POST['confirm'])) {
// Make a backup
unlink(".$lang.php.bak");
rename("$lang.php", ".$lang.php.bak");
rename(".$lang.php.work", "$lang.php");
// Reload page, so that form data won't get posted again on refresh
header("location: $self&begin=$begin" . ($search? "&search_for=".urlencode($search): "") . ($show_empty? "&empty=": ""));
exit;
} else if(isset($_POST['submit']) && isset($_POST['L'])) {
// Save button was pressed
update_language($lang, $_POST['L'], @$_POST['E']);
// Reload page, so that form data won't get posted again on refresh
header("location: $self&begin=$begin" . ($search? "&search_for=".urlencode($search): "") . ($show_empty? "&empty=": ""));
exit;
}
// One form for all buttons and inputs
echo 'Overview';
echo "