-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheditlang_edit.php
188 lines (165 loc) · 7.03 KB
/
editlang_edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
/**
* Edit a language file
*
* Genmod: Genealogy Viewer
* Copyright (C) 2005 - 2012 Genmod Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package Genmod
* @subpackage EditLang
* @version $Id: editlang_edit.php 29 2022-07-17 13:18:20Z Boudewijn $
*/
/**
* Inclusion of the configuration file
*/
require "config.php";
//-- make sure that they have admin status before they can use this page
//-- otherwise have them login again
$uname = $gm_username;
if (empty($uname)) {
print "Please close this window and do a Login in the former window first...";
exit;
}
if (!isset($lang_filename)) $lang_filename = "";
if (!isset($file_type)) $file_type = "";
if (!isset($language2)) $language2 = "";
if (!isset($ls01)) $ls01 = "";
if (!isset($ls02)) $ls02 = "";
if (!isset($lang_filename_orig)) $lang_filename_orig = "";
if (!isset($anchor)) $anchor = "";
if (!isset($realtime)) $realtime = false;
PrintSimpleHeader(GM_LANG_editlang);
print "<script language=\"JavaScript\" type=\"text/javascript\">";
print "<!--\nself.focus();\n//-->";
print "</script>\n";
switch ($file_type) {
case "lang":
$lang_filename = $language2;
$lang_filename_orig = "english";
break;
case "facts":
$lang_filename = $language2;
$lang_filename_orig = "english";
break;
case "help_text":
$lang_filename = $language2;
$lang_filename_orig = "english";
break;
}
if ($action != "save") {
print "<div class=\"EditLangContainer\">";
print "<form name=\"Form1\" method=\"post\" action=\"" .$_SERVER["SCRIPT_NAME"]. "\">";
print "<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\" />";
print "<input type=\"hidden\" name=\"action\" value=\"save\" />";
print "<input type=\"hidden\" name=\"anchor\" value=\"".$anchor."\" />";
print "<input type=\"hidden\" name=\"language2\" value=\"" . $language2 . "\" />";
print "<input type=\"hidden\" name=\"ls01\" value=\"" . $ls01 . "\" />";
print "<input type=\"hidden\" name=\"ls02\" value=\"" . $ls02 . "\" />";
print "<input type=\"hidden\" name=\"file_type\" value=\"" . $file_type . "\" />";
print "<input type=\"hidden\" name=\"realtime\" value=\"" . $realtime . "\" />";
print "<div class=\"NavBlockHeader\">";
PrintText("editlang_edit");
if (!empty($lang_filename)) print " ".$language_settings[$lang_filename]['gm_lang'];
print "</div>";
print "<div id=\"original_text\" class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">";
PrintText("original_message");
print "</div>";
print "<div class=\"NavBlockField EditLangOrgTextArea\">";
print "<textarea id=\"old_message\" readonly rows=\"10\" name=\"old_message\" cols=\"75\" >";
print stripslashes(AdminFunctions::Mask_all(LanguageFunctions::GetString($ls01, $lang_filename_orig, $file_type)));
print "</textarea>";
print "</div>";
print "<div id=\"translated_text\" class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">";
PrintText("message_to_edit");
print "</div>";
print "<div class=\"NavBlockField EditLangDestTextArea\">";
print "<textarea rows=\"10\" id=\"new_message\" name=\"new_message\" cols=\"75\">";
if (strlen($ls02) > 0) print stripslashes(AdminFunctions::Mask_all(LanguageFunctions::GetString($ls02, $lang_filename, $file_type)));
print "</textarea>";
print "</div>";
print "<div id=\"toplinks\" name=\"toplinks\" class=\"NavBlockFooter\">";
print "<input type=\"submit\" value=\"";
PrintText("lang_save");
if ($realtime) print "\" onclick=\"window.opener.location.reload()\" />";
else print "\" />";
print " ";
print "<input type=\"submit\" value=\"";
PrintText("cancel");
print "\"" . " onclick=\"self.close()\" />";
print "</div>";
print "</form>";
print "</div>";
?>
<script language="JavaScript" type="text/javascript">
<!--
document.Form1.new_message.focus();
//-->
</script>
<?php
}
if ($action == "save") {
if (!isset($_POST)) $_POST = $HTTP_POST_VARS;
// Post-parameters
// $new_message is the edited message
// $language2 is the name of the language to edit
// $ls01 is the number of the message in english language file
// $ls02 is the number of the message in the edited language file
// $file_type defines which language file
$new_message = preg_replace(array("/&/","/</","/>/"), array("&","<",">"), $new_message);
$Write_Ok = AdminFunctions::WriteString($new_message, $ls01, $language2, $file_type);
// Header
print "<form name=\"Form2\" method=\"post\" action=\"" .$_SERVER["SCRIPT_NAME"]. "\">";
print "<input type=\"hidden\" name=\"lang_filename_orig\" value=\"".$lang_filename_orig."\" />";
print "<div class=\"EditLangContainer\">";
print "<div class=\"NavBlockHeader EditLangNavBlockHeader\">";
PrintText("savelang_help");
print " (".$language_settings[$lang_filename]['gm_lang'].")";
print "</div>";
// Old text header
print "<div id=\"original_text\" class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">";
if ($Write_Ok) print PrintText("original_message",0,1);
else {
print "<span class=\"Warning\" >";
print str_replace("#lang_filename#", $lang_filename, GM_LANG_lang_file_write_error) . "</span>";
}
print "</div>";
// Old text
print "<div class=\"NavBlockField EditLangNavBlockField\">";
if ($Write_Ok) {
print "<strong style=\"color: red\">|</strong>".stripslashes(AdminFunctions::Mask_all(LanguageFunctions::GetString($ls01, $lang_filename_orig, $file_type)))."<strong style=\"color: red\">|</strong>";
}
print "</div>";
if ($Write_Ok) {
// New text header
print "<div class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">";
PrintText("changed_message");
print "</div>";
// New text
print "<div class=\"NavBlockField EditLangNavBlockField\">";
print "<strong style=\"color: red; \">|</strong>" . stripslashes(AdminFunctions::Mask_all($new_message)) . "<strong style=\"color: red\">|</strong>";
print "</div>";
}
print "<div class=\"NavBlockFooter\">";
srand((double)microtime()*1000000);
if (!$realtime) print "<input type=\"submit\" value=\"" . GM_LANG_close_window . "\"" . " onclick=\"window.opener.showchanges('&dv=".rand()."#".$anchor."'); self.close();\" />";
else print "<input type=\"submit\" value=\"" . GM_LANG_close_window . "\"" . " onclick=\"self.close();\" />";
print "</div>";
print "</div>";
print "</form>";
}
PrintSimpleFooter();
?>