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