author | Dan |
Sun, 27 Jan 2008 22:57:40 -0500 | |
changeset 378 | c1c7fa6b329f |
parent 377 | bb3e6c3bd4f4 |
child 387 | 92664d2efab8 |
permissions | -rw-r--r-- |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
1 |
<?php |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
2 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
3 |
/* |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
4 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
5 |
* Version 1.0.3 (Dyrad) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
6 |
* Copyright (C) 2006-2007 Dan Fuhry |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
7 |
* |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
8 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
9 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
10 |
* |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
12 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
13 |
*/ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
14 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
15 |
function page_Admin_LangManager() |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
16 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
17 |
global $db, $session, $paths, $template, $plugins; // Common objects |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
18 |
global $lang; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
19 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
20 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
21 |
$login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
22 |
echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
23 |
echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
24 |
return; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
25 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
26 |
if ( isset($_POST['action']) ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
27 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
28 |
$action =& $_POST['action']; |
376 | 29 |
// Parse parameters |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
30 |
if ( strpos($action, ';') ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
31 |
{ |
376 | 32 |
// Parameter section |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
33 |
$parms = substr($action, strpos($action, ';') + 1); |
376 | 34 |
|
35 |
// Action name section |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
36 |
$action = substr($action, 0, strpos($action, ';')); |
376 | 37 |
|
38 |
// Match all parameters |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
39 |
preg_match_all('/([a-z0-9_]+)=(.+?)(;|$)/', $parms, $matches); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
40 |
$parms = array(); |
376 | 41 |
|
42 |
// For each full parameter, assign $parms an associative value |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
43 |
foreach ( $matches[0] as $i => $_ ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
44 |
{ |
376 | 45 |
$parm = $matches[2][$i]; |
46 |
||
47 |
// Is this parameter in the form of an integer? |
|
48 |
// (designed to ease validation later) |
|
49 |
if ( preg_match('/^[0-9]+$/', $parm) ) |
|
50 |
// Yes, run intval(), this enabling is_int()-ish checks |
|
51 |
$parm = intval($parm); |
|
52 |
||
53 |
$parms[$matches[1][$i]] = $parm; |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
54 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
55 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
56 |
switch ( $action ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
57 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
58 |
case 'install_language': |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
59 |
$lang_list = list_available_languages(); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
60 |
// Verify that we have this language's metadata |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
61 |
if ( isset($lang_list[@$parms['iso639']]) ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
62 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
63 |
// From here it's all downhill :-) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
64 |
$lang_code =& $parms['iso639']; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
65 |
$lang_data =& $lang_list[$lang_code]; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
66 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
67 |
$result = install_language($lang_code, $lang_data['name_eng'], $lang_data['name']); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
68 |
if ( $result ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
69 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
70 |
// Language installed. Import the language files. |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
71 |
$lang_local = new Language($lang_code); |
376 | 72 |
if ( file_exists(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json") ) |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
73 |
{ |
376 | 74 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json"); |
75 |
} |
|
76 |
else |
|
77 |
{ |
|
78 |
foreach ( array('core', 'admin', 'tools', 'user') as $file ) |
|
79 |
{ |
|
80 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json"); |
|
81 |
} |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
82 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
83 |
unset($lang_local); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
84 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
85 |
echo '<div class="info-box">' . $lang->get('acplm_msg_lang_install_success', array('lang_name' => htmlspecialchars($lang_data['name_eng']))) . '</div>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
86 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
87 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
88 |
break; |
376 | 89 |
case 'modify_language': |
90 |
$lang_id =& $parms['lang_id']; |
|
91 |
if ( !is_int($lang_id) ) |
|
92 |
{ |
|
93 |
echo 'Hacking attempt'; |
|
94 |
break; |
|
95 |
} |
|
96 |
||
97 |
if ( isset($parms['finish']) && !empty($_POST['lang_name_native']) && !empty($_POST['lang_name_english']) ) |
|
98 |
{ |
|
99 |
// We just did validation above, it's safe to save. |
|
100 |
$name_native = $db->escape($_POST['lang_name_native']); |
|
101 |
$name_english = $db->escape($_POST['lang_name_english']); |
|
102 |
||
103 |
$q = $db->sql_query('UPDATE ' . table_prefix . "language SET lang_name_native = '$name_native', lang_name_default = '$name_english' WHERE lang_id = $lang_id;"); |
|
104 |
if ( !$q ) |
|
105 |
$db->_die(); |
|
106 |
||
107 |
echo '<div class="info-box">' . $lang->get('acplm_msg_basic_save_success') . '</div>'; |
|
108 |
} |
|
109 |
||
110 |
// Select language data |
|
111 |
$q = $db->sql_query('SELECT lang_name_native, lang_name_default, lang_code FROM ' . table_prefix . "language WHERE lang_id = $lang_id;"); |
|
112 |
if ( !$q ) |
|
113 |
$db->_die(); |
|
114 |
||
115 |
list($name_native, $name_english, $lang_code) = $db->fetchrow_num(); |
|
116 |
||
117 |
// Output properties table |
|
118 |
echo '<h3>' . $lang->get('acplm_heading_modify') . '</h3>'; |
|
119 |
||
120 |
acp_start_form(); |
|
121 |
||
122 |
?> |
|
123 |
<div class="tblholder"> |
|
124 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
125 |
<tr> |
|
126 |
<th colspan="2"> |
|
127 |
<?php |
|
128 |
echo $lang->get('acplm_th_lang_basic'); |
|
129 |
?> |
|
130 |
</th> |
|
131 |
</tr> |
|
132 |
<tr> |
|
133 |
<td class="row2" style="width: 50%;"> |
|
134 |
<?php |
|
135 |
echo str_replace('"', '', $lang->get('acplm_field_lang_name_native')); |
|
136 |
?> |
|
137 |
</td> |
|
138 |
<td class="row1"> |
|
139 |
<input type="text" name="lang_name_native" value="<?php echo htmlspecialchars($name_native); ?>" /> |
|
140 |
</td> |
|
141 |
</tr> |
|
142 |
<tr> |
|
143 |
<td class="row2"> |
|
144 |
<?php |
|
145 |
echo $lang->get('acplm_field_lang_name_english'); |
|
146 |
?> |
|
147 |
</td> |
|
148 |
<td class="row1"> |
|
149 |
<input type="text" name="lang_name_english" value="<?php echo htmlspecialchars($name_english); ?>" /> |
|
150 |
</td> |
|
151 |
</tr> |
|
152 |
<tr> |
|
153 |
<td class="row2"> |
|
154 |
<?php |
|
155 |
echo $lang->get('acplm_field_lang_code') . '<br />' |
|
156 |
. '<small>' . $lang->get('acplm_field_lang_code_hint') . '</small>'; |
|
157 |
?> |
|
158 |
</td> |
|
159 |
<td class="row1"> |
|
160 |
<?php |
|
161 |
echo $lang_code; |
|
162 |
?> |
|
163 |
</td> |
|
164 |
</tr> |
|
165 |
<tr> |
|
166 |
<th class="subhead" colspan="2"> |
|
167 |
<button name="action" value="modify_language;finish=1;lang_id=<?php echo $lang_id; ?>"><?php echo $lang->get('etc_save_changes'); ?></button> |
|
168 |
</th> |
|
169 |
</tr> |
|
170 |
</table> |
|
171 |
</div> |
|
172 |
</form> |
|
173 |
||
174 |
<?php |
|
175 |
acp_start_form(); |
|
176 |
?> |
|
177 |
||
178 |
<h3><?php echo $lang->get('acplm_heading_edit_strings_portal'); ?></h3> |
|
179 |
<p><?php echo $lang->get('acplm_msg_edit_strings_portal_intro'); ?></p> |
|
180 |
||
181 |
<p> |
|
182 |
||
183 |
<?php |
|
184 |
||
185 |
// Grab a Language object |
|
186 |
if ( $lang->lang_id == $lang_id ) |
|
187 |
{ |
|
188 |
$lang_local =& $lang; |
|
189 |
} |
|
190 |
else |
|
191 |
{ |
|
192 |
$lang_local = new Language($lang_id); |
|
193 |
$lang_local->fetch(); |
|
194 |
} |
|
195 |
||
196 |
$categories_loc = array(); |
|
197 |
||
198 |
// Using the & here ensures that a reference is created, thus avoiding wasting memory |
|
199 |
foreach ( $lang_local->strings as $cat => &$_ ) |
|
200 |
{ |
|
201 |
unset($_); |
|
202 |
$categories_loc[$cat] = htmlspecialchars($lang->get("meta_$cat")); |
|
203 |
} |
|
204 |
||
205 |
asort($categories_loc); |
|
206 |
||
207 |
echo '<select name="cat_id">'; |
|
208 |
foreach ( $categories_loc as $cat_id => $cat_name) |
|
209 |
{ |
|
210 |
echo "<option value=\"$cat_id\">$cat_name</option>"; |
|
211 |
} |
|
212 |
echo '</select>'; |
|
213 |
||
214 |
?> |
|
215 |
<button name="action" value="edit_strings;lang_id=<?php echo $lang_id; ?>"> |
|
216 |
<?php echo $lang->get('acplm_btn_edit_strings_portal'); ?> |
|
217 |
</button> |
|
218 |
</p> |
|
219 |
||
220 |
<h3><?php echo $lang->get('acplm_heading_reimport_portal'); ?></h3> |
|
221 |
<p><?php echo $lang->get('acplm_msg_reimport_portal_intro'); ?></p> |
|
222 |
||
223 |
<p> |
|
224 |
<button name="action" value="reimport;iso639=<?php echo $lang_code; ?>;lang_id=<?php echo $lang_id; ?>"> |
|
225 |
<?php echo $lang->get('acplm_btn_reimport'); ?> |
|
226 |
</button> |
|
227 |
</p> |
|
228 |
||
229 |
</form> |
|
230 |
||
231 |
<?php |
|
232 |
||
233 |
echo '<h3>' . $lang->get('acplm_heading_backup') . '</h3>'; |
|
234 |
echo '<p>' . $lang->get('acplm_backup_intro') . '</p>'; |
|
235 |
||
236 |
echo '<form action="' . makeUrlNS('Admin', 'LangManager') . '" method="post">'; |
|
237 |
echo '<button name="action" value="backup_language;lang_id=' . $lang_id . '">' . $lang->get('acplm_btn_create_backup') . '</button>'; |
|
238 |
echo '</form>'; |
|
239 |
||
240 |
return true; |
|
241 |
case 'edit_strings': |
|
242 |
||
243 |
$cat_id = @$_POST['cat_id']; |
|
244 |
if ( !preg_match('/^[a-z0-9]+$/', $cat_id) || !is_int(@$parms['lang_id']) ) |
|
245 |
break; |
|
246 |
||
247 |
$lang_id =& $parms['lang_id']; |
|
248 |
||
249 |
if ( isset($parms['save']) ) |
|
250 |
{ |
|
251 |
// Grab a Language object |
|
252 |
if ( $lang->lang_id == $lang_id ) |
|
253 |
{ |
|
254 |
$lang_local =& $lang; |
|
255 |
} |
|
256 |
else |
|
257 |
{ |
|
258 |
$lang_local = new Language($lang_id); |
|
259 |
} |
|
260 |
// Main save loop |
|
261 |
// Trying to minimize queries as much as possible here, but you know how that goes. |
|
262 |
$count_upd = 0; |
|
263 |
foreach ( $_POST['string'] as $string_id => $user_content ) |
|
264 |
{ |
|
265 |
$curr_content = $lang_local->get_uncensored("{$cat_id}_{$string_id}"); |
|
266 |
if ( $curr_content != $user_content ) |
|
267 |
{ |
|
268 |
$count_upd++; |
|
269 |
$user_content = $db->escape($user_content); |
|
270 |
$string_id = $db->escape($string_id); |
|
271 |
$q = $db->sql_query('UPDATE ' . table_prefix . "language_strings SET string_content = '$user_content' WHERE lang_id = $lang_id AND string_category = '$cat_id' AND string_name = '$string_id';"); |
|
272 |
if ( !$q ) |
|
273 |
$db->_die(); |
|
274 |
} |
|
275 |
} |
|
276 |
if ( $count_upd > 0 ) |
|
277 |
{ |
|
278 |
// Update the cache |
|
279 |
$lang_local->regen_caches(); |
|
280 |
||
281 |
// Update modification time |
|
282 |
$q = $db->sql_query('UPDATE ' . table_prefix . "language SET last_changed = " . time() . " WHERE lang_id = $lang_id;"); |
|
283 |
if ( !$q ) |
|
284 |
$db->_die(); |
|
285 |
} |
|
286 |
||
287 |
echo '<div class="info-box">' . $lang->get('acplm_msg_string_save_success') . '</div>'; |
|
288 |
} |
|
289 |
||
290 |
acp_start_form(); |
|
291 |
||
292 |
$cat_name = $lang->get("meta_$cat_id"); |
|
293 |
echo '<h3>' . $lang->get('acplm_editor_heading', array('cat_name' => $cat_name)) . '</h3>'; |
|
294 |
||
295 |
// Fetch all strings |
|
296 |
// This is more efficient than iterating through $lang->strings, I think. |
|
297 |
$q = $db->sql_query('SELECT string_id, string_name, string_content FROM ' . table_prefix . "language_strings WHERE string_category = '$cat_id' AND lang_id = $lang_id;"); |
|
298 |
if ( !$q ) |
|
299 |
$db->_die(); |
|
300 |
||
301 |
?> |
|
302 |
<div class="tblholder"> |
|
303 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
304 |
<tr> |
|
305 |
<th style="width: 3%;"><?php echo $lang->get('acplm_editor_col_string_name'); ?></th> |
|
306 |
<th><?php echo $lang->get('acplm_editor_col_string_content'); ?></th> |
|
307 |
</tr> |
|
308 |
<?php |
|
309 |
||
310 |
while ( $row = $db->fetchrow_num() ) |
|
311 |
{ |
|
312 |
list($string_id, $string_name, $string_content) = $row; |
|
313 |
unset($row); |
|
314 |
||
315 |
echo '<tr>'; |
|
316 |
||
317 |
if ( strpos($string_content, "\n") ) |
|
318 |
{ |
|
319 |
$editor = '<textarea rows="' . get_line_count($string_content) . '" cols="50" style="width: 99%;" '; |
|
320 |
$editor .= 'name="string[' . htmlspecialchars($string_name) . ']" '; |
|
321 |
$editor .= '>' . htmlspecialchars($string_content); |
|
322 |
$editor .= '</textarea>'; |
|
323 |
} |
|
324 |
else |
|
325 |
{ |
|
326 |
$editor = '<input type="text" size="50" style="width: 99%;" '; |
|
327 |
$editor .= 'name="string[' . htmlspecialchars($string_name) . ']" '; |
|
328 |
$editor .= 'value="' . htmlspecialchars($string_content) . '" '; |
|
329 |
$editor .= '/>'; |
|
330 |
} |
|
331 |
||
332 |
echo '<td class="row2">' . htmlspecialchars($string_name) . '</td>'; |
|
333 |
echo '<td class="row1">' . $editor . '</td>'; |
|
334 |
||
335 |
||
336 |
echo '</tr>'; |
|
337 |
echo "\n"; |
|
338 |
} |
|
339 |
||
340 |
echo '<tr> |
|
341 |
<th class="subhead" colspan="2">'; |
|
342 |
||
343 |
echo '<input type="hidden" name="cat_id" value="' . $cat_id . '" />'; |
|
344 |
||
345 |
// Button: save |
|
346 |
echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . ';save=1" style="font-weight: bold;">' . $lang->get('etc_save_changes') . '</button> '; |
|
347 |
// Button: revert |
|
348 |
echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_revert') . '</button> '; |
|
349 |
// Button: cancel |
|
350 |
echo '<button name="action" value="modify_language;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_cancel') . '</button>'; |
|
351 |
||
352 |
echo ' </th> |
|
353 |
</tr>'; |
|
354 |
||
355 |
?> |
|
356 |
</table> |
|
357 |
</div> |
|
358 |
<?php |
|
359 |
echo '</form>'; |
|
360 |
||
361 |
return true; |
|
362 |
case 'reimport': |
|
363 |
if ( !isset($parms['iso639']) || !is_int(@$parms['lang_id']) ) |
|
364 |
break; |
|
365 |
||
366 |
$lang_code =& $parms['iso639']; |
|
367 |
$lang_id =& $parms['lang_id']; |
|
368 |
||
369 |
$lang_list = list_available_languages(); |
|
370 |
||
371 |
if ( !isset($lang_list[$lang_code]) ) |
|
372 |
break; |
|
373 |
||
374 |
// Grab a Language object |
|
375 |
if ( $lang->lang_id == $lang_id ) |
|
376 |
{ |
|
377 |
$lang_local =& $lang; |
|
378 |
} |
|
379 |
else |
|
380 |
{ |
|
381 |
$lang_local = new Language($lang_id); |
|
382 |
} |
|
383 |
||
384 |
$lang_data =& $lang_list[$lang_code]; |
|
385 |
||
386 |
// This is the big re-import loop |
|
387 |
if ( file_exists(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json") ) |
|
388 |
{ |
|
389 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json"); |
|
390 |
} |
|
391 |
else |
|
392 |
{ |
|
393 |
foreach ( array('core', 'admin', 'tools', 'user') as $file ) |
|
394 |
{ |
|
395 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json"); |
|
396 |
} |
|
397 |
} |
|
398 |
||
399 |
echo '<div class="info-box">' . $lang->get('acplm_msg_reimport_success') . '</div>'; |
|
400 |
||
401 |
break; |
|
402 |
case 'backup_language': |
|
403 |
if ( !is_int(@$parms['lang_id']) ) |
|
404 |
break; |
|
405 |
||
406 |
$lang_id =& $parms['lang_id']; |
|
407 |
||
408 |
// Grab a Language object |
|
409 |
if ( $lang->lang_id == $lang_id ) |
|
410 |
{ |
|
411 |
$lang_local =& $lang; |
|
412 |
} |
|
413 |
else |
|
414 |
{ |
|
415 |
$lang_local = new Language($lang_id); |
|
416 |
} |
|
417 |
||
418 |
$filename = 'enano_lang_' . $lang_local->lang_code . '_' . enano_date('ymd') . '.json'; |
|
419 |
||
420 |
// Free as much memory as possible |
|
421 |
$db->close(); |
|
422 |
unset($GLOBALS['session'], $GLOBALS['paths'], $GLOBALS['template'], $GLOBALS['plugins']); |
|
423 |
||
424 |
// HTTP headers |
|
425 |
header('Content-type: application/json'); |
|
426 |
header('Content-disposition: attachment; filename=' . $filename); |
|
427 |
||
428 |
// Export to JSON |
|
429 |
$lang_struct = array( |
|
430 |
'categories' => array_keys($lang_local->strings), |
|
431 |
'strings' => $lang_local->strings |
|
432 |
); |
|
433 |
||
434 |
$lang_struct = enano_json_encode($lang_struct); |
|
435 |
||
436 |
header('Content-length: ' . strlen($lang_struct)); |
|
437 |
echo $lang_struct; |
|
438 |
||
439 |
exit; |
|
440 |
||
441 |
case 'uninstall_language': |
|
442 |
if ( !is_int(@$parms['lang_id']) ) |
|
443 |
break; |
|
444 |
||
445 |
$lang_id =& $parms['lang_id']; |
|
446 |
||
447 |
if ( isset($parms['confirm']) ) |
|
448 |
{ |
|
449 |
$lang_default = intval(getConfig('default_language')); |
|
450 |
if ( $lang_default == $lang_id ) |
|
451 |
{ |
|
452 |
echo '<div class="error-box">' . $lang->get('acplm_err_cant_uninstall_default') . '</div>'; |
|
453 |
break; |
|
454 |
} |
|
455 |
if ( $lang_id == $lang->lang_id ) |
|
456 |
{ |
|
457 |
// Unload the current language since it's about to be uninstalled |
|
458 |
unset($lang, $GLOBALS['lang']); |
|
459 |
$GLOBALS['lang'] = new Language($lang_default); |
|
460 |
global $lang; |
|
461 |
} |
|
462 |
// We're clear |
|
463 |
||
464 |
// Remove cache files |
|
465 |
$cache_file = ENANO_ROOT . "/cache/lang_{$lang_id}.php"; |
|
466 |
if ( file_exists($cache_file) ) |
|
467 |
@unlink($cache_file); |
|
468 |
||
469 |
// Remove strings |
|
470 |
$q = $db->sql_query('DELETE FROM ' . table_prefix . "language_strings WHERE lang_id = $lang_id;"); |
|
471 |
if ( !$q ) |
|
472 |
$db->_die(); |
|
473 |
||
474 |
// Delete the language |
|
475 |
$q = $db->sql_query('DELETE FROM ' . table_prefix . "language WHERE lang_id = $lang_id;"); |
|
476 |
if ( !$q ) |
|
477 |
$db->_die(); |
|
478 |
||
479 |
echo '<div class="info-box">' . $lang->get('acplm_msg_uninstall_success') . '</div>'; |
|
480 |
break; |
|
481 |
} |
|
482 |
||
483 |
acp_start_form(); |
|
484 |
||
485 |
echo '<h3>' . $lang->get('acplm_uninstall_confirm_title') . '</h3>'; |
|
486 |
echo '<p>' . $lang->get('acplm_uninstall_confirm_body') . '</p>'; |
|
487 |
||
488 |
echo '<p><button name="action" style="font-weight: bold;" value="uninstall_language;lang_id=' . $lang_id . ';confirm=1">' . $lang->get('acplm_btn_uninstall_confirm') . '</button> '; |
|
489 |
echo '<button name="action" value="home">' . $lang->get('acplm_btn_uninstall_cancel') . '</button></p>'; |
|
490 |
||
491 |
echo '</form>'; |
|
492 |
return true; |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
493 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
494 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
495 |
|
376 | 496 |
acp_start_form(); |
497 |
||
498 |
// Select current languages |
|
499 |
$q = $db->sql_query('SELECT lang_code, lang_name_native, lang_name_default, lang_id FROM ' . table_prefix . "language ORDER BY lang_id ASC;"); |
|
500 |
if ( !$q ) |
|
501 |
$db->_die(); |
|
502 |
||
503 |
// Language properties/edit/delete portal table |
|
504 |
echo '<h3>' . $lang->get('acplm_heading_editor_portal') . '</h3>'; |
|
505 |
||
506 |
echo '<div class="tblholder">'; |
|
507 |
echo '<table border="0" cellspacing="1" cellpadding="4">'; |
|
508 |
echo '<tr> |
|
509 |
<th>' . $lang->get('acplm_col_lang_id') . '</th> |
|
510 |
<th>' . $lang->get('acplm_col_lang_code') . '</th> |
|
511 |
<th>' . $lang->get('acplm_col_lang_name') . '</th> |
|
512 |
<th>' . $lang->get('acplm_col_lang_name_eng') . '</th> |
|
513 |
<th></th> |
|
514 |
</tr>'; |
|
515 |
||
516 |
$cls = 'row2'; |
|
517 |
||
518 |
$btn_edit = $lang->get('acplm_portal_btn_edit'); |
|
519 |
$btn_unin = $lang->get('acplm_portal_btn_unin'); |
|
520 |
||
521 |
while ( $row = $db->fetchrow($q) ) |
|
522 |
{ |
|
523 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
|
524 |
||
525 |
echo '<tr>'; |
|
526 |
||
527 |
$lang_code = htmlspecialchars($row['lang_code']); |
|
528 |
$lang_name_native = htmlspecialchars($row['lang_name_native']); |
|
529 |
$lang_name_english = htmlspecialchars($row['lang_name_default']); |
|
530 |
||
531 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$row['lang_id']}</td>"; |
|
532 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_code}</td>"; |
|
533 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_native}</td>"; |
|
534 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_english}</td>"; |
|
535 |
echo "<td class=\"$cls\" style=\"text-align: center;\"><button name=\"action\" value=\"modify_language;lang_id={$row['lang_id']}\">$btn_edit</button> <button name=\"action\" value=\"uninstall_language;lang_id={$row['lang_id']}\">$btn_unin</button></td>"; |
|
536 |
||
537 |
echo '</tr>'; |
|
538 |
} |
|
539 |
||
540 |
echo '</table></div>'; |
|
541 |
||
542 |
// Reset the result pointer to zero so we can fetch that list of languages again |
|
377
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
376
diff
changeset
|
543 |
if ( !$db->sql_data_seek(0, $q) ) |
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
376
diff
changeset
|
544 |
{ |
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
376
diff
changeset
|
545 |
$db->_die('LangManager doing seek back to zero for installation blacklist'); |
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
376
diff
changeset
|
546 |
} |
376 | 547 |
|
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
548 |
// $lang_list is fetched by the posthandler sometimes |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
549 |
if ( !isset($lang_list) ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
550 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
551 |
// Build a list of languages in the languages/ directory, then |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
552 |
// eliminate the ones that are already installed. |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
553 |
$lang_list = list_available_languages(); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
554 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
555 |
|
377
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
376
diff
changeset
|
556 |
while ( $row = $db->fetchrow($q) ) |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
557 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
558 |
$lang_code =& $row['lang_code']; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
559 |
if ( isset($lang_list[$lang_code]) ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
560 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
561 |
unset($lang_list[$lang_code]); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
562 |
unset($lang_list[$lang_code]); // PHP <5.1.4 Zend bug |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
563 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
564 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
565 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
566 |
if ( count($lang_list) > 0 ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
567 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
568 |
echo '<h3>' . $lang->get('acplm_heading_install') . '</h3>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
569 |
echo '<div class="tblholder"> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
570 |
<table border="0" cellspacing="1" cellpadding="4"> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
571 |
<tr> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
572 |
<th>' . $lang->get('acplm_col_lang_code') . '</th> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
573 |
<th>' . $lang->get('acplm_col_lang_name') . '</th> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
574 |
<th>' . $lang->get('acplm_col_lang_name_eng') . '</th> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
575 |
<th></th> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
576 |
</tr>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
577 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
578 |
$cls = 'row2'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
579 |
foreach ( $lang_list as $lang_code => $lang_data ) |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
580 |
{ |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
581 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
582 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
583 |
echo '<tr>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
584 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
585 |
$lang_code = htmlspecialchars($lang_code); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
586 |
$lang_data['name'] = htmlspecialchars($lang_data['name']); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
587 |
$lang_data['name_eng'] = htmlspecialchars($lang_data['name_eng']); |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
588 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
589 |
echo "<td class=\"$cls\" style=\"text-align: center;\">$lang_code</td>"; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
590 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_data['name']}</td>"; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
591 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_data['name_eng']}</td>"; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
592 |
echo "<td class=\"$cls\" style=\"text-align: center;\"><button name=\"action\" value=\"install_language;iso639=$lang_code\">" . $lang->get('acplm_btn_install_language') . "</button></td>"; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
593 |
|
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
594 |
echo '</tr>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
595 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
596 |
echo ' </tr> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
597 |
</table> |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
598 |
</div>'; |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
599 |
} |
376 | 600 |
echo '</form>'; |
372
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
601 |
} |
5bd429428101
A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents:
diff
changeset
|
602 |