FSN#33301 Username/password velden alleen nog expliciet. Verder wat code versimpeling
svn path=/Website/trunk/; revision=25654
This commit is contained in:
@@ -107,9 +107,8 @@ function send1Order(Bedrijf_key, XMLnode, OpdrKey, ordernr, Sender, cust)
|
||||
+ " ba.prs_bedrijfadres_ext, "
|
||||
+ " ba.prs_bedrijfadres_username,"
|
||||
+ " ba.prs_bedrijfadres_password"
|
||||
+ " FROM prs_bedrijf b, prs_bedrijfadres ba "
|
||||
+ " WHERE b.prs_bedrijf_key = " + Bedrijf_key
|
||||
+ " AND b.prs_bedrijf_key = ba.prs_bedrijf_key(+)"
|
||||
+ " FROM prs_bedrijfadres ba "
|
||||
+ " WHERE ba.prs_bedrijf_key = " + Bedrijf_key;
|
||||
|
||||
switch (XMLnode)
|
||||
{
|
||||
@@ -206,7 +205,6 @@ function send1Order(Bedrijf_key, XMLnode, OpdrKey, ordernr, Sender, cust)
|
||||
Log2File(4, "AttachFile=" + bedrijfadres.AttachFile);
|
||||
Log2File(4, "username=" + bedrijfadres.username);
|
||||
|
||||
var MailSubject = getMailSubject(XMLnode, OpdrKey, ordernr);
|
||||
var SendOrderResult = SendOrder( connect
|
||||
, xml_content
|
||||
, bedrijfadres
|
||||
@@ -215,7 +213,7 @@ function send1Order(Bedrijf_key, XMLnode, OpdrKey, ordernr, Sender, cust)
|
||||
, OpdrKey
|
||||
, AttachPath
|
||||
, Sender
|
||||
, MailSubject
|
||||
, XMLnode
|
||||
, "");
|
||||
|
||||
Log2File(1, "SendOrderResult: " + SendOrderResult.sendorder);
|
||||
@@ -265,42 +263,3 @@ function getXslNode(pXslFile, pNode)
|
||||
return vFile;
|
||||
}
|
||||
|
||||
function getMailSubject(pXMLnode, pOpdrKey, ordernr)
|
||||
{
|
||||
var sqlS = "";
|
||||
var MailSubject = "";
|
||||
switch (pXMLnode)
|
||||
{
|
||||
case "opdracht":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefixmld");
|
||||
sqlS = "SELECT mld.opdrsprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
case "bestelopdr":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefix");
|
||||
sqlS = "SELECT bes.opdrsprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
case "contract":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefixcnt");
|
||||
sqlS = "SELECT cnt.sprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (MailSubject.indexOf("##") == -1)
|
||||
{
|
||||
MailSubject = MailSubject + ordernr; // Geen ##, backwards compatible toch nummer erbij
|
||||
}
|
||||
else
|
||||
{
|
||||
var oRsS = Oracle.Execute(sqlS);
|
||||
MailSubject = oRsS("subj").value;
|
||||
oRsS.Close();
|
||||
}
|
||||
|
||||
return MailSubject;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,24 +48,11 @@ function ConnectorCls()
|
||||
this.isMail = false;
|
||||
this.ConnectionType = CONNECTION_NONE;
|
||||
this.CurrentAddress = "";
|
||||
this.connection = create(); // initialize a FTP connection object
|
||||
|
||||
// Public functies
|
||||
this.connect = _connect;
|
||||
this.disconnect = _disconnect;
|
||||
|
||||
|
||||
|
||||
function create()
|
||||
{
|
||||
Log2File(2, "Creating connector...");
|
||||
var about = new ActiveXObject("SLNKDWF.About");
|
||||
Log2File(2, "Ge<47>nstalleerde SLNKDWF Versie: " + about.VersionString);
|
||||
Log2File(2, about.All);
|
||||
//
|
||||
return new ActiveXObject("SLNKDWF.FTP");
|
||||
}
|
||||
|
||||
function _connect(p_bedrijfadres) //BEDRIJF_ORDER_ADRES
|
||||
{
|
||||
// voorbeeld url's:
|
||||
@@ -107,74 +94,70 @@ function ConnectorCls()
|
||||
{
|
||||
this.ConnectionType = CONNECTION_MAIL;
|
||||
// Let op dat mailto:jan@example.com;klaas@example.com goed blijft gaan!
|
||||
// Ietwat getruct stoppen we dan example.com;piet@example.com in de Hostname
|
||||
this.connection.Username = URLParts.path.split("@")[0]; // Alles voor de eerste @
|
||||
this.connection.Hostname = URLParts.path.substr(this.connection.Username.length + 1); // Alles na de eerste @
|
||||
this.mailto = this.url.split(":")[1]; // alles achter de mailto
|
||||
//
|
||||
Log2File(2, "protocol: mailto");
|
||||
this.Connected = true;
|
||||
if (S("puo_lcl_friendly_mailto"))
|
||||
this.friendlyurl = S("puo_lcl_friendly_mailto").format(URLParts.path);
|
||||
this.friendlyurl = S("puo_lcl_friendly_mailto").format(this.mailto);
|
||||
break;
|
||||
}
|
||||
case "http":
|
||||
{
|
||||
this.ConnectionType = CONNECTION_HTTP;
|
||||
this.connection.Username = URLParts.user;
|
||||
this.connection.Password = URLParts.password;
|
||||
//
|
||||
Log2File(2, "protocol: http");
|
||||
Log2File(2, "Login/Wachtwoord: " + URLParts.user + "/" + URLParts.password);
|
||||
this.Connected = true;
|
||||
if (S("puo_lcl_friendly_http"))
|
||||
this.friendlyurl = S("puo_lcl_friendly_http").format("http://" + URLParts.host);
|
||||
this.friendlyurl = S("puo_lcl_friendly_http").format(URLParts.protocol + "://" + URLParts.host);
|
||||
break;
|
||||
}
|
||||
case "https":
|
||||
{
|
||||
this.ConnectionType = CONNECTION_HTTPS;
|
||||
this.connection.Username = URLParts.user;
|
||||
this.connection.Password = URLParts.password;
|
||||
//
|
||||
Log2File(2, "protocol: https");
|
||||
Log2File(2, "Login/Wachtwoord: " + URLParts.user + "/" + URLParts.password);
|
||||
this.Connected = true;
|
||||
if (S("puo_lcl_friendly_http"))
|
||||
this.friendlyurl = S("puo_lcl_friendly_http").format("https://" + URLParts.host);
|
||||
this.friendlyurl = S("puo_lcl_friendly_http").format(URLParts.protocol + "://" + URLParts.host);
|
||||
break;
|
||||
}
|
||||
case "ftp":
|
||||
{ // voorbeeld: "ftp://klaas:geheim@example.com/folder/"
|
||||
{ // voorbeeld: "ftp://example.com/folder/"
|
||||
this.ConnectionType = CONNECTION_FTP;
|
||||
this.connection.Hostname = URLParts.host;
|
||||
this.connection.Username = p_bedrijfadres.username||URLParts.user;
|
||||
this.connection.Password = p_bedrijfadres.password||URLParts.password;
|
||||
this.connection.Port = URLParts.port || 21;
|
||||
this.connection.Proxyname = (S("puo_useproxy") ? S("puo_proxyserveripaddress") : "");
|
||||
this.Subfolder = URLParts.directory;
|
||||
this.connection.Flags = S("puo_connectionflag")||0;
|
||||
Log2File(2, "Creating connector...");
|
||||
var about = new ActiveXObject("SLNKDWF.About");
|
||||
Log2File(2, "Ge<47>nstalleerde SLNKDWF Versie: " + about.VersionString);
|
||||
Log2File(2, about.All);
|
||||
//
|
||||
this.ftpconnection new ActiveXObject("SLNKDWF.FTP");
|
||||
this.ftpconnection.Hostname = URLParts.host;
|
||||
this.ftpconnection.Username = p_bedrijfadres.username;
|
||||
this.ftpconnection.Password = p_bedrijfadres.password;
|
||||
this.ftpconnection.Port = URLParts.port || 21;
|
||||
this.ftpconnection.Proxyname = (S("puo_useproxy") ? S("puo_proxyserveripaddress") : "");
|
||||
this.Subfolder = URLParts.directory;
|
||||
this.ftpconnection.Flags = S("puo_connectionflag")||0;
|
||||
//
|
||||
Log2File(2, "protocol: ftp");
|
||||
Log2File(2, "FTPServer: " + this.connection.Hostname);
|
||||
Log2File(2, "FTPUser: " + this.connection.Username);
|
||||
Log2File(2, "FTPPassword: " + this.connection.Password);
|
||||
Log2File(2, "FTPPort: " + this.connection.Port);
|
||||
Log2File(2, "FTPProxy: " + this.connection.Proxyname);
|
||||
Log2File(2, "FTPServer: " + this.ftpconnection.Hostname);
|
||||
Log2File(2, "FTPPort: " + this.ftpconnection.Port);
|
||||
Log2File(2, "FTPProxy: " + this.ftpconnection.Proxyname);
|
||||
Log2File(2, "FTPDir: " + this.Subfolder);
|
||||
Log2File(2, "Flags: " + this.connection.Flags);
|
||||
Log2File(2, "Flags: " + this.ftpconnection.Flags);
|
||||
//
|
||||
if (S("puo_lcl_friendly_ftp"))
|
||||
this.friendlyurl = S("puo_lcl_friendly_ftp").format(URLParts.host, URLParts.directory, URLParts.port);
|
||||
try
|
||||
{
|
||||
// Probeer nu de FTP verbinding tot stand te brengen.
|
||||
this.connection.Open();
|
||||
this.ftpconnection.Open();
|
||||
// Change FTP dir
|
||||
if (URLParts.directory)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.connection.SetCurrentDir(URLParts.directory);
|
||||
this.ftpconnection.SetCurrentDir(URLParts.directory);
|
||||
this.Connected = true;
|
||||
}
|
||||
catch(err)
|
||||
@@ -233,15 +216,18 @@ function ConnectorCls()
|
||||
|
||||
function _disconnect()
|
||||
{
|
||||
try
|
||||
if (this.ftpconnection)
|
||||
{
|
||||
Log2File(2, "Disconnect...");
|
||||
this.connection.Close(); // Let op: effectief sluit deze alleen de SLNKDWF.FTP verbinding.
|
||||
this.Connected = false;
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
Log2File(0, "Error during disconnection: " + err.message);
|
||||
try
|
||||
{
|
||||
Log2File(2, "Disconnect...");
|
||||
this.ftpconnection.Close(); // Let op: effectief sluit deze alleen de SLNKDWF.FTP verbinding.
|
||||
this.Connected = false;
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
Log2File(0, "Error during disconnection: " + err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ function notificationSYS(rec, params)
|
||||
, refkey
|
||||
, AttachPath
|
||||
, sender_email
|
||||
, S("puo_subjectprefix") + ordernr
|
||||
, XMLnode
|
||||
, code
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ function connectHTTP( p_connect
|
||||
|
||||
|
||||
function connectFTP( p_connect
|
||||
, p_bedrijfadres // nog niet gebruikt. Hier zouden we ooit username/password uit kunnen gaan halen
|
||||
, p_bedrijfadres
|
||||
, p_textstream
|
||||
, p_filename
|
||||
, p_attachfolder
|
||||
@@ -156,8 +156,6 @@ function connectFTP( p_connect
|
||||
{
|
||||
Log2File(1, "Sending FTP as: " + p_filename + "...");
|
||||
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
// De opdracht:
|
||||
Log2File(2, "Sending data as file: " + p_filename + " (" + p_textstream.Size + " bytes)");
|
||||
var FTPresult = sendFTP(p_connect, p_filename, p_textstream); // send text data
|
||||
@@ -165,6 +163,7 @@ function connectFTP( p_connect
|
||||
// Stuur alle flexfiles (type M(ap) en F(file)) ook mee
|
||||
if (FTPresult && p_attachfolder)
|
||||
{
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
if (objFso.FolderExists(p_attachfolder))
|
||||
{
|
||||
var objFolders = objFso.GetFolder(p_attachfolder);
|
||||
@@ -203,10 +202,10 @@ function connectMail( p_connect
|
||||
, p_bedrijfadres
|
||||
, p_xslPath
|
||||
, p_ordernr
|
||||
, p_order_key // wordt hier niet gebruikt
|
||||
, p_order_key
|
||||
, p_attachfolder
|
||||
, p_sender
|
||||
, p_mailsubject
|
||||
, XMLnode
|
||||
, p_filename
|
||||
)
|
||||
{
|
||||
@@ -230,8 +229,10 @@ function connectMail( p_connect
|
||||
encryptpass = p_bedrijfadres.certificateName;
|
||||
}
|
||||
|
||||
var mailsubject = getMailSubject(XMLnode, p_order_key, p_ordernr);
|
||||
|
||||
// Alleen txt en html kunnen eventueel in de mailbody
|
||||
var mail_to = p_connect.connection.Username + "@" + p_connect.connection.Hostname;
|
||||
var mail_to = p_connect.mailto;
|
||||
var params = { attachFolder: p_attachfolder
|
||||
, attachPassword: encryptpass
|
||||
, include_file: p_bedrijfadres.AttachFile
|
||||
@@ -253,7 +254,7 @@ function connectMail( p_connect
|
||||
params.attachFileName = p_filename; //JGL Volgens mij don't care parameter
|
||||
mailResult = sendMail( p_sender
|
||||
, mail_to
|
||||
, p_mailsubject
|
||||
, mailsubject
|
||||
, ""
|
||||
, content
|
||||
, params
|
||||
@@ -263,7 +264,7 @@ function connectMail( p_connect
|
||||
{
|
||||
mailResult = sendMail( p_sender
|
||||
, mail_to
|
||||
, p_mailsubject
|
||||
, mailsubject
|
||||
, stream2text(p_textstream)
|
||||
, ""
|
||||
, params
|
||||
@@ -276,7 +277,7 @@ function connectMail( p_connect
|
||||
params.attachStream = p_textstream;
|
||||
mailResult = sendMail( p_sender
|
||||
, mail_to
|
||||
, p_mailsubject
|
||||
, mailsubject
|
||||
, body
|
||||
, ""
|
||||
, params
|
||||
@@ -311,7 +312,7 @@ function SendOrder( p_connect
|
||||
, p_order_key
|
||||
, p_attachfolder
|
||||
, p_sender
|
||||
, p_mailsubject
|
||||
, XMLnode
|
||||
, p_code
|
||||
)
|
||||
{
|
||||
@@ -416,7 +417,7 @@ function SendOrder( p_connect
|
||||
{
|
||||
connectResult = connectHTTP( p_connect
|
||||
, streamResult
|
||||
, xslDoc
|
||||
, xslDoc // voor de terugweg
|
||||
, p_bedrijfadres
|
||||
, filename
|
||||
);
|
||||
@@ -443,7 +444,7 @@ function SendOrder( p_connect
|
||||
, p_order_key
|
||||
, p_attachfolder
|
||||
, p_sender
|
||||
, p_mailsubject
|
||||
, XMLnode
|
||||
, filename
|
||||
);
|
||||
}
|
||||
@@ -469,3 +470,43 @@ function SendOrder( p_connect
|
||||
|
||||
return {sendorder: SendOrder, errtext: errText};
|
||||
}
|
||||
|
||||
function getMailSubject(pXMLnode, pOpdrKey, ordernr)
|
||||
{
|
||||
var sqlS = "";
|
||||
var MailSubject = "";
|
||||
switch (pXMLnode)
|
||||
{
|
||||
case "opdracht":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefixmld");
|
||||
sqlS = "SELECT mld.opdrsprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
case "bestelopdr":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefix");
|
||||
sqlS = "SELECT bes.opdrsprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
case "contract":
|
||||
{
|
||||
MailSubject = S("puo_subjectprefixcnt");
|
||||
sqlS = "SELECT cnt.sprintf(" + safe.quoted_sql(MailSubject) + "," + pOpdrKey + ") subj FROM DUAL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (MailSubject.indexOf("##") == -1)
|
||||
{
|
||||
MailSubject = MailSubject + ordernr; // Geen ##, backwards compatible toch nummer erbij
|
||||
}
|
||||
else
|
||||
{
|
||||
var oRsS = Oracle.Execute(sqlS);
|
||||
MailSubject = oRsS("subj").value;
|
||||
oRsS.Close();
|
||||
}
|
||||
|
||||
return MailSubject;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,18 +20,18 @@ function sendFTP(p_connect, p_file, p_data, p_path)
|
||||
{
|
||||
objFile = objFso.GetFile(p_path);
|
||||
Log2File(1, "Transfer file: " + p_file + " (size: " + objFile.Size + ")");
|
||||
p_connect.connection.PutFile(p_file, p_path); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
p_connect.ftpconnection.PutFile(p_file, p_path); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
}
|
||||
else
|
||||
{ // Forceer p_data altijd naar utf-8
|
||||
var tempfile = "../../../temp/puo_" + objFso.GetTempName();
|
||||
p_data.SaveToFile(tempfile);
|
||||
Log2File(1, "Transfer data as file: " + p_file + " (size: " + p_data.Size + ")");
|
||||
p_connect.connection.PutFile(p_file, tempfile); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
p_connect.ftpconnection.PutFile(p_file, tempfile); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
if (S("puo_loglevel") < 4)
|
||||
objFso.DeleteFile(tempfile);
|
||||
// schrijft geen utf-8
|
||||
// p_connect.connection.PutFileFromTextData(p_file, p_data.ReadText()); // Alleen een tekst-string schrijven.
|
||||
// p_connect.ftpconnection.PutFileFromTextData(p_file, p_data.ReadText()); // Alleen een tekst-string schrijven.
|
||||
}
|
||||
FTPsend = true;
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ function submitHTTP( p_connect
|
||||
// Call xmlHTTP.setOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS, secu)
|
||||
httpReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||
|
||||
if (p_connect.connection.Username != "")
|
||||
if (p_bedrijfadres.username != "")
|
||||
{
|
||||
var base64 = new Base64Cls();
|
||||
httpReq.setRequestHeader("Authorization", "Basic " + base64.encode(p_connect.connection.Username + ":" + p_connect.connection.Password));
|
||||
httpReq.setRequestHeader("Authorization", "Basic " + base64.encode(p_bedrijfadres.username + ":" + p_bedrijfadres.username.password));
|
||||
}
|
||||
|
||||
httpReq.send(p_textstream);
|
||||
|
||||
Reference in New Issue
Block a user