59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
//Формирую JavaScript массив для перевода интерфейса
|
|
@session_start();
|
|
|
|
require_once("./config.php");
|
|
|
|
$db=connectToDB();
|
|
//$db->exec('SET NAMES utf8');
|
|
//$db->exec("SET time_zone = '+00:00'");
|
|
|
|
header("Content-type: text/javascript");
|
|
?>
|
|
|
|
|
|
/*function trt(key)
|
|
{
|
|
var val=g_translations[key];
|
|
if(val===undefined)
|
|
{
|
|
if(key===undefined) return '';
|
|
else return key.replace(/_/g, ' ');
|
|
}else
|
|
return val;
|
|
}*/
|
|
|
|
var g_translations = {
|
|
'':''
|
|
<?php
|
|
|
|
//$sql="select id,identifier,translation from main._translations where del=false and language_id=(select id from main._languages where short_name='".$_SESSION["LNG"]."');";
|
|
$sql='select id,identifier,translation from main._translations where del=false and language_id='.$_SESSION["LNG"];
|
|
$res = NULL;
|
|
try
|
|
{
|
|
$res = $db->query($sql);
|
|
}catch (Exception $e)
|
|
{
|
|
echo $e->getMessage();
|
|
}
|
|
if($res!=NULL && $res->rowCount()>0)
|
|
{
|
|
while ($row = $res->fetch(PDO::FETCH_NUM))
|
|
{
|
|
$identifier = str_replace(" ", "_", $row[1]);
|
|
$identifier = str_replace("\"", "_", $identifier);
|
|
$identifier = str_replace("'", "_", $identifier);
|
|
$identifier = str_replace("!", "_", $identifier);
|
|
$identifier = str_replace("%", "_", $identifier);
|
|
$identifier = str_replace("(", "_", $identifier);
|
|
$identifier = str_replace(")", "_", $identifier);
|
|
$identifier = str_replace("/", "_", $identifier);
|
|
$identifier = str_replace(".", "_", $identifier);
|
|
|
|
$row[2] = str_replace("'", "\'", $row[2]);
|
|
echo " ,".$identifier.": '".trim($row[2])."'\n";
|
|
}
|
|
}
|
|
?>
|
|
};
|