author | Dan |
Sat, 28 Feb 2009 14:38:10 -0500 | |
changeset 847 | 28d5049803f1 |
parent 826 | dcf5381ce8ba |
child 1081 | 745200a9cc2a |
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 |
801
eb8b23f11744
Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents:
685
diff
changeset
|
5 |
* Version 1.1.6 (Caoineag beta 1) |
536 | 6 |
* Copyright (C) 2006-2008 Dan Fuhry |
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
|
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; |
661
5dd55a9240f8
Made Admin:LangManager purge caches properly when uninstalling a language
Dan
parents:
536
diff
changeset
|
19 |
global $cache; |
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
|
20 |
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
|
21 |
{ |
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 |
$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
|
23 |
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
|
24 |
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
|
25 |
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
|
26 |
} |
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 |
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
|
28 |
{ |
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
|
29 |
$action =& $_POST['action']; |
376 | 30 |
// 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
|
31 |
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
|
32 |
{ |
376 | 33 |
// 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
|
34 |
$parms = substr($action, strpos($action, ';') + 1); |
376 | 35 |
|
36 |
// 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
|
37 |
$action = substr($action, 0, strpos($action, ';')); |
376 | 38 |
|
39 |
// 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
|
40 |
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
|
41 |
$parms = array(); |
376 | 42 |
|
43 |
// 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
|
44 |
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
|
45 |
{ |
376 | 46 |
$parm = $matches[2][$i]; |
47 |
||
48 |
// Is this parameter in the form of an integer? |
|
49 |
// (designed to ease validation later) |
|
826
dcf5381ce8ba
Replaced integer checks that used preg_match() to use ctype_digit() instead
Dan
parents:
801
diff
changeset
|
50 |
if ( ctype_digit($parm) ) |
376 | 51 |
// Yes, run intval(), this enabling is_int()-ish checks |
52 |
$parm = intval($parm); |
|
53 |
||
54 |
$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
|
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 |
} |
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 |
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
|
58 |
{ |
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 |
case 'install_language': |
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
60 |
|
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
61 |
if ( defined('ENANO_DEMO_MODE') ) |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
62 |
{ |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
63 |
echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>'; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
64 |
break; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
65 |
} |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
66 |
|
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
|
67 |
$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
|
68 |
// 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
|
69 |
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
|
70 |
{ |
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 |
// 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
|
72 |
$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
|
73 |
$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
|
74 |
|
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
|
75 |
$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
|
76 |
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
|
77 |
{ |
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
|
78 |
// 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
|
79 |
$lang_local = new Language($lang_code); |
376 | 80 |
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
|
81 |
{ |
376 | 82 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json"); |
83 |
} |
|
84 |
else |
|
85 |
{ |
|
86 |
foreach ( array('core', 'admin', 'tools', 'user') as $file ) |
|
87 |
{ |
|
88 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json"); |
|
89 |
} |
|
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
|
90 |
} |
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
|
91 |
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
|
92 |
|
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
|
93 |
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
|
94 |
} |
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
|
95 |
} |
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
|
96 |
break; |
376 | 97 |
case 'modify_language': |
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
98 |
|
376 | 99 |
$lang_id =& $parms['lang_id']; |
100 |
if ( !is_int($lang_id) ) |
|
101 |
{ |
|
102 |
echo 'Hacking attempt'; |
|
103 |
break; |
|
104 |
} |
|
105 |
||
400 | 106 |
if ( isset($parms['finish']) && !empty($_POST['lang_name_native']) && !empty($_POST['lang_name_english']) && !defined('ENANO_DEMO_MODE') ) |
376 | 107 |
{ |
108 |
// We just did validation above, it's safe to save. |
|
109 |
$name_native = $db->escape($_POST['lang_name_native']); |
|
110 |
$name_english = $db->escape($_POST['lang_name_english']); |
|
111 |
||
112 |
$q = $db->sql_query('UPDATE ' . table_prefix . "language SET lang_name_native = '$name_native', lang_name_default = '$name_english' WHERE lang_id = $lang_id;"); |
|
113 |
if ( !$q ) |
|
114 |
$db->_die(); |
|
115 |
||
116 |
echo '<div class="info-box">' . $lang->get('acplm_msg_basic_save_success') . '</div>'; |
|
117 |
} |
|
400 | 118 |
else if ( isset($parms['finish']) && defined('ENANO_DEMO_MODE') ) |
119 |
{ |
|
120 |
echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>'; |
|
121 |
} |
|
376 | 122 |
|
123 |
// Select language data |
|
124 |
$q = $db->sql_query('SELECT lang_name_native, lang_name_default, lang_code FROM ' . table_prefix . "language WHERE lang_id = $lang_id;"); |
|
125 |
if ( !$q ) |
|
126 |
$db->_die(); |
|
127 |
||
128 |
list($name_native, $name_english, $lang_code) = $db->fetchrow_num(); |
|
129 |
||
130 |
// Output properties table |
|
131 |
echo '<h3>' . $lang->get('acplm_heading_modify') . '</h3>'; |
|
132 |
||
133 |
acp_start_form(); |
|
134 |
||
135 |
?> |
|
136 |
<div class="tblholder"> |
|
137 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
138 |
<tr> |
|
139 |
<th colspan="2"> |
|
140 |
<?php |
|
141 |
echo $lang->get('acplm_th_lang_basic'); |
|
142 |
?> |
|
143 |
</th> |
|
144 |
</tr> |
|
145 |
<tr> |
|
146 |
<td class="row2" style="width: 50%;"> |
|
147 |
<?php |
|
148 |
echo str_replace('"', '', $lang->get('acplm_field_lang_name_native')); |
|
149 |
?> |
|
150 |
</td> |
|
151 |
<td class="row1"> |
|
152 |
<input type="text" name="lang_name_native" value="<?php echo htmlspecialchars($name_native); ?>" /> |
|
153 |
</td> |
|
154 |
</tr> |
|
155 |
<tr> |
|
156 |
<td class="row2"> |
|
157 |
<?php |
|
158 |
echo $lang->get('acplm_field_lang_name_english'); |
|
159 |
?> |
|
160 |
</td> |
|
161 |
<td class="row1"> |
|
162 |
<input type="text" name="lang_name_english" value="<?php echo htmlspecialchars($name_english); ?>" /> |
|
163 |
</td> |
|
164 |
</tr> |
|
165 |
<tr> |
|
166 |
<td class="row2"> |
|
167 |
<?php |
|
168 |
echo $lang->get('acplm_field_lang_code') . '<br />' |
|
169 |
. '<small>' . $lang->get('acplm_field_lang_code_hint') . '</small>'; |
|
170 |
?> |
|
171 |
</td> |
|
172 |
<td class="row1"> |
|
173 |
<?php |
|
174 |
echo $lang_code; |
|
175 |
?> |
|
176 |
</td> |
|
177 |
</tr> |
|
178 |
<tr> |
|
179 |
<th class="subhead" colspan="2"> |
|
180 |
<button name="action" value="modify_language;finish=1;lang_id=<?php echo $lang_id; ?>"><?php echo $lang->get('etc_save_changes'); ?></button> |
|
181 |
</th> |
|
182 |
</tr> |
|
183 |
</table> |
|
184 |
</div> |
|
185 |
</form> |
|
186 |
||
187 |
<?php |
|
188 |
acp_start_form(); |
|
189 |
?> |
|
190 |
||
191 |
<h3><?php echo $lang->get('acplm_heading_edit_strings_portal'); ?></h3> |
|
192 |
<p><?php echo $lang->get('acplm_msg_edit_strings_portal_intro'); ?></p> |
|
193 |
||
194 |
<p> |
|
195 |
||
196 |
<?php |
|
197 |
||
198 |
// Grab a Language object |
|
199 |
if ( $lang->lang_id == $lang_id ) |
|
200 |
{ |
|
201 |
$lang_local =& $lang; |
|
202 |
} |
|
203 |
else |
|
204 |
{ |
|
205 |
$lang_local = new Language($lang_id); |
|
206 |
$lang_local->fetch(); |
|
207 |
} |
|
208 |
||
209 |
$categories_loc = array(); |
|
210 |
||
211 |
// Using the & here ensures that a reference is created, thus avoiding wasting memory |
|
212 |
foreach ( $lang_local->strings as $cat => &$_ ) |
|
213 |
{ |
|
214 |
unset($_); |
|
215 |
$categories_loc[$cat] = htmlspecialchars($lang->get("meta_$cat")); |
|
216 |
} |
|
217 |
||
218 |
asort($categories_loc); |
|
219 |
||
220 |
echo '<select name="cat_id">'; |
|
221 |
foreach ( $categories_loc as $cat_id => $cat_name) |
|
222 |
{ |
|
223 |
echo "<option value=\"$cat_id\">$cat_name</option>"; |
|
224 |
} |
|
225 |
echo '</select>'; |
|
226 |
||
227 |
?> |
|
228 |
<button name="action" value="edit_strings;lang_id=<?php echo $lang_id; ?>"> |
|
229 |
<?php echo $lang->get('acplm_btn_edit_strings_portal'); ?> |
|
230 |
</button> |
|
231 |
</p> |
|
232 |
||
233 |
<h3><?php echo $lang->get('acplm_heading_reimport_portal'); ?></h3> |
|
234 |
<p><?php echo $lang->get('acplm_msg_reimport_portal_intro'); ?></p> |
|
235 |
||
236 |
<p> |
|
237 |
<button name="action" value="reimport;iso639=<?php echo $lang_code; ?>;lang_id=<?php echo $lang_id; ?>"> |
|
238 |
<?php echo $lang->get('acplm_btn_reimport'); ?> |
|
239 |
</button> |
|
240 |
</p> |
|
241 |
||
242 |
</form> |
|
243 |
||
244 |
<?php |
|
245 |
||
246 |
echo '<h3>' . $lang->get('acplm_heading_backup') . '</h3>'; |
|
247 |
echo '<p>' . $lang->get('acplm_backup_intro') . '</p>'; |
|
248 |
||
249 |
echo '<form action="' . makeUrlNS('Admin', 'LangManager') . '" method="post">'; |
|
250 |
echo '<button name="action" value="backup_language;lang_id=' . $lang_id . '">' . $lang->get('acplm_btn_create_backup') . '</button>'; |
|
251 |
echo '</form>'; |
|
252 |
||
253 |
return true; |
|
254 |
case 'edit_strings': |
|
255 |
||
256 |
$cat_id = @$_POST['cat_id']; |
|
257 |
if ( !preg_match('/^[a-z0-9]+$/', $cat_id) || !is_int(@$parms['lang_id']) ) |
|
258 |
break; |
|
259 |
||
260 |
$lang_id =& $parms['lang_id']; |
|
261 |
||
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
262 |
if ( isset($parms['save']) && !defined('ENANO_DEMO_MODE') ) |
376 | 263 |
{ |
264 |
// Grab a Language object |
|
265 |
if ( $lang->lang_id == $lang_id ) |
|
266 |
{ |
|
267 |
$lang_local =& $lang; |
|
268 |
} |
|
269 |
else |
|
270 |
{ |
|
271 |
$lang_local = new Language($lang_id); |
|
272 |
} |
|
273 |
// Main save loop |
|
274 |
// Trying to minimize queries as much as possible here, but you know how that goes. |
|
275 |
$count_upd = 0; |
|
276 |
foreach ( $_POST['string'] as $string_id => $user_content ) |
|
277 |
{ |
|
278 |
$curr_content = $lang_local->get_uncensored("{$cat_id}_{$string_id}"); |
|
279 |
if ( $curr_content != $user_content ) |
|
280 |
{ |
|
281 |
$count_upd++; |
|
282 |
$user_content = $db->escape($user_content); |
|
283 |
$string_id = $db->escape($string_id); |
|
284 |
$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';"); |
|
285 |
if ( !$q ) |
|
286 |
$db->_die(); |
|
287 |
} |
|
288 |
} |
|
289 |
if ( $count_upd > 0 ) |
|
290 |
{ |
|
291 |
// Update the cache |
|
292 |
$lang_local->regen_caches(); |
|
293 |
||
294 |
// Update modification time |
|
295 |
$q = $db->sql_query('UPDATE ' . table_prefix . "language SET last_changed = " . time() . " WHERE lang_id = $lang_id;"); |
|
296 |
if ( !$q ) |
|
297 |
$db->_die(); |
|
298 |
} |
|
299 |
||
300 |
echo '<div class="info-box">' . $lang->get('acplm_msg_string_save_success') . '</div>'; |
|
301 |
} |
|
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
302 |
else if ( isset($parms['save']) && defined('ENANO_DEMO_MODE') ) |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
303 |
{ |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
304 |
echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>'; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
305 |
} |
376 | 306 |
|
307 |
acp_start_form(); |
|
308 |
||
309 |
$cat_name = $lang->get("meta_$cat_id"); |
|
310 |
echo '<h3>' . $lang->get('acplm_editor_heading', array('cat_name' => $cat_name)) . '</h3>'; |
|
311 |
||
312 |
// Fetch all strings |
|
313 |
// This is more efficient than iterating through $lang->strings, I think. |
|
314 |
$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;"); |
|
315 |
if ( !$q ) |
|
316 |
$db->_die(); |
|
317 |
||
318 |
?> |
|
319 |
<div class="tblholder"> |
|
320 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
321 |
<tr> |
|
322 |
<th style="width: 3%;"><?php echo $lang->get('acplm_editor_col_string_name'); ?></th> |
|
323 |
<th><?php echo $lang->get('acplm_editor_col_string_content'); ?></th> |
|
324 |
</tr> |
|
325 |
<?php |
|
326 |
||
327 |
while ( $row = $db->fetchrow_num() ) |
|
328 |
{ |
|
329 |
list($string_id, $string_name, $string_content) = $row; |
|
330 |
unset($row); |
|
331 |
||
332 |
echo '<tr>'; |
|
333 |
||
334 |
if ( strpos($string_content, "\n") ) |
|
335 |
{ |
|
336 |
$editor = '<textarea rows="' . get_line_count($string_content) . '" cols="50" style="width: 99%;" '; |
|
337 |
$editor .= 'name="string[' . htmlspecialchars($string_name) . ']" '; |
|
338 |
$editor .= '>' . htmlspecialchars($string_content); |
|
339 |
$editor .= '</textarea>'; |
|
340 |
} |
|
341 |
else |
|
342 |
{ |
|
343 |
$editor = '<input type="text" size="50" style="width: 99%;" '; |
|
344 |
$editor .= 'name="string[' . htmlspecialchars($string_name) . ']" '; |
|
345 |
$editor .= 'value="' . htmlspecialchars($string_content) . '" '; |
|
346 |
$editor .= '/>'; |
|
347 |
} |
|
348 |
||
349 |
echo '<td class="row2">' . htmlspecialchars($string_name) . '</td>'; |
|
350 |
echo '<td class="row1">' . $editor . '</td>'; |
|
351 |
||
352 |
||
353 |
echo '</tr>'; |
|
354 |
echo "\n"; |
|
355 |
} |
|
356 |
||
357 |
echo '<tr> |
|
358 |
<th class="subhead" colspan="2">'; |
|
359 |
||
360 |
echo '<input type="hidden" name="cat_id" value="' . $cat_id . '" />'; |
|
361 |
||
362 |
// Button: save |
|
363 |
echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . ';save=1" style="font-weight: bold;">' . $lang->get('etc_save_changes') . '</button> '; |
|
364 |
// Button: revert |
|
365 |
echo '<button name="action" value="edit_strings;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_revert') . '</button> '; |
|
366 |
// Button: cancel |
|
367 |
echo '<button name="action" value="modify_language;lang_id=' . $lang_id . '" style="font-weight: normal;">' . $lang->get('acplm_editor_btn_cancel') . '</button>'; |
|
368 |
||
369 |
echo ' </th> |
|
370 |
</tr>'; |
|
371 |
||
372 |
?> |
|
373 |
</table> |
|
374 |
</div> |
|
375 |
<?php |
|
376 |
echo '</form>'; |
|
377 |
||
378 |
return true; |
|
379 |
case 'reimport': |
|
380 |
if ( !isset($parms['iso639']) || !is_int(@$parms['lang_id']) ) |
|
381 |
break; |
|
382 |
||
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
383 |
if ( defined('ENANO_DEMO_MODE') ) |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
384 |
{ |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
385 |
echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>'; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
386 |
break; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
387 |
} |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
388 |
|
376 | 389 |
$lang_code =& $parms['iso639']; |
390 |
$lang_id =& $parms['lang_id']; |
|
391 |
||
392 |
$lang_list = list_available_languages(); |
|
393 |
||
394 |
if ( !isset($lang_list[$lang_code]) ) |
|
395 |
break; |
|
396 |
||
397 |
// Grab a Language object |
|
398 |
if ( $lang->lang_id == $lang_id ) |
|
399 |
{ |
|
400 |
$lang_local =& $lang; |
|
401 |
} |
|
402 |
else |
|
403 |
{ |
|
404 |
$lang_local = new Language($lang_id); |
|
405 |
} |
|
406 |
||
407 |
$lang_data =& $lang_list[$lang_code]; |
|
408 |
||
409 |
// This is the big re-import loop |
|
410 |
if ( file_exists(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json") ) |
|
411 |
{ |
|
412 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/backup.json"); |
|
413 |
} |
|
414 |
else |
|
415 |
{ |
|
416 |
foreach ( array('core', 'admin', 'tools', 'user') as $file ) |
|
417 |
{ |
|
418 |
$lang_local->import(ENANO_ROOT . "/language/{$lang_data['dir']}/$file.json"); |
|
419 |
} |
|
420 |
} |
|
421 |
||
422 |
echo '<div class="info-box">' . $lang->get('acplm_msg_reimport_success') . '</div>'; |
|
423 |
||
424 |
break; |
|
425 |
case 'backup_language': |
|
426 |
if ( !is_int(@$parms['lang_id']) ) |
|
427 |
break; |
|
428 |
||
429 |
$lang_id =& $parms['lang_id']; |
|
430 |
||
431 |
// Grab a Language object |
|
432 |
if ( $lang->lang_id == $lang_id ) |
|
433 |
{ |
|
434 |
$lang_local =& $lang; |
|
435 |
} |
|
436 |
else |
|
437 |
{ |
|
438 |
$lang_local = new Language($lang_id); |
|
439 |
} |
|
440 |
||
441 |
$filename = 'enano_lang_' . $lang_local->lang_code . '_' . enano_date('ymd') . '.json'; |
|
442 |
||
443 |
// Free as much memory as possible |
|
444 |
$db->close(); |
|
445 |
unset($GLOBALS['session'], $GLOBALS['paths'], $GLOBALS['template'], $GLOBALS['plugins']); |
|
446 |
||
447 |
// HTTP headers |
|
448 |
header('Content-type: application/json'); |
|
449 |
header('Content-disposition: attachment; filename=' . $filename); |
|
450 |
||
451 |
// Export to JSON |
|
452 |
$lang_struct = array( |
|
453 |
'categories' => array_keys($lang_local->strings), |
|
454 |
'strings' => $lang_local->strings |
|
455 |
); |
|
456 |
||
457 |
$lang_struct = enano_json_encode($lang_struct); |
|
458 |
||
459 |
header('Content-length: ' . strlen($lang_struct)); |
|
460 |
echo $lang_struct; |
|
461 |
||
462 |
exit; |
|
463 |
||
464 |
case 'uninstall_language': |
|
465 |
if ( !is_int(@$parms['lang_id']) ) |
|
466 |
break; |
|
467 |
||
399
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
468 |
if ( defined('ENANO_DEMO_MODE') ) |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
469 |
{ |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
470 |
echo '<div class="error-box">' . $lang->get('acplm_err_lang_install_demo') . '</div>'; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
471 |
break; |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
472 |
} |
a3a9e463c62f
Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents:
387
diff
changeset
|
473 |
|
376 | 474 |
$lang_id =& $parms['lang_id']; |
475 |
||
476 |
if ( isset($parms['confirm']) ) |
|
477 |
{ |
|
478 |
$lang_default = intval(getConfig('default_language')); |
|
479 |
if ( $lang_default == $lang_id ) |
|
480 |
{ |
|
481 |
echo '<div class="error-box">' . $lang->get('acplm_err_cant_uninstall_default') . '</div>'; |
|
482 |
break; |
|
483 |
} |
|
484 |
if ( $lang_id == $lang->lang_id ) |
|
485 |
{ |
|
486 |
// Unload the current language since it's about to be uninstalled |
|
487 |
unset($lang, $GLOBALS['lang']); |
|
488 |
$GLOBALS['lang'] = new Language($lang_default); |
|
489 |
global $lang; |
|
490 |
} |
|
491 |
// We're clear |
|
492 |
||
493 |
// Remove cache files |
|
494 |
$cache_file = ENANO_ROOT . "/cache/lang_{$lang_id}.php"; |
|
495 |
if ( file_exists($cache_file) ) |
|
496 |
@unlink($cache_file); |
|
497 |
||
661
5dd55a9240f8
Made Admin:LangManager purge caches properly when uninstalling a language
Dan
parents:
536
diff
changeset
|
498 |
$cache->purge("lang_{$lang_id}"); |
5dd55a9240f8
Made Admin:LangManager purge caches properly when uninstalling a language
Dan
parents:
536
diff
changeset
|
499 |
|
376 | 500 |
// Remove strings |
501 |
$q = $db->sql_query('DELETE FROM ' . table_prefix . "language_strings WHERE lang_id = $lang_id;"); |
|
502 |
if ( !$q ) |
|
503 |
$db->_die(); |
|
504 |
||
505 |
// Delete the language |
|
506 |
$q = $db->sql_query('DELETE FROM ' . table_prefix . "language WHERE lang_id = $lang_id;"); |
|
507 |
if ( !$q ) |
|
508 |
$db->_die(); |
|
509 |
||
510 |
echo '<div class="info-box">' . $lang->get('acplm_msg_uninstall_success') . '</div>'; |
|
511 |
break; |
|
512 |
} |
|
513 |
||
514 |
acp_start_form(); |
|
515 |
||
516 |
echo '<h3>' . $lang->get('acplm_uninstall_confirm_title') . '</h3>'; |
|
517 |
echo '<p>' . $lang->get('acplm_uninstall_confirm_body') . '</p>'; |
|
518 |
||
519 |
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> '; |
|
520 |
echo '<button name="action" value="home">' . $lang->get('acplm_btn_uninstall_cancel') . '</button></p>'; |
|
521 |
||
522 |
echo '</form>'; |
|
523 |
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
|
524 |
} |
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
|
525 |
} |
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
|
526 |
|
376 | 527 |
acp_start_form(); |
528 |
||
529 |
// Select current languages |
|
530 |
$q = $db->sql_query('SELECT lang_code, lang_name_native, lang_name_default, lang_id FROM ' . table_prefix . "language ORDER BY lang_id ASC;"); |
|
531 |
if ( !$q ) |
|
532 |
$db->_die(); |
|
533 |
||
534 |
// Language properties/edit/delete portal table |
|
535 |
echo '<h3>' . $lang->get('acplm_heading_editor_portal') . '</h3>'; |
|
536 |
||
537 |
echo '<div class="tblholder">'; |
|
538 |
echo '<table border="0" cellspacing="1" cellpadding="4">'; |
|
539 |
echo '<tr> |
|
540 |
<th>' . $lang->get('acplm_col_lang_id') . '</th> |
|
541 |
<th>' . $lang->get('acplm_col_lang_code') . '</th> |
|
542 |
<th>' . $lang->get('acplm_col_lang_name') . '</th> |
|
543 |
<th>' . $lang->get('acplm_col_lang_name_eng') . '</th> |
|
544 |
<th></th> |
|
545 |
</tr>'; |
|
546 |
||
547 |
$cls = 'row2'; |
|
548 |
||
549 |
$btn_edit = $lang->get('acplm_portal_btn_edit'); |
|
550 |
$btn_unin = $lang->get('acplm_portal_btn_unin'); |
|
551 |
||
552 |
while ( $row = $db->fetchrow($q) ) |
|
553 |
{ |
|
554 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
|
555 |
||
556 |
echo '<tr>'; |
|
557 |
||
558 |
$lang_code = htmlspecialchars($row['lang_code']); |
|
559 |
$lang_name_native = htmlspecialchars($row['lang_name_native']); |
|
560 |
$lang_name_english = htmlspecialchars($row['lang_name_default']); |
|
561 |
||
562 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$row['lang_id']}</td>"; |
|
563 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_code}</td>"; |
|
564 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_native}</td>"; |
|
565 |
echo "<td class=\"$cls\" style=\"text-align: center;\">{$lang_name_english}</td>"; |
|
566 |
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>"; |
|
567 |
||
568 |
echo '</tr>'; |
|
569 |
} |
|
570 |
||
571 |
echo '</table></div>'; |
|
572 |
||
573 |
// 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
|
574 |
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
|
575 |
{ |
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
|
576 |
$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
|
577 |
} |
376 | 578 |
|
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
|
579 |
// $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
|
580 |
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
|
581 |
{ |
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 |
// 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
|
583 |
// 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
|
584 |
$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
|
585 |
} |
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 |
|
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
|
587 |
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
|
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 |
$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
|
590 |
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
|
591 |
{ |
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 |
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
|
593 |
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
|
594 |
} |
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 |
|
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 |
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
|
598 |
{ |
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 |
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
|
600 |
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
|
601 |
<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
|
602 |
<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
|
603 |
<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
|
604 |
<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
|
605 |
<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
|
606 |
<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
|
607 |
</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
|
608 |
|
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
|
609 |
$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
|
610 |
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
|
611 |
{ |
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
|
612 |
$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
|
613 |
|
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
|
614 |
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
|
615 |
|
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
|
616 |
$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
|
617 |
$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
|
618 |
$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
|
619 |
|
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
|
620 |
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
|
621 |
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
|
622 |
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
|
623 |
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
|
624 |
|
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
|
625 |
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
|
626 |
} |
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
|
627 |
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
|
628 |
</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
|
629 |
</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
|
630 |
} |
376 | 631 |
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
|
632 |
} |
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
|
633 |