не знаю что
This commit is contained in:
@ -18,17 +18,19 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
//import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.Checksum;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jws;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
@ -78,6 +80,7 @@ import org.xml.sax.InputSource;
|
||||
|
||||
import tctable.Tools;
|
||||
import tools.EmailUtility;
|
||||
import tools.Translation;
|
||||
import tools.User;
|
||||
|
||||
|
||||
@ -105,9 +108,10 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
//Документация по @RequestBody http://javastudy.ru/spring-mvc/json-xml/ application/xml
|
||||
@RequestMapping(value = "/api/dbms/records.xyz",method = {RequestMethod.POST,RequestMethod.GET}) //,produces = "text/plain; charset=utf-8"
|
||||
@RequestMapping(value = "/api/dbms/v09/records.xyz",method = {RequestMethod.POST,RequestMethod.GET}) //,produces = "text/plain; charset=utf-8"
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> ajaxRecords(@ModelAttribute User user, @RequestBody(required = false) byte[] reqData, @RequestParam(required=false,name="lng") String language_id) {
|
||||
|
||||
final HttpHeaders httpHeaders= new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
@ -187,13 +191,11 @@ public class DBMSRecords implements ServletContextAware {
|
||||
logger.info("Connect is OK!");
|
||||
} else {
|
||||
error=true;
|
||||
//result="<metadata fn=\"-1\"><![CDATA[An error occurred while connecting to the database!]]></metadata>";
|
||||
result=sendError(1,"An error occurred while connecting to the database!");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.info(ex.getMessage());
|
||||
error=true;
|
||||
//result="<metadata fn=\"-1\"><![CDATA[An error occurred while connecting to the database!]]></metadata>";
|
||||
result=sendError(1,"An error occurred while connecting to the database!");
|
||||
}
|
||||
|
||||
@ -205,7 +207,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
error=true;
|
||||
//result="<metadata fn=\"-1\"><![CDATA[An set TYPE_SCROLL_SENSITIVE!]]></metadata>";
|
||||
result=sendError(1,"An set TYPE_SCROLL_SENSITIVE!");
|
||||
}
|
||||
|
||||
@ -296,7 +297,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage() + " SQL=" + sql_query);
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
}finally {
|
||||
@ -324,7 +324,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
}finally {
|
||||
@ -352,7 +351,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
}finally {
|
||||
@ -380,7 +378,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
}finally {
|
||||
@ -395,7 +392,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
xml += "<metadata fn=\"0\"></metadata>";
|
||||
}
|
||||
|
||||
result=getText(conn,xml,user);
|
||||
result=trts(conn,xml,user);
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
|
||||
} else if (fn != null && fn.equals("1")) {
|
||||
@ -500,7 +497,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
stt.close();
|
||||
rs.close();
|
||||
@ -508,7 +504,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
rs=null;
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -616,13 +611,11 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -708,13 +701,11 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -822,7 +813,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -967,7 +957,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
result=json.toString();
|
||||
//logger.info("json = " + json);
|
||||
|
||||
rs.close();
|
||||
stmt.close();
|
||||
@ -977,7 +966,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -1066,7 +1054,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
@ -1074,7 +1061,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
stt=null;
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -1203,7 +1189,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
result=xmlstring;
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
//logger.info("xmlstring = " + xmlstring);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
@ -1211,7 +1196,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
stt=null;
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage()+"\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -1219,7 +1203,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
|
||||
|
||||
} else {
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Could not find the requested node!]]></metadata>";
|
||||
result=sendError(1,"Could not find the requested node!");
|
||||
error=true;
|
||||
}
|
||||
@ -1552,7 +1535,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
|
||||
} else if (fn != null && fn.equals("8")) {
|
||||
//Select information about the current user
|
||||
//Select information about the current user for generated report
|
||||
String uName = "<br>";
|
||||
|
||||
try {
|
||||
@ -1573,7 +1556,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
stt=null;
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
}
|
||||
@ -1721,7 +1703,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
expr = xpath.compile("objects-list/@d");
|
||||
|
||||
writer.write(" <table border=\"1\" cellspacing=\"0\">\n");
|
||||
writer.write(" <caption><b>" + getText(conn,"" + expr.evaluate(nTypeS, XPathConstants.STRING),user) + "</b></caption>\n");
|
||||
writer.write(" <caption><b>" + trts(conn,"" + expr.evaluate(nTypeS, XPathConstants.STRING),user) + "</b></caption>\n");
|
||||
writer.write(" <thead>\n");
|
||||
writer.write(" <tr>");
|
||||
|
||||
@ -1729,7 +1711,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
Object exprResult = expr.evaluate(nTypeS, XPathConstants.NODESET);
|
||||
nodeList = (NodeList) exprResult;
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
writer.write("<td bgcolor=\"#d1d1d1\" width=\"" + nodeList.item(i).getAttributes().getNamedItem("width").getNodeValue() + "px\"><b>" + getText(conn,nodeList.item(i).getAttributes().getNamedItem("d").getNodeValue(),user)
|
||||
writer.write("<td bgcolor=\"#d1d1d1\" width=\"" + nodeList.item(i).getAttributes().getNamedItem("width").getNodeValue() + "px\"><b>" + trts(conn,nodeList.item(i).getAttributes().getNamedItem("d").getNodeValue(),user)
|
||||
+ "</b></td>");
|
||||
}
|
||||
writer.write(" </tr>\n");
|
||||
@ -1755,7 +1737,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage());
|
||||
error=true;
|
||||
} finally {
|
||||
@ -1764,8 +1745,9 @@ public class DBMSRecords implements ServletContextAware {
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
//Отправляем название файла на сервер
|
||||
//Отправляем название файла клиенту
|
||||
result="<metadata fn=\"8\"><file><![CDATA[" + tmpName + "]]></file></metadata>";
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
}
|
||||
rs.close();
|
||||
stt.close();
|
||||
@ -1773,7 +1755,6 @@ public class DBMSRecords implements ServletContextAware {
|
||||
stt=null;
|
||||
} catch (SQLException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
//result="<metadata fn=\"-1\"><![CDATA[Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query + "]]></metadata>";
|
||||
result=sendError(1,"Error: " + ex.getMessage() + "\n\nSQL query: " + sql_query);
|
||||
error=true;
|
||||
}
|
||||
@ -2265,7 +2246,7 @@ public class DBMSRecords implements ServletContextAware {
|
||||
}
|
||||
|
||||
//Translate text by patterns
|
||||
public String getText(Connection conn,String text,User user) {
|
||||
public String trts(Connection conn,String text,User user) {
|
||||
int pos1 = 0;
|
||||
while (true) {
|
||||
pos1 = text.indexOf("trt('", pos1);
|
||||
|
||||
@ -223,27 +223,25 @@ class DBMSUser
|
||||
//Функция запрашивает информацию о текущем пользователе с сервера
|
||||
LoadData()
|
||||
{
|
||||
var r = new TRequest(this);
|
||||
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||
let r = new TRequest(this);
|
||||
let xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||
if(r.callServer(ScriptName,xs))
|
||||
{
|
||||
this.showShadow(true);
|
||||
}
|
||||
};
|
||||
//Check whether the already authorized (+ attempt to log in through "hash").
|
||||
isLogined()
|
||||
/*isLogined()
|
||||
{
|
||||
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||
var request=new TRequest(this);
|
||||
let xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
|
||||
let request=new TRequest(this);
|
||||
if(request.callServer(ScriptName,xs))
|
||||
{
|
||||
this.showShadow(true);
|
||||
|
||||
alert(ScriptName+" = "+xs);
|
||||
|
||||
//m_winPP.showProgressBar();
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
addListener(l)
|
||||
{ if(l.OnLogin==null) alert('Object does not have the function "OnLogin()"!');
|
||||
|
||||
@ -924,7 +924,7 @@
|
||||
header('Content-type: text/xml');
|
||||
echo $xmlstring;
|
||||
}else
|
||||
if ($fn==7)//Залогинеться
|
||||
if ($fn==7)//Залогинеться (TODO логин происходит через JWT в другом коде на java)
|
||||
{
|
||||
$cmd=getCdataValue(findFirstNode($reqNode,"cmd"));
|
||||
$login=getCdataValue(findFirstNode($reqNode,"login"));
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//var ScriptName='../api/dbms/records.xyz'; //POST
|
||||
//var ScriptName='../api/dbms/v09/records.xyz'; //POST
|
||||
//var ScriptDName='../download';
|
||||
//var ScriptUName='../upload';
|
||||
//var ScriptRName='../reports'; //GET For download reports (?file=name)
|
||||
|
||||
@ -38,7 +38,8 @@
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"classmap": ["mpdf.php", "classes"]
|
||||
"classmap": [
|
||||
"mpdf.php", "classes"]
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
*
|
||||
.gitignore
|
||||
!.gitignore
|
||||
|
||||
2
metadata/include/mpdf-6.1/tmp/.gitignore
vendored
2
metadata/include/mpdf-6.1/tmp/.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
*
|
||||
.gitignore
|
||||
!.gitignore
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
*
|
||||
.gitignore
|
||||
!.gitignore
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
// Из файла file.js делаем file_v123456789.js добавив время
|
||||
function getScript($path)
|
||||
function getScript($path,$pathURL="")
|
||||
{
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].$path))
|
||||
{
|
||||
if($pathURL!="")
|
||||
{
|
||||
return '<script src="' . $pathURL.'?v='.filectime($_SERVER['DOCUMENT_ROOT'] . $path). '"></script>' . "\n";
|
||||
}else {
|
||||
return '<script src="' . beforeLast($path, '.') . '_v' . filectime($_SERVER['DOCUMENT_ROOT'] . $path) . '.' . afterLast($path, '.') . '"></script>' . "\n";
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@
|
||||
*/
|
||||
function findFirstNode($node, $nodename)
|
||||
{
|
||||
if($node==null) return null;
|
||||
|
||||
$mas=array();
|
||||
$pos=0;
|
||||
$mas[$pos] = $node->firstChild;
|
||||
|
||||
@ -285,7 +285,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
|
||||
pn=pn.parent;
|
||||
}
|
||||
//Шаблон кнопки по умолчанию
|
||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="./?path=${path}" style="${select}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="?path=${path}" style="${select}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||
|
||||
str=str.replace(/\${path}/g, tn.getTreePath());
|
||||
str=str.replace(/\${hash}/g, crc32(tn.getTreePath()));
|
||||
@ -417,7 +417,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню
|
||||
if(str!='') break;
|
||||
nTmp=nTmp.parentNode;
|
||||
}
|
||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="./?path=${path}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||
if(str=='') str='<div style="border: 1px solid #dddddd;" onClick="window.location.href = \'./?path=${path}\'" onMouseOver="this.style.backgroundColor=\'#ffffff\'; this.style.textDecoration=\'underline\';" onMouseOut="this.style.backgroundColor=\'#dddddd\'; this.style.textDecoration=\'none\';"><table style="width: 100%;"><tr><td style="vertical-align: middle;"><nobr> <a href="?path=${path}">${name}</a> </nobr></td><td style="vertical-align: middle; width: 10px; padding-right: 4px;"><img src="./img/next.gif" alt="" align="right" style="vertical-align: middle; display: ${none};"></td></tr></table></div>';
|
||||
str=str.replace(/\${path}/g, this.m_tn[this.m_tn.length-1].getTreePath());
|
||||
str=str.replace(/\${name}/g, getCdataValue(nodeTree));
|
||||
str=str.replace(/\${none}/g, nodeTree.getAttribute("c")=='1' ? 'block' : 'none');
|
||||
|
||||
Reference in New Issue
Block a user