trt
This commit is contained in:
@ -152,36 +152,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Перевод для строки в которой встречаются подстроки вида: trt('')
|
||||
function parseGT($text)
|
||||
{
|
||||
$result='';
|
||||
$pLen=4; //Длина преамбулы trt(
|
||||
$cut=0;
|
||||
$from = 0; // Позиция поиска для итерации
|
||||
while (true)
|
||||
{
|
||||
$pos1 = strpos($text, 'trt(', $from);
|
||||
if($pos1 !== false)
|
||||
{
|
||||
$from = $pos1+$pLen+1;
|
||||
$pos2 = false;
|
||||
if($text[$pos1+$pLen] == '"') $pos2 = strpos($text, '")', $from);
|
||||
if($text[$pos1+$pLen] == '\'') $pos2 = strpos($text, '\')', $from);
|
||||
if($pos2 !== false)
|
||||
{
|
||||
$result.=substr($text, $cut, $pos1 - $cut );
|
||||
//$result.=__(substr($text, $pos1+3, $pos2 - $pos1 - 3 ));
|
||||
$toTranslate=substr($text, $pos1+$pLen+1, $pos2 - $pos1 - $pLen-1 );
|
||||
$result.=trt($toTranslate);
|
||||
$cut=$pos2+2;
|
||||
$from = $pos2 + $pLen;
|
||||
}
|
||||
}else break;
|
||||
}
|
||||
$result.=substr($text, $cut); //Копируем остатки
|
||||
return $result;
|
||||
}
|
||||
|
||||
function special_handler($exception)
|
||||
{
|
||||
@ -273,7 +243,7 @@
|
||||
$resX = $db->query($sql);
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -361,7 +331,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -482,7 +452,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -606,7 +576,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -661,7 +631,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -828,7 +798,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -872,7 +842,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -944,7 +914,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if(!$xmls){
|
||||
sendError("XML node \"".$typename."\" not find!");
|
||||
@ -1141,7 +1111,7 @@
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
@ -1393,12 +1363,12 @@
|
||||
$field = $_REQUEST['f']; //Название поля с двоичными данными
|
||||
$name = $_REQUEST['n']; //поле с названием файла
|
||||
$idval = $_REQUEST['i']; //Идентификатор поля в базе
|
||||
|
||||
|
||||
$xmls='';
|
||||
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
|
||||
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
{
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
|
||||
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.trts($rowX['xml']).'</metadata>';
|
||||
}
|
||||
if($xmls=='')
|
||||
{
|
||||
|
||||
@ -1611,10 +1611,10 @@ function isInt(value)
|
||||
function isFloat(value)
|
||||
{
|
||||
let num="-1234567890.,"
|
||||
for (i=0;i<value.length;i++)
|
||||
for(let i=0;i<value.length;i++)
|
||||
{
|
||||
let b=true;
|
||||
for(j=0;j<num.length;j++)
|
||||
for(let j=0;j<num.length;j++)
|
||||
{
|
||||
if(value.charAt(i)==num.charAt(j)) b=false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user