Перевод через trt(
This commit is contained in:
@ -1,5 +1,70 @@
|
||||
<?php
|
||||
|
||||
// Из файла file.js делаем file_v123456789.js добавив время
|
||||
function getScript($path)
|
||||
{
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].$path))
|
||||
{
|
||||
return '<script type="text/javascript" src="'.beforeLast($path,'.').'_v'.filectime($_SERVER['DOCUMENT_ROOT'].$path).'.'.afterLast($path,'.').'"></script>'."\n";
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
//Функция для перевода текста без применения GetText
|
||||
function trt($text)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$result='';
|
||||
$sql='select translation from main._translations where del=false and language_id=(select id from main._languages where short_name=\''.$_SESSION["LNG"].'\') and identifier=\''.$text.'\';';
|
||||
$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))
|
||||
{
|
||||
$result=$row[0];
|
||||
}
|
||||
}else
|
||||
{
|
||||
$result=str_replace("_", " ", $text);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Получить разрешения для текущего пользователя
|
||||
function getAccess($key)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$result=false;
|
||||
if(isset($_SESSION['USER_ID']))
|
||||
$sql="select main.p_getaccess(".$_SESSION['USER_ID'].",'".$key."') as acc;";
|
||||
else
|
||||
$sql="select main.p_getaccess(0,'".$key."') as acc;";
|
||||
try
|
||||
{
|
||||
$res = $db->query($sql);
|
||||
}catch (Exception $e)
|
||||
{
|
||||
echo $e->getMessage();
|
||||
}
|
||||
if($res!=NULL && $res->rowCount()>0)
|
||||
{
|
||||
while ($row = $res->fetch(PDO::FETCH_NUM))
|
||||
{
|
||||
$result=$row[0];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function delPHPExt($fName)
|
||||
{
|
||||
$pos = strrpos($fName, '.')+1;
|
||||
|
||||
Reference in New Issue
Block a user