Daniel Quathamer
1 year ago
2 changed files with 117 additions and 7 deletions
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
<%@page pageEncoding="UTF-8" contentType="text/html" %> |
||||
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.PreparedStatement,java.sql.Statement,java.sql.ResultSet,de.superx.common.SxUser" %> |
||||
<% |
||||
SxUser user = (SxUser) request.getSession().getAttribute("user"); |
||||
|
||||
if (user != null && user.isAdmin()) { |
||||
|
||||
StringBuffer LinkMandantID=new StringBuffer(""); |
||||
|
||||
|
||||
int MAXCHARLENGTH_OF_KEYS = 50; |
||||
String ALLOWED_KEY_CHARS = "abcdefghijklmnopqrstuvwxyzäöüßABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ_1234567890"; |
||||
|
||||
String IdOutput=request.getParameter("tid"); |
||||
String typeOutput="html"; //TODO:parametrisierbar request.getParameter("type"); |
||||
String defaultMandantenIDParam=request.getParameter("MandantID"); |
||||
//Check Validity: |
||||
boolean entryOK=true; |
||||
if(IdOutput.length()> MAXCHARLENGTH_OF_KEYS) |
||||
entryOK=false; |
||||
|
||||
for (int i = 0; i < IdOutput.length(); i++) { |
||||
char lookingAt = IdOutput.charAt(i); |
||||
if (ALLOWED_KEY_CHARS.indexOf(lookingAt)==-1) { |
||||
entryOK=false; |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
if(!entryOK) |
||||
throw new IllegalArgumentException( |
||||
"output Parameter contains forbidden characters or length"); |
||||
|
||||
|
||||
|
||||
if(defaultMandantenIDParam != null && !defaultMandantenIDParam.toString().equals("")) { |
||||
LinkMandantID.append("/"+defaultMandantenIDParam.toString()); |
||||
} |
||||
/* |
||||
if (request.getSession()!=null&&request.getSession().getAttribute("sessiontype")!=null&& |
||||
request.getSession().getAttribute("sessiontype").equals("superx")) { |
||||
*/ |
||||
Object mandantobject=request.getSession().getAttribute("MandantenID"); |
||||
//Object userid=request.getSession().getAttribute("UserID"); |
||||
String mandantenid=""; |
||||
if(mandantobject != null) |
||||
mandantenid=mandantobject.toString(); |
||||
else |
||||
{ |
||||
if(defaultMandantenIDParam != null) |
||||
mandantenid=defaultMandantenIDParam.toString(); |
||||
} |
||||
//der superx-Default-Mandant ist bei dbforms ein Leerstring |
||||
if(mandantenid.equals("default")) |
||||
mandantenid=""; |
||||
|
||||
|
||||
Connection conmm=null; |
||||
|
||||
try { |
||||
|
||||
conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid); |
||||
|
||||
|
||||
//Ausgabe holen: |
||||
|
||||
PreparedStatement st_output; |
||||
ResultSet rs_output; |
||||
st_output=conmm.prepareStatement("select result_html from qa_mask_execution_result where tid=? "); |
||||
st_output.setInt(1,Integer.valueOf(IdOutput)); |
||||
rs_output = st_output.executeQuery(); |
||||
String sb_output=""; |
||||
while (rs_output.next()) |
||||
{ if(rs_output.getObject(1) !=null) |
||||
sb_output=rs_output.getObject(1).toString().trim(); |
||||
} |
||||
rs_output.close(); |
||||
st_output.close(); |
||||
if(sb_output==null || sb_output.equals("")) |
||||
sb_output="<html><body><p>Text konnte nicht geladen werden, wenden Sie sich an den Administrator</p></body></html>"; |
||||
//Ende Ausgabe holen |
||||
|
||||
String sb_titel=""; |
||||
sb_titel="Show HTML content"; |
||||
|
||||
|
||||
conmm.close(); |
||||
|
||||
out.println(sb_output); |
||||
|
||||
|
||||
} //ende Suche DB Verbindung |
||||
catch (Exception e) { |
||||
out.print("<html><body>Fehler bei Datenverbindung: "+e+ " <br>MandantID: "+mandantenid+"</body></html>"); |
||||
} |
||||
|
||||
} |
||||
else { |
||||
|
||||
if (request.getSession()!=null) session.invalidate(); |
||||
String send_redirect="/superx/index.jsp"; //" + LinkMandantID.toString() + " |
||||
response.sendRedirect(send_redirect); |
||||
return; |
||||
} |
||||
%> |
||||
|
Loading…
Reference in new issue