root / tags / milestone_3 / phpBB / adm / admin_language.php
History | View | Annotate | Download (29.4 kB)
| 1 | <?php
|
|---|---|
| 2 | /**
|
| 3 | * |
| 4 | * @package acp |
| 5 | * @version $Id: admin_language.php 5132 2005-04-30 14:12:21Z acydburn $ |
| 6 | * @copyright (c) 2005 phpBB Group |
| 7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /**
|
| 12 | */ |
| 13 | if (!empty($setmodules)) |
| 14 | {
|
| 15 | if (!$auth->acl_get('a_server')) |
| 16 | {
|
| 17 | return;
|
| 18 | } |
| 19 | |
| 20 | $module['LANGUAGE']['LANGUAGE_PACKS'] = basename(__FILE__) . "$SID&mode=manage"; |
| 21 | |
| 22 | return;
|
| 23 | } |
| 24 | |
| 25 | define('IN_PHPBB', 1); |
| 26 | // Include files
|
| 27 | $phpbb_root_path = '../'; |
| 28 | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 29 | require('pagestart.' . $phpEx); |
| 30 | include($phpbb_root_path . 'includes/functions_user.'.$phpEx); |
| 31 | |
| 32 | // Do we have general permissions?
|
| 33 | if (!$auth->acl_get('a_server')) |
| 34 | {
|
| 35 | trigger_error('NO_ADMIN'); |
| 36 | } |
| 37 | |
| 38 | // Check and set some common vars
|
| 39 | $mode = request_var('mode', ''); |
| 40 | $confirm = (isset($_POST['confirm'])) ? true : false; |
| 41 | $cancel = (isset($_POST['cancel'])) ? true : false; |
| 42 | $action = request_var('action', ''); |
| 43 | |
| 44 | $action = (isset($_POST['update_details'])) ? 'update_details' : $action; |
| 45 | $action = (isset($_POST['download_file'])) ? 'download_file' : $action; |
| 46 | $action = (isset($_POST['submit_file'])) ? 'submit_file' : $action; |
| 47 | $action = (isset($_POST['remove_store'])) ? 'details' : $action; |
| 48 | |
| 49 | $lang_id = request_var('id', 0); |
| 50 | $cur_file = request_var('cur_file', 'common'); |
| 51 | |
| 52 | if (is_array($cur_file)) |
| 53 | {
|
| 54 | list($cur_file, ) = array_keys($cur_file); |
| 55 | } |
| 56 | |
| 57 | $cur_file = (strpos($cur_file, 'email/') !== false) ? 'email/' . basename($cur_file) : basename($cur_file) . '.' . $phpEx; |
| 58 | $safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false; |
| 59 | |
| 60 | $language_files = array('common', 'groups', 'mcp', 'memberlist', 'posting', 'search', 'ucp', 'viewforum', 'viewtopic', 'admin', 'help_bbcode', 'help_faq'); |
| 61 | |
| 62 | $language_file_header = '<?php |
| 63 | /** |
| 64 | * |
| 65 | * {FILENAME} [{LANG_NAME}]
|
| 66 | * |
| 67 | * @package phpBB3 |
| 68 | * @version $Id: admin_language.php 5132 2005-04-30 14:12:21Z acydburn $ |
| 69 | * @copyright (c) 2005 phpBB Group |
| 70 | * @author {CHANGED} - {AUTHOR}
|
| 71 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 72 | * |
| 73 | */ |
| 74 | |
| 75 | // DEVELOPERS PLEASE NOTE |
| 76 | // |
| 77 | // Placeholders can now contain order information, e.g. instead of |
| 78 | // \'Page %s of %s\' you can (and should) write \'Page %1$s of %2$s\', this allows |
| 79 | // translators to re-order the output of data while ensuring it remains correct |
| 80 | // |
| 81 | // You do not need this where single placeholders are used, e.g. \'Message %d\' is fine |
| 82 | // equally where a string contains only two placeholders which are used to wrap text |
| 83 | // in a url you again do not need to specify an order e.g., \'Click %sHERE%s\' is fine |
| 84 | |
| 85 | /** |
| 86 | */ |
| 87 | ';
|
| 88 | |
| 89 | if (!$mode) |
| 90 | {
|
| 91 | trigger_error('NO_MODE'); |
| 92 | } |
| 93 | |
| 94 | switch ($action) |
| 95 | {
|
| 96 | case 'update_details': |
| 97 | |
| 98 | if (!$lang_id) |
| 99 | {
|
| 100 | trigger_error('NO_LANGUAGE_PACK_DEFINED'); |
| 101 | } |
| 102 | |
| 103 | $sql = 'SELECT * FROM ' . LANG_TABLE . " |
| 104 | WHERE lang_id = $lang_id"; |
| 105 | $result = $db->sql_query($sql); |
| 106 | $row = $db->sql_fetchrow($result); |
| 107 | $db->sql_freeresult($result); |
| 108 | |
| 109 | $sql_ary['lang_english_name'] = request_var('lang_english_name', $row['lang_english_name']); |
| 110 | $sql_ary['lang_local_name'] = request_var('lang_local_name', $row['lang_local_name']); |
| 111 | $sql_ary['lang_author'] = request_var('lang_author', $row['lang_author']); |
| 112 | |
| 113 | $db->sql_query('UPDATE ' . LANG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' |
| 114 | WHERE lang_id = ' . $lang_id); |
| 115 | |
| 116 | add_log('admin', 'LOG_UPDATE_LANG_DETAILS', $sql_ary['lang_english_name']); |
| 117 | |
| 118 | trigger_error('LANGUAGE_DETAILS_UPDATED'); |
| 119 | break;
|
| 120 | |
| 121 | case 'submit_file': |
| 122 | case 'download_file': |
| 123 | |
| 124 | if (!$lang_id) |
| 125 | {
|
| 126 | trigger_error('NO_LANGUAGE_PACK_DEFINED'); |
| 127 | } |
| 128 | |
| 129 | if (!$cur_file) |
| 130 | {
|
| 131 | trigger_error('NO_FILE_SELECTED'); |
| 132 | } |
| 133 | |
| 134 | $sql = 'SELECT * FROM ' . LANG_TABLE . " |
| 135 | WHERE lang_id = $lang_id"; |
| 136 | $result = $db->sql_query($sql); |
| 137 | $row = $db->sql_fetchrow($result); |
| 138 | $db->sql_freeresult($result); |
| 139 | |
| 140 | if (!$safe_mode) |
| 141 | {
|
| 142 | $mkdir_ary = array('language', 'language/' . $row['lang_iso']); |
| 143 | if (strpos($cur_file, 'email/') !== false) |
| 144 | {
|
| 145 | $mkdir_ary[] = 'language/' . $row['lang_iso'] . '/email'; |
| 146 | } |
| 147 | |
| 148 | foreach ($mkdir_ary as $dir) |
| 149 | {
|
| 150 | $dir = $phpbb_root_path . 'store/' . $dir; |
| 151 | |
| 152 | if (!is_dir($dir)) |
| 153 | {
|
| 154 | if (!@mkdir($dir, 0777)) |
| 155 | {
|
| 156 | trigger_error("Could not create directory $dir"); |
| 157 | } |
| 158 | @chmod($dir, 0777); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | $filename = get_filename($row['lang_iso'], $cur_file, true); |
| 164 | $fp = fopen($filename, 'wb'); |
| 165 | |
| 166 | if (strpos($cur_file, 'email/') !== false) |
| 167 | {
|
| 168 | fwrite($fp, (STRIP) ? stripslashes($_POST['entry']) : $_POST['entry']); |
| 169 | } |
| 170 | else if (strpos($cur_file, 'help_') === 0) |
| 171 | {
|
| 172 | $header = str_replace(array('{FILENAME}', '{LANG_NAME}', '{CHANGED}', '{AUTHOR}'), array($cur_file, $row['lang_english_name'], date('Y-m-d', time()), $row['lang_author']), $language_file_header); |
| 173 | $header .= '$help = array(' . "\n"; |
| 174 | fwrite($fp, $header); |
| 175 | |
| 176 | foreach ($_POST['entry'] as $key => $value) |
| 177 | {
|
| 178 | if (!is_array($value)) |
| 179 | {
|
| 180 | } |
| 181 | else
|
| 182 | {
|
| 183 | $entry = "\tarray(\n"; |
| 184 | |
| 185 | foreach ($value as $_key => $_value) |
| 186 | {
|
| 187 | $_value = (STRIP) ? stripslashes($_value) : $_value; |
| 188 | $entry .= "\t\t" . (int) $_key . "\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; |
| 189 | } |
| 190 | |
| 191 | $entry .= "\t),\n"; |
| 192 | } |
| 193 | |
| 194 | fwrite($fp, $entry); |
| 195 | } |
| 196 | |
| 197 | $footer = ");\n\n?>"; |
| 198 | fwrite($fp, $footer); |
| 199 | } |
| 200 | else
|
| 201 | {
|
| 202 | $header = str_replace(array('{FILENAME}', '{LANG_NAME}', '{CHANGED}', '{AUTHOR}'), array($cur_file, $row['lang_english_name'], date('Y-m-d', time()), $row['lang_author']), $language_file_header); |
| 203 | $header .= ' |
| 204 | /** |
| 205 | * DO NOT CHANGE |
| 206 | */ |
| 207 | if (empty($lang) || !is_array($lang)) |
| 208 | {
|
| 209 | $lang = array(); |
| 210 | } |
| 211 | |
| 212 | $lang += array( |
| 213 | ';
|
| 214 | fwrite($fp, $header); |
| 215 | |
| 216 | foreach ($_POST['entry'] as $key => $value) |
| 217 | {
|
| 218 | if (!is_array($value)) |
| 219 | {
|
| 220 | $value = (STRIP) ? stripslashes($value) : $value; |
| 221 | $entry = "\t'" . $key . "'\t=> '" . str_replace("'", "\\'", $value) . "',\n"; |
| 222 | } |
| 223 | else
|
| 224 | {
|
| 225 | $entry = "\n\t'" . $key . "'\t=> array(\n"; |
| 226 | |
| 227 | foreach ($value as $_key => $_value) |
| 228 | {
|
| 229 | $_value = (STRIP) ? stripslashes($_value) : $_value; |
| 230 | $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; |
| 231 | } |
| 232 | |
| 233 | $entry .= "\t),\n\n"; |
| 234 | } |
| 235 | |
| 236 | fwrite($fp, $entry); |
| 237 | } |
| 238 | |
| 239 | $footer = ");\n\n?>"; |
| 240 | fwrite($fp, $footer); |
| 241 | } |
| 242 | |
| 243 | fclose($fp); |
| 244 | |
| 245 | if ($action == 'download_file') |
| 246 | {
|
| 247 | $name = basename($cur_file); |
| 248 | |
| 249 | header('Pragma: no-cache'); |
| 250 | header('Content-Type: application/octetstream; name="' . $name . '"'); |
| 251 | header('Content-disposition: attachment; filename=' . $name); |
| 252 | |
| 253 | $fp = fopen($filename, 'rb'); |
| 254 | while ($buffer = fread($fp, 1024)) |
| 255 | {
|
| 256 | echo $buffer; |
| 257 | } |
| 258 | fclose($fp); |
| 259 | |
| 260 | exit;
|
| 261 | } |
| 262 | |
| 263 | $action = 'details'; |
| 264 | |
| 265 | case 'details': |
| 266 | adm_page_header($user->lang['LANGUAGE_PACK_DETAILS']); |
| 267 | |
| 268 | if (!$lang_id) |
| 269 | {
|
| 270 | trigger_error('NO_LANGUAGE_PACK_DEFINED'); |
| 271 | } |
| 272 | |
| 273 | $sql = 'SELECT * FROM ' . LANG_TABLE . ' |
| 274 | WHERE lang_id = ' . $lang_id; |
| 275 | $result = $db->sql_query($sql); |
| 276 | $lang_entries = $db->sql_fetchrow($result); |
| 277 | $db->sql_freeresult($result); |
| 278 | |
| 279 | $lang_iso = $lang_entries['lang_iso']; |
| 280 | $missing_vars = $missing_files = array(); |
| 281 | |
| 282 | $email_templates = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'email', 'txt'); |
| 283 | $email_templates = $email_templates['email/']; |
| 284 | |
| 285 | if (!in_array(str_replace(".{$phpEx}", '', $cur_file), $language_files) && !in_array(basename($cur_file), $email_templates)) |
| 286 | {
|
| 287 | trigger_error('WRONG_LANGUAGE_FILE'); |
| 288 | } |
| 289 | |
| 290 | if (isset($_POST['remove_store'])) |
| 291 | {
|
| 292 | if (!$safe_mode) |
| 293 | {
|
| 294 | @unlink(get_filename($lang_iso, $cur_file)); |
| 295 | } |
| 296 | else
|
| 297 | {
|
| 298 | @unlink(get_filename($lang_iso, $cur_file, true)); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | ?>
|
| 303 | <h1><?php echo $user->lang['LANGUAGE_PACK_DETAILS']; ?></h1> |
| 304 | |
| 305 | <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> |
| 306 | <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 307 | <tr>
|
| 308 | <th colspan="2"><?php echo $lang_entries['lang_local_name']; ?></th> |
| 309 | </tr>
|
| 310 | <tr>
|
| 311 | <td class="row1"><b><?php echo $user->lang['LANG_ENGLISH_NAME']; ?>: </b></td> |
| 312 | <td class="row2"><input type="text" class="text" name="lang_english_name" value="<?php echo $lang_entries['lang_english_name']; ?>" /></td> |
| 313 | </tr>
|
| 314 | <tr>
|
| 315 | <td class="row1"><b><?php echo $user->lang['LANG_LOCAL_NAME']; ?>: </b></td> |
| 316 | <td class="row2"><input type="text" class="text" name="lang_local_name" value="<?php echo $lang_entries['lang_local_name']; ?>" /></td> |
| 317 | </tr>
|
| 318 | <tr>
|
| 319 | <td class="row1"><b><?php echo $user->lang['LANG_ISO_CODE']; ?>: </b></td> |
| 320 | <td class="row2"><?php echo $lang_entries['lang_iso']; ?></td> |
| 321 | </tr>
|
| 322 | <tr>
|
| 323 | <td class="row1"><b><?php echo $user->lang['LANG_AUTHOR']; ?>: </b></td> |
| 324 | <td class="row2"><input type="text" class="text" name="lang_author" value="<?php echo $lang_entries['lang_author']; ?>" /></td> |
| 325 | </tr>
|
| 326 | <tr>
|
| 327 | <td class="cat" colspan="2" align="right"><input type="submit" name="update_details" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> |
| 328 | </tr>
|
| 329 | </table>
|
| 330 | <br /><br /> |
| 331 | </form>
|
| 332 | <?php
|
| 333 | |
| 334 | // If current lang is different from the default lang, then first try to grab missing/additional vars
|
| 335 | if ($lang_iso != $config['default_lang']) |
| 336 | {
|
| 337 | $is_missing_var = false; |
| 338 | |
| 339 | foreach ($language_files as $file) |
| 340 | {
|
| 341 | if (file_exists(get_filename($lang_iso, "$file.$phpEx"))) |
| 342 | {
|
| 343 | $missing_vars["$file.$phpEx"] = compare_language_files($config['default_lang'], $lang_iso, $file); |
| 344 | |
| 345 | if (sizeof($missing_vars["$file.$phpEx"])) |
| 346 | {
|
| 347 | $is_missing_var = true; |
| 348 | } |
| 349 | else
|
| 350 | {
|
| 351 | unset($missing_vars["$file.$phpEx"]); |
| 352 | } |
| 353 | } |
| 354 | else
|
| 355 | {
|
| 356 | $missing_files[] = get_filename($lang_iso, "$file.$phpEx"); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | // More missing files... for example email templates?
|
| 361 | foreach ($email_templates as $file) |
| 362 | {
|
| 363 | if (!file_exists(get_filename($lang_iso, "email/$file"))) |
| 364 | {
|
| 365 | $missing_files[] = get_filename($lang_iso, "email/$file"); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | if (sizeof($missing_files)) |
| 370 | {
|
| 371 | ?>
|
| 372 | <h1><?php echo sprintf($user->lang['THOSE_MISSING_LANG_FILES'], $lang_entries['lang_local_name']); ?></h1> |
| 373 | |
| 374 | <p><b style="color: red;"><?php echo implode('<br />', $missing_files); ?></b></p> |
| 375 | |
| 376 | <br /><br /> |
| 377 | <?php
|
| 378 | } |
| 379 | |
| 380 | if ($is_missing_var) |
| 381 | {
|
| 382 | ?>
|
| 383 | <h1><?php echo $user->lang['MISSING_LANG_VARIABLES']; ?></h1> |
| 384 | |
| 385 | <p><?php echo sprintf($user->lang['THOSE_MISSING_LANG_VARIABLES'], $lang_entries['lang_local_name']); ?></p> |
| 386 | |
| 387 | <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> |
| 388 | <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 389 | <tr>
|
| 390 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_KEY']; ?></th> |
| 391 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_VARIABLE']; ?></th> |
| 392 | </tr>
|
| 393 | <?php
|
| 394 | foreach ($missing_vars as $file => $vars) |
| 395 | {
|
| 396 | ?>
|
| 397 | <tr>
|
| 398 | <td class="row3" colspan="2"><b><?php echo $file; ?></b></td> |
| 399 | </tr>
|
| 400 | <?php
|
| 401 | print_language_entries($vars, '', false); |
| 402 | ?>
|
| 403 | <tr>
|
| 404 | <td class="cat" align="right" colspan="2"><input type="submit" name="cur_file[<?php echo str_replace(".{$phpEx}", '', $file); ?>]" value="<?php echo $user->lang['SELECT']; ?>" class="btnmain" /></td> |
| 405 | </tr>
|
| 406 | <?php
|
| 407 | } |
| 408 | ?>
|
| 409 | </table>
|
| 410 | <br /><br /> |
| 411 | </form>
|
| 412 | <?php
|
| 413 | } |
| 414 | } |
| 415 | |
| 416 | $s_lang_options = '<option class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; |
| 417 | foreach ($language_files as $file) |
| 418 | {
|
| 419 | if (strpos($file, 'help_') === 0) |
| 420 | {
|
| 421 | continue; |
| 422 | } |
| 423 | |
| 424 | $prefix = (file_exists(get_filename($lang_iso, $file . '.' . $phpEx, true))) ? '* ' : ''; |
| 425 | |
| 426 | $selected = ($cur_file == $file . '.' . $phpEx) ? ' selected="selected"' : ''; |
| 427 | $s_lang_options .= '<option value="' . $file . '"' . $selected . '>' . $prefix . $file . '.' . $phpEx . '</option>'; |
| 428 | } |
| 429 | |
| 430 | $s_lang_options .= '<option class="sep">' . $user->lang['HELP_FILES'] . '</option>'; |
| 431 | foreach ($language_files as $file) |
| 432 | {
|
| 433 | if (strpos($file, 'help_') !== 0) |
| 434 | {
|
| 435 | continue; |
| 436 | } |
| 437 | |
| 438 | $prefix = (file_exists(get_filename($lang_iso, $file . '.' . $phpEx, true))) ? '* ' : ''; |
| 439 | |
| 440 | $selected = ($cur_file == $file . '.' . $phpEx) ? ' selected="selected"' : ''; |
| 441 | $s_lang_options .= '<option value="' . $file . '"' . $selected . '>' . $prefix . $file . '.' . $phpEx . '</option>'; |
| 442 | } |
| 443 | |
| 444 | $s_lang_options .= '<option class="sep">' . $user->lang['EMAIL_TEMPLATES'] . '</option>'; |
| 445 | foreach ($email_templates as $file) |
| 446 | {
|
| 447 | $prefix = (file_exists(get_filename($lang_iso, "email/{$file}", true))) ? '* ' : '';
|
| 448 | |
| 449 | $selected = ($cur_file == 'email/' . $file) ? ' selected="selected"' : ''; |
| 450 | $s_lang_options .= '<option value="email/' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; |
| 451 | } |
| 452 | |
| 453 | // Get Language Entries - if saved within store folder, we take this one (with the option to remove it) |
| 454 | $lang = array(); |
| 455 | $is_email_file = (strpos($cur_file, 'email/') !== false) ? true : false; |
| 456 | $is_help_file = (strpos($cur_file, 'help_') === 0) ? true : false; |
| 457 | $file_from_store = (file_exists(get_filename($lang_iso, $cur_file, true))) ? true : false; |
| 458 | |
| 459 | if (!$file_from_store && !file_exists(get_filename($lang_iso, $cur_file))) |
| 460 | {
|
| 461 | $print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $cur_file);
|
| 462 | } |
| 463 | else |
| 464 | {
|
| 465 | if ($is_email_file) |
| 466 | {
|
| 467 | $lang = implode('', file(get_filename($lang_iso, $cur_file, $file_from_store)));
|
| 468 | } |
| 469 | else |
| 470 | {
|
| 471 | include(get_filename($lang_iso, $cur_file, $file_from_store)); |
| 472 | |
| 473 | if ($is_help_file) |
| 474 | {
|
| 475 | $lang = $help; |
| 476 | unset($help); |
| 477 | } |
| 478 | } |
| 479 | $print_message = $cur_file; |
| 480 | } |
| 481 | |
| 482 | // Normal language pack entries |
| 483 | ?>
|
| 484 | <a name="entries"></a> |
| 485 | <h1><?php echo $user->lang['LANGUAGE_ENTRIES']; ?></h1> |
| 486 | |
| 487 | <p><?php echo $user->lang['LANGUAGE_ENTRIES_EXPLAIN']; ?></p> |
| 488 | |
| 489 | <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id#entries"; ?>"> |
| 490 | <table width="95%" cellspacing="0" cellpadding="0" border="0" align="center"> |
| 491 | <tr>
|
| 492 | <td align="left"><?php |
| 493 | if ($file_from_store) { |
| 494 | ?> <input type="submit" name="remove_store" value="<?php echo $user->lang['REMOVE_FROM_STORAGE_FOLDER']; ?>" class="btnmain" /> <?php |
| 495 | } |
| 496 | ?>
|
| 497 | <td align="right"><select name="cur_file"><?php echo $s_lang_options; ?></select> <input type="submit" class="btnmain" name="change" value="<?php echo $user->lang['SELECT']; ?>" /></td> |
| 498 | </tr>
|
| 499 | </table>
|
| 500 | <br /> |
| 501 | <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 502 | <?php
|
| 503 | if ($is_email_file) |
| 504 | {
|
| 505 | ?>
|
| 506 | <tr>
|
| 507 | <th colspan="2"><?php echo $user->lang['FILE_CONTENTS']; ?></th> |
| 508 | </tr>
|
| 509 | <?php
|
| 510 | } |
| 511 | else |
| 512 | {
|
| 513 | ?>
|
| 514 | <tr>
|
| 515 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_KEY']; ?></th> |
| 516 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_VARIABLE']; ?></th> |
| 517 | </tr>
|
| 518 | <?php
|
| 519 | } |
| 520 | ?>
|
| 521 | <tr>
|
| 522 | <td class="row3" align="left"><b><?php echo $print_message . (($file_from_store) ? '<br /><b style="color:red;">' . $user->lang['FILE_FROM_STORAGE'] . '</b>' : ''); ?></b></td> |
| 523 | <td class="row3" align="right"><input type="submit" name="download_file" class="btnlite" value="<?php echo $user->lang['SUBMIT_AND_DOWNLOAD']; ?>" /> <input type="submit" name="submit_file" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> |
| 524 | </tr>
|
| 525 | <?php
|
| 526 | if (!$is_email_file) |
| 527 | {
|
| 528 | $function = ($is_help_file) ? 'print_help_entries' : 'print_language_entries'; |
| 529 | if (isset($missing_vars[$cur_file]) && sizeof($missing_vars[$cur_file])) |
| 530 | {
|
| 531 | $function($missing_vars[$cur_file], '* '); |
| 532 | } |
| 533 | $function($lang); |
| 534 | } |
| 535 | else
|
| 536 | {
|
| 537 | ?>
|
| 538 | <tr>
|
| 539 | <td class="row1" colspan="2" align="center"><textarea name="entry" cols="80" rows="20" class="post" style="width:90%"><?php echo $lang; ?></textarea></td> |
| 540 | </tr>
|
| 541 | <?php
|
| 542 | } |
| 543 | ?>
|
| 544 | <tr>
|
| 545 | <td class="cat" colspan="2" align="right"><input type="submit" name="download_file" class="btnlite" value="<?php echo $user->lang['SUBMIT_AND_DOWNLOAD']; ?>" /> <input type="submit" name="submit_file" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> |
| 546 | </tr>
|
| 547 | </table>
|
| 548 | <br /><br /> |
| 549 | </form>
|
| 550 | <?php
|
| 551 | |
| 552 | break;
|
| 553 | |
| 554 | case 'delete': |
| 555 | |
| 556 | if (!$lang_id) |
| 557 | {
|
| 558 | trigger_error('NO_LANGUAGE_PACK_DEFINED'); |
| 559 | } |
| 560 | |
| 561 | $sql = 'SELECT * FROM ' . LANG_TABLE . ' |
| 562 | WHERE lang_id = ' . $lang_id; |
| 563 | $result = $db->sql_query($sql); |
| 564 | $row = $db->sql_fetchrow($result); |
| 565 | $db->sql_freeresult($result); |
| 566 | |
| 567 | if ($row['lang_iso'] == $config['default_lang']) |
| 568 | {
|
| 569 | trigger_error('NO_REMOVE_DEFAULT_LANG'); |
| 570 | } |
| 571 | |
| 572 | $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); |
| 573 | $sql = 'UPDATE ' . USERS_TABLE . " |
| 574 | SET user_lang = '{$config['default_lang']}' |
| 575 | WHERE user_lang = '{$row['lang_iso']}'"; |
| 576 | $db->sql_query($sql); |
| 577 | |
| 578 | add_log('admin', 'LOG_DELETE_LANGUAGE_PACK', $row['lang_english_name']); |
| 579 | |
| 580 | trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name'])); |
| 581 | |
| 582 | break;
|
| 583 | |
| 584 | case 'install': |
| 585 | $lang_iso = request_var('iso', ''); |
| 586 | $lang_iso = basename($lang_iso); |
| 587 | |
| 588 | if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) |
| 589 | {
|
| 590 | trigger_error('LANGUAGE_PACK_NOT_EXIST'); |
| 591 | } |
| 592 | |
| 593 | $file = file("{$phpbb_root_path}language/$lang_iso/iso.txt"); |
| 594 | $lang_pack = array(); |
| 595 | |
| 596 | $lang_pack = array( |
| 597 | 'iso' => htmlspecialchars($lang_iso), |
| 598 | 'name' => trim(htmlspecialchars($file[0])), |
| 599 | 'local_name'=> trim(htmlspecialchars($file[1])), |
| 600 | 'author' => trim(htmlspecialchars($file[2])) |
| 601 | ); |
| 602 | unset($file); |
| 603 | |
| 604 | $sql = 'SELECT lang_iso FROM ' . LANG_TABLE . " |
| 605 | WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; |
| 606 | $result = $db->sql_query($sql); |
| 607 | if ($row = $db->sql_fetchrow($result)) |
| 608 | {
|
| 609 | trigger_error('LANGUAGE_PACK_ALREADY_INSTALLED'); |
| 610 | } |
| 611 | $db->sql_freeresult($result); |
| 612 | |
| 613 | if (!$lang_pack['name'] || !$lang_pack['local_name']) |
| 614 | {
|
| 615 | trigger_error('INVALID_LANGUAGE_PACK'); |
| 616 | } |
| 617 | |
| 618 | // Add language pack
|
| 619 | $sql_ary = array( |
| 620 | 'lang_iso' => $lang_pack['iso'], |
| 621 | 'lang_dir' => $lang_pack['iso'], |
| 622 | 'lang_english_name' => $lang_pack['name'], |
| 623 | 'lang_local_name' => $lang_pack['local_name'], |
| 624 | 'lang_author' => $lang_pack['author'] |
| 625 | ); |
| 626 | |
| 627 | $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); |
| 628 | |
| 629 | add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); |
| 630 | |
| 631 | trigger_error(sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name'])); |
| 632 | |
| 633 | break;
|
| 634 | |
| 635 | case 'download': |
| 636 | |
| 637 | if (!$lang_id) |
| 638 | {
|
| 639 | trigger_error('NO_LANGUAGE_PACK_DEFINED'); |
| 640 | } |
| 641 | |
| 642 | $sql = 'SELECT * FROM ' . LANG_TABLE . ' |
| 643 | WHERE lang_id = ' . $lang_id; |
| 644 | $result = $db->sql_query($sql); |
| 645 | $row = $db->sql_fetchrow($result); |
| 646 | $db->sql_freeresult($result); |
| 647 | |
| 648 | $use_method = request_var('use_method', ''); |
| 649 | $methods = array('tar'); |
| 650 | |
| 651 | foreach (array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib') as $type => $module) |
| 652 | {
|
| 653 | if (!@extension_loaded($module)) |
| 654 | {
|
| 655 | break;
|
| 656 | } |
| 657 | $methods[] = $type; |
| 658 | } |
| 659 | |
| 660 | if (!in_array($use_method, $methods)) |
| 661 | {
|
| 662 | $use_method = ''; |
| 663 | } |
| 664 | |
| 665 | // Let the user decide in which format he wants to have the pack
|
| 666 | if (!$use_method) |
| 667 | {
|
| 668 | adm_page_header($user->lang['SELECT_DOWNLOAD_FORMAT']); |
| 669 | |
| 670 | ?>
|
| 671 | <h1><?php echo $user->lang['SELECT_DOWNLOAD_FORMAT']; ?></h1> |
| 672 | |
| 673 | <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> |
| 674 | <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 675 | <tr>
|
| 676 | <th><?php echo $user->lang['DOWNLOAD_AS']; ?></td> |
| 677 | </tr>
|
| 678 | <tr>
|
| 679 | <td class="row1" align="center"> |
| 680 | <?php
|
| 681 | foreach ($methods as $method) |
| 682 | {
|
| 683 | echo '<input type="radio" value="' . $method . '" name="use_method" /> ' . $method . ' '; |
| 684 | } |
| 685 | ?>
|
| 686 | </td>
|
| 687 | </tr>
|
| 688 | <tr>
|
| 689 | <td class="cat" align="right"><input type="submit" class="btnmain" value="<?php echo $user->lang['DOWNLOAD']; ?>" name="download" /></td> |
| 690 | </tr>
|
| 691 | </table>
|
| 692 | </form>
|
| 693 | <br /><br /> |
| 694 | <?php
|
| 695 | adm_page_footer(); |
| 696 | exit;
|
| 697 | } |
| 698 | |
| 699 | include($phpbb_root_path . 'includes/functions_compress.'.$phpEx); |
| 700 | |
| 701 | if ($use_method == 'zip') |
| 702 | {
|
| 703 | $compress = new compress_zip('w', $phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method);
|
| 704 | } |
| 705 | else |
| 706 | {
|
| 707 | $compress = new compress_tar('w', $phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method, $use_method);
|
| 708 | } |
| 709 | |
| 710 | $email_templates = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); |
| 711 | $email_templates = $email_templates['email/']; |
| 712 | |
| 713 | // Go through all language files, we want to write those within the storage folder first |
| 714 | $src_path = 'language/' . $row['lang_iso'] . '/'; |
| 715 | foreach ($language_files as $file) |
| 716 | {
|
| 717 | if (file_exists(get_filename($row['lang_iso'], $file . '.' . $phpEx, 'store'))) |
| 718 | {
|
| 719 | if ($safe_mode) |
| 720 | {
|
| 721 | $compress->add_custom_file('store/langfile_' . $row['lang_iso'] . '_' . $file . '.' . $phpEx, $src_path . $file . '.' . $phpEx);
|
| 722 | } |
| 723 | else |
| 724 | {
|
| 725 | $compress->add_file('store/' . $src_path . $file . '.' . $phpEx, 'store/');
|
| 726 | } |
| 727 | } |
| 728 | else |
| 729 | {
|
| 730 | $compress->add_file($src_path . $file . '.' . $phpEx);
|
| 731 | } |
| 732 | } |
| 733 | |
| 734 | foreach ($email_templates as $file) |
| 735 | {
|
| 736 | if (file_exists(get_filename($row['lang_iso'], 'email/' . $file, 'store'))) |
| 737 | {
|
| 738 | if ($safe_mode) |
| 739 | {
|
| 740 | $compress->add_custom_file('store/langfile_' . $row['lang_iso'] . '_email_' . $file, $src_path . 'email/' . $file);
|
| 741 | } |
| 742 | else |
| 743 | {
|
| 744 | $compress->add_file('store/' . $src_path . 'email/' . $file, 'store/');
|
| 745 | } |
| 746 | } |
| 747 | else |
| 748 | {
|
| 749 | $compress->add_file($src_path . 'email/' . $file);
|
| 750 | } |
| 751 | } |
| 752 | |
| 753 | // Write ISO File |
| 754 | $iso_src = strtr($row['lang_english_name'], array_flip(get_html_translation_table(HTML_ENTITIES))) . "\n"; |
| 755 | $iso_src .= strtr($row['lang_local_name'], array_flip(get_html_translation_table(HTML_ENTITIES))) . "\n"; |
| 756 | $iso_src .= strtr($row['lang_author'], array_flip(get_html_translation_table(HTML_ENTITIES))); |
| 757 | $compress->add_data($iso_src, 'language/' . $row['lang_iso'] . '/iso.txt');
|
| 758 | |
| 759 | // index.html files |
| 760 | $compress->add_data('', 'language/' . $row['lang_iso'] . '/index.html');
|
| 761 | $compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.html');
|
| 762 | $compress->close();
|
| 763 | |
| 764 | $compress->download('lang_pack_' . $row['lang_iso']);
|
| 765 | @unlink($phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method); |
| 766 | exit; |
| 767 | |
| 768 | break; |
| 769 | |
| 770 | default: |
| 771 | // Output list of language packs |
| 772 | adm_page_header($user->lang['LANGUAGE_PACKS']);
|
| 773 | ?>
|
| 774 | <h1><?php echo $user->lang['LANGUAGE_PACKS']; ?></h1> |
| 775 | |
| 776 | <p><?php echo $user->lang['LANGUAGE_PACKS_EXPLAIN']; ?></p> |
| 777 | |
| 778 | <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 779 | <tr>
|
| 780 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_NAME']; ?></th> |
| 781 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_LOCALNAME']; ?></th> |
| 782 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_ISO']; ?></th> |
| 783 | <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_USED_BY']; ?></th> |
| 784 | <th nowrap="nowrap"><?php echo $user->lang['OPTIONS']; ?></th> |
| 785 | </tr>
|
| 786 | <tr>
|
| 787 | <td class="row3" colspan="5"><b><?php echo $user->lang['INSTALLED_LANGUAGE_PACKS']; ?></b></td> |
| 788 | </tr>
|
| 789 | <?php
|
| 790 | |
| 791 | $sql = 'SELECT user_lang, COUNT(user_lang) AS lang_count |
| 792 | FROM ' . USERS_TABLE . ' |
| 793 | GROUP BY user_lang';
|
| 794 | $result = $db->sql_query($sql); |
| 795 | |
| 796 | $lang_count = array(); |
| 797 | while ($row = $db->sql_fetchrow($result)) |
| 798 | {
|
| 799 | $lang_count[$row['user_lang']] = $row['lang_count']; |
| 800 | } |
| 801 | $db->sql_freeresult($result); |
| 802 | |
| 803 | $sql = 'SELECT * |
| 804 | FROM ' . LANG_TABLE; |
| 805 | $result = $db->sql_query($sql); |
| 806 | |
| 807 | $installed = array(); |
| 808 | $row_class = ''; |
| 809 | while ($row = $db->sql_fetchrow($result)) |
| 810 | {
|
| 811 | $installed[] = $row['lang_iso']; |
| 812 | $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; |
| 813 | $tagstyle = ($row['lang_iso'] == $config['default_lang']) ? '*' : ''; |
| 814 | |
| 815 | ?>
|
| 816 | <tr>
|
| 817 | <td class="<?php echo $row_class; ?>" width="100%" nowrap="nowrap"><a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=details&id=" . $row['lang_id']; ?>"><?php echo $row['lang_english_name']; ?></a> <?php echo $tagstyle; ?></td> |
| 818 | <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $row['lang_local_name']; ?></td> |
| 819 | <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><b><?php echo $row['lang_iso']; ?></b></td> |
| 820 | <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo (isset($lang_count[$row['lang_iso']])) ? $lang_count[$row['lang_iso']] : '0'; ?></td> |
| 821 | <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"> <a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=download&id=" . $row['lang_id']; ?>"><?php echo $user->lang['DOWNLOAD']; ?></a> | <a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=delete&id=" . $row['lang_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td> |
| 822 | </tr>
|
| 823 | <?php
|
| 824 | |
| 825 | } |
| 826 | $db->sql_freeresult($result);
|
| 827 | |
| 828 | ?>
|
| 829 | <tr>
|
| 830 | <td class="row3" colspan="5"><b><?php echo $user->lang['UNINSTALLED_LANGUAGE_PACKS']; ?></b></td> |
| 831 | </tr>
|
| 832 | <?php
|
| 833 | |
| 834 | $new_ary = $iso = array(); |
| 835 | $dp = opendir("{$phpbb_root_path}language"); |
| 836 | while ($file = readdir($dp)) |
| 837 | {
|
| 838 | if ($file{0} != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt")) |
| 839 | {
|
| 840 | if (!in_array($file, $installed)) |
| 841 | {
|
| 842 | if ($iso = file("{$phpbb_root_path}language/$file/iso.txt")) |
| 843 | {
|
| 844 | if (sizeof($iso) == 3) |
| 845 | {
|
| 846 | $new_ary[$file] = array( |
| 847 | 'iso' => $file, |
| 848 | 'name' => trim($iso[0]), |
| 849 | 'local_name'=> trim($iso[1]), |
| 850 | 'author' => trim($iso[2]) |
| 851 | ); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | } |
| 856 | } |
| 857 | unset($installed); |
| 858 | @closedir($dp); |
| 859 | |
| 860 | if (sizeof($new_ary)) |
| 861 | {
|
| 862 | $row_class = ''; |
| 863 | foreach ($new_ary as $iso => $lang_ary) |
| 864 | {
|
| 865 | $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; |
| 866 | |
| 867 | ?>
|
| 868 | <tr>
|
| 869 | <td class="<?php echo $row_class; ?>"><?php echo $lang_ary['name']; ?></td> |
| 870 | <td class="<?php echo $row_class; ?>"><?php echo $lang_ary['local_name']; ?></td> |
| 871 | <td class="<?php echo $row_class; ?>"><b><?php echo $lang_ary['iso']; ?></b></td> |
| 872 | <td class="<?php echo $row_class; ?>" colspan="2" align="center"><a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=install&iso=" . urlencode($lang_ary['iso']); ?>"><?php echo $user->lang['INSTALL']; ?></a></td> |
| 873 | </tr>
|
| 874 | <?php
|
| 875 | |
| 876 | } |
| 877 | } |
| 878 | else |
| 879 | {
|
| 880 | |
| 881 | ?>
|
| 882 | <tr>
|
| 883 | <td class="row1" colspan="5" align="center"><?php echo $user->lang['NO_UNINSTALLED_LANGUAGE_PACKS']; ?></td> |
| 884 | </tr>
|
| 885 | <?php
|
| 886 | |
| 887 | } |
| 888 | unset($new_ary); |
| 889 | ?>
|
| 890 | </table>
|
| 891 | <br /><br /> |
| 892 | <?php
|
| 893 | adm_page_footer(); |
| 894 | |
| 895 | } |
| 896 | |
| 897 | exit; |
| 898 | |
| 899 | |
| 900 | // |
| 901 | // FUNCTIONS |
| 902 | |
| 903 | /** |
| 904 | * Compare two language files |
| 905 | */ |
| 906 | function compare_language_files($source_lang, $dest_lang, $file_var) |
| 907 | {
|
| 908 | global $phpbb_root_path, $phpEx; |
| 909 | |
| 910 | $return_ary = array(); |
| 911 | |
| 912 | $lang = array(); |
| 913 | include("{$phpbb_root_path}language/{$source_lang}/{$file_var}.{$phpEx}");
|
| 914 | $lang_entry_src = $lang; |
| 915 | |
| 916 | $lang = array(); |
| 917 | if (file_exists(get_filename($dest_lang, $file_var . '.' . $phpEx, true))) |
| 918 | {
|
| 919 | include(get_filename($dest_lang, $file_var . '.' . $phpEx, true)); |
| 920 | } |
| 921 | else |
| 922 | {
|
| 923 | include(get_filename($dest_lang, $file_var . '.' . $phpEx)); |
| 924 | } |
| 925 | $lang_entry_dst = $lang; |
| 926 | |
| 927 | unset($lang); |
| 928 | |
| 929 | $diff_array_keys = array_diff(array_keys($lang_entry_src), array_keys($lang_entry_dst)); |
| 930 | unset($lang_entry_dst); |
| 931 | |
| 932 | foreach ($diff_array_keys as $key) |
| 933 | {
|
| 934 | $return_ary[$key] = $lang_entry_src[$key]; |
| 935 | } |
| 936 | |
| 937 | unset($lang_entry_src); |
| 938 | |
| 939 | return $return_ary; |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * Print language entries |
| 944 | */ |
| 945 | function print_language_entries(&$lang_ary, $key_prefix = '', $input_field = true)
|
| 946 | {
|
| 947 | foreach ($lang_ary as $key => $value)
|
| 948 | {
|
| 949 | ?>
|
| 950 | <tr>
|
| 951 | <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key; ?></b></td> |
| 952 | <td class="row2"> |
| 953 | <?php
|
| 954 | if (is_array($value)) |
| 955 | {
|
| 956 | ?>
|
| 957 | </td> |
| 958 | </tr>
|
| 959 | <?php
|
| 960 | foreach ($value as $_key => $_value) |
| 961 | {
|
| 962 | ?>
|
| 963 | <tr>
|
| 964 | <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key . ' :: ' . $_key; ?></b></td> |
| 965 | <td class="row2"><?php if ($input_field) { ?><input type="text" class="text" name="entry[<?php echo $key; ?>][<?php echo $_key; ?>]" value="<?php echo htmlspecialchars($_value); ?>" style="width:99%" /><?php } else { ?><b><?php echo htmlspecialchars($_value); ?></b><?php } ?></td> |
| 966 | </tr>
|
| 967 | <?php
|
| 968 | } |
| 969 | } |
| 970 | else |
| 971 | {
|
| 972 | ?>
|
| 973 | <?php if ($input_field) { ?><input type="text" class="post" name="entry[<?php echo $key; ?>]" value="<?php echo htmlspecialchars($value); ?>" style="width:99%" /><?php } else { ?><b><?php echo htmlspecialchars($value); ?></b><?php } ?></td> |
| 974 | </tr>
|
| 975 | <?php
|
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | /** |
| 981 | * Print help entries |
| 982 | */ |
| 983 | function print_help_entries(&$lang_ary, $key_prefix = '', $text_field = true)
|
| 984 | {
|
| 985 | foreach ($lang_ary as $key => $value)
|
| 986 | {
|
| 987 | ?>
|
| 988 | <tr>
|
| 989 | <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key; ?></b></td> |
| 990 | <td class="row2"> |
| 991 | <?php
|
| 992 | if (is_array($value)) |
| 993 | {
|
| 994 | ?>
|
| 995 | </td> |
| 996 | </tr>
|
| 997 | <?php
|
| 998 | foreach ($value as $_key => $_value) |
| 999 | {
|
| 1000 | ?>
|
| 1001 | <tr>
|
| 1002 | <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key . ' :: ' . $_key; ?></b></td> |
| 1003 | <td class="row2"><?php if ($text_field) { ?><textarea class="post" name="entry[<?php echo $key; ?>][<?php echo $_key; ?>]" cols="80" rows="5" class="post" style="width:90%"><?php echo htmlspecialchars($_value); ?></textarea><?php } else { ?><b><?php echo htmlspecialchars($_value); ?></b><?php } ?></td> |
| 1004 | </tr>
|
| 1005 | <?php
|
| 1006 | } |
| 1007 | } |
| 1008 | else |
| 1009 | {
|
| 1010 | ?>
|
| 1011 | <?php if ($text_field) { ?><textarea type="text" class="post" name="entry[<?php echo $key; ?>]" cols="80" rows="5" style="width:90%"><?php echo htmlspecialchars($value); ?></textarea><?php } else { ?><b><?php echo htmlspecialchars($value); ?></b><?php } ?></td> |
| 1012 | </tr>
|
| 1013 | <?php
|
| 1014 | } |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | /** |
| 1019 | * Get filename/location of language/help/email file |
| 1020 | */ |
| 1021 | function get_filename($lang_iso, $file, $check_store = false) |
| 1022 | {
|
| 1023 | global $phpbb_root_path, $safe_mode; |
| 1024 | |
| 1025 | if ($check_store && $safe_mode) |
| 1026 | {
|
| 1027 | return "{$phpbb_root_path}store/langfile_{$lang_iso}_" . ((strpos($file, 'email/') !== false) ? str_replace('email/', 'email_', $file) : $file);
|
| 1028 | } |
| 1029 | else if ($check_store) |
| 1030 | {
|
| 1031 | return $phpbb_root_path . 'store/language/' . $lang_iso . '/' . $file; |
| 1032 | } |
| 1033 | else |
| 1034 | {
|
| 1035 | return $phpbb_root_path . 'language/' . $lang_iso . '/' . $file; |
| 1036 | } |
| 1037 | } |
| 1038 | |
| 1039 | ?> |

