-
Notifications
You must be signed in to change notification settings - Fork 0
/
lang.js.php
29 lines (22 loc) · 1.01 KB
/
lang.js.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
// We don't want any errors corrupting the JavaScript
@error_reporting(0);
// Send out a proper Content-Type header
header("Content-Type: text/javascript");
// Pull in the configuration file.
include('config.php');
include($config['paths']['includes'].'functions.php');
// Pull the requested language from
$input['lang'] = $_GET['lang'];
// Verify that the value passed in was only made up of a to z, or a hyphen.
// Also verify that the language specified actually exists. If either fails,
// fall back to using the English language file.
//if (empty($input['lang']) || !ereg('a-z\-', $input['lang']) || !file_exists($config['paths']['language'].$input['lang'].".php"))
include($config['paths']['language']."en.php");
/*else
include($config['paths']['language'].$input['lang'].".php");*/
// Write out the JavaScript language file
echo "var lang = new Array();\n";
foreach ($lang as $key => $item)
echo "lang['$key'] = \"".str_replace('"', '\"', $item)."\"\n";
?>